/* ==========================================================================
   STEFANO BOSSOLASCO — PORTFOLIO STYLESHEET
   Shared by index.html and all progetto-*.html pages.
   Theme is driven by html[data-theme="light" | "dark"] (set in <head>).
   ========================================================================== */

/* --- Design tokens --- */
:root {
    /* One variable family: Archivo. Headings use its expanded width, text the normal width. */
    --font-body: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
    --font-display: var(--font-body);
    --display-stretch: 112%;

    /* Type roles (1.25 step from body to card headings) */
    --fs-label: 0.8125rem;   /* 13px: tags, small caps labels */
    --fs-small: 0.875rem;    /* 14px: captions, dates, metadata */
    --fs-body: 1rem;         /* 16px: body and list text */
    --fs-lead: 1.125rem;     /* 18px: leads, card labels */
    --fs-card: 1.25rem;      /* 20px: card and item headings */
    --fs-sub: clamp(1.5rem, 2.6vw, 1.875rem);       /* project section headings */
    --fs-section: clamp(2.125rem, 3.8vw, 2.875rem); /* homepage section headings */
    --fs-page: clamp(2.25rem, 4.8vw, 3.25rem);      /* project page titles */
    --fs-display: clamp(2.75rem, 6.5vw, 4.75rem);   /* hero names */

    --bg: #070a12;
    --bg-alt: #0a0f1b;
    --surface: #0e1424;
    --surface-2: #141c30;
    --border: rgba(148, 163, 184, 0.14);
    --border-strong: rgba(148, 163, 184, 0.28);

    --text: #e8edf5;
    --text-2: #b4bfd0;
    --muted: #8590a5;

    --accent: #38bdf8;
    --accent-ink: #04111d;

    /* One colour per career track */
    --research: #38bdf8;
    --industry: #a78bfa;
    --venture: #fb923c;

    --nav-bg: rgba(7, 10, 18, 0.78);
    --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.6);

    --radius: 16px;
    --radius-sm: 10px;
    --max-width: 1160px;
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

html[data-theme="light"] {
    --bg: #f7f8fb;
    --bg-alt: #eef1f6;
    --surface: #ffffff;
    --surface-2: #f2f5fa;
    --border: rgba(15, 23, 42, 0.1);
    --border-strong: rgba(15, 23, 42, 0.2);

    --text: #0b1220;
    --text-2: #334155;
    --muted: #5b6678;

    --accent: #0369a1;
    --accent-ink: #ffffff;

    --research: #0369a1;
    --industry: #6d28d9;
    --venture: #c2410c;

    --nav-bg: rgba(247, 248, 251, 0.85);
    --shadow: 0 18px 40px -22px rgba(15, 23, 42, 0.25);
}

/* --- Reset & base --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: var(--fs-body);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 650;
    line-height: 1.2;
    letter-spacing: -0.015em;
    color: var(--text);
}

p { color: var(--text-2); }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }
html[data-theme="light"] .only-dark, html[data-theme="dark"] .only-light { display: none !important; }
strong { color: var(--text); font-weight: 600; }
/* Display roles take the expanded width; smaller headings stay at normal width */
h1, h2, .logo, .hero-title, .section-title, .stat-grid strong { font-stretch: var(--display-stretch); font-weight: 700; }
.hero-title, .about-hero h1, .project-header h1 { letter-spacing: -0.025em; line-height: 1.04; }
/* Dates, figures and table data line up */
.exp-date, .edu-date, .tl-date, .stat-grid strong, .project-meta span, .chart-table td { font-variant-numeric: tabular-nums; }
/* Light text on dark surfaces reads slightly heavier and tighter: open it up a touch */
html[data-theme="dark"] body { letter-spacing: 0.005em; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 220ms; animation-timing-function: ease; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--text); }
/* Native scrollbars and controls follow the active theme */
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
html { scrollbar-color: var(--border-strong) var(--bg); }
h1, h2, h3 { text-wrap: balance; }
p, li, figcaption { text-wrap: pretty; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip-link {
    position: absolute; left: 1rem; top: -100px; z-index: 200;
    background: var(--accent); color: var(--accent-ink);
    padding: 0.6rem 1rem; border-radius: var(--radius-sm); font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* --- Layout --- */
.container { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 2rem; }
.section { padding: 6.5rem 0; position: relative; }
.section-alt { background: color-mix(in srgb, var(--bg-alt) 85%, transparent); }

.section-header { margin-bottom: 3rem; max-width: 720px; }
.eyebrow {
    display: inline-block;
    font-family: var(--font-display);
    font-size: var(--fs-label);
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.7rem;
}
.section-title { font-size: var(--fs-section); margin-bottom: 0.8rem; }
.section-lead { font-size: var(--fs-lead); }

/* --- Background canvas --- */
#orbit-canvas {
    position: fixed; inset: 0; width: 100%; height: 100%;
    z-index: -1; pointer-events: none; opacity: 0.55;
}

/* --- Navigation --- */
/* Motion: ease-out for anything entering or responding to the user; exits run faster than entrances */
:root { --press: 160ms; }

.navbar {
    position: fixed; top: 0; left: 0; width: 100%; z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid transparent;
    transition: border-color 200ms ease-out, box-shadow 200ms ease-out;
}
.navbar.scrolled { border-bottom-color: var(--border); box-shadow: 0 8px 24px -16px rgba(0, 0, 0, 0.35); }

.nav-container {
    max-width: var(--max-width); margin: 0 auto; padding: 0.9rem 2rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
}
.logo { font-family: var(--font-display); font-size: var(--fs-lead); font-weight: 700; letter-spacing: 0.02em; padding-block: 0.6rem; margin-block: -0.6rem; }
.logo span { color: var(--accent); }

.nav-menu { display: flex; align-items: center; gap: 1.6rem; }
.nav-link {
    font-size: var(--fs-small); font-weight: 500; color: var(--text-2);
    position: relative; padding: 0.35rem 0; transition: color 150ms ease-out;
}
/* Underline grows with transform (GPU-friendly) instead of animating width */
.nav-link::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
    background: var(--accent); transform: scaleX(0); transform-origin: left center;
    transition: transform 200ms var(--ease-out);
}
.nav-link.active { color: var(--text); }
.nav-link.active::after { transform: scaleX(1); }
.nav-cv-mobile { display: none; }

.nav-controls { display: flex; align-items: center; gap: 0.6rem; }

.icon-btn {
    width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
    background: none; color: var(--text); border: 1px solid var(--border-strong); border-radius: 50%;
    cursor: pointer; position: relative;
    transition: border-color 150ms ease-out, color 150ms ease-out, transform var(--press) var(--ease-out);
    -webkit-tap-highlight-color: transparent;
}
/* Invisible hit area so touch targets reach 44px without changing the visual size */
.icon-btn::before { content: ''; position: absolute; inset: -4px; border-radius: 50%; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:active { transform: scale(0.95); }

.theme-toggle svg { transition: transform 300ms var(--ease-out), opacity 200ms ease-out; }
.theme-toggle .moon-icon { display: none; }
html[data-theme="light"] .theme-toggle .sun-icon { display: none; }
html[data-theme="light"] .theme-toggle .moon-icon { display: block; }
/* Icon swap animates only when the user switches theme, never on page load */
@starting-style { html.theme-switching .theme-toggle svg { transform: rotate(-60deg) scale(0.6); opacity: 0; } }

.nav-toggle { display: none; }
.nav-toggle .bar { display: block; width: 18px; height: 2px; background: currentColor; margin: 2px 0; transition: transform 200ms var(--ease-out), opacity 150ms ease-out; }
.nav-toggle[aria-expanded="true"] .bar:nth-child(1) { transform: translateY(4px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .bar:nth-child(3) { transform: translateY(-4px) rotate(-45deg); }

/* --- Buttons --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.75rem 1.4rem; border-radius: var(--radius-sm);
    font-family: var(--font-display); font-size: var(--fs-body); font-weight: 600;
    border: 1px solid transparent; cursor: pointer;
    transition: transform var(--press) var(--ease-out), background-color 150ms ease-out, border-color 150ms ease-out;
    -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-sm { padding: 0.5rem 0.95rem; font-size: var(--fs-small); }

/* Hover styles only where a real pointer can hover, so they don't stick after a tap */
@media (hover: hover) and (pointer: fine) {
    .nav-link:hover { color: var(--text); }
    .nav-link:hover::after { transform: scaleX(1); }
    .icon-btn:hover { border-color: var(--accent); color: var(--accent); }
    .btn:hover { transform: translateY(-1px); }
    .btn:hover:active { transform: scale(0.97); }
    .btn-primary:hover { background: color-mix(in srgb, var(--accent) 85%, white); }
    .btn-secondary:hover { border-color: var(--accent); }
    .project-card:hover, .track-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
    .project-card:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
    .track-card:hover { border-color: color-mix(in srgb, var(--track) 45%, transparent); }
    .project-card:hover .project-thumb img { transform: scale(1.03); }
    .track-card:hover .track-link::after { transform: translateX(3px); }
    .exp-gallery button:hover img { transform: scale(1.04); }
    a.contact-link:hover { border-color: var(--accent); transform: translateX(3px); }
}
/* Cards press like buttons */
.project-card:active { transform: scale(0.99); }

/* --- Hero --- */
.hero { min-height: 100vh; display: flex; align-items: center; padding: 120px 0 5rem; position: relative; }
.hero::before {
    content: ''; position: absolute; inset: 0; z-index: -1;
    background: radial-gradient(circle at 85% 15%, color-mix(in srgb, var(--accent) 12%, transparent) 0%, transparent 45%);
}
.hero-grid { display: grid; grid-template-columns: 1.35fr 0.65fr; gap: 4rem; align-items: center; }


.hero-title { font-size: var(--fs-display); line-height: 1.05; margin-bottom: 1rem; letter-spacing: -0.035em; }
.hero-subtitle { font-size: clamp(1.2rem, 2.2vw, 1.5rem); font-weight: 500; color: var(--text-2); margin-bottom: 1.4rem; font-family: var(--font-display); }
.hero-subtitle .hl { color: var(--accent); }
.hero-lead { font-size: var(--fs-lead); max-width: 620px; margin-bottom: 2rem; }


.hero-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; }

.hero-visual { display: flex; justify-content: center; }
.portrait { position: relative; width: min(320px, 70vw); aspect-ratio: 1; }
.portrait img {
    width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
    border: 1px solid var(--border-strong); position: relative; z-index: 1;
}
.portrait::before, .portrait::after {
    content: ''; position: absolute; border-radius: 50%; border: 1px dashed var(--border-strong);
}
.portrait::before { inset: -18px; }
.portrait::after { inset: -40px; border-style: solid; border-color: color-mix(in srgb, var(--accent) 22%, transparent); }

/* --- Affiliations strip --- */
.affiliations { padding: 2.2rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--bg-alt); }
.affiliations-inner { display: flex; align-items: center; gap: 2.5rem; flex-wrap: wrap; justify-content: center; }
.affiliations-label { font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.affiliations-logos { display: flex; align-items: center; gap: 2.6rem; flex-wrap: wrap; justify-content: center; }
.affiliations-logos img { height: 30px; width: auto; object-fit: contain; }
.affiliations-logos img.affil-logo { height: 21px; }
.affiliations-logos .wordmark { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lead); color: var(--text-2); }
/* Logos with dark artwork need a light plate in dark mode */
html[data-theme="dark"] .affiliations-logos .logo-plate,
html[data-theme="dark"] .exp-logo.logo-plate { background: #f1f5f9; padding: 5px 9px; border-radius: 6px; box-sizing: content-box; }

/* --- Tracks overview --- */
.tracks-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.track-card {
    --track: var(--accent);
    position: relative; display: flex; flex-direction: column; gap: 0.9rem;
    padding: 2rem; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border);
    transition: transform 200ms var(--ease-out), border-color 150ms ease, box-shadow 200ms ease;
    overflow: hidden;
}
.track-card.research { --track: var(--research); }
.track-card.industry { --track: var(--industry); }
.track-card.venture { --track: var(--venture); }

.track-icon {
    width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--track) 14%, transparent); color: var(--track);
}
.track-icon svg { width: 22px; height: 22px; }
.track-label { font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--track); }
.track-card h3 { font-size: var(--fs-card); }
.track-card p { font-size: var(--fs-body); flex-grow: 1; }
.track-stats { display: flex; gap: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.track-stat strong { display: block; font-family: var(--font-display); font-size: var(--fs-card); color: var(--text); }
.track-stat span { font-size: var(--fs-label); color: var(--muted); }
.track-link { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-small); color: var(--track); display: inline-flex; gap: 0.4rem; align-items: center; }
.track-link::after { content: '→'; transition: transform 0.25s var(--ease-out); }

/* --- Research --- */
.research-layout { display: grid; grid-template-columns: 1.25fr 0.75fr; gap: 1.5rem; align-items: start; }

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem;
}
.card-title { font-size: var(--fs-card); margin-bottom: 1.2rem; display: flex; align-items: center; gap: 0.6rem; }
.card-title::before { content: ''; width: 18px; height: 2px; background: var(--accent); }

.current-research { display: flex; flex-direction: column; gap: 1.2rem; }
.current-research .meta-row { display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; font-size: var(--fs-small); color: var(--muted); }
.current-research h3 { font-size: var(--fs-sub); }
.current-research img { border-radius: var(--radius-sm); border: 1px solid var(--border); aspect-ratio: 16 / 8; object-fit: cover; width: 100%; }

.rq-list { display: grid; gap: 0.9rem; }
.rq-list li { display: grid; grid-template-columns: 110px 1fr; gap: 1rem; font-size: var(--fs-body); color: var(--text-2); }
.rq-list li > span:first-child { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-label); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding-top: 0.15rem; }

.interest-list { display: grid; gap: 1.1rem; }
.interest-list li { display: grid; grid-template-columns: 28px 1fr; gap: 0.8rem; }
.interest-num { font-family: var(--font-display); font-weight: 700; color: var(--accent); font-size: var(--fs-small); padding-top: 0.1rem; }
.interest-list h4 { font-size: var(--fs-lead); font-weight: 600; margin-bottom: 0.2rem; }
.interest-list p { font-size: var(--fs-small); }

.side-stack { display: grid; gap: 1.5rem; }

.pub-list { display: grid; gap: 1rem; }
.pub-list li { font-size: var(--fs-body); color: var(--text-2); padding-left: 1rem; border-left: 2px solid var(--border-strong); }
.pub-list .pub-status { display: inline-block; font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.15rem; }

/* --- Tags --- */
.tag-list { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.tag {
    display: inline-block; padding: 0.25rem 0.65rem; border-radius: 6px;
    font-size: var(--fs-label); font-weight: 500; color: var(--text-2);
    background: var(--surface-2); border: 1px solid var(--border);
}

/* --- Experience (grouped by track) --- */
.track-group { --track: var(--accent); margin-bottom: 3.5rem; }
.track-group:last-child { margin-bottom: 0; }
.track-group.research { --track: var(--research); }
.track-group.industry { --track: var(--industry); }
.track-group.venture { --track: var(--venture); }

.track-group-header { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1.4rem; padding-bottom: 0.8rem; border-bottom: 1px solid var(--border); }
.track-group-header h3 { font-size: var(--fs-card); display: flex; align-items: center; gap: 0.7rem; }
.track-group-header h3::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--track); }
.track-group-header p { font-size: var(--fs-small); color: var(--muted); }

.exp-list { display: grid; gap: 1.2rem; }
.exp-card {
    display: grid; grid-template-columns: 1fr 300px; gap: 2rem;
    padding: 1.8rem 2rem; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border);
}
.exp-card.no-gallery { grid-template-columns: 1fr; }
.exp-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.4rem; flex-wrap: wrap; }
.exp-logo { height: 30px; width: auto; max-width: 150px; object-fit: contain; }
.exp-date { font-family: var(--font-display); font-size: var(--fs-small); font-weight: 600; color: var(--track); white-space: nowrap; }
.exp-role { font-size: var(--fs-card); margin: 0.8rem 0 0.2rem; }
.exp-org { font-size: var(--fs-small); color: var(--muted); margin-bottom: 1rem; }
.exp-points { display: grid; gap: 0.5rem; margin-bottom: 1.1rem; }
.exp-points li { position: relative; padding-left: 1.1rem; font-size: var(--fs-body); color: var(--text-2); }
.exp-points li::before { content: ''; position: absolute; left: 0; top: 0.68em; width: 5px; height: 5px; border-radius: 50%; background: var(--track); }
.exp-highlights { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.exp-highlight {
    font-family: var(--font-display); font-size: var(--fs-label); font-weight: 600;
    padding: 0.3rem 0.7rem; border-radius: 6px;
    color: var(--track); background: color-mix(in srgb, var(--track) 12%, transparent);
}

.exp-gallery { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 0.5rem; align-self: start; aspect-ratio: 1 / 0.9; }
.exp-gallery button { padding: 0; border: 0; border-radius: var(--radius-sm); overflow: hidden; cursor: zoom-in; background: var(--surface-2); }
.exp-gallery button:first-child { grid-row: span 2; }
.exp-gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform 300ms var(--ease-out); }
.exp-gallery button { transition: transform var(--press) var(--ease-out); }
.exp-gallery button:active { transform: scale(0.97); }

/* --- Projects --- */
.projects-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.project-card {
    display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden;
    background: var(--surface); border: 1px solid var(--border);
    transition: transform 200ms var(--ease-out), border-color 150ms ease, box-shadow 200ms ease;
}
.project-thumb { aspect-ratio: 16 / 8; overflow: hidden; background: var(--surface-2); }
.project-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 400ms var(--ease-out); }
.project-body { padding: 1.5rem 1.7rem 1.7rem; display: flex; flex-direction: column; gap: 0.6rem; flex-grow: 1; }
.project-kicker { display: flex; justify-content: space-between; font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.project-kicker span:last-child { color: var(--muted); }
.project-body h3 { font-size: var(--fs-card); }
.project-body p { font-size: var(--fs-body); flex-grow: 1; }
.project-more { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-small); color: var(--text); padding-block: 0.6rem; margin: -0.2rem 0 -0.6rem; align-self: flex-start; }
.project-more::after { content: ' →'; color: var(--accent); }

/* --- Education --- */
.edu-layout { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 2.5rem; align-items: start; }
.edu-timeline { position: relative; padding-left: 1.8rem; display: grid; gap: 2rem; }
.edu-timeline::before { content: ''; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; background: var(--border-strong); }
.edu-item { position: relative; }
.edu-item::before {
    content: ''; position: absolute; left: calc(-1.8rem + 0px); top: 7px; width: 12px; height: 12px;
    border-radius: 50%; background: var(--bg); border: 2px solid var(--accent);
}
.edu-date { font-family: var(--font-display); font-size: var(--fs-small); font-weight: 600; color: var(--accent); }
.edu-degree { font-size: var(--fs-lead); margin: 0.2rem 0; }
.edu-school { font-size: var(--fs-body); color: var(--muted); display: block; margin-bottom: 0.5rem; }
.edu-details { font-size: var(--fs-body); }
.edu-facts { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.7rem; }

.cert-list { display: grid; gap: 1rem; }
.cert-list li { display: grid; grid-template-columns: 36px 1fr; gap: 0.9rem; align-items: start; }
.cert-icon {
    width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent);
}
.cert-icon svg { width: 18px; height: 18px; }
.cert-list h4 { font-size: var(--fs-lead); font-weight: 600; }
.cert-list p { font-size: var(--fs-small); color: var(--muted); }

/* --- Skills --- */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.skill-card h3 { font-size: var(--fs-card); margin-bottom: 1rem; }
.lang-list { display: grid; gap: 0.6rem; }
.lang-list li { display: flex; justify-content: space-between; font-size: var(--fs-body); color: var(--text-2); border-bottom: 1px dashed var(--border); padding-bottom: 0.5rem; }
.lang-list li span:last-child { color: var(--muted); }

.beyond { margin-top: 1.5rem; display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.beyond-item h4 { font-size: var(--fs-lead); font-weight: 600; margin-bottom: 0.15rem; }
.beyond-item .beyond-meta { font-size: var(--fs-small); color: var(--muted); display: block; margin-bottom: 0.5rem; }
.beyond-item p { font-size: var(--fs-body); }

/* --- Contact --- */
.contact-card {
    display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 3rem; align-items: center;
    padding: 3rem; border-radius: calc(var(--radius) + 4px);
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--surface)) 0%, var(--surface) 60%);
    border: 1px solid var(--border);
}
.contact-card h2 { font-size: var(--fs-section); margin-bottom: 0.8rem; }
.contact-card .hero-actions { margin-top: 1.8rem; }
.contact-links { display: grid; gap: 0.8rem; }
.contact-link {
    display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem;
    border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border);
    transition: border-color 150ms ease, transform var(--press) var(--ease-out);
}
a.contact-link:active { transform: scale(0.98); }
.contact-link svg { width: 20px; height: 20px; color: var(--accent); flex-shrink: 0; }
.contact-link small { display: block; font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.contact-link span { font-size: var(--fs-body); color: var(--text); word-break: break-word; }

/* --- Footer --- */
.footer { padding: 2.5rem 0; border-top: 1px solid var(--border); }
.footer .container { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: var(--fs-small); color: var(--muted); }
.footer p { color: var(--muted); }
.footer a { display: inline-block; padding: 0.75rem 0; margin: -0.75rem 0; }
.footer a:hover { color: var(--accent); }

/* --- Lightbox --- */
.lightbox { border: none; padding: 0; background: transparent; max-width: 92vw; max-height: 90vh; margin: auto; }
.lightbox::backdrop { background: rgba(3, 6, 12, 0.88); backdrop-filter: blur(4px); }
.lightbox[open] { animation: lightbox-in 220ms var(--ease-out); }
.lightbox[open]::backdrop { animation: backdrop-in 220ms var(--ease-out); }
@keyframes lightbox-in { from { opacity: 0; transform: scale(0.96); } }
@keyframes backdrop-in { from { opacity: 0; } }
.lightbox img { max-width: 92vw; max-height: 82vh; border-radius: var(--radius-sm); margin: 0 auto; }
.lightbox figcaption { text-align: center; color: #cbd5e1; font-size: var(--fs-small); margin-top: 0.8rem; }
.lightbox-close { position: fixed; top: 1.2rem; right: 1.2rem; color: #fff; border-color: rgba(255, 255, 255, 0.3); }

/* --- Reveal on scroll --- */
/* Content is visible by default; the entrance only applies once the script has marked the page */
html.js-reveal .reveal:not(.visible) { opacity: 0; transform: translateY(8px); }
.reveal { transition: opacity 400ms var(--ease-out), transform 400ms var(--ease-out); transition-delay: calc(var(--stagger, 0) * 60ms); }

/* ==========================================================================
   Project detail pages
   ========================================================================== */
.project-page { padding: 120px 0 5rem; }
.breadcrumb { display: inline-flex; align-items: center; gap: 0.5rem; font-size: var(--fs-small); font-weight: 500; color: var(--muted); padding-block: 0.6rem; margin: -0.6rem 0 1.4rem; }
.breadcrumb:hover { color: var(--accent); }
.project-header { max-width: 820px; margin-bottom: 2.5rem; }
.project-header h1 { font-size: var(--fs-page); margin: 0.4rem 0 1rem; }
.project-header .lead { font-size: var(--fs-lead); }

.project-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 3rem; }
.project-meta div { background: var(--surface); padding: 1.1rem 1.3rem; }
.project-meta small { display: block; font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.25rem; }
.project-meta span { font-family: var(--font-display); font-weight: 600; color: var(--text); }

.project-layout { display: grid; grid-template-columns: 1fr 340px; gap: 4rem; align-items: start; }
/* Grid children must be allowed to shrink, or wide content (diagrams) stretches the column */
.project-layout > *, .research-layout > *, .edu-layout > * { min-width: 0; }
.prose h2 { font-size: var(--fs-sub); margin: 2.5rem 0 1rem; }
.prose h2:first-child { margin-top: 0; }
.prose p { margin-bottom: 1rem; font-size: var(--fs-body); }
.prose ul { display: grid; gap: 0.6rem; margin: 0 0 1rem; }
.prose li { position: relative; padding-left: 1.2rem; color: var(--text-2); }
.prose li::before { content: ''; position: absolute; left: 0; top: 0.7em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.prose-figure { margin: 2rem 0 0; }
.prose-figure img { border-radius: var(--radius); border: 1px solid var(--border); width: 100%; }
.prose-figure figcaption { font-size: var(--fs-small); color: var(--muted); margin-top: 0.6rem; }

.system-diagram { width: 100%; height: auto; display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem; }
.system-diagram .sa-box { fill: var(--surface-2); stroke: var(--border-strong); stroke-width: 1; }
.system-diagram .sa-title { font-family: var(--font-display); font-size: 15px; font-weight: 600; fill: var(--text); }
.system-diagram .sa-sub { font-family: var(--font-body); font-size: 12.5px; fill: var(--muted); }
.system-diagram .sa-label { font-family: var(--font-body); font-size: 12.5px; fill: var(--text-2); }
.system-diagram path, .system-diagram line { fill: none; stroke-width: 1.6; }
.system-diagram .sa-data { stroke: var(--accent); }
.system-diagram .sa-ctrl { stroke: var(--industry); }
.system-diagram .sa-fb { stroke: var(--muted); stroke-dasharray: 2 3; }
.system-diagram .sa-pwr { stroke: var(--venture); stroke-dasharray: 6 4; opacity: 0.85; }

.diagram-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
.swipe-hint { display: none; font-size: var(--fs-label); color: var(--muted); margin: 0.4rem 0 0 !important; }
.lightbox.wide { width: 100vw; max-width: 100vw; max-height: 100vh; overflow: auto; }


/* Numbered page sections: clear levels for long project write-ups */
.pblock { padding-top: 3rem; margin-top: 3rem; border-top: 1px solid var(--border); scroll-margin-top: 90px; }
.pblock:first-child { padding-top: 0; margin-top: 0; border-top: 0; }
.pblock-head { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.pblock-num { flex-shrink: 0; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-small); color: var(--accent); width: 2.6rem; height: 2.6rem; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.prose .pblock-head h2 { margin: 0; font-size: var(--fs-sub); }
.prose .pblock-lead { font-size: var(--fs-lead); line-height: 1.6; color: var(--text); margin-bottom: 1.4rem; }
.prose h3 { font-size: var(--fs-lead); margin: 2rem 0 0.6rem; color: var(--text); }

.req-grid, .baseline-grid, .takeaway-grid { display: grid; gap: 0.8rem; margin: 1.2rem 0 1.5rem; }
.req-grid { grid-template-columns: 1fr 1fr; }
.req-grid > div, .baseline-grid > div, .takeaway-grid > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem 1.1rem; }
.req-grid span { display: inline-flex; width: 1.5rem; height: 1.5rem; border-radius: 50%; align-items: center; justify-content: center; font-family: var(--font-display); font-size: var(--fs-label); font-weight: 700; background: var(--surface-2); color: var(--muted); margin-bottom: 0.5rem; }
.req-grid strong, .baseline-grid strong, .takeaway-grid strong { display: block; font-family: var(--font-display); font-size: var(--fs-body); margin-bottom: 0.25rem; }
.prose .req-grid p, .prose .baseline-grid p, .prose .takeaway-grid p { font-size: var(--fs-small); margin: 0; }
.req-grid .req-key { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.req-grid .req-key span { background: var(--accent); color: var(--accent-ink); }
.baseline-grid { grid-template-columns: repeat(2, 1fr); }
.baseline-grid small { display: block; font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.3rem; }
.baseline-grid .is-ours { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.baseline-grid .is-ours small { color: var(--accent); }
.takeaway-grid { grid-template-columns: repeat(3, 1fr); }

.toc ol { display: grid; gap: 0.15rem; margin-top: 0.4rem; }
.toc a { display: flex; gap: 0.7rem; align-items: center; padding: 0.45rem 0.6rem; border-radius: 8px; font-size: var(--fs-body); color: var(--text-2); transition: background-color 0.2s ease, color 0.2s ease; }
.toc a span { font-family: var(--font-display); font-size: var(--fs-label); font-weight: 700; color: var(--muted); }
.toc a:hover, .toc a.active { background: var(--surface-2); color: var(--text); }
.toc a.active span { color: var(--accent); }
.math-block { font-family: "Cambria Math", "STIX Two Math", Georgia, serif; font-size: var(--fs-lead); color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem 1.2rem; margin: 0 0 1.2rem; display: grid; gap: 0.35rem; overflow-x: auto; }
.chart-figure { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.2rem 1rem; margin: 1rem 0 1.5rem; }
.chart-title { font-family: var(--font-display); font-weight: 600; color: var(--text) !important; margin: 0 0 0.5rem !important; font-size: var(--fs-body) !important; }
.chart-legend { display: flex !important; flex-wrap: wrap; gap: 0.4rem 1.1rem !important; margin: 0 0 0.6rem !important; }
.chart-legend li { padding-left: 0 !important; font-size: var(--fs-label); color: var(--text-2); display: inline-flex; align-items: center; gap: 0.45rem; }
.chart-legend li::before { display: none; }
.chart-legend span { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.mpc-chart { width: 100%; height: auto; display: block; }
.chart-table { margin-top: 0.6rem; font-size: var(--fs-small); }
.chart-table summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.chart-table { overflow-x: auto; }
.chart-table table { width: 100%; border-collapse: collapse; margin-top: 0.6rem; font-size: var(--fs-small); }
.chart-table th, .chart-table td { text-align: right; padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--border); color: var(--text-2); font-variant-numeric: tabular-nums; }
.chart-table th:first-child { text-align: left; color: var(--text); font-weight: 500; }
/* Legend swatches read the chart's own colour tokens */
.mpc-chart-wrap { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; }
html[data-theme="dark"] .mpc-chart-wrap { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; }

.project-video { margin: 0 0 3rem; }
.yt-embed { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: #000; }
.yt-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* The cover shows until the player is ready, and stays as a link if scripts are blocked */
.yt-fallback { position: absolute; inset: 0; display: block; }
.yt-fallback img { width: 100%; height: 100%; object-fit: cover; }
.yt-embed iframe { opacity: 0; transition: opacity 200ms ease-out; }
.yt-embed.is-ready iframe { opacity: 1; }
.yt-embed.is-ready .yt-fallback { display: none; }
.yt-offline-note { display: none; position: absolute; left: 50%; bottom: 1rem; transform: translateX(-50%); padding: 0.35rem 0.8rem; border-radius: 100px; background: rgba(0, 0, 0, 0.72); color: #fff; font-size: var(--fs-label); white-space: nowrap; }
.yt-embed.is-offline .yt-offline-note { display: block; }
.yt-play { position: absolute; left: 50%; top: 50%; width: 68px; height: 48px; margin: -24px 0 0 -34px; border-radius: 14px; background: rgba(0, 0, 0, 0.7); color: #fff; display: flex; align-items: center; justify-content: center; transition: transform var(--press) var(--ease-out), background-color 150ms ease-out; }
.yt-play svg { width: 26px; height: 26px; }
.yt-fallback:active .yt-play { transform: scale(0.95); }
@media (hover: hover) and (pointer: fine) { .yt-fallback:hover .yt-play { background: #e62117; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.project-video video { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); background: #fff; display: block; }
.project-video figcaption { font-size: var(--fs-small); color: var(--muted); margin-top: 0.6rem; }
.figure-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.figure-pair .prose-figure { margin-top: 1rem; }
.figure-pair img { aspect-ratio: 4 / 3; object-fit: contain; background: #ffffff; }
.prose ol.steps { counter-reset: step; display: grid; gap: 0.7rem; margin-bottom: 1rem; }
.prose ol.steps li { counter-increment: step; padding-left: 2.4rem; }
.prose ol.steps li::before {
    content: counter(step); top: 0; width: 1.6rem; height: 1.6rem; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-size: var(--fs-label); font-weight: 700;
    background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent);
}
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 1rem; }
.stat-grid div { background: var(--surface); padding: 1rem 1.1rem; }
.stat-grid strong { display: block; font-family: var(--font-display); font-size: var(--fs-card); }
.stat-grid span { font-size: var(--fs-label); color: var(--muted); line-height: 1.4; display: block; }

.project-aside { position: sticky; top: 100px; display: grid; gap: 1.5rem; }
.project-aside figure img { border-radius: var(--radius); border: 1px solid var(--border); }
.project-aside figcaption { font-size: var(--fs-label); color: var(--muted); margin-top: 0.5rem; }

.project-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.project-nav a { display: flex; flex-direction: column; gap: 0.2rem; max-width: 48%; }
.project-nav a:last-child { text-align: right; margin-left: auto; }
.project-nav small { font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.project-nav span { font-family: var(--font-display); font-weight: 600; color: var(--text); }
.project-nav a:hover span { color: var(--accent); }

/* ==========================================================================
   About page
   ========================================================================== */
.about-hero { padding: 140px 0 4.5rem; }
.about-hero-grid { display: grid; grid-template-columns: 1.4fr 0.6fr; gap: 4rem; align-items: center; }
.about-hero h1 { font-size: var(--fs-display); margin-bottom: 1.2rem; letter-spacing: -0.03em; }
.about-lead { font-size: var(--fs-card); color: var(--text); margin-bottom: 1rem; max-width: 640px; }
.about-hero p { max-width: 640px; }
.about-hero .hero-actions { margin-top: 2rem; }
.about-portrait img { width: 100%; height: auto; max-width: 300px; aspect-ratio: 1; object-fit: cover; border-radius: 28px; border: 1px solid var(--border-strong); margin-left: auto; }

.life-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.2rem; }
.life-cards h3 { font-size: var(--fs-card); margin-bottom: 0.2rem; }
.life-meta { display: block; font-size: var(--fs-small); color: var(--muted); margin-bottom: 0.6rem; }
/* Photo gallery: CSS columns give a masonry layout that keeps each photo's own proportions */
.life-gallery { columns: 3 260px; column-gap: 1rem; margin-top: 1.5rem; }
.life-photo { break-inside: avoid; margin: 0 0 1rem; }
.life-photo button { display: block; width: 100%; padding: 0; border: 0; border-radius: var(--radius); overflow: hidden; cursor: zoom-in; background: var(--surface-2); }
.life-photo img { width: 100%; height: auto; transition: transform 400ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .life-photo button:hover img { transform: scale(1.03); } }
.life-photo figcaption { font-size: var(--fs-small); color: var(--muted); margin-top: 0.45rem; }

.about-split { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 3rem; align-items: start; }
.about-timeline { position: relative; display: grid; gap: 1.3rem; padding-left: 1.6rem; }
.about-timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--border-strong); }
.tl-item { position: relative; display: grid; grid-template-columns: 110px 1fr; gap: 1rem; }
.tl-item::before { content: ''; position: absolute; left: calc(-1.6rem + 0px); top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--tl, var(--accent)); }
.tl-research { --tl: var(--research); } .tl-industry { --tl: var(--industry); } .tl-venture { --tl: var(--venture); } .tl-edu { --tl: var(--muted); }
.tl-date { font-family: var(--font-display); font-size: var(--fs-small); font-weight: 600; color: var(--muted); padding-top: 0.1rem; }
.tl-item strong { display: block; font-family: var(--font-display); font-size: var(--fs-body); }
.tl-item p { font-size: var(--fs-small); margin-top: 0.15rem; }
.about-side { display: grid; gap: 1.2rem; position: sticky; top: 100px; }
.about-link { display: block; transition: border-color 150ms ease-out; }
.about-link .eyebrow { display: block; margin-bottom: 0.3rem; }
.about-link strong { font-family: var(--font-display); }
@media (hover: hover) and (pointer: fine) { .about-link:hover { border-color: var(--accent); } }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1024px) {
    .hero-grid { grid-template-columns: 1fr; gap: 3rem; }
    .hero-visual { order: -1; justify-content: flex-start; }
    .portrait { width: 150px; }
    .portrait::after { inset: -24px; }
    .portrait::before { inset: -11px; }
    .tracks-grid, .skills-grid { grid-template-columns: 1fr; }
    .research-layout, .edu-layout, .contact-card, .project-layout { grid-template-columns: 1fr; }
    .exp-card { grid-template-columns: 1fr; }
    .exp-gallery { aspect-ratio: auto; grid-template-rows: 150px; grid-template-columns: repeat(3, 1fr); }
    .exp-gallery button:first-child { grid-row: auto; }
    .project-aside { position: static; }
    .about-hero-grid, .about-split { grid-template-columns: 1fr; gap: 2rem; }
    .about-portrait { order: -1; }
    .about-portrait img { max-width: 160px; margin-left: 0; border-radius: 22px; }
    .about-side { position: static; }
    .project-aside .toc { display: none; }
    .baseline-grid { grid-template-columns: 1fr 1fr; }
    .project-meta { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
    /* Wide diagrams open larger than the screen so they can be panned */
    .lightbox.wide img { width: 260vw; max-width: none; max-height: none; }
    .nav-toggle { display: inline-flex; flex-direction: column; }
    .icon-btn { width: 44px; height: 44px; }
    .icon-btn::before { display: none; }
    .nav-menu {
        position: absolute; top: 100%; left: 0; right: 0;
        flex-direction: column; align-items: stretch; gap: 0;
        background: var(--bg); border-bottom: 1px solid var(--border);
        box-shadow: 0 16px 32px -20px rgba(0, 0, 0, 0.45);
        padding: 0.5rem 1.5rem 1.2rem;
        /* Closed: short slide + fade out, faster than opening; visibility flips after the fade */
        opacity: 0; transform: translateY(-8px); visibility: hidden;
        transition: opacity 150ms var(--ease-out), transform 150ms var(--ease-out), visibility 0s linear 150ms;
    }
    .nav-menu.open {
        opacity: 1; transform: none; visibility: visible;
        transition: opacity 200ms var(--ease-out), transform 250ms var(--ease-out), visibility 0s;
    }
    .nav-link { padding: 0.85rem 0; border-bottom: 1px solid var(--border); }
    .nav-link::after { display: none; }
    .nav-link:active { color: var(--text); }
    .nav-cv { display: none; }
    .nav-cv-mobile { display: block; color: var(--accent); border-bottom: 0; }
}

@media (max-width: 640px) {
    .container, .nav-container { padding-left: 1rem; padding-right: 1rem; }
    .nav-container { gap: 0.75rem; }
    .logo { font-size: var(--fs-body); font-stretch: 100%; }
    .section { padding: 4.5rem 0; }
    .hero { padding-top: 100px; min-height: auto; }
    .hero-visual { padding-left: 26px; padding-top: 10px; }
    #orbit-canvas { opacity: 0.22; }
    .projects-grid { grid-template-columns: 1fr; }
    .exp-card, .card, .track-card { padding: 1.4rem; }
    .exp-gallery { grid-template-rows: 100px; }
    .rq-list li { grid-template-columns: 1fr; gap: 0.2rem; }
    .contact-card { padding: 1.6rem; }
    .beyond { grid-template-columns: 1fr; }
    .affiliations-logos { gap: 1.6rem; }
    .affiliations-logos img { height: 24px; }
    .project-meta { grid-template-columns: 1fr 1fr; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .req-grid, .takeaway-grid { grid-template-columns: 1fr; }
    .life-cards { grid-template-columns: 1fr; }
    .tl-item { grid-template-columns: 1fr; gap: 0.15rem; }
    .about-hero { padding-top: 110px; }
    .diagram-scroll .system-diagram { min-width: 680px; }
    .diagram-scroll .mpc-chart { min-width: 560px; }
    .swipe-hint { display: block; }
    .track-group-header { flex-direction: column; align-items: flex-start; gap: 0.15rem; }
    .figure-pair { grid-template-columns: 1fr; }
    .project-nav { flex-direction: column; }
    .project-nav a { max-width: 100%; }
    .project-nav a:last-child { text-align: left; margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    /* No movement: entrances become plain fades, hovers and presses stop translating or scaling */
    html.js-reveal .reveal:not(.visible) { transform: none; }
    .reveal { transition: opacity 200ms ease; transition-delay: 0s; }
    .btn:hover, .btn:active, .icon-btn:active, .project-card:hover, .project-card:active, .track-card:hover,
    a.contact-link:hover, a.contact-link:active, .exp-gallery button:active, .yt-fallback:active .yt-play,
    .project-card:hover .project-thumb img, .exp-gallery button:hover img, .life-photo button:hover img,
    .nav-menu, .nav-menu.open { transform: none !important; }
    img { transition: none !important; }
    .lightbox[open] { animation: backdrop-in 150ms ease; }
    .theme-toggle svg { transition: opacity 150ms ease; }
}
