/* ==========================================================================
   Anant Joglekar — Portfolio V2
   Design tokens live on :root. Theme switches by toggling [data-theme] on
   <html>; every colour below reads from a variable, so nothing reloads.
   ========================================================================== */

:root {
  --bg: #FAFAFA;
  --bg-elev: #FFFFFF;
  --surface: #F1F1F1;
  --fg: #111111;
  --fg-muted: #5E5E5E;
  --fg-subtle: #9A9A9A;
  --border: #E7E7E7;
  --border-strong: #D2D2D2;
  --accent: #2B59FF;
  --accent-ink: #FFFFFF;
  --live: #16A34A;
  --hl-bg: #2B59FF;
  --hl-bg-hover: #1E44D6;
  --hl-fg: #FFFFFF;
  --tool-bg: #111111;
  --tool-bg-hover: #3A3A3A;
  --glass: rgba(250, 250, 250, 0.72);
  --selection: rgba(43, 89, 255, 0.16);

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "SF Pro Display", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: clamp(1rem, 4vw, 3.5rem);
  --max: 1240px;
  --radius: 14px;
  --radius-lg: 22px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --header-h: 72px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A0A0A;
    --bg-elev: #111111;
    --surface: #151515;
    --fg: #EDEDED;
    --fg-muted: #A0A0A0;
    --fg-subtle: #6A6A6A;
    --border: #222222;
    --border-strong: #333333;
    --accent: #6E8BFF;
    --accent-ink: #0A0A0A;
    --live: #22C55E;
    --hl-bg: #3D64FF;
    --hl-bg-hover: #5677FF;
    --tool-bg: #3A3A3A;
    --tool-bg-hover: #4D4D4D;
    --glass: rgba(10, 10, 10, 0.66);
    --selection: rgba(110, 139, 255, 0.28);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0A0A0A;
  --bg-elev: #111111;
  --surface: #151515;
  --fg: #EDEDED;
  --fg-muted: #A0A0A0;
  --fg-subtle: #6A6A6A;
  --border: #222222;
  --border-strong: #333333;
  --accent: #6E8BFF;
  --accent-ink: #0A0A0A;
  --live: #22C55E;
  --hl-bg: #3D64FF;
  --hl-bg-hover: #5677FF;
  --tool-bg: #3A3A3A;
  --tool-bg-hover: #4D4D4D;
  --glass: rgba(10, 10, 10, 0.66);
  --selection: rgba(110, 139, 255, 0.28);
  color-scheme: dark;
}

/* Scale the whole system up on very large displays (everything is rem-based) */
@media (min-width: 2200px) { html { font-size: 19px; } }
@media (min-width: 2800px) { html { font-size: 22px; } :root { --max: 1760px; } }
@media (min-width: 3600px) { html { font-size: 26px; } :root { --max: 2200px; } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
::selection { background: var(--selection); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }
.mono { font-family: var(--mono); font-size: .75rem; letter-spacing: .02em; text-transform: uppercase; }
.muted { color: var(--fg-muted); }
.subtle { color: var(--fg-subtle); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip { position: absolute; left: 1rem; top: -100px; z-index: 200; padding: .6rem 1rem; background: var(--fg); color: var(--bg); border-radius: 8px; }
.skip:focus { top: 1rem; }

/* ---------- Page transitions ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: .28s var(--ease) both vt-out; }
::view-transition-new(root) { animation: .45s var(--ease) both vt-in; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(12px); } }

/* Theme toggle: circular reveal (overrides the page-transition animation) */
html.theme-vt::view-transition-old(root),
html.theme-vt::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* Fallback fade for browsers without cross-document view transitions */
html.js-fade body { animation: page-in .5s var(--ease) both; }
html.js-fade.leaving body { opacity: 0; transform: translateY(-6px); transition: opacity .25s ease, transform .25s ease; }
@keyframes page-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 100;
  height: var(--header-h);
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  backdrop-filter: blur(18px) saturate(1.6);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, background-color .4s var(--ease);
}
.site-header.scrolled { border-bottom-color: var(--border); }
.site-header .wrap { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }

.brand { display: inline-flex; align-items: center; gap: .7rem; font-weight: 600; letter-spacing: -.01em; }
.brand-mark {
  width: 2rem; height: 2rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--fg); color: var(--bg);
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  transition: transform .5s var(--ease);
}
.brand:hover .brand-mark { transform: rotate(-12deg) scale(1.06); }
.brand-name { font-size: .95rem; }

.nav { display: flex; align-items: center; gap: .25rem; }
.nav a {
  position: relative; padding: .5rem .85rem; border-radius: 999px;
  font-size: .9rem; color: var(--fg-muted);
  transition: color .2s ease, background-color .2s ease;
}
.nav a:hover { color: var(--fg); }
.nav a[aria-current="page"] { color: var(--fg); }
.nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 50%; bottom: .15rem; width: 4px; height: 4px;
  border-radius: 50%; background: var(--accent); transform: translateX(-50%);
}

.header-actions { display: flex; align-items: center; gap: .5rem; }
.icon-btn {
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  color: var(--fg);
  transition: border-color .2s ease, background-color .2s ease, transform .2s ease;
}
.icon-btn:hover { border-color: var(--border-strong); background: var(--surface); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 1.1rem; height: 1.1rem; }

.theme-toggle .sun, .theme-toggle .moon { transition: transform .5s var(--ease), opacity .3s ease; transform-origin: center; }
.theme-toggle { position: relative; }
.theme-toggle svg { position: absolute; }
:root[data-theme="dark"] .theme-toggle .moon,
:root:not([data-theme="dark"]) .theme-toggle .sun { opacity: 0; transform: rotate(-90deg) scale(.5); }

.menu-btn { display: none; }
.menu-btn i { display: block; }
@media (prefers-reduced-motion: reduce) { .marquee-track > ul + ul { display: none; } }
.menu-btn span { display: block; width: 16px; height: 1.5px; background: currentColor; transition: transform .35s var(--ease); }
.menu-btn span + span { margin-top: 5px; }
.menu-open .menu-btn span:first-child { transform: translateY(3.25px) rotate(45deg); }
.menu-open .menu-btn span:last-child { transform: translateY(-3.25px) rotate(-45deg); }

@media (max-width: 760px) {
  :root { --header-h: 64px; }
  .menu-btn { display: grid; }
  .nav {
    position: fixed; inset: var(--header-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: .5rem var(--gutter) 1.5rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    opacity: 0; pointer-events: none; transform: translateY(-8px);
    transition: opacity .25s ease, transform .35s var(--ease);
  }
  .menu-open .nav { opacity: 1; pointer-events: auto; transform: none; }
  .nav a { font-size: 1.6rem; font-weight: 500; letter-spacing: -.02em; padding: .7rem 0; border-radius: 0; color: var(--fg); border-bottom: 1px solid var(--border); }
  .nav a[aria-current="page"]::after { left: auto; right: 0; top: 50%; bottom: auto; width: 6px; height: 6px; transform: translateY(-50%); }
  .brand-name { display: none; }
}

/* ---------- Typography ---------- */
.eyebrow { display: inline-flex; align-items: center; gap: .6rem; color: var(--fg-muted); }
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.display {
  font-size: clamp(2.9rem, 10.2vw, 12.5rem);
  line-height: 1.06; letter-spacing: -.055em; font-weight: 600;
  margin: 0;
}
.h2 { font-size: clamp(2rem, 5vw, 4.5rem); line-height: 1.12; letter-spacing: -.045em; font-weight: 600; margin: 0; }
.h3 { font-size: clamp(1.35rem, 2.2vw, 2rem); line-height: 1.22; letter-spacing: -.03em; font-weight: 600; margin: 0; }
.lede { font-size: clamp(1.05rem, 1.35vw, 1.3rem); line-height: 1.6; color: var(--fg-muted); max-width: 40ch; margin: 0; }
.lede strong { color: var(--fg); font-weight: 500; }

/* ---------- Buttons / pills ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .6rem;
  height: 3rem; padding: 0 1.35rem; border-radius: 999px;
  font-size: .92rem; font-weight: 500;
  border: 1px solid var(--border-strong);
  transition: background-color .25s ease, color .25s ease, border-color .25s ease, transform .25s var(--ease);
}
.btn:hover { border-color: var(--fg); }
.btn .arr { transition: transform .35s var(--ease); }
.btn:hover .arr { transform: translate(2px, -2px); }
.btn.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn.primary:hover { border-color: var(--accent); color: var(--accent-ink); }

.pill {
  display: inline-flex; align-items: center; gap: .5rem;
  height: 2.5rem; padding: 0 1.1rem; border-radius: 999px;
  border: 1px solid var(--border); font-size: .9rem; color: var(--fg-muted);
  transition: all .25s ease;
}
.pill:hover { color: var(--fg); border-color: var(--border-strong); }
.pill[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.pill .count { font-family: var(--mono); font-size: .7rem; opacity: .6; }

.tag { display: inline-flex; padding: .3rem .7rem; border-radius: 999px; background: var(--surface); font-size: .8rem; color: var(--fg-muted); }

/* ---------- Sections ---------- */
section { position: relative; }
.section { padding-block: clamp(4.5rem, 10vw, 9rem); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 2rem; flex-wrap: wrap; margin-bottom: clamp(2rem, 5vw, 4rem); }
.section-head .h2 { max-width: 14ch; }
/* Centre the intro text on the heading itself (offset by the eyebrow above it) */
.section-head.mid { align-items: center; }
.section-head.mid > .lede { margin-top: calc(.75rem * 1.6 + 1.25rem); }
@media (max-width: 760px) { .section-head.mid > .lede { margin-top: 0; } }
.rule { border: 0; border-top: 1px solid var(--border); margin: 0; }

/* ---------- Hero ---------- */
.hero { position: relative; isolation: isolate; overflow: hidden; padding-block: clamp(1.75rem, 4.5vw, 4rem) clamp(3rem, 6vw, 5rem); }
.hero-grid {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  --line: color-mix(in srgb, var(--fg) 7%, transparent);
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 72px 72px; background-position: center -1px;
  -webkit-mask-image: radial-gradient(ellipse 75% 70% at 50% 35%, #000 25%, transparent 80%);
  mask-image: radial-gradient(ellipse 75% 70% at 50% 35%, #000 25%, transparent 80%);
}
.hero-grid::before, .hero-grid::after { content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity .6s ease; }
.hero-grid::before { background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 30%), color-mix(in srgb, var(--accent) 16%, transparent), transparent 65%); }
.hero-grid::after {
  --line: color-mix(in srgb, var(--accent) 55%, transparent);
  background-image: inherit; background-size: inherit; background-position: inherit;
  -webkit-mask-image: radial-gradient(180px circle at var(--mx, 50%) var(--my, 30%), #000, transparent 70%);
  mask-image: radial-gradient(180px circle at var(--mx, 50%) var(--my, 30%), #000, transparent 70%);
}
.hero.lit .hero-grid::before, .hero.lit .hero-grid::after { opacity: 1; }

.dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--live); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 8px transparent; } }

.hero-title { margin: 0; display: grid; font-size: clamp(2.6rem, 12vw, 9.5rem); line-height: 1.06; letter-spacing: -.055em; font-weight: 600; }
.hero-title .row { display: flex; align-items: center; gap: .16em; white-space: nowrap; will-change: transform; }
.hero-title .row:nth-child(2) { padding-left: .9em; }
.hero-title .line { display: block; overflow: hidden; padding: 0 .12em .08em .06em; margin: 0 -.12em -.08em -.06em; }
.hero-title .line > span { display: inline-block; animation: rise 1.1s var(--ease) both; animation-delay: calc(var(--i, 0) * 90ms + 80ms); }
.hero-title .soft { color: var(--fg-subtle); }
.pill-img {
  position: relative; flex: none; display: block; overflow: hidden;
  width: 1.7em; height: .8em; border-radius: 999px; margin-top: .06em;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--border);
  animation: pill-in 1.1s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 90ms + 250ms);
  transition: width .7s var(--ease);
}
.pill-img:hover { width: 2.3em; }
.pill-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.18); transition: opacity .9s ease, transform 2.2s var(--ease); }
.pill-img img.on { opacity: 1; transform: none; }
@keyframes pill-in { from { width: 0; opacity: 0; } }

.display .line { display: block; overflow: hidden; padding: 0 .12em .06em .06em; margin: 0 -.12em 0 -.06em; }
.display .line > span { display: inline-block; animation: rise 1.1s var(--ease) both; animation-delay: calc(var(--i, 0) * 90ms + 80ms); }
.display .soft { color: var(--fg-subtle); }
@keyframes rise { from { transform: translateY(105%); } }

.hero-foot {
  margin-top: clamp(2.5rem, 6vw, 4.5rem); padding-top: 1.75rem; border-top: 1px solid var(--border);
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: clamp(1.5rem, 4vw, 3rem); align-items: center;
}
.hero-foot .lede { max-width: 46ch; }
.cta-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.scroll-cue { width: 2.4rem; height: 3.8rem; border: 1px solid var(--border-strong); border-radius: 999px; display: grid; justify-items: center; padding-top: .6rem; }
.scroll-cue span { width: 3px; height: .7rem; border-radius: 2px; background: var(--fg); animation: cue 1.8s var(--ease) infinite; }
@keyframes cue { 0% { transform: translateY(0); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(1.5rem); opacity: 0; } }
@media (max-width: 800px) {
  .hero-foot { grid-template-columns: 1fr; }
  .scroll-cue { display: none; }
}

.fade-up { animation: fade-up 1s var(--ease) both; animation-delay: var(--d, .5s); }
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--border); }
.stat { padding: 1.75rem 1.5rem 1.75rem 0; }
.stat + .stat { padding-left: 1.5rem; border-left: 1px solid var(--border); }
.stat:nth-child(4n+1) { padding-left: 0; border-left: 0; }
.stat:nth-child(n+5) { border-top: 1px solid var(--border); }
.stat b { display: block; font-size: clamp(2rem, 4vw, 3.4rem); font-weight: 600; letter-spacing: -.05em; line-height: 1; }
.stat span { display: block; margin-top: .6rem; color: var(--fg-muted); font-size: .88rem; }
@media (max-width: 700px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(n) { padding-left: 1.5rem; border-left: 1px solid var(--border); }
  .stat:nth-child(odd) { border-left: 0; padding-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--border); }
}

/* ---------- Marquee ---------- */
.marquee {
  border-block: 1px solid var(--border);
  overflow: hidden; padding-block: clamp(1.1rem, 2.4vw, 1.9rem);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track { display: flex; width: max-content; animation: marquee 42s linear infinite; }
.marquee-track.js { animation: none; will-change: transform; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee ul { display: flex; align-items: center; list-style: none; margin: 0; padding: 0; }
.marquee li {
  display: inline-flex; align-items: center; white-space: nowrap;
  font-size: clamp(1.6rem, 4vw, 3.6rem); font-weight: 500; letter-spacing: -.04em;
}
.marquee li.tool { color: var(--fg-subtle); }
.marquee li::after { content: "✦"; font-size: .4em; color: var(--accent); margin-inline: clamp(1rem, 2.8vw, 2.5rem); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Expertise list ---------- */
.expertise { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border-top: 1px solid var(--border); }
.exp-item { padding: 2rem 1.5rem 2rem 0; }
.exp-item + .exp-item { padding-left: 1.5rem; border-left: 1px solid var(--border); }
.exp-item .mono { color: var(--fg-subtle); }
.exp-item h3 { margin: 1.4rem 0 .6rem; font-size: 1.2rem; font-weight: 600; letter-spacing: -.02em; }
.exp-item p { margin: 0; color: var(--fg-muted); font-size: .94rem; }
@media (max-width: 900px) {
  .expertise { grid-template-columns: 1fr 1fr; }
  .exp-item:nth-child(3) { border-left: 0; padding-left: 0; }
  .exp-item:nth-child(n+3) { border-top: 1px solid var(--border); }
}
@media (max-width: 520px) {
  .expertise { grid-template-columns: 1fr; }
  .exp-item, .exp-item + .exp-item { padding: 1.6rem 0; border-left: 0; }
  .exp-item + .exp-item { border-top: 1px solid var(--border); }
}

/* ---------- Project cards ---------- */
.card { display: block; position: relative; }
.card-media {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: var(--surface);
  aspect-ratio: var(--ar, 4 / 3);
}
.card-media img {
  width: 100%; height: 100%; object-fit: cover;
  transform: scale(1.001);
  transition: transform 1.1s var(--ease), opacity .6s ease;
}
.card:hover .card-media img { transform: scale(1.045); }
.card-media::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fg) 6%, transparent);
  pointer-events: none;
}
.card-meta { display: flex; justify-content: space-between; align-items: start; gap: 1rem; padding-top: 1.1rem; }
.card-title { margin: 0; font-size: clamp(1.05rem, 1.4vw, 1.3rem); font-weight: 500; letter-spacing: -.02em; line-height: 1.3; }
.card-cat { margin-top: .3rem; font-size: .88rem; color: var(--fg-muted); }
.card-arrow {
  flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  transition: background-color .3s ease, color .3s ease, border-color .3s ease, transform .45s var(--ease);
}
.card-arrow svg { width: 1rem; height: 1rem; }
.card:hover .card-arrow { background: var(--fg); color: var(--bg); border-color: var(--fg); transform: rotate(45deg); }
.card-year { position: absolute; top: .9rem; left: .9rem; z-index: 1; padding: .35rem .6rem; border-radius: 999px; background: var(--glass); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: var(--fg); }

/* Featured: asymmetric two-column grid */
.featured { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: clamp(1rem, 2.5vw, 2.5rem); row-gap: clamp(3rem, 6vw, 5.5rem); }
.featured .card:nth-child(4n+1) { grid-column: 1 / span 7; --ar: 808 / 632; }
.featured .card:nth-child(4n+2) { grid-column: 8 / span 5; --ar: 808 / 632; margin-top: clamp(4rem, 12vw, 11rem); }
.featured .card:nth-child(4n+3) { grid-column: 1 / span 5; --ar: 808 / 632; }
.featured .card:nth-child(4n+4) { grid-column: 7 / span 6; --ar: 808 / 632; margin-top: clamp(3rem, 9vw, 8rem); }
.featured .card-index { font-family: var(--mono); font-size: .75rem; color: var(--fg-subtle); margin-bottom: .9rem; display: block; }
@media (max-width: 760px) {
  .featured { grid-template-columns: 1fr; row-gap: 3rem; }
  .featured .card:nth-child(n) { grid-column: 1 / -1; margin-top: 0; --ar: 4 / 3; }
}

/* Archive grid */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: clamp(2rem, 4vw, 3rem); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); column-gap: clamp(1rem, 2vw, 2rem); row-gap: clamp(2.5rem, 4vw, 3.5rem); }
.grid-3 .card { --ar: 808 / 632; }
.grid-3 .card.is-hidden { display: none; }
@media (max-width: 1024px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-3 { grid-template-columns: 1fr; } }

/* Staggered reveal */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform .9s var(--ease); transition-delay: calc(var(--i, 0) * 80ms); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Page header (inner pages) ---------- */
.page-head { padding-top: clamp(1.75rem, 4.5vw, 4rem); padding-bottom: clamp(2.5rem, 5vw, 4rem); }
.page-head .display { font-size: clamp(2.4rem, 8vw, 7rem); margin-top: 1.25rem; }
.page-head .lede { margin-top: 1.75rem; }
.page-head-row { display: flex; justify-content: space-between; align-items: end; gap: 2rem; flex-wrap: wrap; }

/* Page headers with a right-hand panel */
.ph-split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: clamp(2rem, 5vw, 5rem); align-items: end; }
.ph-main { min-width: 0; }
@media (max-width: 900px) { .ph-split { grid-template-columns: 1fr; } }

/* Experience: career at a glance */
.glance { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-elev); padding: clamp(1.25rem, 2.4vw, 1.75rem); display: grid; gap: 1.1rem; }
.career-bar { position: relative; height: .9rem; border-radius: 999px; background: var(--surface); margin-top: .35rem; }
.career-bar .seg {
  position: absolute; top: 0; bottom: 0; left: var(--l); width: var(--w); border-radius: 999px;
  background: color-mix(in srgb, var(--fg) 28%, transparent);
  transform-origin: 0 50%; animation: seg-in 1.1s var(--ease) backwards; animation-delay: calc(.8s + var(--k) * 120ms);
  transition: filter .2s ease;
}
.career-bar .seg.now { background: var(--accent); }
.career-bar .seg:hover { filter: brightness(1.15); }
@keyframes seg-in { from { transform: scaleX(0); } }
.career-ticks { position: relative; height: 1rem; color: var(--fg-subtle); font-size: .68rem; }
.career-ticks span { position: absolute; left: var(--l); transform: translateX(-50%); }
.career-ticks span:first-child { transform: none; }
.career-ticks span:last-child { transform: translateX(-100%); }
.career-key { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; font-size: .9rem; }
.career-key li { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.career-key i { width: .7rem; height: .7rem; border-radius: 50%; background: color-mix(in srgb, var(--fg) 28%, transparent); flex: none; }
.career-key i.now { background: var(--accent); }
.career-key .subtle { font-family: var(--mono); font-size: .72rem; }
.glance-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; padding-top: 1.1rem; border-top: 1px solid var(--border); }
.glance-stats div + div { padding-left: 1rem; border-left: 1px solid var(--border); }
.glance-stats dt { font-size: .8rem; color: var(--fg-muted); }
.glance-stats dd { margin: .2rem 0 0; font-size: clamp(1.5rem, 2.4vw, 2.1rem); font-weight: 600; letter-spacing: -.04em; line-height: 1.1; font-variant-numeric: tabular-nums; }

/* Work: header artwork (transparent PNG; the bear breaks out of its rounded frame) */
.work-hero { margin: 0; align-self: end; }
@media (min-width: 901px) { .work-hero { margin-bottom: clamp(1.5rem, 3vw, 3rem); } }
.work-hero img { width: 100%; height: auto; display: block; filter: drop-shadow(0 18px 30px color-mix(in srgb, var(--fg) 14%, transparent)); transition: transform 1s var(--ease); }
.work-hero:hover img { transform: translateY(-4px) scale(1.01); }

/* ---------- Project detail ---------- */
.p-hero { padding-top: clamp(1.75rem, 4.5vw, 4rem); }
.p-fields { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1.5rem; }
.back-link { display: inline-flex; align-items: center; gap: .5rem; color: var(--fg-muted); font-size: .9rem; transition: color .2s ease; }
.back-link:hover { color: var(--fg); }
.back-link svg { width: 1rem; height: 1rem; transition: transform .3s var(--ease); }
.back-link:hover svg { transform: translateX(-3px); }
.p-title { font-size: clamp(2.4rem, 7vw, 7.5rem); line-height: 1.08; letter-spacing: -.05em; font-weight: 600; margin: 1.5rem 0 0; max-width: 16ch; }
.p-title .soft { color: var(--fg-subtle); }
.p-cover { margin-top: clamp(2.5rem, 5vw, 4rem); width: 100%; aspect-ratio: 16 / 8; overflow: hidden; background: var(--surface); }
.p-cover img { width: 100%; height: 100%; object-fit: cover; object-position: top center; animation: cover-in 1.4s var(--ease) both; }
@keyframes cover-in { from { transform: scale(1.08); opacity: 0; } }
@media (max-width: 700px) { .p-cover { aspect-ratio: 4 / 3; } }

.meta-row { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--border); }
.meta-cell { padding: 1.75rem 1.5rem 1.75rem 0; }
.meta-cell + .meta-cell { padding-left: 1.5rem; border-left: 1px solid var(--border); }
.meta-cell .mono { color: var(--fg-subtle); display: block; margin-bottom: .55rem; }
.meta-cell b { font-weight: 500; font-size: 1rem; }
.meta-cell .tools { display: flex; flex-wrap: wrap; gap: .35rem; }
@media (max-width: 800px) {
  .meta-row { grid-template-columns: 1fr 1fr; }
  .meta-cell:nth-child(3) { border-left: 0; padding-left: 0; }
  .meta-cell:nth-child(n+3) { border-top: 1px solid var(--border); }
}

.block { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(1.5rem, 5vw, 6rem); padding-block: clamp(3rem, 6vw, 5.5rem); border-bottom: 1px solid var(--border); }
.block-label { display: flex; gap: 1rem; align-items: baseline; }
.block-label .mono { color: var(--fg-subtle); }
.block-label h2 { margin: 0; font-size: clamp(1.4rem, 2.4vw, 2.1rem); letter-spacing: -.03em; font-weight: 600; line-height: 1.2; }
.block-body p { margin: 0; font-size: clamp(1.1rem, 1.6vw, 1.5rem); line-height: 1.55; letter-spacing: -.012em; color: var(--fg); max-width: 38ch; }
.block-body p + p { margin-top: 1.2em; }
.block-label .sticky { position: sticky; top: calc(var(--header-h) + 2rem); }
@media (max-width: 800px) { .block { grid-template-columns: 1fr; } }

.gallery { display: grid; gap: clamp(.75rem, 1.5vw, 1.25rem); padding-top: clamp(2.5rem, 5vw, 4rem); }
.gallery figure { margin: 0; overflow: hidden; border-radius: var(--radius); background: var(--surface); }
.gallery img { width: 100%; }
.gallery-cta { display: flex; justify-content: center; padding-top: clamp(2rem, 4vw, 3rem); }

.pager-nav { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--border); margin-top: clamp(4rem, 8vw, 7rem); }
.pager-nav a { padding: clamp(2rem, 5vw, 4rem) 0; display: block; transition: color .3s ease; }
.pager-nav a + a { text-align: right; border-left: 1px solid var(--border); padding-left: 1.5rem; }
.pager-nav a:first-child { padding-right: 1.5rem; }
.pager-nav .mono { color: var(--fg-subtle); display: inline-flex; align-items: center; gap: .5rem; }
.pager-nav .t { display: block; margin-top: .9rem; font-size: clamp(1.3rem, 3.2vw, 2.8rem); font-weight: 600; letter-spacing: -.04em; line-height: 1.05; color: var(--fg-muted); transition: color .3s ease; }
.pager-nav a:hover .t { color: var(--fg); }
@media (max-width: 600px) {
  .pager-nav { grid-template-columns: 1fr; }
  .pager-nav a + a { text-align: left; border-left: 0; border-top: 1px solid var(--border); padding-left: 0; }
}

/* ---------- Experience ---------- */
.timeline { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.role {
  display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 5fr) minmax(0, 4fr);
  gap: clamp(1rem, 3vw, 3rem); padding-block: clamp(1.75rem, 3.5vw, 2.75rem);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.role-when { display: flex; align-items: center; gap: .8rem; color: var(--fg-muted); }
.role-when .node { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--fg-subtle); flex: none; }
.role.current .node { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent); }
.role h3 { margin: 0; font-size: clamp(1.3rem, 2.4vw, 2.1rem); letter-spacing: -.035em; font-weight: 600; line-height: 1.2; }
.role .org { margin-top: .45rem; color: var(--fg-muted); }
.role p { margin: 0; color: var(--fg-muted); font-size: .96rem; }
.now-badge { padding: .2rem .55rem; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .65rem; }
.role .dur { display: block; margin-top: .4rem; color: var(--fg-subtle); }
@media (max-width: 900px) {
  .role { grid-template-columns: 1fr; gap: .9rem; padding-left: 1.75rem; }
  .role::before { content: ""; position: absolute; left: 4px; top: 0; bottom: 0; width: 1px; background: var(--border); }
  .role-when .node { position: absolute; left: 0; top: calc(clamp(1.75rem, 3.5vw, 2.75rem) + .35rem); background: var(--bg); }
  .role.current .node { background: var(--accent); }
}

.edu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1rem, 2vw, 1.5rem); }
.edu {
  padding: clamp(1.5rem, 2.5vw, 2rem); border: 1px solid var(--border); border-radius: var(--radius-lg);
  display: flex; flex-direction: column; gap: .5rem; min-height: 15rem;
  transition: border-color .3s ease, transform .5s var(--ease);
}
.edu:hover { border-color: var(--border-strong); transform: translateY(-4px); }
.edu .mono { color: var(--fg-subtle); display: flex; justify-content: space-between; }
.edu h3 { margin: auto 0 0; font-size: 1.3rem; letter-spacing: -.025em; font-weight: 600; line-height: 1.2; }
.edu .by { color: var(--fg-muted); font-size: .92rem; }
@media (max-width: 900px) { .edu-grid { grid-template-columns: 1fr; } .edu { min-height: 0; } .edu h3 { margin-top: 1.5rem; } }

.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1.5rem, 3vw, 3rem); }
.skills h3 { margin: 0 0 1rem; font-size: 1rem; font-weight: 600; }
.skills ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
@media (max-width: 800px) { .skills { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.site-footer { padding-top: clamp(5rem, 11vw, 10rem); padding-bottom: 2rem; border-top: 1px solid var(--border); margin-top: clamp(3rem, 8vw, 7rem); }
.say-hello {
  display: inline-flex; align-items: center; gap: clamp(.75rem, 2vw, 2rem);
  font-size: clamp(3.4rem, 13vw, 14rem); font-weight: 600; letter-spacing: -.06em; line-height: 1.02;
  margin-top: 1.5rem;
}
.say-hello .circle {
  width: .62em; height: .62em; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--fg); color: var(--bg);
  transition: transform .6s var(--ease), background-color .3s ease;
}
.say-hello .circle svg { width: 38%; height: 38%; }
.say-hello:hover .circle { transform: rotate(45deg); background: var(--accent); color: var(--accent-ink); }
.say-hello .txt { background: linear-gradient(currentColor, currentColor) 0 100% / 0 2px no-repeat; transition: background-size .6s var(--ease); }

.footer-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; margin-top: clamp(3.5rem, 7vw, 6rem); padding-top: 2rem; border-top: 1px solid var(--border); }
.footer-grid .mono { color: var(--fg-subtle); display: block; margin-bottom: .8rem; }
.footer-grid a { display: inline-block; position: relative; }
.footer-grid a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform .45s var(--ease); }
.footer-grid a:hover::after { transform: scaleX(1); transform-origin: left; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.footer-big { font-size: clamp(1rem, 1.3vw, 1.2rem); letter-spacing: -.02em; font-weight: 500; line-height: 2rem; }
.footer-row { display: inline-flex; align-items: center; max-width: 100%; }
.footer-row .copy-btn { margin-left: .25rem; flex: none; }
.footer-grid ul.social { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; }
.social-link { display: inline-flex !important; align-items: center; gap: .5rem; }
.social-link .brand { width: 1.05em; height: 1.05em; flex: none; transition: color .25s ease; }
.social-link:hover .brand { color: var(--accent); }
.social-link::after { left: calc(1.05em + .5rem) !important; }
.versions { display: flex; align-items: center; gap: .6rem; height: 2rem; }
.ver-btn {
  display: grid !important; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%;
  background: var(--bg-elev); color: var(--fg); box-shadow: 0 0 0 1px var(--border);
  transition: transform .4s var(--ease), box-shadow .3s ease, color .25s ease;
}
.ver-btn::after { display: none; }
.ver-btn svg { width: 1.15rem; height: 1.15rem; }
.ver-btn:hover { transform: translateY(-2px); color: var(--accent); box-shadow: 0 0 0 1px var(--border-strong); }
.footer-legal { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 4rem; color: var(--fg-subtle); font-size: .85rem; }
.copy-btn { display: inline-grid; place-items: center; width: 2rem; height: 2rem; margin-left: .35rem; border-radius: 50%; color: var(--fg-muted); vertical-align: middle; transition: color .2s ease, background-color .2s ease; }
.copy-btn:hover { color: var(--fg); background: var(--surface); }
.copy-btn svg { grid-area: 1 / 1; width: 1.05rem; height: 1.05rem; transition: opacity .2s ease, transform .3s var(--ease); }
.copy-btn .i-check { opacity: 0; transform: scale(.6); color: var(--live); }
.copy-btn.copied .i-copy { opacity: 0; transform: scale(.6); }
.copy-btn.copied .i-check { opacity: 1; transform: none; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 2rem; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- Misc ---------- */
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; z-index: 250;
  transform: translate(-50%, 1rem); opacity: 0;
  padding: .7rem 1.1rem; border-radius: 999px;
  background: var(--fg); color: var(--bg); font-size: .88rem;
  transition: opacity .3s ease, transform .4s var(--ease);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Interactions ---------- */
.scroll-progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 160; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); pointer-events: none; }

/* Magnetic elements move via the independent `translate` property, so their own transforms keep working */
.btn, .icon-btn, .card-arrow, .say-hello .circle, .brand-mark, .scroll-cue, .pill { transition-property: background-color, color, border-color, transform, translate, width; transition-duration: .3s, .3s, .3s, .45s, .5s, .7s; transition-timing-function: var(--ease); }

/* Buttons fill from the pointer */
.btn { position: relative; overflow: hidden; isolation: isolate; }
.btn::before {
  content: ""; position: absolute; z-index: -1; left: var(--x, 50%); top: var(--y, 50%);
  width: 0; aspect-ratio: 1; border-radius: 50%; background: var(--fg);
  transform: translate(-50%, -50%); transition: width .55s var(--ease);
}
.btn:hover::before { width: 260%; }
.btn:hover { color: var(--bg); }
.btn.primary::before { background: var(--accent); }

/* Nav labels roll on hover */
.roll { display: inline-block; overflow: hidden; vertical-align: top; height: 1.6em; line-height: 1.6; }
.roll > span { display: block; text-shadow: 0 1.6em currentColor; transition: transform .5s var(--ease); }
a:hover > .roll > span { transform: translateY(-1.6em); }

/* Card tilt + inner image drift */
.card-media { transition: transform .7s var(--ease), clip-path 1.2s var(--ease); }
.card-media img { transition: transform 1.1s var(--ease), translate .7s var(--ease), opacity .6s ease; }
.card.reveal .card-media { clip-path: inset(14% 0 0 0 round var(--radius)); }
.card.reveal.in .card-media { clip-path: inset(0 0 0 0 round var(--radius)); }

/* Headings reveal word by word */
.sw { display: inline-block; overflow: hidden; vertical-align: top; padding: 0 .1em .1em .04em; margin: 0 -.1em -.1em -.04em; }
.sw > span { display: inline-block; transition: transform 1s var(--ease); transition-delay: calc(var(--w, 0) * 45ms); }
.split:not(.in) .sw > span { transform: translateY(105%); }

/* "Say Hello" letters wave on hover */
.say-hello .ch { display: inline-block; transition: transform .6s var(--ease); transition-delay: calc(var(--c, 0) * 28ms); }
.say-hello:hover .ch { transform: translateY(-.1em) rotate(-3deg); }
.say-hello:hover .txt { background-size: 100% 2px; }

/* Timeline rows respond to hover */
.role h3, .role .org { transition: transform .5s var(--ease); }
.role:hover h3 { transform: translateX(.35rem); }
.role:hover .org { transform: translateX(.35rem); }
.role .node { transition: transform .4s var(--ease), background-color .3s ease, border-color .3s ease; }
.role:hover .node { transform: scale(1.5); border-color: var(--accent); }

/* Experience + skills tags */
.tag { transition: background-color .25s ease, color .25s ease, transform .35s var(--ease); }
.tag:hover { background: var(--fg); color: var(--bg); transform: translateY(-2px); }

/* Highlighted tools */
.hl { display: inline-block; padding: .05em .5em; border-radius: 999px; background: var(--tool-bg); color: var(--hl-fg); font-weight: 500; line-height: 1.45; }
.hl.cap { background: var(--hl-bg); font-size: .22em; line-height: 1; letter-spacing: -.01em; padding: .35em .75em .38em; vertical-align: middle; font-weight: 600; margin-left: .1em; }
.sw.sw-el { vertical-align: middle; padding-bottom: 0; margin-bottom: 0; position: relative; top: -.18em; }

/* Project cover parallax */
.p-cover img { height: 116%; }

@media (prefers-reduced-motion: reduce) {
  .split:not(.in) .sw > span, .card.reveal .card-media { transform: none; clip-path: none; }
  .p-cover img { height: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
  .marquee-track { animation: none; flex-wrap: wrap; }
}

/* ---------- Project pages: narrower 70% container (header and footer keep full width) ---------- */
@media (min-width: 1024px) {
  body[data-page="project"] main .wrap,
  body[data-page="project"] .p-cover { width: min(70%, var(--max)); margin-inline: auto; }
  body[data-page="project"] .p-cover { border-radius: var(--radius-lg); }
  body[data-page="project"] .block { grid-template-columns: minmax(0, 3fr) minmax(0, 7fr); }
}
