:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --text-color: #333;
    --bg-color: #f8f9fa;
    --accent-color: #e74c3c;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

/* Header & Navigation */
header {
    background-color: var(--primary-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 2rem;
}

nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

nav a:hover {
    color: var(--secondary-color);
}

.nav-icon {
    width: 20px;
    height: 20px;
    vertical-align: middle;
    filter: brightness(0) invert(1); /* makes SVG white to match nav text */
    transition: filter 0.3s;
}

nav a:hover .nav-icon {
    filter: brightness(0) saturate(100%) invert(47%) sepia(80%) saturate(500%) hue-rotate(180deg); /* matches --secondary-color #3498db */
}

/* Main Content — 3-column grid: [toc col] [content col] [empty col]
   Left:   minmax(200px, 1fr) — at least TOC width, expands symmetrically
   Center: minmax(0, 900px)   — capped at 900px, shrinks on narrow viewports
   Right:  minmax(0, 1fr)     — mirrors left but can collapse to 0 if no room
   Net effect: if viewport > 900+200px, right = left = (viewport-900)/2
               if viewport < 900+200px, left stays 200px, right shrinks first */
main {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) minmax(0, 900px) minmax(0, 1fr);
    grid-template-rows: auto;
    padding: 2rem 1rem;
    width: 100%;
    margin: 0 auto;
    align-items: start;
}

/* All direct children go in center column by default */
main > * {
    grid-column: 2;
}

section {
    margin-bottom: 3rem;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* ===== TOC: left column, aligned to its paired section ===== */
.expertise-toc {
    grid-column: 1;
    justify-self: start;
    align-self: stretch;    /* fills full row height = paired section height */
    overflow: clip;         /* clips visual overflow without creating scroll container (sticky still works) */
    width: 200px;
}

/* Inner wrapper is what actually sticks — bounded by the parent's height */
.expertise-toc-sticky {
    position: sticky;
    top: 80px;
    padding-left: 1rem;
    border-left: 2px solid var(--secondary-color);
    text-align: left;
}

/* Explicit grid rows — TOC and its section share the same row */
#about              { grid-row: 1; }
#expertise-toc      { grid-row: 2; }
#rendering          { grid-row: 2; }
#career             { grid-row: 3; }
#games-toc          { grid-row: 4; }
#games              { grid-row: 4; }
#education          { grid-row: 5; }
#lectures           { grid-row: 6; }
#spoken-languages   { grid-row: 7; }
#contact            { grid-row: 8; }

h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--secondary-color);
}

h3 {
    font-size: 1.5rem;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--secondary-color);
    font-weight: 500;
}

/* About section */
.bio {
    margin-top: 1.25rem;
    font-size: 1.05rem;
    line-height: 1.7;
    color: #444;
}

/* Languages & Tools block */
.tech-tags {
    margin-top: 1.25rem;
    font-size: 0.92rem;
    line-height: 1.8;
    color: #555;
}

.tech-row {
    margin-bottom: 0.15rem;
}

.tech-label {
    font-weight: 600;
    color: var(--primary-color);
}

/* Career phases timeline */
.career-phases {
    margin: 1rem 0 1.5rem;
    padding-left: 1rem;
    border-left: 2px solid var(--secondary-color);
}

.career-phase {
    display: block;
    margin-bottom: 0.6rem;
    line-height: 1.5;
}

.phase-period {
    font-weight: 600;
    color: var(--primary-color);
    margin-right: 0.5rem;
    font-size: 0.9rem;
}

.phase-title {
    font-weight: 600;
    color: var(--accent-color);
    margin-right: 0.5rem;
}

.phase-title::after {
    content: " — ";
    color: #999;
    font-weight: 400;
}

.phase-desc {
    color: #555;
    font-size: 0.93rem;
}

.core-skills-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #888;
    margin-bottom: 0.6rem;
    text-align: left;
}

/* TOC pill links */
.skill-tags {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.skill-tags li a {
    display: block;
    background-color: var(--primary-color);
    color: white;
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
    text-align: left;
    transition: background-color 0.2s, transform 0.1s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.skill-tags li a:hover {
    background-color: var(--secondary-color);
    transform: translateX(3px);
}

.skill-tags li a.active {
    background-color: var(--secondary-color);
}

/* Articles column — fills full card width */
.expertise-articles h2 {
    margin-bottom: 1.5rem;
}

/* Article separators inside both sections */
.expertise-articles article {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e0e0e0;
    scroll-margin-top: 80px;
}

.expertise-articles article:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* Bullet list inside expertise articles */
.expertise-list {
    list-style: disc;
    padding-left: 1.4rem;
    margin-top: 0.5rem;
}

.expertise-list li {
    padding: 0.2rem 0;
    line-height: 1.5;
}

/* Skills list (used elsewhere) */
.skills-list {
    list-style: none;
    padding-left: 0;
}

.skills-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #e0e0e0;
}

.skills-list li:last-child {
    border-bottom: none;
}

.portfolio-item,
.lecture-item {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e0e0e0;
}

.portfolio-item-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.portfolio-item-header h3 {
    margin: 0;
}

.game-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}

.game-icon[src=""] {
    display: none;
}

.portfolio-item:last-child,
.lecture-item:last-child {
    border-bottom: none;
}

.role,
.event {
    color: var(--accent-color);
    font-weight: 600;
    margin: 0.5rem 0;
}

.platform {
    color: #666;
    font-style: italic;
    margin-bottom: 1rem;
}

.video-container {
    margin: 1rem 0;
    padding: 0.5rem;
    background-color: #f0f0f0;
    border-radius: 4px;
    max-width: 580px; /* caps both the grey border and the iframe together */
}

/* Responsive iframe embed (16:9) — padding-bottom trick, works on all mobile browsers */
/* iframe-wrapper must be full width of its container, NO max-width here */
/* padding-bottom: 56.25% = height is always 9/16 of THIS element's own width */
.iframe-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}

.iframe-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.video-container a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
}

.video-container a:hover {
    text-decoration: underline;
}

/* Spoken Languages */
.spoken-languages-list {
    font-size: 0.95rem;
    color: var(--text-color);
    line-height: 1.8;
}

/* Contact */
#contact a {
    color: var(--secondary-color);
    text-decoration: none;
}

#contact a:hover {
    text-decoration: underline;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    background-color: var(--primary-color);
    color: white;
    margin-top: 3rem;
}

/* Print-specific classes */
.print-only {
    display: none;
}

.no-print {
    display: block;
}

/* Responsive Design */

/* Hide TOC when viewport is too narrow to fit content (900px) + TOC (200px) */
@media (max-width: 1100px) {
    .expertise-toc {
        display: none;
    }

    /* Collapse to single centered column — no wasted side space */
    main {
        grid-template-columns: 0 minmax(0, 900px) 0;
    }
}

@media (max-width: 768px) {
    nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.4rem 1rem;
    }

    nav a {
        font-size: 0.85rem;
    }

    main {
        padding: 1rem;
        grid-template-columns: 0 minmax(0, 100%) 0;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    section {
        padding: 1rem;
    }
}

/* Print Preview Mode */
body.print-preview {
    font-size: 11pt;
    line-height: 1.4;
    font-family: 'Times New Roman', serif;
    background: white !important;
    color: #000 !important;
    max-width: 21cm;
    margin: 2cm auto;
    padding: 2cm;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

body.print-preview .no-print {
    display: none !important;
}

body.print-preview .print-only {
    display: block !important;
}

body.print-preview main {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

body.print-preview section {
    margin-bottom: 1.5cm;
    padding: 0;
}

body.print-preview h1 {
    font-size: 24pt;
    margin-bottom: 0.3cm;
}

body.print-preview h2 {
    font-size: 16pt;
    margin-top: 0.8cm;
    margin-bottom: 0.3cm;
    border-bottom: 1px solid #000;
}

body.print-preview h3 {
    font-size: 13pt;
    margin-top: 0.4cm;
    margin-bottom: 0.2cm;
}

body.print-preview ul {
    margin-left: 0.8cm;
}

body.print-preview a {
    color: #000 !important;
    text-decoration: none;
}

body.print-preview .video-container {
    display: none !important;
}
