/* =====================================================================
   "The Beamline" — v2 CV, Apple-style light design
   ===================================================================== */
:root {
    --bg: #f7f7f8;          /* light mode: a soft off-white, easier on the eyes than pure white */
    --card: #ededef;
    --text: #1d1d1f;
    --body: #424245;
    --muted: #6e6e73;
    --faint: #86868b;
    --line: #d2d2d7;
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --link: #0066cc;
    --accent-soft: rgba(0, 113, 227, 0.08);
    --warm: #bf4800;
    /* San Francisco on Apple devices, Inter (closest free match) everywhere else */
    --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI Variable Display', 'Segoe UI', Inter, Roboto, 'Helvetica Neue', Arial, sans-serif;
    --wrap: 1100px;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-hover: cubic-bezier(0.25, 0.1, 0.25, 1);
    --radius: 28px;
    --shadow: 0 2px 6px rgba(0, 0, 0, 0.03), 0 12px 32px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 4px 10px rgba(0, 0, 0, 0.04), 0 24px 56px rgba(0, 0, 0, 0.12);
}
.alt { --bg: #eeeef0; --card: #fbfbfc; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 52px; }
body {
    margin: 0; background: #f7f7f8; color: var(--text);
    font: 400 17px/1.47 var(--sans); letter-spacing: -0.022em;
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
    overflow-x: hidden;
}
a { color: inherit; }
b, strong { color: var(--text); font-weight: 600; }
img { display: block; max-width: 100%; }
::selection { background: rgba(0, 113, 227, 0.2); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 22px; }
.wrap.narrow { max-width: 860px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff; padding: 8px 12px; z-index: 200; }
.skip:focus { left: 8px; }
.eyebrow { font-size: 0.95rem; font-weight: 600; letter-spacing: -0.01em; color: var(--warm); margin: 0 0 10px; }

/* Apple-style text link with chevron */
.link { color: var(--link); text-decoration: none; font-size: 1.05rem; white-space: nowrap; }
.link::after { content: ' ›'; display: inline-block; transition: transform 0.3s var(--ease-hover); }
.link:hover { text-decoration: underline; }
.link:hover::after { transform: translateX(3px); }
.link-row { display: flex; flex-wrap: wrap; gap: 10px 28px; }

.btn {
    display: inline-block; background: var(--accent); color: #fff; text-decoration: none; font-size: 1.05rem;
    padding: 12px 24px; border-radius: 980px; transition: background 0.3s var(--ease-hover), transform 0.3s var(--ease-hover);
}
.btn:hover { background: var(--accent-hover); transform: scale(1.03); }

/* ---------- Apple-style sticky section bar ---------- */
.topbar {
    position: fixed; inset: 0 0 auto 0; z-index: 50; height: 52px;
    display: flex; align-items: center; gap: 18px; padding: 0 max(22px, calc((100vw - 1024px) / 2));
    background: rgba(255, 255, 255, 0.72); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid transparent; transition: border-color 0.4s var(--ease), background 0.4s var(--ease);
}
.topbar.scrolled { border-bottom-color: rgba(0, 0, 0, 0.12); background: rgba(255, 255, 255, 0.85); }
.ln-title { font-size: 1.3rem; font-weight: 600; letter-spacing: -0.02em; color: var(--text); text-decoration: none; white-space: nowrap; margin-right: auto; }
/* BSR mark (Faraday cup) beside the name */
:root { --brand-dot: #0071e3; }
html[data-theme="dark"] { --brand-dot: #2997ff; }
.ln-title { display: inline-flex; align-items: center; gap: 0.42em; }
.brand-mark { height: 0.95em; width: auto; flex: none; overflow: visible; }
.brand-mark .bm-dot { fill: var(--brand-dot); }
.brand-mark circle { transition: transform 0.5s var(--ease); }
.ln-title:hover .bm-p1 { transform: translateX(2px); }
.ln-title:hover .bm-p2 { transform: translateX(1.5px); }
.ln-title:hover .bm-dot { transform: translateX(1px); }

/* BSR intro: the beam flies into the cup, then the page fades in */
.bsr-intro { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; background: var(--bg); color: var(--text); cursor: pointer;
    transition: opacity 0.45s var(--ease), visibility 0.45s; }
html[data-theme="dark"] .bsr-intro { background: #000; }
.bsr-intro.out { opacity: 0; visibility: hidden; }
.bi-lock { display: flex; align-items: center; gap: 0.32em; font-size: clamp(56px, 11vw, 112px); transition: transform 0.6s var(--ease); }
.bsr-intro.out .bi-lock { transform: scale(0.94); }
.bi-mark { height: 1.1em; width: auto; overflow: visible; }
.bi-cup { fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: square; stroke-dasharray: 1; stroke-dashoffset: 1; animation: bi-draw 0.5s var(--ease) 0.05s forwards; }
.bi-p, .bi-dot { opacity: 0; animation: bi-fly 0.55s var(--ease) forwards; }
.bi-p { fill: currentColor; }
.bi-p1 { animation-delay: 0.3s; } .bi-p1 { --o: 0.3; }
.bi-p2 { animation-delay: 0.25s; } .bi-p2 { --o: 0.6; }
.bi-dot { fill: var(--brand-dot); --o: 1; animation-delay: 0.2s; }
@keyframes bi-draw { to { stroke-dashoffset: 0; } }
@keyframes bi-fly { from { opacity: 0; transform: translateX(-22px); } to { opacity: var(--o); transform: none; } }

.topnav { display: flex; align-items: center; gap: 2px; }
.topnav a { font-size: 0.78rem; color: rgba(29, 29, 31, 0.86); text-decoration: none; padding: 6px 10px; border-radius: 980px; letter-spacing: -0.01em; transition: color 0.3s var(--ease-hover); }
.topnav a:hover { color: var(--link); }
.topnav a.active { color: var(--text); font-weight: 500; }
.topnav a.active::after { content: ''; display: block; height: 1px; margin-top: 2px; background: var(--text); }
.topnav a.ln-mobile { display: none; }
.topbar-cta { font-size: 0.78rem; text-decoration: none; color: #fff; background: var(--accent); padding: 4px 13px 5px; border-radius: 980px; white-space: nowrap; transition: background 0.3s; }
.topbar-cta:hover { background: var(--accent-hover); }
.ln-toggle { display: none; width: 30px; height: 30px; border: 0; background: none; cursor: pointer; color: var(--text); padding: 0; }
.ln-toggle svg { width: 13px; height: 8px; transition: transform 0.4s var(--ease); }
.topbar.menu-open .ln-toggle svg { transform: rotate(180deg); }

/* ---------- hero (centred, Apple product-page style) ---------- */
.hero { position: relative; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; justify-content: center; padding: 120px 0 56px; overflow: hidden; text-align: center; }
#field { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.hero > .wrap { position: relative; z-index: 1; width: 100%; }
.hero-inner { will-change: transform, opacity; }
.hero .eyebrow { font-size: 1.05rem; }
.hero-name { font-weight: 700; font-size: clamp(3rem, 9vw, 6.8rem); line-height: 1.02; letter-spacing: -0.045em; margin: 0 0 22px; }
.hero-name .light { display: inline-block; color: var(--text); }
.hero-name sup { font-size: 0.2em; font-weight: 600; letter-spacing: 0; color: var(--muted); -webkit-text-fill-color: var(--muted); vertical-align: top; margin-left: 0.4em; position: relative; top: 0.4em; }
.hero-pitch { font-size: clamp(1.2rem, 2.2vw, 1.6rem); line-height: 1.35; color: var(--muted); max-width: 34ch; margin: 0 auto 34px; font-weight: 500; letter-spacing: -0.02em; }
.hero-ctas { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 14px 30px; }
.greeting { font-size: 0.85rem; color: var(--muted); margin: 26px 0 0; min-height: 1.5em; opacity: 0; transition: opacity 0.8s var(--ease); }
.greeting.show { opacity: 1; }
.greeting img { display: inline-block; width: 18px; height: 13px; vertical-align: -1px; margin-right: 8px; border-radius: 2px; }
.greeting b { color: var(--text); font-weight: 500; }

/* ---------- sections ---------- */
.section { padding: 130px 0; background: var(--bg); }
.sec-head { text-align: center; margin: 0 auto 64px; max-width: 760px; }
.sec-head h2 { font-size: clamp(2.4rem, 5.5vw, 4rem); line-height: 1.05; letter-spacing: -0.04em; margin: 0; font-weight: 700; }
.sec-sub { color: var(--muted); margin: 18px auto 0; max-width: 46ch; font-size: clamp(1.1rem, 1.8vw, 1.35rem); line-height: 1.4; font-weight: 500; letter-spacing: -0.015em; }

/* ---------- image card with hover zoom (shared) ---------- */
.zoom { overflow: hidden; border-radius: var(--radius); background: #e8e8ed; isolation: isolate; }
.zoom img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.001); transition: transform 0.9s var(--ease); }

/* ---------- about ---------- */
.about { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 72px; align-items: center; }
.about-photo { margin: 0; aspect-ratio: 4 / 5; border-radius: var(--radius); box-shadow: var(--shadow); transition: box-shadow 0.6s var(--ease); }
.about-photo:hover { box-shadow: var(--shadow-hover); }
.about-photo:hover img { transform: none; }   /* the portrait stays still: only the black & white -> colour scroll fade */
.about-photo img { filter: grayscale(calc(1 - var(--colour, 0))); }
html:not([data-theme="dark"]) .about-photo img { filter: grayscale(calc(1 - var(--colour, 0))) brightness(0.97); }   /* light mode: pure whites match the off-white page instead of glowing */
/* the photo is a cut-out (head-and-shoulders crop): no tile, no shadow, no fades; it sits straight on the page colour */
.about-photo, .about-photo:hover { box-shadow: none; }
.about-photo .zoom, html[data-theme="dark"] .about-photo .zoom { background: transparent; border-radius: 0; }
.about-title { font-size: clamp(2.4rem, 5vw, 3.6rem); letter-spacing: -0.04em; line-height: 1.05; margin: 0 0 22px; font-weight: 700; }
.about-body { font-size: clamp(1.15rem, 1.7vw, 1.35rem); line-height: 1.5; color: var(--muted); margin: 0 0 28px; font-weight: 500; letter-spacing: -0.015em; }

/* ---------- career beamline ---------- */
.beamline { list-style: none; margin: 0 auto; padding: 0; position: relative; max-width: 920px; }
.beamline::before, .beamline::after { content: ''; position: absolute; left: 31px; top: 30px; bottom: 30px; width: 2px; border-radius: 2px; }
.beamline::before { background: var(--line); }
.beamline::after { background: linear-gradient(to bottom, #1d1d1f 0%, #1d1d1f calc(100% - 40px), rgba(29, 29, 31, 0.15) 100%); transform-origin: top; transform: scaleY(var(--beam, 0)); }
.station { position: relative; display: grid; grid-template-columns: 64px 1fr; column-gap: 16px; padding-bottom: 22px; }
.station:last-child { padding-bottom: 0; }
.node { position: relative; z-index: 1; width: 64px; display: flex; justify-content: center; padding-top: 30px; }
.node i { display: block; width: 16px; height: 16px; border: 2px solid #c7c7cc; background: var(--bg); transform: rotate(45deg); box-shadow: 0 0 0 6px var(--bg); transition: background 0.4s var(--ease), border-color 0.4s var(--ease), box-shadow 0.4s var(--ease); }
.station.edu .node i { border-radius: 50%; transform: none; }
.station.lit .node i { border-color: #1d1d1f; background: #1d1d1f; }
.station.now.lit .node i { box-shadow: 0 0 0 6px var(--bg), 0 0 0 10px rgba(29, 29, 31, 0.1); }
.station-body { background: var(--card); border-radius: 22px; padding: 28px 30px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02); transition: transform 0.6s var(--ease), box-shadow 0.6s var(--ease); }
.station-body:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.station-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }
.station-meta .kind { color: var(--accent); font-weight: 600; }
.station.edu .station-meta .kind { color: var(--warm); }
.station-meta .now-tag { color: #fff; background: var(--accent); padding: 1px 9px; border-radius: 980px; font-size: 0.75rem; font-weight: 500; }
.station h3 { margin: 0; font-size: 1.45rem; letter-spacing: -0.025em; font-weight: 600; }
.station .org { color: var(--muted); margin: 2px 0 0; }
.station ul { margin: 16px 0 0; padding: 0; list-style: none; }
.station li { position: relative; padding-left: 18px; margin-top: 8px; color: var(--body); font-size: 0.98rem; }
.more-btn { display: none; margin-top: 10px; padding: 8px 0; border: 0; background: none; font: inherit; font-size: 0.95rem; color: var(--link); cursor: pointer; }
.station li::before { content: ''; position: absolute; left: 0; top: 0.68em; width: 6px; height: 6px; border-radius: 50%; background: var(--line); }

/* ---------- research (bento tiles) ---------- */
.projects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.project {
    position: relative; display: flex; flex-direction: column; background: var(--card); border-radius: var(--radius);
    overflow: hidden; text-decoration: none; color: var(--text); box-shadow: var(--shadow);
    transition: transform 0.7s var(--ease), box-shadow 0.7s var(--ease);
}
.project:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.project .zoom { border-radius: 0; aspect-ratio: 16 / 10; }
.project:hover .zoom img { transform: scale(1.04); }
.project-body { padding: 30px 32px 34px; display: flex; flex-direction: column; flex: 1; }
.project .tag { font-size: 0.85rem; font-weight: 600; color: var(--warm); }
.project h3 { font-size: 1.7rem; margin: 6px 0 10px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.1; }
.project p { margin: 0; color: var(--body); font-size: 1rem; }
.metric-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 14px; }
.project .metric {
    font-size: clamp(2.2rem, 4vw, 3rem); font-weight: 700; letter-spacing: -0.045em; line-height: 1.05;
    background: linear-gradient(90deg, #0071e3, #7a5af8); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.project .metric-label { font-size: 0.9rem; color: var(--muted); }
.project .go { margin-top: auto; padding-top: 22px; }
.project.text-only .project-body { justify-content: center; }
.project.text-only .metric { font-size: clamp(3.4rem, 7vw, 5rem); }

/* ---------- lab gallery: pinned, scroll-driven, centre tile enlarged (Apple-style) ---------- */
.lab { position: relative; background: var(--bg); }            /* height set by JS = scroll distance */
.lab-pin {
    position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden;
    display: flex; flex-direction: column; justify-content: center; padding-top: 52px;
}
.lab-head { margin-bottom: clamp(16px, 4vh, 44px); }
.lab-head h2 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
.lab-head .sec-sub { margin-top: 10px; }
.lab-track { display: flex; gap: clamp(16px, 2.4vw, 32px); padding: 0 var(--pad, 30vw); }
.lab.inview .lab-track, .lab.inview .tile { will-change: transform; }
.tile {
    position: relative; flex: 0 0 auto; margin: 0;
    height: min(60vh, 560px); aspect-ratio: 3 / 4; max-width: 80vw;
    border-radius: var(--radius); overflow: hidden; background: #1d1d1f; box-shadow: var(--shadow);
    transform-origin: 50% 50%;
}
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.4s var(--ease); }
.tile::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.12) 45%, transparent 70%); pointer-events: none; }
.tile figcaption { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 24px 26px 26px; color: #fff; }
.tile h3 { margin: 0; font-size: 1.3rem; font-weight: 600; letter-spacing: -0.025em; line-height: 1.15; }
.tile p {
    margin: 0; font-size: 0.95rem; line-height: 1.4; color: rgba(255, 255, 255, 0.86);
    max-height: 0; opacity: 0; transform: translateY(8px); overflow: hidden;
    transition: max-height 0.7s var(--ease), opacity 0.5s var(--ease), transform 0.7s var(--ease), margin 0.7s var(--ease);
}
.tile.active p, .tile:hover p { max-height: 6em; opacity: 1; transform: none; margin-top: 8px; }
.tile:hover img { transform: scale(1.04); }
/* focus pull: only the centred photo is sharp and in colour; the rest wait soft and grey (both scroll directions) */
.lab:not(.static) .tile img { filter: blur(10px) grayscale(1) brightness(0.82); transform: scale(1.08);
    transition: filter 1.1s var(--ease), transform 1.4s var(--ease); }
.lab:not(.static) .tile.active img { filter: blur(0) grayscale(0) brightness(1); transform: scale(1.001); }
.lab:not(.static) .tile.active:hover img { transform: scale(1.04); }
.tile-3d { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; padding: 7px 14px; border-radius: 980px; font-size: 0.82rem; font-weight: 600;
    color: #1d1d1f; background: rgba(255, 255, 255, 0.9); text-decoration: none; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    transition: background 0.3s var(--ease), transform 0.3s var(--ease); }
.tile-3d::before { content: ''; width: 13px; height: 13px; background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M12 2 3 7v10l9 5 9-5V7z'/%3E%3Cpath d='M3 7l9 5 9-5M12 12v10'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M12 2 3 7v10l9 5 9-5V7z'/%3E%3Cpath d='M3 7l9 5 9-5M12 12v10'/%3E%3C/svg%3E") center / contain no-repeat; }
.tile-3d:hover { background: #fff; transform: scale(1.03); }
/* lab gallery: slow Ken Burns drift on the centre photo, spotlight, hover tilt + shine */
.tile.active > img:first-child { animation: kenburns 18s ease-in-out infinite alternate; }
@keyframes kenburns { from { transform: scale(1.02) translate(0, 0); } to { transform: scale(1.1) translate(-2%, -1.6%); } }
.tile .shine { position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; transition: opacity 0.5s var(--ease);
    background: radial-gradient(circle at var(--mx, 50%) var(--my, 30%), rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05) 35%, transparent 60%); }
.tile:hover .shine { opacity: 1; }
.tile figcaption { z-index: 3; }
.lab.dark .lab-pin::before { content: ''; position: absolute; inset: 0; pointer-events: none;
    background:
        radial-gradient(ellipse 34% 42% at 50% 64%, rgba(255, 255, 255, 0.09), transparent 72%),
        conic-gradient(from 162deg at 50% -6%, transparent 0deg, rgba(255, 255, 255, 0.045) 12deg, rgba(255, 255, 255, 0.07) 18deg, rgba(255, 255, 255, 0.045) 24deg, transparent 36deg); }
.lab-pin > * { position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) { .tile.active > img:first-child { animation: none; } }
.lab-progress { width: min(240px, 50vw); height: 3px; margin: clamp(18px, 4vh, 40px) auto 0; border-radius: 3px; background: rgba(0, 0, 0, 0.08); overflow: hidden; }
.lab-progress span { display: block; height: 100%; width: 100%; background: var(--text); transform-origin: left; transform: scaleX(0); }
/* static fallback (reduced motion / no JS): plain horizontal scroller */
.lab.static { height: auto !important; padding: 110px 0; }
.lab.static .lab-pin { position: static; height: auto; overflow: visible; padding-top: 0; }
.lab.static .lab-track { overflow-x: auto; scroll-snap-type: x mandatory; padding: 10px 9vw 30px; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.lab.static .lab-track::-webkit-scrollbar { display: none; }
.lab.static .tile { height: auto; width: 82vw; max-width: 380px; aspect-ratio: 3 / 4; }
.lab.static .tile { scroll-snap-align: center; }
.lab.static .tile p { max-height: 6em; opacity: 1; transform: none; margin-top: 8px; }
.lab.static .lab-progress { display: none; }

/* ---------- videos ---------- */
.video-grid { display: grid; gap: 22px; }
.video-grid.lectures { grid-template-columns: repeat(2, 1fr); margin-bottom: 22px; }
.video-grid.sims { grid-template-columns: repeat(4, 1fr); }
.vcard {
    display: block; width: 100%; padding: 0; border: 0; text-align: left; font: inherit; color: inherit; cursor: pointer;
    background: var(--card); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow);
}
.vcard:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.vthumb { position: relative; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.vthumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease), opacity 0.5s; }
.vcard:hover .vthumb img { transform: scale(1.04); }
.vthumb iframe { position: absolute; inset: -1px; width: calc(100% + 2px); height: calc(100% + 2px); border: 0; opacity: 0; transition: opacity 0.6s var(--ease); pointer-events: none; }
.vthumb iframe.on { opacity: 1; }
.vplay {
    position: absolute; left: 14px; bottom: 14px; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
    background: rgba(255, 255, 255, 0.9);
    transition: transform 0.5s var(--ease), opacity 0.4s; z-index: 1;
}
.vplay svg { width: 16px; height: 16px; margin-left: 3px; fill: var(--text); }
.vcard:hover .vplay { transform: scale(1.1); }
.vcard.playing .vplay { opacity: 0; }
.vmeta { padding: 16px 20px 20px; }
.vmeta .kind { font-size: 0.8rem; font-weight: 600; color: var(--warm); }
.vmeta h3 { margin: 4px 0 0; font-size: 1.05rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.3; }
.lectures .vmeta h3 { font-size: 1.3rem; }
.channel-link { text-align: center; margin: 40px 0 0; }

.vmodal { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 24px; background: rgba(0, 0, 0, 0.82); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); opacity: 0; transition: opacity 0.4s var(--ease); }
.vmodal.open { opacity: 1; }
.vmodal[hidden] { display: none; }
.vmodal-box { position: relative; width: min(1100px, 100%); aspect-ratio: 16 / 9; border-radius: 18px; overflow: hidden; background: #000; transform: scale(0.94); transition: transform 0.45s var(--ease); }
.vmodal.open .vmodal-box { transform: none; }
.vmodal-frame, .vmodal-frame iframe { width: 100%; height: 100%; border: 0; }
.vmodal-close { position: absolute; top: 12px; right: 12px; z-index: 1; width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer; background: rgba(255, 255, 255, 0.85); color: #1d1d1f; font-size: 0.95rem; }

/* ---------- publications ---------- */
.pub-year { display: grid; grid-template-columns: 72px 1fr; column-gap: 16px; padding: 22px 0; border-top: 1px solid var(--line); }
.pub-year:last-child { border-bottom: 1px solid var(--line); }
.pub-year > span { font-weight: 600; color: var(--faint); font-size: 1.05rem; }
.pub + .pub { margin-top: 14px; }
.pub .venue { font-size: 0.85rem; font-weight: 600; color: var(--accent); }
.pub .badge { display: inline-block; margin-left: 8px; color: #fff; background: var(--warm); padding: 1px 9px; border-radius: 980px; font-size: 0.72rem; font-weight: 500; vertical-align: 1px; }
.pub .badge.cover { background: var(--text); }
.pub .title { display: block; color: var(--text); margin-top: 3px; font-size: 1.05rem; text-decoration: none; }
a.title:hover { color: var(--link); text-decoration: underline; }
.pub .authors { display: block; margin-top: 4px; font-size: 0.88rem; color: var(--muted); }
.pub .authors b { color: var(--text); font-weight: 600; }
.pub .doi { display: inline-block; margin-top: 3px; font-size: 0.82rem; color: var(--link); text-decoration: none; }
.pub .doi:hover { text-decoration: underline; }
.pub .doi + .doi { margin-left: 14px; }
.pub .doi.sim { color: var(--warm); font-weight: 500; }   /* link to my own re-simulation of the paper */
.station li a { color: var(--link); text-decoration: none; }
.station li a:hover { text-decoration: underline; }

/* ---------- talks ---------- */
.talks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.talk { background: var(--card); border-radius: 22px; padding: 28px 30px; }
.talk:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.talk .kind { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.talk.invited .kind { color: var(--warm); }
.talk h3 { margin: 8px 0 10px; font-size: 1.25rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.02em; }
.talk .where { font-size: 0.92rem; color: var(--muted); }

/* ---------- offer ---------- */
.offer { background: var(--card); border-radius: var(--radius); padding: 38px 34px 40px; }
/* offer cards as a pinned scroll row (shares the .lab machinery) */
.offer-rail .offer {
    flex: 0 0 auto; width: min(440px, 78vw); min-height: min(42vh, 340px);
    display: flex; flex-direction: column; justify-content: center;
    transform-origin: 50% 50%; box-shadow: var(--shadow);
}
.offer-rail .offer h3 { font-size: clamp(1.5rem, 2.4vw, 1.9rem); }
.offer-rail .offer p { font-size: 1.05rem; line-height: 1.5; }
.offer-rail .offer.active { box-shadow: var(--shadow-hover); }
.offer-rail.inview .offer { will-change: transform; }
.offer-rail .offer:hover { transform: none; }
.lab.static .offer { width: 82vw; max-width: 380px; scroll-snap-align: center; }
.offer:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.offer .icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 22px; transition: transform 0.7s var(--ease); }
.offer:hover .icon { transform: scale(1.06); }
.offer .icon svg { width: 26px; height: 26px; }
.offer h3 { margin: 0 0 10px; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.03em; }
.offer p { margin: 0; color: var(--body); }
.offer .offer-link { display: inline-block; margin: 16px 18px 0 0; color: var(--accent); font-weight: 600; text-decoration: none; }
.offer .offer-link:hover { text-decoration: underline; }

/* ---------- skills rack ---------- */
.rack { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.module { background: var(--card); border-radius: 22px; padding: 26px 26px 28px; }
.module .label { display: flex; align-items: center; gap: 10px; font-size: 0.95rem; font-weight: 600; }
.module .label::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.module .items { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.module .items span { font-size: 0.88rem; padding: 4px 12px; border-radius: 980px; background: var(--bg); color: var(--body); transition: background 0.3s, color 0.3s; }
.module .items span:hover { background: var(--accent-soft); color: var(--accent); }
.module .items span.own { background: var(--accent); color: #fff; }

/* ---------- off-beam ---------- */
.hobbies { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.hobby { background: var(--card); border-radius: 22px; padding: 30px; text-align: center; }
.hobby:hover { transform: translateY(-4px); }
.hobby .icon { font-size: 2.4rem; display: inline-block; transition: transform 0.6s var(--ease); }
.hobby:hover .icon { transform: scale(1.06); }
.hobby h3 { margin: 14px 0 6px; font-size: 1.25rem; font-weight: 600; letter-spacing: -0.02em; }
.hobby p { margin: 0; color: var(--muted); font-size: 0.97rem; }

/* ---------- contact ---------- */
.contact { padding: 150px 0 190px; text-align: center; }   /* room for the beam scene under the links */
.contact-title { font-size: clamp(3rem, 8vw, 6rem); line-height: 1; letter-spacing: -0.05em; margin: 0 0 30px; font-weight: 700; }
.contact-mail { display: inline-block; font-size: clamp(1.3rem, 3.2vw, 2rem); color: var(--link); text-decoration: none; font-weight: 500; letter-spacing: -0.02em; }
.contact-mail:hover { text-decoration: underline; }
#contact-links .link-row { justify-content: center; margin-top: 30px; }

.footer { background: #f5f5f7; border-top: 1px solid var(--line); padding: 20px 0; font-size: 0.75rem; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.footer a { color: var(--body); text-decoration: none; }
.footer a:hover { color: var(--text); text-decoration: underline; }

/* ---------- reveal on scroll ---------- */
.reveal {
    opacity: 0; transform: translate3d(0, 28px, 0);
    transition: opacity 0.9s var(--ease), transform 0.9s var(--ease), box-shadow 0.5s var(--ease);
    transition-delay: var(--d, 0ms);
}
.reveal.in { opacity: 1; transform: none; }
/* once revealed, cards use quick hover transitions with no stagger delay */
.reveal.in.done { transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease); transition-delay: 0ms; }
/* light press feedback */
.btn:active, .vcard:active, a.project:active, .round-btn:active, .more-btn:active { transform: scale(0.98); transition-duration: 0.12s; }

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

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
    .topbar { gap: 4px; }
    .ln-title { font-size: 1.15rem; margin-right: 0; }
    .ln-toggle { display: grid; place-items: center; margin-right: auto; }
    .topnav {
        position: absolute; top: 52px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0;
        padding: 6px 22px 18px; background: rgba(247, 247, 248, 0.96); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        opacity: 0; visibility: hidden; transform: translateY(-8px); transition: opacity 0.35s var(--ease), transform 0.35s var(--ease), visibility 0.35s;
    }
    .topbar.menu-open .topnav { opacity: 1; visibility: visible; transform: none; }
    .topnav a { font-size: 1rem; padding: 12px 0; border-radius: 0; border-bottom: 1px solid rgba(0, 0, 0, 0.06); }
    .topnav a.active::after { display: none; }
    .topnav a.ln-mobile { display: block; }
    .about { grid-template-columns: 1fr; gap: 40px; }
    .about-photo { max-width: 460px; width: 100%; margin: 0 auto; }
    .about-text { text-align: center; }
    .about .link-row { justify-content: center; }
}
@media (max-width: 860px) {
    .video-grid.sims { grid-template-columns: repeat(2, 1fr); }
    .projects, .talks { grid-template-columns: 1fr; }
    .rack, .hobbies { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
    body { font-size: 16px; }
    .wrap { padding: 0 18px; }
    .topbar { padding: 0 16px; }
    .section { padding: 64px 0; }
    .topbar-cta { padding: 10px 16px; min-height: 40px; display: inline-flex; align-items: center; font-size: 0.85rem; }
    .ln-toggle { width: 44px; height: 44px; }
    .station .extra { display: none; }
    .station.open .extra { display: list-item; }
    .more-btn { display: inline-block; }
    .pub .doi { padding: 8px 0; }
    .video-grid.sims { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 14px; margin: 0 -18px; padding: 4px 18px 16px; scrollbar-width: none; }
    .video-grid.sims::-webkit-scrollbar { display: none; }
    .video-grid.sims .vcard { flex: 0 0 78vw; scroll-snap-align: center; }
    .sec-head { margin-bottom: 30px; }
    .beamline::before, .beamline::after { left: 11px; }
    .station { grid-template-columns: 24px 1fr; column-gap: 14px; }
    .node { width: 24px; }
    .node i { width: 13px; height: 13px; }
    .station-body { padding: 22px; }
    .project-body { padding: 24px 24px 28px; }
    .pub-year { grid-template-columns: 1fr; }
    .pub-year > span { margin-bottom: 6px; }
    .rack, .hobbies { grid-template-columns: 1fr; }
    .video-grid.lectures { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; transition: none; }
    .hero-inner { transform: none !important; opacity: 1 !important; }
    .beamline::after { transform: none; }
    *, *::before, *::after { transition-duration: 0.01ms !important; }
}

/* ---------- Apple Music–style mini player ---------- */
.mp {
    position: fixed; right: 20px; bottom: 20px; z-index: 120; width: 400px; max-width: calc(100vw - 32px);
    border-radius: 22px; overflow: hidden; color: var(--text);
    background: rgba(250, 250, 252, 0.88); backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px);
    box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.1), 0 10px 40px rgba(0, 0, 0, 0.16);
    transition: box-shadow 0.5s var(--ease), transform 0.5s var(--ease);
}
.mp:hover { box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.12), 0 16px 50px rgba(0, 0, 0, 0.2); }
.mp button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.mp-bar { display: grid; grid-template-columns: 48px 1fr auto; grid-template-rows: auto auto auto; column-gap: 12px; align-items: center; padding: 12px 14px 10px; }
.mp .mp-art {
    grid-row: 1; width: 48px; height: 48px; border-radius: 10px; display: grid; place-items: center;
    background: #1d1d1f; color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); transition: transform 0.5s var(--ease), background 0.6s;
}
.mp-art svg { width: 22px; height: 22px; fill: currentColor; }
.mp.playing .mp-art { transform: scale(1.04); }
.mp-art:hover { transform: scale(1.08); }
.mp-info { display: flex; flex-direction: column; min-width: 0; text-align: left; }
.mp-title { font-size: 0.92rem; font-weight: 600; letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-sub { font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-ctrls { display: flex; align-items: center; gap: 0; }
.mp-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; transition: background 0.25s, transform 0.25s var(--ease); }
.mp-btn svg { width: 22px; height: 22px; fill: var(--text); }
.mp-btn.small svg { width: 17px; height: 17px; }
.mp-btn:hover { background: rgba(0, 0, 0, 0.06); }
.mp-btn:active { transform: scale(0.9); }
.mp-shuffle svg { fill: none; stroke: var(--faint); }
.mp-shuffle.on svg { stroke: var(--text); }
.mp-progress { grid-column: 1 / -1; position: relative; height: 4px; margin: 12px 0 0; border-radius: 4px; background: rgba(0, 0, 0, 0.1); cursor: pointer; touch-action: none; transition: height 0.2s; }
.mp-progress:hover, .mp-progress:focus-visible { height: 6px; }
.mp-progress::before { content: ''; position: absolute; inset: -8px 0; }      /* bigger hit area */
.mp-fill { height: 100%; border-radius: inherit; background: rgba(29, 29, 31, 0.75); transform-origin: left; transform: scaleX(0); }
.mp-times { grid-column: 1 / -1; display: flex; justify-content: space-between; font-size: 0.68rem; color: var(--faint); margin-top: 5px; font-variant-numeric: tabular-nums; }

.mp-queue { max-height: 0; overflow: hidden; transition: max-height 0.5s var(--ease); border-bottom: 1px solid rgba(0, 0, 0, 0.06); }
.mp.expanded .mp-queue { max-height: min(52vh, 420px); overflow-y: auto; }
.mp-queue-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: baseline; padding: 14px 16px 8px; font-weight: 700; font-size: 1.05rem; letter-spacing: -0.02em; background: rgba(250, 250, 252, 0.92); z-index: 1; }
.mp-count { font-size: 0.75rem; font-weight: 400; color: var(--muted); }
.mp-queue ol { list-style: none; margin: 0; padding: 0 8px 8px; }
.mp-queue li button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 7px 8px; border-radius: 10px; text-align: left; transition: background 0.2s; }
.mp-queue li button:hover { background: rgba(0, 0, 0, 0.05); }
.mp-q-art { flex: none; width: 34px; height: 34px; border-radius: 7px; }
.mp-q-title { flex: 1; min-width: 0; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-queue li button.current .mp-q-title { color: var(--text); font-weight: 700; }
.mp-q-eq { display: none; gap: 2px; align-items: flex-end; height: 12px; }
.mp-q-eq i { width: 3px; height: 12px; background: var(--text); border-radius: 1px; transform-origin: bottom; animation: eq 0.9s ease-in-out infinite; }
.mp-q-eq i:nth-child(2) { animation-delay: -0.3s; } .mp-q-eq i:nth-child(3) { animation-delay: -0.6s; }
.mp.playing .current .mp-q-eq { display: flex; }
@keyframes eq { 0%, 100% { transform: scaleY(0.25); } 50% { transform: scaleY(1); } }

.footer { padding-bottom: 130px; }        /* room so the player never covers the footer */
@media (max-width: 600px) {
    .mp { right: 12px; left: 12px; bottom: 12px; width: auto; max-width: none; border-radius: 18px; }
    .mp .mp-art { width: 40px; height: 40px; border-radius: 9px; }
    .mp-bar { grid-template-columns: 40px 1fr auto; padding: 8px 10px 8px; }
    .mp-shuffle, .mp-times { display: none; }
    .mp-progress { margin-top: 8px; height: 3px; }
    .tile { height: min(50vh, 440px); }          /* leave room above the mini player */
    .lab-pin { justify-content: flex-start; padding-top: 72px; }
}
@media (prefers-reduced-motion: reduce) { .mp-q-eq i, .mp-fab-eq i { animation: none; transform: scaleY(0.6); } }
.mp-shuffle.spin svg { animation: shuffle-pop 0.45s var(--ease); }
@keyframes shuffle-pop { 0% { transform: scale(1); } 40% { transform: scale(1.25) rotate(-8deg); } 100% { transform: none; } }

/* ---------- player: small round button until opened ---------- */
.mp-fab { display: none; }
.mp.collapsed { width: 56px; height: 56px; border-radius: 50%; }
.mp.collapsed .mp-bar, .mp.collapsed .mp-queue { display: none; }
.mp.collapsed .mp-fab {
    display: grid; place-items: center; position: relative; width: 56px; height: 56px; border-radius: 50%;
    background: rgba(29, 29, 31, 0.92); color: #fff; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22); transition: transform 0.4s var(--ease);
}
.mp.collapsed .mp-fab:hover { transform: scale(1.08); }
.mp.collapsed .mp-fab:active { transform: scale(0.94); }
.mp-fab svg { width: 24px; height: 24px; fill: currentColor; }
.mp-fab-eq { display: none; position: absolute; right: 11px; bottom: 11px; gap: 2px; align-items: flex-end; height: 10px; }
.mp-fab-eq i { width: 2.5px; height: 10px; background: #fff; border-radius: 1px; transform-origin: bottom; animation: eq 0.9s ease-in-out infinite; }
.mp-fab-eq i:nth-child(2) { animation-delay: -0.3s; } .mp-fab-eq i:nth-child(3) { animation-delay: -0.6s; }
.mp.playing .mp-fab-eq { display: flex; }
.mp.playing.collapsed .mp-fab svg { opacity: 0.55; }
.mp-min svg { fill: none !important; stroke: var(--faint); }
@media (max-width: 600px) {
    .mp.collapsed { left: auto; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); width: 52px; height: 52px; border-radius: 50%; }
    .mp.collapsed .mp-fab { width: 52px; height: 52px; }
}

/* ---------- wide screens: use the side space ---------- */
@media (min-width: 1400px) { :root { --wrap: 1280px; } }
@media (min-width: 1200px) {
    /* sticky side headings: title stays put on the left while the content scrolls on the right */
    .wrap.split { display: grid; grid-template-columns: minmax(280px, 0.78fr) 2fr; column-gap: 72px; align-items: start; }
    .split > .sec-head { position: sticky; top: 110px; text-align: left; margin: 0; max-width: none; }
    .split > .sec-head .sec-sub { margin-left: 0; }
    .split .beamline { max-width: none; margin: 0; }
    .split .rack { grid-template-columns: repeat(2, 1fr); }

    /* research as a bento grid: big tiles and small tiles */
    /* row 1: big PY-BEMCS + smaller AEgIS; row 2: two equal tiles */
    .projects { grid-template-columns: repeat(6, 1fr); }
    .projects > * { grid-column: span 3; }
    .projects > :nth-child(4n + 1) { grid-column: span 4; }
    .projects > :nth-child(4n + 2) { grid-column: span 2; }
    .projects > :nth-child(4n + 1) .zoom { aspect-ratio: 21 / 10; }
    .projects > :nth-child(4n + 3) .zoom, .projects > :nth-child(4n + 4) .zoom { aspect-ratio: 2 / 1; }   /* shorter photos on row 2 */
}
@media (min-width: 1400px) {
    .talks { grid-template-columns: repeat(4, 1fr); }
    .video-grid.sims { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- background physics scenes (scenes.js) ---------- */
.has-scene { position: relative; }
.has-scene > .wrap { position: relative; z-index: 1; }
.bg-scene { position: absolute; left: 0; top: 0; width: 100%; pointer-events: none; z-index: 0; }
@media (max-width: 600px) { .contact { padding-bottom: 110px; } }

/* ---------- sound toggle (sfx.js) ---------- */
#sfx-toggle {
    width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: rgba(29, 29, 31, 0.72);
    display: grid; place-items: center; cursor: pointer; padding: 0; transition: background 0.3s var(--ease-hover), color 0.3s;
}
#sfx-toggle:hover { background: rgba(0, 0, 0, 0.05); color: var(--text); }
#sfx-toggle svg { width: 18px; height: 18px; }
#sfx-toggle[aria-pressed="false"] { color: var(--faint); }
@media (max-width: 1000px) { #sfx-toggle { margin-left: auto; } }
@media (max-width: 600px) { #sfx-toggle { width: 40px; height: 40px; } }

/* ---------- language switch ---------- */
#lang-pick {
    appearance: none; -webkit-appearance: none; border: 0; background: transparent; cursor: pointer;
    font: inherit; font-size: 0.78rem; font-weight: 500; color: rgba(29, 29, 31, 0.8); padding: 6px 8px; border-radius: 980px;
}
#lang-pick:hover { background: rgba(0, 0, 0, 0.05); color: var(--text); }
@media (max-width: 1000px) { #lang-pick { margin-left: auto; } #sfx-toggle { margin-left: 0; } }

/* ---------- contact extras ---------- */
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-size: 1.05rem; cursor: pointer; color: var(--link); }
.localtime { margin: 22px 0 0; font-size: 0.95rem; color: var(--muted); }

/* ---------- physics term tooltips ---------- */
.term { text-decoration: underline dotted rgba(29, 29, 31, 0.45); text-underline-offset: 3px; cursor: help; border-radius: 3px; transition: background 0.2s; }
.term:hover, .term:focus-visible { background: rgba(0, 0, 0, 0.05); outline: none; }
#term-tip {
    position: fixed; z-index: 400; max-width: 320px; padding: 14px 16px; border-radius: 14px; pointer-events: none;
    background: rgba(29, 29, 31, 0.94); color: #f5f5f7; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; line-height: 1.4;
    opacity: 0; transform: translateY(4px); transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
#term-tip.show { opacity: 1; transform: none; }
#term-tip strong { font-size: 0.9rem; font-weight: 600; }
#term-tip .eq { font-family: 'Times New Roman', 'STIX Two Math', serif; font-size: 1.05rem; font-style: italic; color: #fff; }
#term-tip .def { color: rgba(245, 245, 247, 0.78); }

/* ---------- skills network ---------- */
.sg { margin: 0 0 34px; }
.sg-title { margin: 0; font-size: 1.35rem; font-weight: 700; letter-spacing: -0.025em; }
.sg-sub { margin: 4px 0 18px; color: var(--muted); font-size: 0.95rem; }
.sg-body { position: relative; display: grid; grid-template-columns: 1fr 1fr; column-gap: clamp(60px, 16%, 180px); background: var(--card); border-radius: 22px; padding: 22px; }
.sg-links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.sg-links path { fill: none; stroke: #d2d2d7; stroke-width: 1; transition: stroke 0.3s, stroke-width 0.3s, opacity 0.3s; }
.sg.focusing .sg-links path { opacity: 0.25; }
.sg.focusing .sg-links path.on { opacity: 1; stroke: #1d1d1f; stroke-width: 1.6; }
.sg-col { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; position: relative; z-index: 1; }
.sg-skills { align-items: flex-end; }
.sg-work { align-items: flex-start; justify-content: space-around; }
.sg-node {
    border: 0; font: inherit; font-size: 0.85rem; cursor: pointer; padding: 5px 12px; border-radius: 980px;
    background: var(--bg); color: var(--body); transition: background 0.25s, color 0.25s, opacity 0.25s;
}
.sg-node.work { font-weight: 600; color: var(--text); }
.sg.focusing .sg-node { opacity: 0.35; }
.sg.focusing .sg-node.on { opacity: 1; background: #1d1d1f; color: #fff; }
@media (max-width: 600px) { .sg-body { padding: 14px; column-gap: 34px; } .sg-node { font-size: 0.75rem; padding: 4px 9px; } }

/* ---------- easter egg ---------- */
.beam-fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 250; }
.beam-toast {
    position: fixed; left: 50%; bottom: 90px; z-index: 260; transform: translate(-50%, 10px); opacity: 0;
    background: rgba(29, 29, 31, 0.92); color: #fff; padding: 10px 18px; border-radius: 980px; font-size: 0.9rem;
    transition: opacity 0.4s var(--ease), transform 0.4s var(--ease); pointer-events: none;
}
.beam-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* fixes: graph + rack share the right column on wide screens; nav labels never wrap; tooltip title readable */
@media (min-width: 1200px) {
    .split > .sec-head { grid-row: 1 / span 2; }
    .split > .sg, .split > .rack { grid-column: 2; }
}
.topnav a { white-space: nowrap; }
html[lang="es"] .topnav a, html[lang="ru"] .topnav a { padding: 6px 8px; font-size: 0.75rem; }
@media (max-width: 1180px) { html[lang="es"] .topnav a.ln-ext, html[lang="ru"] .topnav a.ln-ext { display: none; } }
#term-tip strong { color: #fff; }

/* ---------- living research cards (simulation clips over the photo) ---------- */
.project .zoom { position: relative; }
.project .zoom .clip {
    position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none;
    transition: opacity 0.6s var(--ease), transform 0.9s var(--ease);
}
.project.clip-on .zoom .clip { opacity: 1; }
.project:hover .zoom .clip { transform: scale(1.04); }
.clip-tag {
    position: absolute; left: 14px; bottom: 14px; z-index: 1; padding: 4px 10px; border-radius: 980px;
    font-size: 0.72rem; font-weight: 600; letter-spacing: 0.01em; color: #1d1d1f;
    background: rgba(255, 255, 255, 0.78); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    opacity: 0; transform: translateY(4px); transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}
.project.clip-on .clip-tag { opacity: 1; transform: none; }
.project .zoom .clip-src { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; pointer-events: none; }
.project .zoom img { position: relative; }

/* ---------- hobby words that play my music videos ---------- */
.media-word {
    border: 0; background: none; padding: 0 1px; font: inherit; color: var(--link); cursor: pointer;
    display: inline-flex; align-items: center; gap: 3px; border-radius: 4px;
}
.media-word svg { width: 0.7em; height: 0.7em; fill: currentColor; }
.media-word:hover, .media-word:focus-visible { text-decoration: underline; text-underline-offset: 3px; outline: none; }
.media-pop {
    position: fixed; z-index: 300; width: 300px; border-radius: 18px; overflow: hidden; cursor: pointer;
    background: #1d1d1f; color: #f5f5f7; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
    opacity: 0; transform: translateY(6px) scale(0.97); transform-origin: 50% 100%;
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.media-pop.show { opacity: 1; transform: none; }
.media-pop .mpop-frame { aspect-ratio: 16 / 9; background: #000; }
.media-pop iframe { width: 100%; height: 100%; border: 0; display: block; pointer-events: none; }
.media-pop .mpop-cap { padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 2px; font-size: 0.8rem; }
.media-pop .mpop-cap strong { font-size: 0.85rem; font-weight: 600; color: #fff; }
.media-pop .mpop-cap span { color: rgba(245, 245, 247, 0.65); }
.hobby-link { color: var(--link); }
.hobby-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- player: artist photos for newer songs ---------- */
.mp-art svg { transition: opacity 0.3s; }
.mp-art.has-photo svg { opacity: 0; }
.mp-q-title small { display: block; font-size: 0.74rem; font-weight: 400; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.mp-queue li button.current .mp-q-title small { font-weight: 400; }

/* ---------- player: drag to move (desktop) ---------- */
@media (hover: hover) and (pointer: fine) {
    .mp .mp-bar, .mp .mp-times { cursor: grab; }
    .mp.dragging, .mp.dragging * { cursor: grabbing !important; user-select: none; }
    .mp.dragging { transition: none; box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.12), 0 22px 60px rgba(0, 0, 0, 0.24); }
}

/* ---------- player: moves with the beat (desktop, while playing) ---------- */
.mp.beat { box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.1), 0 10px calc(40px + var(--beat, 0) * 26px) rgba(0, 0, 0, calc(0.16 + var(--beat, 0) * 0.1)); transition: transform 0.5s var(--ease); }
.mp.beat .mp-art { transform: scale(calc(1.02 + var(--beat, 0) * 0.08)); transition: background 0.6s; }
.mp.beat.collapsed { transform: scale(calc(1 + var(--beat, 0) * 0.07)); transition: none; }
.mp.beat .mp-fab-eq i, .mp.beat .mp-q-eq i { animation: none; transition: transform 0.08s linear; }
.mp.beat .mp-fab-eq i:nth-child(1), .mp.beat .mp-q-eq i:nth-child(1) { transform: scaleY(var(--b1, 0.4)); }
.mp.beat .mp-fab-eq i:nth-child(2), .mp.beat .mp-q-eq i:nth-child(2) { transform: scaleY(var(--b2, 0.4)); }
.mp.beat .mp-fab-eq i:nth-child(3), .mp.beat .mp-q-eq i:nth-child(3) { transform: scaleY(var(--b3, 0.4)); }

/* ---------- "Take a break" card + Beamline Run game ---------- */
.play-card {
    display: flex; align-items: center; gap: 24px; margin-top: 20px; padding: 22px 28px;
    background: var(--card); border-radius: 22px; transition: transform 0.5s var(--ease);
}
.play-card:hover { transform: translateY(-4px); }
.play-preview { width: 96px; height: 48px; image-rendering: pixelated; flex: none; }
.play-text { flex: 1; min-width: 0; }
.play-text h3 { margin: 0 0 4px; font-size: 1.25rem; font-weight: 600; letter-spacing: -0.02em; }
.play-text p { margin: 0; color: var(--muted); font-size: 0.97rem; }
.play-best { color: var(--text); font-weight: 600; white-space: nowrap; }
.play-btn { flex: none; }
@media (max-width: 600px) { .play-card { flex-wrap: wrap; padding: 20px; gap: 14px; } .play-btn { width: 100%; text-align: center; } }

.game-ov {
    position: fixed; inset: 0; z-index: 600; display: grid; place-items: center; padding: 16px;
    background: rgba(0, 0, 0, 0.55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    opacity: 0; transition: opacity 0.3s var(--ease);
}
.game-ov.open { opacity: 1; }
html.game-open { overflow: hidden; }
.game-box { width: min(980px, 100%); background: #fff; border-radius: 22px; padding: 14px 16px 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35); }
.game-top { display: flex; align-items: center; gap: 14px; padding: 2px 4px 10px; font-size: 0.95rem; }
.game-top strong { font-weight: 700; letter-spacing: -0.02em; }
.game-hud { flex: 1; color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.game-close { border: 0; background: rgba(0, 0, 0, 0.06); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 0.9rem; color: var(--text); }
.game-close:hover { background: rgba(0, 0, 0, 0.1); }
.game-stage { position: relative; border-radius: 12px; overflow: hidden; outline: none; background: #f2f2f5; }
.game-stage canvas { display: block; width: 100%; aspect-ratio: 320 / 176; image-rendering: pixelated; image-rendering: crisp-edges; }
.g-msg {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
    background: rgba(242, 242, 245, 0.72); opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.g-msg.show { opacity: 1; }
.g-msg b { font-size: clamp(1.6rem, 4.5vw, 3rem); letter-spacing: -0.04em; color: var(--text); }
.g-msg span { color: var(--body); font-size: 1rem; }
.g-msg small { color: var(--muted); font-size: 0.85rem; margin-top: 6px; }
.g-fact {
    position: absolute; left: 12px; right: 12px; top: 12px; padding: 10px 14px; border-radius: 12px;
    background: rgba(29, 29, 31, 0.88); color: #f5f5f7; font-size: 0.9rem; line-height: 1.4;
    opacity: 0; transform: translateY(-6px); transition: opacity 0.3s, transform 0.3s; pointer-events: none;
}
.g-fact.show { opacity: 1; transform: none; }
.game-help { margin: 10px 4px 0; font-size: 0.78rem; color: var(--muted); text-align: center; }
.game-touch { display: none; }
@media (hover: none), (pointer: coarse) {
    .game-help { display: none; }
    .game-touch { display: flex; gap: 10px; margin-top: 12px; user-select: none; -webkit-user-select: none; }
    .game-touch button {
        flex: 1; height: 56px; border: 0; border-radius: 14px; background: #f2f2f5; font-size: 1.4rem; color: var(--text);
        touch-action: none; -webkit-tap-highlight-color: transparent;
    }
    .game-touch button:active { background: #e3e3e8; }
    .game-touch .jump { flex: 1.4; background: #1d1d1f; color: #fff; }
}
.game-ov[hidden] { display: none; }
/* game: name entry, top-5 board, power-up legend, fire button */
.g-msg.form { pointer-events: auto; }
.g-name { display: flex; gap: 8px; margin-top: 10px; }
.g-name input {
    font: inherit; font-size: 1rem; padding: 9px 14px; border-radius: 980px; border: 1px solid #d2d2d7; background: #fff; color: var(--text);
    width: min(220px, 50vw); outline: none;
}
.g-name input:focus { border-color: var(--link); box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2); }
.g-name button { font: inherit; font-size: 0.95rem; border: 0; border-radius: 980px; padding: 9px 18px; background: var(--link); color: #fff; cursor: pointer; }
.g-board { list-style: none; margin: 8px 0 2px; padding: 8px 14px; min-width: 210px; border-radius: 12px; background: rgba(255, 255, 255, 0.85); font-size: 0.85rem; }
.g-board li { display: flex; justify-content: space-between; gap: 18px; padding: 2px 0; counter-increment: rank; }
.g-board li:not(.g-board-h)::before { content: counter(rank) '.'; color: var(--faint); width: 1.4em; }
.g-board li span { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-board .g-board-h { font-weight: 700; justify-content: center; counter-increment: none; counter-reset: rank; }
.g-board li.me { color: var(--link); font-weight: 600; }
.g-legend { font-size: 0.82rem !important; color: var(--muted) !important; }
@media (hover: none), (pointer: coarse) { .game-touch .fire { flex: 0.8; background: #ffd60a; } }
.g-msg .g-board b { font-size: inherit; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.g-msg .g-board { line-height: 1.5; }

/* =====================================================================
   Liquid Glass (Apple, 2025): clear glass that lets the page through, a bright rim,
   a soft sheen, and a highlight that follows the pointer.
   ===================================================================== */
.topbar, .mp {
    --glass-rim: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -1px 0 rgba(0, 0, 0, 0.04), inset 1px 0 0 rgba(255, 255, 255, 0.5), inset -1px 0 0 rgba(255, 255, 255, 0.5);
}
.topbar {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.42));
    backdrop-filter: blur(14px) saturate(190%) brightness(1.04); -webkit-backdrop-filter: blur(14px) saturate(190%) brightness(1.04);
    box-shadow: var(--glass-rim), 0 6px 24px rgba(0, 0, 0, 0.06);
    border-bottom: 0;
    transition: background 0.5s var(--ease), box-shadow 0.5s var(--ease), color 0.5s var(--ease);
}
.topbar.scrolled { background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.5)); border-bottom: 0; }
.topbar::before, .mp::before {                     /* the glossy sheen across the top */
    content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 46%);
    mix-blend-mode: soft-light;
}
.topbar::after, .mp::after {                       /* the highlight that follows the pointer */
    content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0;
    background: radial-gradient(180px circle at var(--lx, 50%) var(--ly, 0%), rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 70%);
    transition: opacity 0.4s var(--ease);
}
.topbar.lit::after, .mp.lit::after { opacity: 1; }
.topbar::before, .topbar::after, .mp::before, .mp::after { z-index: -1; }   /* under the content, over the glass */
.topbar, .mp { isolation: isolate; }

/* desktop: the bar floats as a glass capsule, like the iOS 26 tab bar */
@media (min-width: 1001px) {
    .topbar {
        top: 10px; left: 50%; right: auto; transform: translateX(-50%);
        width: min(1100px, calc(100vw - 32px)); height: 50px; border-radius: 25px; padding: 0 8px 0 24px;
    }
    html { scroll-padding-top: 70px; }
}

.mp {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(250, 250, 252, 0.5));
    backdrop-filter: blur(16px) saturate(190%) brightness(1.04); -webkit-backdrop-filter: blur(16px) saturate(190%) brightness(1.04);
    box-shadow: var(--glass-rim), 0 0 0 0.5px rgba(0, 0, 0, 0.08), 0 12px 40px rgba(0, 0, 0, 0.16);
}
.mp.beat { box-shadow: var(--glass-rim), 0 0 0 0.5px rgba(0, 0, 0, 0.08), 0 10px calc(40px + var(--beat, 0) * 26px) rgba(0, 0, 0, calc(0.16 + var(--beat, 0) * 0.1)); }
.mp-queue-head { background: rgba(255, 255, 255, 0.55); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }

/* blue buttons get a glassy gloss */
.btn, .topbar-cta, .g-name button {
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 55%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -1px 0 rgba(0, 0, 0, 0.12), 0 4px 14px rgba(0, 113, 227, 0.25);
}

/* dark glass: tooltips, pop-ups and toasts */
#term-tip, .media-pop, .beam-toast {
    background: linear-gradient(180deg, rgba(48, 48, 52, 0.72), rgba(24, 24, 27, 0.66));
    -webkit-backdrop-filter: blur(18px) saturate(180%); backdrop-filter: blur(18px) saturate(180%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), inset 0 0 0 0.5px rgba(255, 255, 255, 0.1), 0 14px 40px rgba(0, 0, 0, 0.3);
}

/* the top bar goes dark over the dark Lab section */
.topbar.on-dark { background: linear-gradient(180deg, rgba(40, 40, 44, 0.62), rgba(22, 22, 24, 0.5)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 0 0 0.5px rgba(255, 255, 255, 0.08), 0 6px 24px rgba(0, 0, 0, 0.3); }
.topbar.on-dark .ln-title, .topbar.on-dark .topnav a, .topbar.on-dark #lang-pick, .topbar.on-dark #sfx-toggle, .topbar.on-dark .ln-toggle { color: #f5f5f7; }
.topbar.on-dark .topnav a.active::after { background: #f5f5f7; }
.topbar.on-dark::before { opacity: 0.4; }
@media (max-width: 1000px) { .topbar.on-dark .topnav a { color: var(--text); } }   /* the open menu stays light */

/* =====================================================================
   One cinematic dark section: the Lab gallery on black
   ===================================================================== */
.lab.dark { --bg: #000000; --card: #1d1d1f; --text: #f5f5f7; --body: #d2d2d7; --muted: #a1a1a6; --faint: #86868b; --warm: #ff9f0a; color: var(--text); }
.lab.dark .tile { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 30px 80px rgba(0, 0, 0, 0.6); }
.lab.dark .tile.active { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 0 70px rgba(255, 255, 255, 0.08), 0 30px 80px rgba(0, 0, 0, 0.6); }
.lab.dark .lab-progress { background: rgba(255, 255, 255, 0.16); }
.lab.dark .lab-progress span { background: #f5f5f7; }

/* =====================================================================
   About text that lights up word by word as you scroll
   ===================================================================== */
.about-body.words { color: var(--text); }
.about-body.words .w { color: #d2d2d7; transition: color 0.35s var(--ease); }
.about-body.words .w.on { color: var(--text); }
.about-body.words .term { text-decoration-color: rgba(29, 29, 31, 0.3); }

/* =====================================================================
   Apple-style footer
   ===================================================================== */
.footer.foot-apple { padding: 34px 0 130px; font-size: 0.75rem; line-height: 1.4; color: var(--muted); }
.foot-fine { margin: 0 0 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); color: var(--faint); }
.foot-cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.foot-col h4 { margin: 0 0 10px; font-size: 0.75rem; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.foot-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.foot-col a { color: var(--body); text-decoration: none; }
.foot-col a:hover { color: var(--text); text-decoration: underline; }
.foot-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding-top: 16px; }
.foot-langs { display: flex; gap: 8px; align-items: center; }
.foot-langs i { font-style: normal; color: var(--line); }
.foot-langs a { color: var(--body); text-decoration: none; }
.foot-langs a:hover { text-decoration: underline; }
.foot-langs [aria-current] { color: var(--text); }
@media (max-width: 700px) { .foot-cols { grid-template-columns: 1fr 1fr; row-gap: 26px; } }
@media (max-width: 1000px) { .topbar .topnav { background: #fbfbfd; -webkit-backdrop-filter: none; backdrop-filter: none; } }   /* nested glass doesn't render reliably: keep the open menu solid */

/* =====================================================================
   Dynamic Island: a black pill at the top while music plays and the player is tucked away
   ===================================================================== */
.island {
    position: fixed; z-index: 130; top: 70px; left: 50%; transform: translate(-50%, -12px) scale(0.6); opacity: 0; pointer-events: none;
    display: grid; grid-template-columns: 26px 1fr auto; align-items: center; column-gap: 10px;
    width: 156px; height: 38px; padding: 0 12px 0 6px; border-radius: 22px; overflow: hidden;
    background: #000; color: #f5f5f7; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.28);
    transition: width 0.5s cubic-bezier(0.32, 1.25, 0.5, 1), height 0.5s cubic-bezier(0.32, 1.25, 0.5, 1), border-radius 0.5s, transform 0.5s cubic-bezier(0.32, 1.25, 0.5, 1), opacity 0.3s;
}
@media (max-width: 1000px) { .island { top: 60px; } }
.island.show { opacity: 1; transform: translate(-50%, 0) scale(1); pointer-events: auto; cursor: pointer; }
.island button { border: 0; background: none; color: inherit; padding: 0; cursor: pointer; }
.isl-art { width: 26px; height: 26px; border-radius: 50%; background: #3a3a3c; transition: width 0.5s cubic-bezier(0.32, 1.25, 0.5, 1), height 0.5s, border-radius 0.5s; }
.island.playing .isl-art { animation: isl-spin 8s linear infinite; }
@keyframes isl-spin { to { rotate: 360deg; } }
.isl-info { min-width: 0; display: flex; flex-direction: column; opacity: 0; transition: opacity 0.2s; }
.isl-title { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.isl-artist { font-size: 0.72rem; color: #a1a1a6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.isl-ctrls { display: none; gap: 2px; }
.isl-ctrls button { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; transition: background 0.2s; }
.isl-ctrls button:hover { background: rgba(255, 255, 255, 0.12); }
.isl-ctrls svg { width: 18px; height: 18px; fill: #f5f5f7; }
.isl-ctrls #isl-play svg { width: 22px; height: 22px; }
.isl-wave { position: absolute; right: 14px; top: 50%; translate: 0 -50%; display: flex; gap: 2.5px; align-items: center; height: 16px; }
.isl-wave i { width: 3px; height: 16px; border-radius: 2px; background: #ff9f0a; transform: scaleY(0.25); transition: transform 0.08s linear; }
.isl-wave i:nth-child(2) { background: #ffd60a; } .isl-wave i:nth-child(3) { background: #30d158; } .isl-wave i:nth-child(4) { background: #64d2ff; }
.island.wave-css.playing .isl-wave i { animation: eq 0.9s ease-in-out infinite; }
.island.wave-css .isl-wave i:nth-child(2) { animation-delay: -0.3s; } .island.wave-css .isl-wave i:nth-child(3) { animation-delay: -0.6s; } .island.wave-css .isl-wave i:nth-child(4) { animation-delay: -0.45s; }
/* expanded */
.island.open { width: min(380px, calc(100vw - 24px)); height: 76px; border-radius: 30px; padding: 0 14px; grid-template-columns: 52px 1fr auto; column-gap: 12px; cursor: default; }
.island.open .isl-art { width: 52px; height: 52px; border-radius: 12px; animation: none; cursor: pointer; }
.island.open .isl-info { opacity: 1; transition-delay: 0.15s; }
.island.open .isl-ctrls { display: flex; }
.island.open .isl-wave { top: 14px; translate: 0; height: 10px; right: 18px; opacity: 0; }
@media (prefers-reduced-motion: reduce) { .island, .isl-art { transition: none; animation: none !important; } }

/* =====================================================================
   Spotlight search
   ===================================================================== */
.spot-btn { border: 0; background: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: rgba(29, 29, 31, 0.8); }
.spot-btn:hover { background: rgba(0, 0, 0, 0.05); color: var(--text); }
.spot-btn svg { width: 16px; height: 16px; }
.topbar.on-dark .spot-btn { color: #f5f5f7; }
@media (max-width: 1000px) { .spot-btn { margin-left: auto; } #lang-pick { margin-left: 0; } }
.spot { position: fixed; inset: 0; z-index: 700; display: flex; justify-content: center; align-items: flex-start; padding: 14vh 16px 16px; background: rgba(0, 0, 0, 0.18); opacity: 0; transition: opacity 0.2s; }
.spot[hidden] { display: none; }
.spot.in { opacity: 1; }
.spot-panel {
    width: min(640px, 100%); border-radius: 22px; overflow: hidden;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(246, 246, 248, 0.76));
    -webkit-backdrop-filter: blur(30px) saturate(190%); backdrop-filter: blur(30px) saturate(190%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 0 0.5px rgba(0, 0, 0, 0.12), 0 30px 80px rgba(0, 0, 0, 0.28);
    transform: translateY(-8px) scale(0.98); transition: transform 0.25s var(--ease);
}
.spot.in .spot-panel { transform: none; }
.spot-field { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid rgba(0, 0, 0, 0.08); }
.spot-field svg { width: 22px; height: 22px; color: var(--muted); flex: none; }
.spot-field input { flex: 1; border: 0; background: none; outline: none; font: inherit; font-size: 1.35rem; letter-spacing: -0.02em; color: var(--text); }
.spot-field input::-webkit-search-cancel-button { display: none; }
.spot-list { list-style: none; margin: 0; padding: 6px 8px; max-height: min(52vh, 460px); overflow-y: auto; }
.spot-group { padding: 10px 12px 4px; font-size: 0.72rem; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: 0.04em; }
.spot-item { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 10px; cursor: pointer; }
.spot-item.sel { background: var(--accent); color: #fff; }
.spot-item.sel small { color: rgba(255, 255, 255, 0.8); }
.spot-glyph { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 7px; background: rgba(0, 0, 0, 0.06); font-size: 0.8rem; }
.spot-item.sel .spot-glyph { background: rgba(255, 255, 255, 0.22); }
.spot-text { display: flex; flex-direction: column; min-width: 0; }
.spot-text b { font-weight: 500; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spot-text small { font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spot-empty { padding: 22px 12px; text-align: center; color: var(--muted); }
.spot-hint { margin: 0; padding: 10px 20px 12px; border-top: 1px solid rgba(0, 0, 0, 0.06); font-size: 0.72rem; color: var(--faint); }
.spot-hint kbd { font: inherit; font-size: 0.7rem; padding: 1px 6px; border-radius: 5px; background: rgba(0, 0, 0, 0.06); margin-right: 2px; }
@media (hover: none), (pointer: coarse) { .spot-hint { display: none; } .spot { padding-top: 70px; } }
.sp-flash { animation: sp-flash 1.6s var(--ease); border-radius: 16px; }
@keyframes sp-flash { 0%, 100% { box-shadow: 0 0 0 0 rgba(0, 113, 227, 0); } 25% { box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.45); } }

/* =====================================================================
   Photos-style viewer for the Lab gallery
   ===================================================================== */
#gallery .tile { cursor: zoom-in; }
.pview { position: fixed; inset: 0; z-index: 650; display: grid; place-items: center; }
.pview[hidden] { display: none; }
html.pv-open { overflow: hidden; }
.pv-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.92); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); opacity: 0; transition: opacity 0.35s var(--ease); }
.pview.in .pv-bg { opacity: 1; }
.pv-fig { position: relative; margin: 0; max-width: min(92vw, 1200px); display: flex; flex-direction: column; align-items: center; touch-action: none; transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1); }
.pv-img { max-width: 100%; max-height: 74vh; border-radius: 14px; user-select: none; -webkit-user-drag: none; transition: transform 0.35s var(--ease); cursor: zoom-in; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5); }
.pview.zoomed .pv-img { cursor: grab; }
.pv-cap { margin-top: 16px; text-align: center; color: #f5f5f7; max-width: 60ch; opacity: 0; transition: opacity 0.3s 0.15s; }
.pview.in .pv-cap { opacity: 1; }
.pv-cap h3 { margin: 0; font-size: 1.2rem; font-weight: 600; letter-spacing: -0.02em; }
.pv-cap p { margin: 6px 0 0; color: #a1a1a6; font-size: 0.92rem; }
.pv-btn {
    position: absolute; z-index: 2; border: 0; cursor: pointer; color: #f5f5f7; display: grid; place-items: center;
    background: rgba(255, 255, 255, 0.12); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2); transition: background 0.2s, opacity 0.3s; opacity: 0;
}
.pview.in .pv-btn { opacity: 1; }
.pv-btn:hover { background: rgba(255, 255, 255, 0.22); }
.pv-close { top: 18px; right: 18px; width: 40px; height: 40px; border-radius: 50%; font-size: 1rem; }
.pv-prev, .pv-next { top: 50%; translate: 0 -50%; width: 48px; height: 48px; border-radius: 50%; font-size: 1.8rem; line-height: 1; }
.pv-prev { left: 18px; } .pv-next { right: 18px; }
.pv-count { position: absolute; top: 26px; left: 50%; translate: -50% 0; color: #a1a1a6; font-size: 0.8rem; font-variant-numeric: tabular-nums; z-index: 2; }
@media (max-width: 700px) { .pv-prev, .pv-next { display: none; } }
@media (max-width: 430px) {
    .topbar { gap: 0; padding: 0 12px 0 16px; }
    .ln-title { font-size: 1rem; }
    .spot-btn, #sfx-toggle { width: 28px; }
    #lang-pick { padding: 6px 4px; }
    .topbar-cta { padding: 4px 10px 5px; font-size: 0.74rem; }
}

/* =====================================================================
   Dark mode: follows the system, or the visitor's pick in the footer / search
   ===================================================================== */
html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #000000; --card: #1c1c1e; --text: #f5f5f7; --body: #d2d2d7; --muted: #a1a1a6; --faint: #86868b;
    --line: #38383a; --link: #2997ff; --warm: #ff9f0a;
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 12px 32px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 24px 56px rgba(0, 0, 0, 0.6);
}
html[data-theme="dark"] .alt { --bg: #101011; --card: #1c1c1e; }
html[data-theme="dark"] body { background: #000; }
html[data-theme="dark"] .section, html[data-theme="dark"] .hero, html[data-theme="dark"] .contact { background: var(--bg); }

/* top bar: dark glass all the time */
html[data-theme="dark"] .topbar, html[data-theme="dark"] .topbar.scrolled {
    background: linear-gradient(180deg, rgba(44, 44, 48, 0.62), rgba(24, 24, 26, 0.5));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 0 0 0.5px rgba(255, 255, 255, 0.08), 0 6px 24px rgba(0, 0, 0, 0.4);
}
html[data-theme="dark"] .topbar::before { opacity: 0.35; }
html[data-theme="dark"] .topbar::after { background: radial-gradient(180px circle at var(--lx, 50%) var(--ly, 0%), rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 70%); }
html[data-theme="dark"] .topnav a, html[data-theme="dark"] #lang-pick, html[data-theme="dark"] #sfx-toggle, html[data-theme="dark"] .spot-btn { color: rgba(245, 245, 247, 0.86); }
html[data-theme="dark"] .topnav a:hover { color: var(--link); }
html[data-theme="dark"] .topnav a.active::after { background: #f5f5f7; }
html[data-theme="dark"] #lang-pick:hover, html[data-theme="dark"] .spot-btn:hover { background: rgba(255, 255, 255, 0.1); }
@media (max-width: 1000px) {
    html[data-theme="dark"] .topbar .topnav { background: #1c1c1e; border-bottom-color: rgba(255, 255, 255, 0.08); }
    html[data-theme="dark"] .topbar .topnav a { color: var(--text); border-bottom-color: rgba(255, 255, 255, 0.08); }
}

/* page details */
html[data-theme="dark"] .zoom { background: #2c2c2e; }
html[data-theme="dark"] .beamline::after { background: linear-gradient(to bottom, #f5f5f7 0%, #f5f5f7 calc(100% - 40px), rgba(245, 245, 247, 0.15) 100%); }
html[data-theme="dark"] .station.lit .node i { border-color: #f5f5f7; background: #f5f5f7; }
html[data-theme="dark"] .station.now.lit .node i { box-shadow: 0 0 0 6px var(--bg), 0 0 0 10px rgba(245, 245, 247, 0.14); }
html[data-theme="dark"] .vplay svg { fill: #1d1d1f; }
html[data-theme="dark"] .pub .badge.cover { color: #000; }
html[data-theme="dark"] .term { text-decoration-color: rgba(245, 245, 247, 0.45); }
html[data-theme="dark"] .term:hover, html[data-theme="dark"] .term:focus-visible { background: rgba(255, 255, 255, 0.08); }
html[data-theme="dark"] .about-body.words .w { color: #48484a; }
html[data-theme="dark"] .about-body.words .term { text-decoration-color: rgba(245, 245, 247, 0.3); }
html[data-theme="dark"] .sg-links path { stroke: #48484a; }
html[data-theme="dark"] .sg.focusing .sg-links path.on { stroke: #f5f5f7; }
html[data-theme="dark"] .sg.focusing .sg-node.on { background: #f5f5f7; color: #000; }
html[data-theme="dark"] .clip-tag { background: rgba(28, 28, 30, 0.7); color: #f5f5f7; }
html[data-theme="dark"] .footer, html[data-theme="dark"] .footer.foot-apple { background: #101011; }
html[data-theme="dark"] .island { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 8px 30px rgba(0, 0, 0, 0.5); }
html[data-theme="dark"] .media-word:hover { color: #64b5ff; }

/* music player: dark glass */
html[data-theme="dark"] .mp {
    background: linear-gradient(180deg, rgba(44, 44, 48, 0.7), rgba(28, 28, 30, 0.62));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 0 0 0.5px rgba(255, 255, 255, 0.08), 0 12px 40px rgba(0, 0, 0, 0.55);
}
html[data-theme="dark"] .mp.beat { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 0 0 0.5px rgba(255, 255, 255, 0.08), 0 10px calc(40px + var(--beat, 0) * 26px) rgba(0, 0, 0, 0.6); }
html[data-theme="dark"] .mp::before { opacity: 0.3; }
html[data-theme="dark"] .mp::after { background: radial-gradient(180px circle at var(--lx, 50%) var(--ly, 0%), rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 70%); }
html[data-theme="dark"] .mp .mp-art { background-color: #3a3a3c; }
html[data-theme="dark"] .mp-progress { background: rgba(255, 255, 255, 0.16); }
html[data-theme="dark"] .mp-fill { background: rgba(245, 245, 247, 0.85); }
html[data-theme="dark"] .mp-btn:hover, html[data-theme="dark"] .mp-queue li button:hover { background: rgba(255, 255, 255, 0.08); }
html[data-theme="dark"] .mp-queue { border-bottom-color: rgba(255, 255, 255, 0.08); }
html[data-theme="dark"] .mp-queue-head { background: rgba(28, 28, 30, 0.6); }
html[data-theme="dark"] .mp.collapsed .mp-fab { background: rgba(58, 58, 60, 0.92); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 6px 20px rgba(0, 0, 0, 0.5); }

/* search, game window */
html[data-theme="dark"] .spot { background: rgba(0, 0, 0, 0.45); }
html[data-theme="dark"] .spot-panel {
    background: linear-gradient(180deg, rgba(44, 44, 48, 0.82), rgba(28, 28, 30, 0.78));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 0 0.5px rgba(255, 255, 255, 0.1), 0 30px 80px rgba(0, 0, 0, 0.6);
}
html[data-theme="dark"] .spot-field { border-bottom-color: rgba(255, 255, 255, 0.08); }
html[data-theme="dark"] .spot-glyph, html[data-theme="dark"] .spot-hint kbd { background: rgba(255, 255, 255, 0.1); }
html[data-theme="dark"] .spot-hint { border-top-color: rgba(255, 255, 255, 0.06); }
html[data-theme="dark"] .game-box { background: #1c1c1e; }
html[data-theme="dark"] .game-close { background: rgba(255, 255, 255, 0.1); }
html[data-theme="dark"] .game-touch button { background: #2c2c2e; }
html[data-theme="dark"] .game-touch .jump { background: #f5f5f7; color: #000; }
html[data-theme="dark"] .g-name input { background: #2c2c2e; border-color: #48484a; }

/* appearance switch in the footer */
.foot-theme { display: inline-flex; gap: 2px; padding: 2px; border-radius: 980px; background: rgba(0, 0, 0, 0.05); }
.foot-theme button { border: 0; background: none; font: inherit; font-size: 0.72rem; color: var(--body); padding: 3px 10px; border-radius: 980px; cursor: pointer; }
.foot-theme button[aria-pressed="true"] { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
html[data-theme="dark"] .foot-theme { background: rgba(255, 255, 255, 0.08); }
html[data-theme="dark"] .foot-theme button[aria-pressed="true"] { background: #3a3a3c; }
.foot-right { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

/* ---------- career globe (globe.js): sits under the Career heading, turns to each stop ---------- */
.globe { width: 100%; max-width: 230px; margin: 28px auto 0; }
.globe canvas { display: block; width: 100%; aspect-ratio: 1; }
.globe-label { margin: 8px 0 0; text-align: center; font-size: 0.9rem; line-height: 1.35; color: var(--muted); min-height: 2.7em; }
.globe-label b { display: block; color: var(--text); font-weight: 600; transition: opacity 0.4s var(--ease); }
@media (min-width: 1200px) {
    .split > .sec-head .globe { max-width: 330px; margin: 40px 0 0; }
    .split > .sec-head .globe-label { text-align: left; padding-left: 4px; }
}
.globe-label .gl-dates, .globe-label .gl-talks { display: block; }
.globe-label .gl-talks { margin-top: 2px; color: var(--warm); font-size: 0.82rem; }
/* Work / Travel switch under the globe (Apple segmented control) */
.globe-mode { display: flex; width: max-content; margin: 12px auto 0; padding: 3px; border-radius: 999px; background: rgba(120, 120, 128, 0.12); }
.globe-mode button { border: 0; background: transparent; color: var(--body); font: inherit; font-size: 0.82rem; font-weight: 500; padding: 5px 16px; border-radius: 999px; cursor: pointer; transition: background 0.3s var(--ease), color 0.3s var(--ease), box-shadow 0.3s var(--ease); }
.globe-mode button[aria-pressed="true"] { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
:root[data-theme="dark"] .globe-mode button[aria-pressed="true"] { background: #3a3a3c; }
.globe.travel canvas { cursor: grab; touch-action: pan-y; }
@media (min-width: 1200px) { .split > .sec-head .globe-mode { margin-left: 0; } }
/* photo bubble on the globe (Apple Maps style) */
.globe { position: relative; }
.globe-photo {
    position: absolute; left: 0; top: 0; z-index: 2; width: 128px; aspect-ratio: 4 / 3; padding: 0; border: 3px solid var(--bg);
    border-radius: 16px; overflow: hidden; background: var(--card); cursor: zoom-in;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
    opacity: 0; scale: 0.85; pointer-events: none;
    transition: opacity 0.35s var(--ease), scale 0.45s var(--ease), transform 0.25s linear;
}
.globe-photo.show { opacity: 1; scale: 1; pointer-events: auto; }
.globe-photo img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.4s var(--ease); }
.globe-photo.loaded img { opacity: 1; }
.globe-photo:hover { scale: 1.05; }
.gp-dots { position: absolute; left: 0; right: 0; bottom: 5px; display: flex; justify-content: center; gap: 4px; }
.gp-dots i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, 0.55); box-shadow: 0 0 2px rgba(0, 0, 0, 0.4); }
.gp-dots i.on { background: #fff; }
.pview.single .pv-prev, .pview.single .pv-next { display: none; }
@media (max-width: 1199px) { .globe-photo { width: 104px; border-radius: 13px; } }
.globe.travel .globe-label .gl-talks { color: var(--muted); }
/* mini globe: docks top-right on phones while the career timeline scrolls (globe.js toggles .mini) */
.globe-ph { height: 0; }
.globe.mini {
    position: fixed; top: 62px; right: 10px; z-index: 45; width: 86px; max-width: none; margin: 0; opacity: 0.96;
    pointer-events: none; animation: globe-dock 0.45s var(--ease);
}
.globe.mini canvas {
    border-radius: 50%; background: rgba(255, 255, 255, 0.78);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.16), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
}
:root[data-theme="dark"] .globe.mini canvas { background: rgba(28, 28, 30, 0.8); box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5), 0 0 0 0.5px rgba(255, 255, 255, 0.1); }
.globe.mini .globe-mode, .globe.mini .gl-dates, .globe.mini .gl-talks, .globe.mini .globe-photo { display: none; }
.globe.mini .globe-label { position: absolute; right: 0; top: 100%; margin: 6px 0 0; min-height: 0; text-align: right; white-space: nowrap; }
.globe.mini .globe-label b {
    display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.72rem;
    background: rgba(255, 255, 255, 0.85); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}
:root[data-theme="dark"] .globe.mini .globe-label b { background: rgba(44, 44, 46, 0.85); }
@keyframes globe-dock { from { opacity: 0; transform: scale(0.7) translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .globe.mini { animation: none; } }
/* Gujarati: Indic conjuncts need normal tracking and a little more line height */
html[lang="gu"] h1, html[lang="gu"] h2, html[lang="gu"] h3, html[lang="gu"] .sec-head h2, html[lang="gu"] .contact-title { letter-spacing: 0; line-height: 1.3; }
html[lang="gu"] body { line-height: 1.7; }

/* ---------- retro corner: Bio Menace in js-dos (retro.js) ---------- */
.retro-card { margin-top: 22px; }
.retro-screen {
    width: 96px; height: 60px; flex: none; border-radius: 10px; background: #0b0b0d; display: flex; align-items: center; justify-content: center;
    box-shadow: inset 0 0 0 2px #2c2c2e, 0 4px 14px rgba(0, 0, 0, 0.18); font: 600 9.5px/1 ui-monospace, 'SF Mono', Menlo, Consolas, monospace; color: #7cfc8a;
    text-shadow: 0 0 6px rgba(124, 252, 138, 0.55); letter-spacing: 0.02em;
}
.retro-screen i { font-style: normal; animation: retro-blink 1s steps(1) infinite; }
@keyframes retro-blink { 50% { opacity: 0; } }
.retro-note { display: block; margin-top: 4px; font-size: 0.85rem; color: var(--faint); }
.retro-box { width: min(1040px, 100%); }
.retro-hint { flex: 1; font-size: 0.82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.retro-stage { position: relative; aspect-ratio: 4 / 3; max-height: calc(100vh - 160px); margin: 0 auto; background: #000; border-radius: 12px; overflow: hidden; }
.retro-dos { position: absolute; inset: 0; }
.retro-load { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; color: #7cfc8a; font: 500 0.95rem ui-monospace, 'SF Mono', Menlo, Consolas, monospace; }
.retro-credit { font-size: 0.75rem; color: var(--faint); }
.retro-credit a { color: inherit; }
@media (prefers-reduced-motion: reduce) { .retro-screen i { animation: none; } }
.retro-flash { animation: retro-flash 1.6s var(--ease) 2; }
@keyframes retro-flash { 40% { box-shadow: 0 0 0 4px rgba(124, 252, 138, 0.6); } }

/* ---------- the library card (page: /CV/library/) ---------- */
.lib-card { margin-top: 16px; }
.lib-shelf {
    width: 96px; height: 60px; flex: none; border-radius: 10px; display: flex; align-items: flex-end; justify-content: center; gap: 2px; padding: 0 8px 6px;
    background: linear-gradient(180deg, #3a2212, #2a170a); box-shadow: inset 0 -6px 0 #6e4527, 0 4px 14px rgba(0, 0, 0, 0.18);
}
.lib-shelf i { width: 9px; border-radius: 2px 2px 0 0; box-shadow: inset 0 4px 0 -2px rgba(232, 197, 107, 0.7); transition: transform 0.4s var(--ease); }
.lib-card:hover .lib-shelf i:nth-child(4) { transform: translateY(-8px); }
@media (max-width: 600px) { .retro-hint { display: none; } }

/* ion trail behind the cursor (flow.js) */
.ion-trail { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 45; }
.lab.dark.lab-light { --text: #1d1d1f; --body: #424245; --muted: #6e6e73; }
.lab.dark .lab-head h2, .lab.dark .lab-head .sec-sub { transition: color 0.45s var(--ease); }

/* publications: spotlight on highlighted papers; a small upright journal cover beside the cover-story paper */
.pub, .pub-year > span { transition: opacity 0.6s var(--ease); }
.pubs.focus .pub:not(.lit) { opacity: 0.32; }
.pubs.focus .pub-year:not(:has(.star.lit)) > span { opacity: 0.32; }
.pub.star { position: relative; isolation: isolate; }
.pub.star::before { content: ''; position: absolute; inset: -14px -18px; z-index: -1; border-radius: 18px; background: var(--card); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.07); opacity: 0; transform: scale(0.97); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.pub.star.lit::before { opacity: 1; transform: none; }
html[data-theme="dark"] .pub.star::before { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08); }
.pub.has-cover { padding-left: 74px; min-height: 84px; }
.pub-cover { position: absolute; left: 0; top: 3px; width: 56px; border-radius: 3px; overflow: hidden;
    box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.14);
    opacity: 0; transform: translateY(6px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease), box-shadow 0.3s var(--ease); }
.pub-cover img { display: block; width: 100%; height: auto; }
.pub.has-cover.seen .pub-cover { opacity: 1; transform: none; }
.pub-cover:hover { transform: scale(1.05); box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.12), 0 10px 24px rgba(0, 0, 0, 0.2); }
/* award badge: quiet grey outline pill with a laurel, no colour */
.pub .badge.award { display: inline-flex; align-items: center; gap: 5px; background: transparent; color: var(--muted); border: 1px solid var(--line); padding: 1px 9px 1px 7px; text-decoration: none; transition: color 0.3s var(--ease), border-color 0.3s var(--ease); }
.pub .badge.award:hover { color: var(--text); border-color: var(--faint); }
.pub .badge.award .laurel { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 760px) { .pub.has-cover { padding-left: 62px; } .pub-cover { width: 46px; } }
@media (prefers-reduced-motion: reduce) { .pub-cover { transition: none; opacity: 1; transform: none; } }

/* all publications: a quiet disclosure under the selected list */
.pub-more { margin-top: 26px; }
.pub-more summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; color: var(--link); font-size: 0.95rem; font-weight: 500; }
.pub-more summary::-webkit-details-marker { display: none; }
.pub-more summary svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.4s var(--ease); }
.pub-more[open] summary svg { transform: rotate(180deg); }
.pub-more .pm-close, .pub-more[open] .pm-open { display: none; }
.pub-more[open] .pm-close { display: inline; }
.pub-more summary:hover { text-decoration: underline; }
.pm-list { list-style: none; margin: 18px 0 0; padding: 0; border-bottom: 1px solid var(--line); }
.pm-list li { display: grid; grid-template-columns: 72px 1fr; column-gap: 16px; padding: 8px 0; }
.pm-list li.pm-new { border-top: 1px solid var(--line); padding-top: 16px; }
.pm-list li:last-child { padding-bottom: 16px; }
.pm-y { color: var(--faint); font-size: 0.85rem; font-weight: 600; padding-top: 2px; }
@media (max-width: 760px) { .pm-y:empty { display: none; } }
.pm-t { display: block; color: var(--text); font-size: 0.95rem; line-height: 1.35; text-decoration: none; }
a.pm-t:hover { color: var(--link); }
.pm-m { display: block; margin-top: 2px; font-size: 0.8rem; color: var(--muted); }
.pm-m a { color: var(--link); text-decoration: none; overflow-wrap: anywhere; }
.pm-m a:hover { text-decoration: underline; }
.pub-more[open] .pm-list { animation: pm-in 0.5s var(--ease); }
@keyframes pm-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (max-width: 760px) { .pm-list li { grid-template-columns: 1fr; } .pm-y { padding: 0 0 2px; } }
@media (prefers-reduced-motion: reduce) { .pub-more[open] .pm-list { animation: none; } }

/* wide research card (animated simulation): picture left, text right, full row */
.projects > .project.wide { grid-column: 1 / -1; }
.project.wide .zoom { aspect-ratio: 1254 / 574; background: #fff; padding: 10px 14px; box-sizing: content-box; }
.project.wide .zoom img { object-fit: contain; }
@media (min-width: 1000px) {
    .project.wide { display: grid; grid-template-columns: 2.1fr 1fr; align-items: center; }
    .projects > .project.wide .zoom { aspect-ratio: 1254 / 574; }
}
html[data-theme="dark"] .project.wide .zoom img { filter: brightness(0.92); }

/* "Outreach ›" link with a small menu (AEgIS digital twin + gravity game) */
.ln-menu { position: relative; display: inline-block; }
.ln-menu-btn::after { transition: transform 0.3s var(--ease); }
.ln-menu.open .ln-menu-btn::after { transform: rotate(90deg); }
.ln-pop { position: absolute; left: 50%; top: calc(100% + 10px); z-index: 30; min-width: 220px; padding: 6px; display: flex; flex-direction: column; text-align: left;
    background: rgba(255, 255, 255, 0.86); backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6);
    border-radius: 14px; box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.12), 0 12px 36px rgba(0, 0, 0, 0.16);
    display: none; transform: translate(-50%, 0); transform-origin: 50% 0; }                /* closed = no box at all, so it can't widen the page on phones */
.ln-menu.open .ln-pop { display: flex; animation: ln-pop-in 0.25s var(--ease); }
@keyframes ln-pop-in { from { opacity: 0; transform: translate(-50%, -4px) scale(0.97); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
.ln-pop a { display: flex; justify-content: space-between; gap: 18px; padding: 9px 12px; border-radius: 9px; color: var(--text); text-decoration: none; font-size: 0.98rem; white-space: nowrap; }
.ln-pop a i { font-style: normal; color: var(--faint); }
.ln-pop a:hover, .ln-pop a:focus-visible { background: var(--accent); color: #fff; outline: none; }
.ln-pop a:hover i, .ln-pop a:focus-visible i { color: #fff; }
html[data-theme="dark"] .ln-pop { background: rgba(44, 44, 46, 0.88); box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.12), 0 12px 36px rgba(0, 0, 0, 0.5); }

/* In the news: three latest stories under Publications, full list on /CV/news/ */
.news-strip { padding: 0 0 120px; }
.news-top { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 44px; border-top: 1px solid var(--line); margin-bottom: 22px; }
.news-top h2 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -0.03em; font-weight: 700; }
.news-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.news-item { display: flex; flex-direction: column; gap: 6px; padding: 20px 22px 22px; border-radius: 18px; background: var(--card); text-decoration: none; color: var(--text);
    transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease); }
.news-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover, 0 14px 40px rgba(0, 0, 0, 0.1)); }
.news-item .ni-meta { font-size: 0.8rem; color: var(--muted); }
.news-item .ni-meta b { color: var(--text); font-weight: 600; }
.news-item .ni-title { font-size: 1.05rem; font-weight: 600; line-height: 1.32; letter-spacing: -0.012em; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.news-item:hover .ni-title { color: var(--link); }
@media (max-width: 900px) { .news-row { grid-template-columns: 1fr; gap: 10px; } .news-item { padding: 16px 18px; } }

/* play button on research clips: only shown when the phone will not autoplay (Low Power Mode) or for reduced motion */
.clip-play {
    position: absolute; right: 14px; bottom: 14px; z-index: 2; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
    display: grid; place-items: center; color: #1d1d1f; cursor: pointer;
    background: rgba(255, 255, 255, 0.8); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14); transition: transform 0.3s var(--ease);
}
.clip-play[hidden] { display: none; }
.clip-play svg { width: 20px; height: 20px; }
.clip-play:active { transform: scale(0.92); }
html[data-theme="dark"] .clip-play { background: rgba(28, 28, 30, 0.72); color: #f5f5f7; }

/* ---------- phone tidy-up (with mobile.js); desktop unchanged ---------- */
.cta-ic { display: none; }

@media (max-width: 600px) {
    /* top bar: name + menu on the left, one round mail button on the right; tools live in the menu */
    .topbar-cta { width: 40px; height: 40px; min-height: 0; padding: 0; border-radius: 50%; display: grid; place-items: center; }
    .topbar-cta .cta-t { display: none; }
    .topbar-cta .cta-ic { display: block; width: 20px; height: 20px; }
    .ln-tools { display: flex; align-items: center; gap: 10px; padding: 14px 0 2px; }
    .ln-tools > * { margin: 0 !important; }
    .ln-tools .spot-btn, .ln-tools #sfx-toggle { width: 40px; height: 40px; background: rgba(127, 127, 127, 0.14); }
    .ln-tools .spot-btn svg { width: 18px; height: 18px; }
    .ln-tools #lang-pick { height: 40px; padding: 0 14px; border-radius: 980px; background: rgba(127, 127, 127, 0.14); }

    /* career: one key line per role; "More" opens the rest (the globe does not dock on phones: globe.js) */
    .station .extra1 { display: none; }
    .station.open .extra1 { display: list-item; }

    /* music button: smaller, and slides out of the way while you scroll */
    .mp.collapsed { width: 44px; height: 44px; }
    .mp.collapsed .mp-fab { width: 44px; height: 44px; }
    .mp.collapsed.mp-away { transform: translateY(calc(100% + 24px)); opacity: 0; }
    .mp.collapsed { transition: transform 0.45s var(--ease), opacity 0.35s var(--ease), box-shadow 0.5s var(--ease); }

    /* publications: five newest + starred; the rest open with "All publications" */
    #publications:not(.all) .pub-x { display: none; }

    /* research clips: a slower, softer crossfade from photo to simulation */
    .project .zoom .clip { transition: opacity 0.9s var(--ease); }

    /* skills: tap a group to open it; the connection graph is too small to read on a phone */
    .sg { display: none; }
    .rack { gap: 10px; }
    .module { padding: 0; }
    .module .label { padding: 18px 20px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
    .module .label::after { content: ''; margin-left: auto; width: 8px; height: 8px; border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted); transform: rotate(45deg) translateY(-2px); transition: transform 0.35s var(--ease); }
    .module.open .label::after { transform: rotate(-135deg) translateY(-2px); }
    .module .items { display: none; margin: 0; padding: 0 20px 20px; }
    .module.open .items { display: flex; }
}

/* "Share CV" (phones with a share sheet): looks like the other hero links */
.share-cv { border: 0; background: none; padding: 0; font-family: inherit; line-height: inherit; cursor: pointer; }


/* ---------- typography pass: balanced headings, no lone last words, kerning, aligned numbers ---------- */
h1, h2, h3, h4 { text-wrap: balance; font-kerning: normal; }
p, li, dd, figcaption, blockquote { text-wrap: pretty; hanging-punctuation: first; }
body { text-rendering: optimizeLegibility; font-feature-settings: "kern" 1; }
table, time, .num, [data-num] { font-variant-numeric: tabular-nums; }

/* ---------- depth (depth.js): hero layers, photos sliding in their frames, tilting cards, background light ---------- */
/* 1. hero: a soft far glow behind the magnetic bottle */
.hero-glow { position: absolute; inset: -20% -10% auto; height: 120%; pointer-events: none; z-index: 0; will-change: transform;
    background: radial-gradient(42% 38% at 50% 42%, rgba(0, 113, 227, 0.07), transparent 70%),
                radial-gradient(30% 26% at 72% 30%, rgba(191, 72, 0, 0.05), transparent 70%); }
html[data-theme="dark"] .hero-glow { background: radial-gradient(42% 38% at 50% 42%, rgba(41, 151, 255, 0.12), transparent 70%),
                radial-gradient(30% 26% at 72% 30%, rgba(255, 159, 10, 0.07), transparent 70%); }
.depth #field, .depth .hero-name, .depth .hero-pitch, .depth .hero-ctas { will-change: transform; }
/* 3. research photos: a little larger than the frame, sliding inside it */
.depth-full .project:not(.wide) .zoom > img, .depth-full .project:not(.wide) .zoom > video, .depth-full .project:not(.wide) .zoom .clip {
    transform: translate3d(0, var(--py, 0px), 0) scale(1.12); transition: transform 0.9s var(--ease); }
.depth-full .project:not(.wide):hover .zoom > img, .depth-full .project:not(.wide):hover .zoom > video, .depth-full .project:not(.wide):hover .zoom .clip {
    transform: translate3d(0, var(--py, 0px), 0) scale(1.16); }
/* 4. tilting research cards with a soft light reflection that follows the cursor */
.depth-full .project.tilting { transition: transform 0.18s ease-out, box-shadow 0.7s var(--ease); box-shadow: var(--shadow-hover); }
.depth-full .project::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 3; opacity: 0;
    background: radial-gradient(420px circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, 0.22), transparent 60%);
    transition: opacity 0.5s var(--ease); mix-blend-mode: soft-light; }
.depth-full .project.tilting::after { opacity: 1; }
/* 7. background light in each section, moving slower than the content (behind it, above the section colour) */
.depth-full .section:not(.contact) { position: relative; isolation: isolate; }
.depth-full .section:not(.contact)::before { content: ''; position: absolute; inset: -12% 0; z-index: -1; pointer-events: none;
    transform: translate3d(0, var(--bgy, 0px), 0); will-change: transform;
    background: radial-gradient(34% 30% at 12% 30%, rgba(0, 113, 227, 0.045), transparent 70%),
                radial-gradient(28% 26% at 88% 70%, rgba(191, 72, 0, 0.035), transparent 70%); }
.depth-full .section:not(.contact):nth-of-type(even)::before {
    background: radial-gradient(30% 28% at 85% 25%, rgba(0, 113, 227, 0.045), transparent 70%),
                radial-gradient(32% 28% at 15% 78%, rgba(88, 86, 214, 0.035), transparent 70%); }
html[data-theme="dark"].depth-full .section:not(.contact)::before {
    background: radial-gradient(34% 30% at 12% 30%, rgba(41, 151, 255, 0.08), transparent 70%),
                radial-gradient(28% 26% at 88% 70%, rgba(255, 159, 10, 0.05), transparent 70%); }
