/* Jeff Tseng portfolio. Theme from the Aligned NVS design system (aligned-sv-nvs-site/design/design-system):
   one centered column, serif display, Noto Sans text, teal brand fill, light and dark themes as peers. */
:root {
  --page:#ffffff; --surface:#f6f8fa; --surface-strong:#eef3f7; --mist:#eef4f8; --line:#d9dee4;
  --ink:#172026; --ink-muted:#5c6670; --deep:#1b3a4b; --on-deep:#eef4f8; --teal:#38b2ac;
  --link:#0f766e; --link-hover:#115e59; --button:#1b3a4b; --on-button:#ffffff; --button-hover:#25506a;
  --focus:#0f766e; --misaligned:#b45309;
  --shadow-figure:0 1px 2px rgba(23,32,38,0.08);
  --font-serif:Georgia,"Times New Roman",serif;
  --font-sans:"Noto Sans",system-ui,-apple-system,"Segoe UI",sans-serif;
  --content-width:960px; --text-width:760px;
  --nav-h:52px; --ease:cubic-bezier(0.28,0.11,0.32,1); --ease-out:cubic-bezier(0.16,1,0.3,1);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --page:#11191f; --surface:#182229; --surface-strong:#1f2c35; --mist:#15232d; --line:#2c3a44;
  --ink:#e8eef2; --ink-muted:#9aa7b1; --deep:#0b1a22; --on-deep:#e8eef2;
  --link:#4fd1c5; --link-hover:#81e6d9; --button:#38b2ac; --on-button:#0b1a22; --button-hover:#4fd1c5;
  --focus:#81e6d9; --misaligned:#f6ad55; --shadow-figure:0 1px 2px rgba(0,0,0,0.4); color-scheme:dark; } }
:root[data-theme="dark"] {
  --page:#11191f; --surface:#182229; --surface-strong:#1f2c35; --mist:#15232d; --line:#2c3a44;
  --ink:#e8eef2; --ink-muted:#9aa7b1; --deep:#0b1a22; --on-deep:#e8eef2;
  --link:#4fd1c5; --link-hover:#81e6d9; --button:#38b2ac; --on-button:#0b1a22; --button-hover:#4fd1c5;
  --focus:#81e6d9; --misaligned:#f6ad55; --shadow-figure:0 1px 2px rgba(0,0,0,0.4); color-scheme:dark; }

* { box-sizing:border-box; }
html { scroll-padding-top:var(--nav-h); }
body { margin:0; background:var(--page); color:var(--ink); font-family:var(--font-sans); font-size:17px; line-height:27px; -webkit-font-smoothing:antialiased; }
a { color:var(--link); text-decoration:none; }
a:hover { color:var(--link-hover); text-decoration:underline; }
:focus-visible { outline:2px solid var(--focus); outline-offset:2px; }
img { max-width:100%; }
.nowrap { white-space:nowrap; }

.localnav-inner, .hero-inner, .section > .inner, .footer {
  padding-left:max(16px, env(safe-area-inset-left, 0px)); padding-right:max(16px, env(safe-area-inset-right, 0px));
}

/* Local nav: translucent bar that firms up once the hero scrolls away */
.localnav { position:sticky; top:0; z-index:10; height:var(--nav-h); background:color-mix(in srgb, var(--page) 72%, transparent); -webkit-backdrop-filter:saturate(180%) blur(20px); backdrop-filter:saturate(180%) blur(20px); border-bottom:1px solid transparent; transition:border-color .4s var(--ease), background-color .4s var(--ease); }
.localnav.stuck { border-bottom-color:var(--line); background:color-mix(in srgb, var(--page) 84%, transparent); }
.localnav-inner { max-width:calc(var(--content-width) + 32px); height:100%; margin:0 auto; display:flex; align-items:center; gap:24px; }
.localnav-title { flex:none; font-family:var(--font-serif); font-size:19px; color:var(--ink); margin-right:auto; }
.localnav-title:hover { color:var(--ink); text-decoration:none; }
.localnav ul { flex:none; display:flex; gap:20px; margin:0; padding:0; list-style:none; white-space:nowrap; }
.localnav ul a { font-size:13px; line-height:18px; color:var(--ink-muted); transition:color .3s var(--ease); }
.localnav ul a:hover, .localnav ul a[aria-current="true"] { color:var(--ink); text-decoration:none; }
.localnav-cta { flex:none; margin:3px 0 0 -8px; font-size:13px; line-height:18px; font-weight:500; padding:4px 12px; border-radius:999px; background:var(--button); color:var(--on-button) !important; text-decoration:none !important; transition:background-color .3s var(--ease), transform .2s var(--ease), opacity .3s var(--ease); }
.localnav-cta:hover { background:var(--button-hover); }
.localnav.theme-open .localnav-cta { opacity:0; pointer-events:none; }
/* Theme switch: a single icon for the current mode (light, auto, dark) that expands into a slider.
   The position comes from data-theme on <html>, which the inline script in <head> sets before first paint. */
.theme-slot { position:relative; flex:none; width:32px; height:32px; margin:3px 0 0 -12px; }
.theme-switch { --i:1; position:absolute; top:0; right:0; z-index:1; width:32px; height:32px; border:1px solid transparent; border-radius:999px; overflow:hidden; background:transparent; transition:width .4s var(--ease-out), background-color .3s var(--ease), border-color .3s var(--ease); }
:root[data-theme="light"] .theme-switch { --i:0; }
:root[data-theme="dark"] .theme-switch { --i:2; }
.theme-track { position:absolute; top:0; left:0; display:flex; transform:translateX(calc(var(--i) * -30px)); transition:transform .4s var(--ease-out); }
.theme-thumb { position:absolute; top:2px; left:2px; width:26px; height:26px; border-radius:999px; background:var(--page); box-shadow:0 1px 3px rgba(0,0,0,0.12), 0 0 0 1px var(--line); opacity:0; transform:translateX(calc(var(--i) * 30px)); transition:transform .4s var(--ease-out), opacity .3s var(--ease); }
.theme-switch button { position:relative; display:flex; align-items:center; justify-content:center; width:30px; height:30px; padding:0; border:0; border-radius:999px; background:none; color:var(--ink-muted); cursor:pointer; transition:color .3s var(--ease); }
.theme-switch button[aria-checked="true"], .theme-switch.open button:hover { color:var(--ink); }
.theme-switch button:focus-visible { outline-offset:-2px; }
.theme-switch svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.theme-switch .i-phone { display:none; }
@media (hover:none) and (pointer:coarse) { .theme-switch .i-phone { display:block; } .theme-switch .i-monitor { display:none; } }
.theme-switch.open { width:92px; background:var(--surface-strong); border-color:var(--line); }
.theme-switch.open .theme-track { transform:none; }
.theme-switch.open .theme-thumb { opacity:1; }
/* Sections menu: when the links do not fit beside the title (script.js measures this and sets .collapsed),
   they fold into a three-line button that drops them down as a list under the nav. */
.menu-toggle { display:none; position:relative; flex:none; width:32px; height:32px; margin:3px 0 0 -12px; padding:0; border:0; border-radius:999px; background:none; color:var(--ink-muted); cursor:pointer; transition:color .3s var(--ease); }
.menu-toggle:hover, .menu-open .menu-toggle { color:var(--ink); }
.menu-toggle span { position:absolute; left:8px; width:16px; height:1.8px; border-radius:1px; background:currentColor; transition:transform .35s var(--ease-out), opacity .2s var(--ease); }
.menu-toggle span:nth-child(1) { top:10px; }
.menu-toggle span:nth-child(2) { top:15px; }
.menu-toggle span:nth-child(3) { top:20px; }
.menu-open .menu-toggle span:nth-child(1) { transform:translateY(5px) rotate(45deg); }
.menu-open .menu-toggle span:nth-child(2) { opacity:0; }
.menu-open .menu-toggle span:nth-child(3) { transform:translateY(-5px) rotate(-45deg); }
.localnav.collapsed .menu-toggle { display:block; }
.localnav.collapsed ul { position:absolute; top:100%; left:0; right:0; flex-direction:column; gap:0; padding:4px max(16px, calc((100% - var(--content-width)) / 2), env(safe-area-inset-left, 0px)) 12px; background:var(--page); border-bottom:1px solid var(--line); box-shadow:0 12px 24px -16px rgba(0,0,0,0.25); visibility:hidden; opacity:0; transform:translateY(-8px); transition:opacity .3s var(--ease), transform .4s var(--ease-out), visibility 0s linear .4s; }
.localnav.collapsed.menu-open ul { visibility:visible; opacity:1; transform:none; transition:opacity .3s var(--ease), transform .4s var(--ease-out), visibility 0s; }
.localnav.collapsed li + li { border-top:1px solid var(--line); }
.localnav.collapsed ul a { display:block; padding:12px 0; font-size:15px; line-height:20px; }
/* Without JavaScript the links simply hide on phones. */
@media (max-width:640px) { html:not(.js) .localnav ul { display:none; } }

/* Hero */
.hero { position:relative; padding-block:clamp(64px, 12svh, 120px) clamp(48px, 9svh, 88px); text-align:center; overflow:hidden;
  background:radial-gradient(70% 55% at 50% 0%, color-mix(in srgb, var(--teal) 16%, transparent), transparent 70%), var(--page); }
.hero-inner { max-width:calc(var(--content-width) + 32px); margin:0 auto; }
.hero h1 { font-family:var(--font-serif); font-size:clamp(38px, 6.2vw, 72px); line-height:1.06; font-weight:400; letter-spacing:-0.02em; margin:0 0 32px; text-wrap:balance; }
.venue { font-size:14px; line-height:21px; letter-spacing:0.08em; text-transform:uppercase; font-weight:600; color:var(--link); margin:0 0 20px; }
.authors, .affils { display:flex; flex-wrap:wrap; justify-content:center; column-gap:18px; margin:0; }
.authors { font-size:19px; line-height:30px; }
.authors span, .affils span { white-space:nowrap; }
.authors sup, .affils sup { font-size:11px; color:var(--ink-muted); margin-left:1px; }
.affils sup { margin:0 2px 0 0; }
.affils { font-size:15px; line-height:22px; color:var(--ink-muted); margin-top:10px; }
.buttons { display:flex; flex-wrap:wrap; justify-content:center; gap:10px; margin:36px 0 0; padding:0; list-style:none; }
.btn { display:inline-flex; align-items:center; gap:6px; padding:11px 22px 11px 18px; border-radius:999px; background:var(--button); color:var(--on-button) !important; font-size:16px; line-height:20px; font-weight:500; text-decoration:none !important; transition:background-color .3s var(--ease), transform .2s var(--ease); }
.btn:hover { background:var(--button-hover); }
.btn:active, .localnav-cta:active { transform:scale(0.96); }
.btn svg { width:18px; height:18px; flex:none; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.btn[aria-disabled="true"] { opacity:0.5; cursor:default; }
.btn[aria-disabled="true"]:hover { background:var(--button); }
.btn[aria-disabled="true"]:active { transform:none; }
@media (max-width:640px) { .hero { padding-top:48px; } .authors { font-size:17px; line-height:27px; } }

/* Intro: staggered fade-up with a light blur on load */
.js .intro { opacity:0; transform:translateY(28px); filter:blur(8px); animation:intro 1.2s var(--ease-out) forwards; animation-delay:calc(var(--d, 0) * 110ms + 150ms); }
@keyframes intro { to { opacity:1; transform:none; filter:none; } }

/* Compare slider (the signature interaction) */
.compare { position:relative; overflow:hidden; border-radius:8px; box-shadow:var(--shadow-figure); user-select:none; touch-action:pan-y; background:var(--surface); }
.compare img { display:block; width:100%; height:auto; pointer-events:none; }
.compare .after { position:absolute; inset:0; clip-path:inset(0 0 0 50%); }
.compare .after img { width:100%; height:100%; object-fit:cover; }
.compare .bar { position:absolute; top:0; bottom:0; left:50%; width:2px; margin-left:-1px; background:var(--teal); pointer-events:none; }
.compare .knob { position:absolute; top:50%; left:50%; width:32px; height:32px; margin:-16px 0 0 -16px; border-radius:999px; background:var(--teal); box-shadow:0 0 0 2px var(--page), 0 4px 14px rgba(0,0,0,0.25); }
.compare .knob::before, .compare .knob::after { content:""; position:absolute; top:11px; border:5px solid transparent; }
.compare .knob::before { left:3px; border-right-color:var(--deep); }
.compare .knob::after { right:3px; border-left-color:var(--deep); }
.compare input { position:absolute; inset:0; width:100%; height:100%; margin:0; opacity:0; cursor:ew-resize; }
.compare input:focus-visible ~ .bar .knob { outline:2px solid var(--focus); outline-offset:2px; }

/* Sections */
.section.tint { background:var(--mist); }
.section > .inner { max-width:calc(var(--content-width) + 32px); margin:0 auto; }
.section h2 { font-family:var(--font-serif); font-size:clamp(30px, min(4.8vw, 6.4svh), 56px); line-height:1.1; font-weight:400; letter-spacing:-0.015em; text-align:center; margin:0 0 clamp(16px, 4.4svh, 40px); }

/* Reveal on scroll */
.js .reveal, .js .reveal-group > * { opacity:0; transform:translateY(24px); transition:opacity .8s var(--ease-out), transform .9s var(--ease-out); transition-delay:calc(min(var(--i, 0), 5) * 70ms); }
.js .reveal.in, .js .reveal-group.in > * { opacity:1; transform:none; }

/* Table */
.table-wrap { overflow-x:auto; border:1px solid var(--line); border-radius:16px; background:var(--surface); }
table { width:100%; border-collapse:collapse; font-size:15px; line-height:22px; font-variant-numeric:tabular-nums; }
th { background:var(--surface-strong); font-size:13px; line-height:18px; font-weight:600; letter-spacing:0.04em; text-transform:uppercase; text-align:right; padding:clamp(6px, 1.3svh, 12px) 10px; border-bottom:1px solid var(--line); white-space:nowrap; }
td { padding:clamp(4px, 1svh, 9px) 10px; text-align:right; border-bottom:1px solid var(--line); white-space:nowrap; }
th:first-child, td:first-child { text-align:left; padding-left:16px; }
th:last-child, td:last-child { padding-right:16px; }
tbody tr:last-child td { border-bottom:0; }
tbody tr:not(.group) { transition:background-color .25s var(--ease); }
tbody tr:not(.group):hover { background:var(--surface-strong); }
tr.ours td:first-child::before { content:""; display:inline-block; width:8px; height:8px; border-radius:999px; background:var(--teal); margin-right:8px; vertical-align:1px; }

.footer { background:var(--deep); color:var(--on-deep); padding-block:40px; text-align:center; font-size:14px; line-height:21px; }
.footer a { color:var(--on-deep); text-decoration:underline; }

/* Portfolio layout. Sections pad on space-12-ish steps; the About page fills the screen like the paper's TL;DR. */
.section > .inner { padding-block:clamp(56px, 10svh, 112px); }
.hero h1 .alt { color:var(--ink-muted); font-size:0.5em; letter-spacing:0; white-space:nowrap; }
.lede { max-width:var(--text-width); margin:0 auto; font-size:19px; line-height:30px; text-wrap:pretty; }
.affils a { color:var(--link); }
.sub { max-width:var(--text-width); margin:clamp(24px, 5svh, 48px) auto 8px; font-size:13px; line-height:18px; font-weight:600; letter-spacing:0.08em; text-transform:uppercase; color:var(--link); }
.section h2 + .sub { margin-top:0; }
.sub { max-width:none; }

/* Publications: the newest paper is featured with its compare slider; the rest are a ruled list */
.pub-venue { margin:0 0 6px; font-size:13px; line-height:18px; font-weight:600; letter-spacing:0.08em; text-transform:uppercase; color:var(--link); }
.pub-title { margin:0 0 8px; font-family:var(--font-serif); font-size:22px; line-height:1.3; font-weight:400; letter-spacing:-0.005em; text-wrap:balance; }
.pub-authors { margin:0; font-size:15px; line-height:23px; color:var(--ink-muted); }
.pub-authors b { color:var(--ink); font-weight:600; }
.pub-blurb { margin:12px 0 0; font-size:16px; line-height:26px; }
.pub-links { display:flex; flex-wrap:wrap; gap:8px; margin:14px 0 0; padding:0; list-style:none; }
.pill { display:inline-block; padding:5px 14px; border-radius:999px; border:1px solid var(--line); background:var(--surface); color:var(--ink) !important; font-size:14px; line-height:20px; font-weight:500; text-decoration:none !important; transition:background-color .3s var(--ease), transform .2s var(--ease); }
.pill:hover { background:var(--surface-strong); }
.pill:active { transform:scale(0.96); }

.featured { display:grid; grid-template-columns:minmax(0, 5fr) minmax(0, 6fr); gap:clamp(20px, 4vw, 48px); align-items:center; padding:clamp(16px, 3vw, 28px); margin:0 0 clamp(24px, 5svh, 48px); border:1px solid var(--line); border-radius:12px; background:var(--surface); }
.featured .pub-title { font-size:clamp(22px, 2.6vw, 28px); }
.chips { display:flex; justify-content:space-between; margin-top:10px; }
.chip { font-size:13px; line-height:18px; font-weight:600; letter-spacing:0.04em; text-transform:uppercase; padding:3px 8px; border-radius:4px; background:var(--surface-strong); border:1px solid var(--line); }
.chip.conv { color:var(--misaligned); }
.chip.ours { color:var(--link); }
.chip.ours::before { content:""; display:inline-block; width:8px; height:8px; border-radius:999px; background:var(--teal); margin-right:6px; vertical-align:1px; }

.pubs { margin:0; padding:0; list-style:none; }
.pubs > li { padding:clamp(18px, 3svh, 28px) 0; border-top:1px solid var(--line); }
.pubs > li:last-child { border-bottom:1px solid var(--line); }

/* Experience timeline: rows fade up with the reveal group */
.timeline { margin:0; padding:0; list-style:none; }
.timeline > li { display:grid; grid-template-columns:96px minmax(0,1fr); gap:20px; padding:clamp(16px, 2.6svh, 24px) 0; border-top:1px solid var(--line); }
.timeline > li:last-child { border-bottom:1px solid var(--line); }
.timeline .when { font-size:14px; line-height:28px; font-weight:600; color:var(--link); font-variant-numeric:tabular-nums; }
.timeline .role { margin:0; font-family:var(--font-serif); font-size:21px; line-height:28px; }
.timeline .where { margin:2px 0 8px; font-size:14px; line-height:21px; color:var(--ink-muted); }
.timeline ul { margin:0; padding-left:18px; font-size:16px; line-height:25px; }
.timeline ul li + li { margin-top:4px; }
.timeline ul b { font-weight:600; }
.timeline ul li::marker { color:var(--teal); }


/* Tech tags */
.tags { display:flex; flex-wrap:wrap; gap:6px; margin:12px 0 0; padding:0; list-style:none; }
.tags li { font-size:12px; line-height:16px; font-weight:600; letter-spacing:0.04em; text-transform:uppercase; padding:3px 8px; border-radius:4px; background:var(--surface-strong); border:1px solid var(--line); color:var(--ink-muted); }

/* Featured work grid: a cover slab in the deck's deep color; .has-img covers put a paper figure under a scrim */
.work-grid { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:16px; margin:0; padding:0; list-style:none; }
.work-card { display:flex; flex-direction:column; border:1px solid var(--line); border-radius:12px; background:var(--surface); overflow:hidden; transition:background-color .3s var(--ease); }
.work-card:hover { background:var(--surface-strong); }
.cover { position:relative; display:flex; flex-direction:column; justify-content:flex-end; gap:4px; aspect-ratio:16 / 8; padding:16px 18px; background:radial-gradient(90% 120% at 100% 0%, color-mix(in srgb, var(--teal) 38%, transparent), transparent 60%), var(--deep); color:var(--on-deep); }
.cover::before { content:""; position:absolute; top:16px; left:18px; width:10px; height:10px; border-radius:999px; background:var(--teal); }
.cover.has-img { background:var(--deep); }
.cover.has-img > img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.cover.has-img::after { content:""; position:absolute; inset:0; background:linear-gradient(to top, color-mix(in srgb, var(--deep) 88%, transparent) 0%, color-mix(in srgb, var(--deep) 35%, transparent) 55%, transparent 80%); }
.cover.has-img::before { z-index:1; }
.cover.has-img > span { position:relative; z-index:1; }
.cover-venue { font-size:12px; line-height:16px; font-weight:600; letter-spacing:0.08em; text-transform:uppercase; opacity:0.85; }
.cover-word { font-family:var(--font-serif); font-size:26px; line-height:1.15; }
.work-body { display:flex; flex-direction:column; flex:1; padding:18px; }
.work-body .pub-title { font-size:19px; }
.work-body .pub-links { margin-top:auto; padding-top:14px; }

/* About */
.about { display:grid; grid-template-columns:minmax(0, 7fr) minmax(0, 5fr); gap:clamp(24px, 5vw, 56px); max-width:var(--content-width); margin:0 auto; }
.about .prose { margin:0; }
.about .prose p { margin:0 0 16px; }
.facts { margin:0; }
.facts > div + div { margin-top:20px; }
.facts dt { font-size:13px; line-height:18px; font-weight:600; letter-spacing:0.08em; text-transform:uppercase; color:var(--link); }
.facts dd { margin:0; }
.facts dd .tags { margin-top:8px; }
.facts dd p { margin:8px 0 0; font-size:15px; line-height:23px; color:var(--ink-muted); }
.facts dd p b { color:var(--ink); font-weight:600; }

/* Contact */
.contact { text-align:center; }
.contact h2 { margin-bottom:16px; }
.contact-mail { margin:20px 0 0; font-family:var(--font-serif); font-size:clamp(24px, 3.4vw, 34px); line-height:1.2; overflow-wrap:anywhere; }
.contact .buttons { margin-top:24px; }
.contact .caption { margin-top:16px; }

@media (max-width:860px) { .work-grid { grid-template-columns:minmax(0,1fr); } .cover { aspect-ratio:auto; min-height:120px; } .cover.has-img { aspect-ratio:16 / 8; } .about { grid-template-columns:minmax(0,1fr); } }
@media (max-width:720px) {
  .featured { grid-template-columns:minmax(0,1fr); }
  .timeline > li { grid-template-columns:minmax(0,1fr); gap:2px; }
  .lede { font-size:17px; line-height:27px; }
}

/* Reduced motion: nothing moves or fades; everything is shown in place */
@media (prefers-reduced-motion: reduce) {
  .js .intro, .js .reveal, .js .reveal-group > * { opacity:1; transform:none; filter:none; animation:none; transition:none; }
  .theme-switch, .theme-track, .theme-thumb, .menu-toggle span, .localnav.collapsed ul { transition:none; }
}
