/* ==========================================================================
   Viraj Desai — portfolio v2
   One stylesheet, one self-hosted font, no preprocessor, no dependencies.
   Order: font -> tokens -> reset -> primitives -> sections -> motion -> print
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Font — self-hosted variable woff2, SIL OFL (assets/fonts/OFL.txt)
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/space-grotesk-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* Metric-matched fallback so the swap doesn't shift layout. Space Grotesk is
   slightly narrow; these overrides pull the fallback toward its metrics. */
@font-face {
  font-family: "Grotesk Fallback";
  src: local("Segoe UI"), local("Helvetica Neue"), local("Arial"), local("Roboto");
  size-adjust: 97.5%;
  ascent-override: 101%;
  descent-override: 25%;
  line-gap-override: 0%;
}

/* --------------------------------------------------------------------------
   1. Theme-agnostic tokens
   -------------------------------------------------------------------------- */
:root {
  --display: "Space Grotesk", "Grotesk Fallback", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", "JetBrains Mono",
          Consolas, "Liberation Mono", monospace;

  /* spacing — discrete steps, use these rather than ad-hoc rem values */
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem;
  --s5: 1.5rem; --s6: 2rem;  --s7: 3rem;   --s8: 4rem;

  --pad-section: clamp(3rem, 5.5vw, 5rem);
  --gap-grid: clamp(.75rem, 1vw, 1.125rem);
  --gap-rail: clamp(2rem, 4vw, 4rem);
  --pad-card: clamp(.85rem, 1.1vw, 1.05rem);

  --shell: 1200px;
  --rail-w: clamp(180px, 20vw, 248px);
  --gutter: clamp(1.15rem, 4vw, 2.5rem);
  --hdr-h: 3.75rem;

  /* type scale */
  --fs-display: clamp(2.5rem, 1.35rem + 5.6vw, 4.5rem);
  --fs-h2:   clamp(1.75rem, 1.25rem + 2.4vw, 2.75rem);
  --fs-h3:   clamp(1.15rem, 1rem + .75vw, 1.5rem);
  --fs-lede: clamp(1.05rem, 1rem + .35vw, 1.22rem);
  --fs-body: clamp(1rem, .97rem + .16vw, 1.0625rem);
  --fs-sm: .9rem; --fs-xs: .8rem; --fs-label: .72rem;
  --tr-label: .145em;

  --r-sm: 6px; --r: 10px; --r-lg: 16px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --pop:  cubic-bezier(.34, 1.56, .64, 1);
}

/* --------------------------------------------------------------------------
   2. DARK — the default, so a failed inline theme script still renders right.
   Ratios measured with the WCAG formula against --bg #0b1017.
   -------------------------------------------------------------------------- */
:root, [data-theme="dark"] {
  --bg:        #0b1017;
  --surface:   #131c27;
  --surface-2: #18232f;
  --line:      #223041;
  --line-soft: #1a2532;

  --fg:    #e8eff7;   /* 16.46:1  headings, body        */
  --fg-2:  #c3cedc;   /* 11.98:1  secondary body        */
  --muted: #9fb0c3;   /*  8.61:1  meta, labels, lists   */
  --faint: #6b7c91;   /*  4.47:1  BORDERS / DECOR ONLY  */

  /* In dark these are the same value. They diverge in light — see below. */
  --accent:      #22d3ee;   /* 10.56:1 — fills, strokes, large glyphs */
  --accent-ink:  #22d3ee;   /* 10.56:1 — ALL small text               */
  --accent-soft: #67e8f9;
  --accent-2:     #fbbf24;  /* 11.43:1 */
  --accent-2-ink: #fbbf24;
  --accent-2-wash: rgba(251, 191, 36, .10);
  --accent-2-line: rgba(251, 191, 36, .28);
  --on-accent: #04080c;

  --chip: #f4f6f8;          /* logo tile — light in BOTH themes */
  --chip-line: #2a3a4d;
  --glow: rgba(34, 211, 238, .14);
  --glow-a: rgba(34, 211, 238, .13);
  --glow-b: rgba(251, 191, 36, .085);
  --grid-line: rgba(148, 197, 255, .045);
  --spot: rgba(34, 211, 238, .15);
}

/* --------------------------------------------------------------------------
   3. LIGHT — MUST come after the dark block.
   `:root` and `[data-theme="light"]` are both specificity (0,1,0); the tie is
   broken by source order alone. Move this above dark and light silently dies.
   -------------------------------------------------------------------------- */
[data-theme="light"] {
  --bg:        #f2f5f9;
  --surface:   #ffffff;
  --surface-2: #f7f9fc;
  --line:      #d7dee8;
  --line-soft: #e4eaf2;

  --fg:    #0e1620;   /* 16.64:1 */
  --fg-2:  #2b3947;   /* 10.80:1 */
  --muted: #4a5a6e;   /*  6.45:1 */
  --faint: #7d8b9c;   /*  3.18:1  BORDERS / DECOR ONLY */

  /* This split is load-bearing. #22d3ee is 1.71:1 on this background — a hard
     fail — so cyan survives only as a fill/stroke, never as small text. */
  --accent:      #0891b2;   /* 3.37:1 — fills, strokes, 24px+ glyphs only */
  --accent-ink:  #0b6076;   /* 6.51:1 — ALL small text                    */
  --accent-soft: #22d3ee;
  --accent-2:     #b45309;  /* 4.59:1 — fills */
  --accent-2-ink: #92400e;  /* 6.48:1 — text  */
  --accent-2-wash: rgba(180, 83, 9, .08);
  --accent-2-line: rgba(180, 83, 9, .25);
  --on-accent: #ffffff;

  --chip: #ffffff;
  --chip-line: #d7dee8;
  --glow: rgba(8, 145, 178, .10);
  --glow-a: rgba(8, 145, 178, .10);
  --glow-b: rgba(180, 83, 9, .065);
  --grid-line: rgba(15, 23, 42, .055);
  --spot: rgba(8, 145, 178, .12);
}

/* --------------------------------------------------------------------------
   4. Reset / base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

/* The UA rule is `[hidden]{display:none}` — a bare attribute selector, so any
   author rule of equal specificity (.btn{display:inline-flex}) beats it and
   the attribute silently does nothing. Restate it. */
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--hdr-h) + var(--s5));
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  /* `clip`, NOT `hidden`. overflow-x:hidden forces overflow-y:auto, which makes
     <body> a scroll container and breaks every nested position:sticky. */
  overflow-x: clip;
}

/* Drafting-paper grid. Fixed and painted once — `background-attachment: fixed`
   would repaint the whole viewport on every scroll frame. */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 34px 34px;
  -webkit-mask-image: radial-gradient(130% 85% at 50% 0%, #000 0%, transparent 74%);
          mask-image: radial-gradient(130% 85% at 50% 0%, #000 0%, transparent 74%);
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -.028em;
  line-height: 1.12;
}
h1 { font-size: var(--fs-display); line-height: .98; letter-spacing: -.042em; font-weight: 700; }
h2 { font-size: var(--fs-h2); line-height: 1.08; }
h3 { font-size: var(--fs-h3); line-height: 1.2; letter-spacing: -.018em; }
h1, h2 { text-wrap: balance; }                     /* no orphaned words */

p { margin: 0 0 1rem; text-wrap: pretty; }         /* no single-word last lines */
p:last-child { margin-bottom: 0; }

a { color: var(--accent-ink); text-decoration-color: color-mix(in srgb, var(--accent-ink) 40%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent-ink); }

img, svg { max-width: 100%; }
img { height: auto; display: block; }
ul, ol { margin: 0; padding: 0; }
b, strong { font-weight: 650; color: var(--fg); }
::selection { background: var(--accent-ink); color: var(--on-accent); }

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

/* --------------------------------------------------------------------------
   5. Primitives
   -------------------------------------------------------------------------- */
.shell { width: 100%; max-width: var(--shell); margin-inline: auto; padding-inline: var(--gutter); }

.section { padding-block: var(--pad-section); }
.section + .section { border-top: 1px solid var(--line-soft); }

.section__head { margin-bottom: clamp(1.5rem, 3vw, 2.25rem); max-width: 40ch; }

.section__kicker {
  font: 650 var(--fs-label)/1 var(--mono);
  letter-spacing: var(--tr-label); text-transform: uppercase;
  color: var(--accent-ink); margin-bottom: var(--s3);
  display: flex; align-items: center; gap: var(--s3);
}
.section__kicker::after {
  content: ""; flex: 1; height: 1px; transform-origin: left;
  background: linear-gradient(90deg, var(--line) 0%, transparent 100%);
}
.section__lede { margin-top: var(--s3); color: var(--muted); font-size: var(--fs-lede); }

/* The two-column section. THE fix for "too sparse": the shell is 1200px but
   prose caps at ~65ch (~650px), so the right 40% of every section was dead.
   A sticky header makes that gutter work for the whole scroll of the section. */
@media (min-width: 1000px) {
  .section__grid {
    display: grid;
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
    column-gap: var(--gap-rail);
    align-items: start;
  }
  .section__grid > .section__head {
    position: sticky; top: calc(var(--hdr-h) + var(--s5));
    align-self: start; margin-bottom: 0; max-width: none;
  }
  /* "Achievements" at the full h2 size overflows a 248px rail. */
  .section__grid > .section__head h2 { font-size: clamp(1.5rem, 1.1rem + 1.1vw, 2.05rem); }
  .section__grid .section__lede { font-size: var(--fs-sm); }
  .section__grid .section__kicker::after { display: none; }  /* no width in the rail */
}

.vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--accent-ink); color: var(--on-accent);
  padding: .8rem 1.3rem; font-weight: 650; border-radius: 0 0 var(--r) 0;
}
.skip:focus { left: 0; }

/* --------------------------------------------------------------------------
   6. Header
   -------------------------------------------------------------------------- */
.hdr {
  position: sticky; top: 0; z-index: 100;
  /* Flat alpha, NOT backdrop-filter: blur() — blur repaints the strip every
     scroll frame for a difference nobody sees on a near-flat background. */
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--line-soft);
}
.hdr__in { display: flex; align-items: center; gap: var(--s3); min-height: var(--hdr-h); }

.hdr__brand {
  flex: 0 0 auto; font: 700 .95rem/1 var(--mono); letter-spacing: .1em;
  color: var(--fg); text-decoration: none;
  padding: .45rem .6rem; border: 1px solid var(--line); border-radius: var(--r-sm);
}
.hdr__brand:hover { border-color: var(--accent); color: var(--accent-ink); }

.hdr__nav { flex: 1 1 auto; min-width: 0; }
@media (max-width: 949px) {
  /* Fade the right edge so it's discoverable that the strip scrolls. */
  .hdr__nav {
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 26px), transparent);
            mask-image: linear-gradient(90deg, #000 calc(100% - 26px), transparent);
  }
}
.hdr__nav ul {
  display: flex; gap: .2rem; list-style: none;
  overflow-x: auto; scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
  padding: .3rem .2rem; margin: -.3rem -.2rem;
}
.hdr__nav ul::-webkit-scrollbar { display: none; }
.hdr__nav li { flex: 0 0 auto; scroll-snap-align: start; }
.hdr__nav a {
  display: block; padding: .4rem .7rem; border-radius: 99px;
  font-size: .875rem; color: var(--muted); text-decoration: none; white-space: nowrap;
  transition: color .2s, background-color .2s;
}
.hdr__nav a:hover { color: var(--fg); background: var(--surface-2); }
.hdr__nav a[aria-current="true"] { color: var(--accent-ink); background: var(--glow); }

.hdr__tools { flex: 0 0 auto; display: flex; align-items: center; gap: var(--s2); }

/* Theme toggle. No aria-pressed — "pressed" is incoherent for a 2-state
   switch; the aria-label is updated instead, which is what AT users want. */
.thm {
  display: grid; place-items: center; width: 2.25rem; height: 2.25rem;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--muted); cursor: pointer; padding: 0;
  transition: color .2s, border-color .2s;
}
.thm:hover { color: var(--accent-ink); border-color: var(--accent); }
.thm .icon { width: 1.05rem; height: 1.05rem; fill: currentColor; }
/* Show the icon for the theme you'd switch TO. Pure CSS, so it is correct
   even with JS disabled (the button then simply does nothing). */
.thm__sun { display: none; }
[data-theme="dark"] .thm__sun { display: block; }
[data-theme="dark"] .thm__moon { display: none; }

/* --------------------------------------------------------------------------
   7. Buttons
   -------------------------------------------------------------------------- */
.btn {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; gap: var(--s2);
  padding: .62rem 1.05rem; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--fg);
  font: 650 .9rem/1.2 var(--sans); text-decoration: none; cursor: pointer;
  transition: transform .18s var(--ease), border-color .18s, color .18s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent-ink); }
.btn:active { transform: translateY(0); }

/* Diagonal sheen — compositor-only, and it fires on keyboard focus too.
   (Chosen over "magnetic" buttons, which move the target away from the
   cursor and measurably hurt users with tremor or a trackpad.) */
.btn::before {
  content: ""; position: absolute; inset: 0 auto 0 -40%; width: 35%; z-index: -1;
  background: linear-gradient(105deg, transparent, color-mix(in srgb, var(--fg) 20%, transparent), transparent);
  transform: translateX(-120%);
  transition: transform .55s var(--ease);
}
.btn:hover::before, .btn:focus-visible::before { transform: translateX(420%); }

/* Filled controls use --accent-ink, not --accent: white on #0891b2 is
   3.68:1 in light mode and fails. --accent-ink gives 7.12:1, and both
   tokens are the same value in dark. */
.btn--primary { background: var(--accent-ink); border-color: var(--accent-ink); color: var(--on-accent); }
.btn--primary:hover { filter: brightness(1.1); color: var(--on-accent); }
.btn--sm { padding: .42rem .8rem; font-size: .82rem; }
.btn .icon { width: 1em; height: 1em; flex: 0 0 auto; fill: currentColor; }

/* --------------------------------------------------------------------------
   8. Hero — bento
   -------------------------------------------------------------------------- */
.hero { position: relative; padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(2.25rem, 4vw, 3.25rem); overflow: hidden; }

/* Duotone aurora — the one place both accents glow together. */
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(58% 46% at 16% -6%, var(--glow-a), transparent 62%),
    radial-gradient(46% 38% at 88% 10%, var(--glow-b), transparent 62%);
}

/* `contain: paint` bounds the repaint region. stroke-dashoffset is NOT
   compositor-accelerated — it repaints every frame — so the animated layer is
   held to two thin strokes inside this box. */
.hero__bg {
  position: absolute; inset: 0; z-index: 0;
  color: var(--line); contain: paint; pointer-events: none;
  /* scale keeps the mask edge off-screen at max parallax offset */
  transform: translate3d(var(--px, 0), var(--py, 0), 0) scale(1.035);
  transition: transform .45s cubic-bezier(.16, 1, .3, 1);
  -webkit-mask-image: radial-gradient(125% 100% at 50% 38%, #000 32%, transparent 76%);
          mask-image: radial-gradient(125% 100% at 50% 38%, #000 32%, transparent 76%);
}
.hero__bg svg { width: 100%; height: 100%; display: block; }

.pid-flow .flow { stroke-dasharray: 18 520; opacity: .9; animation: flow 9s linear infinite; }
.pid-flow .flow--b { animation-duration: 13s; animation-delay: -4s; }
/* End value must equal the dash+gap sum (18+520) or the loop visibly jumps. */
@keyframes flow { to { stroke-dashoffset: -538; } }

.hero__in { position: relative; z-index: 1; }

@media (min-width: 900px) {
  .hero__in { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--s5); row-gap: var(--s6); align-items: start; }
  .hero__lead { grid-column: 1 / 8; }
  .hero__side { grid-column: 8 / 13; display: grid; gap: var(--s3); align-content: start; }
  .stats { grid-column: 1 / 13; }
}

.hero__eyebrow {
  font: 650 var(--fs-label)/1 var(--mono); letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent-ink); margin-bottom: var(--s4);
}
.hero h1 { margin-bottom: var(--s2); }
.hero__role {
  font-family: var(--display); font-size: clamp(1.15rem, .95rem + .9vw, 1.6rem);
  font-weight: 600; color: var(--fg-2); margin-bottom: var(--s4); max-width: 22ch;
}
.hero__role .sep { color: var(--accent-ink); }
.hero__blurb { color: var(--muted); max-width: 52ch; margin-bottom: var(--s5); }
.hero__cta { display: flex; flex-wrap: wrap; gap: var(--s3); }

/* Side tiles — fill the horizontal void beside the headline */
.tile {
  border: 1px solid var(--line-soft); border-radius: var(--r);
  background: var(--surface); padding: var(--pad-card);
  display: flex; align-items: center; gap: var(--s3);
}
.tile b { display: block; font: 650 .66rem/1 var(--mono); letter-spacing: .13em; text-transform: uppercase; color: var(--faint); margin-bottom: .3rem; }
.tile span.v { display: block; font-size: var(--fs-sm); color: var(--fg-2); }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap-grid); }
/* Declared AFTER the base rule on purpose: both are specificity (0,1,0),
   so source order is the only thing that decides the winner. */
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: var(--pad-card);
}
.stat::after { content: ""; position: absolute; inset: 0 auto auto 0; width: 2.25rem; height: 2px; background: var(--accent); }
.stat:nth-child(2)::after, .stat:nth-child(3)::after { background: var(--accent-2); }

.stat__num {
  display: block;
  font: 700 clamp(1.7rem, 1.2rem + 1.8vw, 2.4rem)/1.04 var(--display);
  letter-spacing: -.035em; color: var(--accent-ink);
  /* Without tabular figures the tile width jitters on every count-up frame. */
  font-variant-numeric: tabular-nums;
}
.stat:nth-child(2) .stat__num, .stat:nth-child(3) .stat__num { color: var(--accent-2-ink); }
.stat__label { display: block; margin-top: .3rem; font: 500 .68rem/1.35 var(--mono); letter-spacing: .05em; color: var(--muted); text-transform: uppercase; }

/* --------------------------------------------------------------------------
   9. Client marquee
   -------------------------------------------------------------------------- */
.clients { padding-block: clamp(1.25rem, 3vw, 2rem); border-top: 1px solid var(--line-soft); }
.clients__top { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.clients__label { font: 650 .66rem/1 var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--faint); }

.marq {
  position: relative; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}
.marq__track { display: flex; width: max-content; animation: marq 46s linear infinite; }
@keyframes marq { to { transform: translate3d(-50%, 0, 0); } }

/* CRITICAL: the inter-chip spacing lives INSIDE each set as padding-right,
   never as `gap` on the track — otherwise -50% doesn't land on the seam and
   the loop visibly stutters once per cycle. */
.marq__set { display: flex; list-style: none; gap: var(--s2); padding-right: var(--s2); }
.marq:hover .marq__track,
.marq:focus-within .marq__track,
.marq.is-paused .marq__track { animation-play-state: paused; }

.marq__set li {
  font: 500 .82rem/1 var(--mono); color: var(--muted); white-space: nowrap;
  border: 1px solid var(--line); border-radius: 99px; padding: .5rem .85rem;
  transition: border-color .2s, color .2s;
}
.marq__set li:hover { color: var(--accent-ink); border-color: var(--accent); }

/* WCAG 2.2.2: motion lasting >5s needs a pause control. Hover/focus alone
   doesn't satisfy it for touch users. */
.marq__pause {
  flex: 0 0 auto; cursor: pointer;
  font: 600 .68rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); background: var(--surface);
  border: 1px solid var(--line); border-radius: 99px; padding: .4rem .7rem;
}
.marq__pause:hover { color: var(--accent-ink); border-color: var(--accent); }

/* --------------------------------------------------------------------------
   10. Scroll-progress pipeline rail (desktop only)
   -------------------------------------------------------------------------- */
.rail { display: none; }
@media (min-width: 1280px) {
  .rail {
    display: block; position: fixed; z-index: 50; pointer-events: none;
    top: 22vh; bottom: 14vh; width: 2px;
    left: max(1.25rem, calc((100vw - var(--shell)) / 2 - 2.25rem));
  }
  .rail__track, .rail__fill { position: absolute; inset: 0; border-radius: 2px; }
  .rail__track { background: var(--line); }
  .rail__fill {
    background: linear-gradient(180deg, var(--accent), var(--accent-2));
    transform: scaleY(var(--p, 0)); transform-origin: top center;
  }
  /* Where supported this needs no JS at all. */
  @supports (animation-timeline: scroll()) {
    .rail__fill {
      transform: scaleY(0);
      animation: rail-grow linear both;
      animation-timeline: scroll(root block);
    }
    @keyframes rail-grow { to { transform: scaleY(1); } }
  }
  .rail__nodes { position: absolute; inset: 0; list-style: none; }
  .rail__nodes li {
    position: absolute; left: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px;
    border-radius: 50%; background: var(--bg); border: 2px solid var(--line);
    transition: border-color .3s, background-color .3s, transform .3s var(--pop);
  }
  .rail__nodes li.is-lit { border-color: var(--accent); background: var(--accent); transform: scale(1.35); }
  .rail__nodes li::after {
    content: attr(data-label);
    position: absolute; left: 1.05rem; top: 50%; transform: translateY(-50%);
    font: 600 .6rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase;
    color: var(--faint); white-space: nowrap; opacity: 0; transition: opacity .25s, color .25s;
  }
  .rail__nodes li.is-lit::after { opacity: 1; color: var(--accent-ink); }
}

/* --------------------------------------------------------------------------
   11. Arc timeline
   -------------------------------------------------------------------------- */
.arc__track { list-style: none; }
.arc__node { position: relative; padding: 0 0 clamp(1.5rem, 3.5vw, 2.4rem) 3.4rem; }
.arc__node:last-child { padding-bottom: 0; }

.arc__node::before {
  content: ""; position: absolute;
  left: 1.155rem; top: 2.6rem; bottom: -.2rem; width: 2px;
  /* Holding colour through the middle matters: fading straight to --line makes
     the pipe effectively invisible against the background. */
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-soft) 42%, var(--line) 100%);
  transform: scaleY(0); transform-origin: top center;
  transition: transform .75s var(--ease);
}
.arc__node:last-child::before { display: none; }
.arc__node.is-in::before { transform: scaleY(1); }

.arc__bubble {
  position: absolute; left: 0; top: .2rem;
  display: grid; place-items: center;
  width: 2.35rem; height: 2.35rem; border-radius: 50%;
  border: 2px solid var(--accent); background: var(--bg);
  font: 650 .6rem/1 var(--mono); letter-spacing: .05em; color: var(--accent-ink);
}
.arc__rail { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .7rem; margin: 0 0 .25rem; font: 500 .77rem/1.4 var(--mono); color: var(--muted); }
.arc__loc { color: var(--faint); }

/* The company name is far too long to sit in the narrow rail without
   colliding with the bubble and the heading — it stays in the content column. */
.arc__meta { margin: 0 0 var(--s2); display: flex; align-items: center; gap: var(--s2); }
.arc__co { font: 650 .82rem/1.4 var(--mono); color: var(--fg); }

.arc__title { margin-bottom: var(--s2); }
.arc__body { color: var(--muted); max-width: 62ch; margin-bottom: var(--s2); }
.arc__metric { display: inline-block; font: 500 .79rem/1.4 var(--mono); color: var(--muted); border-left: 2px solid var(--accent); padding-left: var(--s3); }
.arc__metric b { color: var(--accent-2-ink); font-weight: 650; }

/* --------------------------------------------------------------------------
   12. Logo lockups
   Both existing marks are dark ink on transparent: Aleph is 400x200 (2:1),
   L&T is 354x54 (6.6:1). A square avatar cannot serve both, and on a dark
   background they are ~1.5:1 — invisible. So: a fixed-HEIGHT, auto-width
   lockup on a light chip, with per-employer --logo-h.
   -------------------------------------------------------------------------- */
.lockup {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  /* Chip height is FIXED and the logo scales inside it. Deriving the chip
     from the logo made every employer's chip a different height, and equal
     logo heights are impossible anyway: L&T is a 6.6:1 wordmark, Aleph is a
     2:1 stacked lockup. */
  height: var(--chip-h, 3.25rem);
  padding: 8px 12px; border-radius: 10px;
  background: var(--chip); border: 1px solid var(--chip-line);
}
.lockup img { height: var(--logo-h, 34px); width: auto; max-width: 180px; object-fit: contain; }

/* The Cerebre mark ships with a flat #dedede backdrop baked in, which reads as
   a grey block on the white chip. brightness(1.149) maps 222 -> 255 exactly,
   whitening the backdrop while leaving the dark ink dark. Done in CSS so the
   supplied file is never modified. */
.lockup--lift img { filter: brightness(1.149); }

/* Fallback when no file exists — a designed variant, not an error state. */
.lockup--mono {
  width: var(--chip-h, 3.25rem);
  background: color-mix(in srgb, var(--tint, #1e88c7) 14%, #ffffff);
  border-color: color-mix(in srgb, var(--tint, #1e88c7) 30%, transparent);
}
.lockup--mono::before {
  content: attr(data-mono);
  font: 700 calc(var(--chip-h, 3.25rem) * .33)/1 var(--display); letter-spacing: .02em;
  color: color-mix(in srgb, var(--tint, #1e88c7) 78%, #0e1620);
}
@media (max-width: 719px) {
  .lockup { height: calc(var(--chip-h, 3.25rem) * .82); padding: 6px 9px; }
  .lockup img { height: calc(var(--logo-h, 30px) * .82); }
  .lockup--mono { width: calc(var(--chip-h, 3.25rem) * .82); }
}

/* --------------------------------------------------------------------------
   13. Experience
   -------------------------------------------------------------------------- */
.job { padding-block: clamp(1.25rem, 2.5vw, 1.75rem); }
.job + .job { border-top: 1px solid var(--line-soft); }

.job__head { display: grid; grid-template-columns: auto 1fr; gap: var(--s2) var(--s4); align-items: center; margin-bottom: var(--s4); }
.job__logo { grid-row: 1 / 3; align-self: center; }
.job__co { margin-bottom: .2rem; }
.job__line { grid-column: 2; display: flex; flex-wrap: wrap; gap: .2rem .8rem; font: 500 .77rem/1.5 var(--mono); }
.job__role { color: var(--accent-ink); }
.job__dates, .job__loc { color: var(--faint); }
.job__summary { grid-column: 1 / -1; color: var(--muted); margin-top: var(--s2); max-width: 70ch; }

@media (min-width: 1180px) {
  .job__projects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap-grid); align-items: start; }
  .job__projects > .proj { margin-top: 0; }
  .proj--wide { grid-column: 1 / -1; }
}

.proj {
  position: relative; overflow: hidden;
  border: 1px solid var(--line-soft); border-left: 2px solid var(--accent);
  border-radius: var(--r-sm); padding: var(--pad-card);
  background: var(--surface); margin-top: var(--s3);
}
.proj__title { font-size: .97rem; margin-bottom: .15rem; }
.proj__title .where { color: var(--accent-ink); font-weight: 500; font-family: var(--sans); }
.proj__meta { font: 500 .69rem/1.5 var(--mono); color: var(--faint); margin-bottom: var(--s2); }
.proj ul { list-style: none; display: grid; gap: .4rem; }
.proj li { position: relative; padding-left: 1rem; color: var(--muted); font-size: .89rem; }
.proj li::before { content: ""; position: absolute; left: 0; top: .6em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

/* Native <details>: keyboard-accessible for free, and Chrome's Ctrl+F finds
   text inside a closed one. No JS. */
.more { margin-top: var(--s4); }
.more > summary {
  cursor: pointer; list-style: none;
  display: inline-flex; align-items: center; gap: var(--s2);
  font: 650 .78rem/1 var(--mono); letter-spacing: .05em; color: var(--accent-ink);
  padding: .55rem .9rem; border: 1px dashed var(--line); border-radius: var(--r-sm);
  transition: border-color .2s, background-color .2s;
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary:hover { border-color: var(--accent); background: var(--glow); }
.more > summary::after { content: "+"; font-size: 1.1em; line-height: 1; }
.more[open] > summary::after { content: "\2212"; }

/* --------------------------------------------------------------------------
   14. Project cards + cursor spotlight
   -------------------------------------------------------------------------- */
.cards { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: var(--gap-grid); }

.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: var(--pad-card); overflow: hidden;
  contain: layout paint;                      /* bounds spotlight invalidation */
  transition: transform .2s var(--ease), border-color .2s;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); }

/* Spotlight. --mx/--my are written on pointermove, rAF-coalesced.
   pointer-events:none is MANDATORY: this pseudo-element paints above
   .card__link::after (the stretched hit target) and would eat every click. */
.card::after, .proj::after, .contact__card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  pointer-events: none; opacity: 0; transition: opacity .25s ease;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 0px), var(--spot), transparent 64%);
}
@media (hover: hover) {
  .card:hover::after, .proj:hover::after, .contact__card:hover::after { opacity: 1; }
}

.card__title { position: relative; font-size: 1rem; margin-bottom: var(--s2); }
.card__link { color: var(--fg); text-decoration: none; }
/* Stretched link: one accessible link, whole card is the click target. */
.card__link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.card:hover .card__link { color: var(--accent-ink); }
.card__link:focus-visible { outline: none; }
.card:has(.card__link:focus-visible) { outline: 2px solid var(--accent-ink); outline-offset: 3px; }

.card__desc { position: relative; color: var(--muted); font-size: .88rem; margin-bottom: var(--s3); }
.card__tags { position: relative; list-style: none; display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: var(--s3); }
.card__tags li { font: 500 .66rem/1 var(--mono); color: var(--muted); background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-sm); padding: .3rem .5rem; }

.card__meta { position: relative; margin-top: auto; display: flex; align-items: center; gap: var(--s4); font: 500 .74rem/1 var(--mono); color: var(--muted); padding-top: var(--s3); border-top: 1px solid var(--line-soft); }
.card__meta > span { display: inline-flex; align-items: center; gap: .4rem; }
/* Language colour is never the only signal — the name is always beside it. */
.dot { width: .58rem; height: .58rem; border-radius: 50%; background: var(--dot, #8b949e); flex: 0 0 auto; }
.stars .icon { width: .82rem; height: .82rem; fill: var(--accent-2-ink); }

.projects__foot { margin-top: var(--s5); display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
.projects__note { font: 500 .72rem/1.5 var(--mono); color: var(--faint); }

/* --------------------------------------------------------------------------
   15. Skills — tool chips
   Only ~10 of these tools have a logo anywhere. DWSIM, Aspen HYSYS, PRO-II,
   HTRI, exSILentia, SMath, Bluebeam and Studio Pro have none. So the tinted
   monogram is the PRIMARY design and a logo is an upgrade that drops into an
   identically-sized box with zero layout shift.
   -------------------------------------------------------------------------- */
.skills { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(252px, 1fr)); gap: var(--gap-grid); }

.skillgrp { border: 1px solid var(--line-soft); border-radius: var(--r); background: var(--surface); padding: var(--pad-card); }
.skillgrp h3 {
  font: 650 var(--fs-label)/1.3 var(--mono); letter-spacing: var(--tr-label); text-transform: uppercase;
  color: var(--accent-ink); margin-bottom: var(--s3); padding-bottom: var(--s2);
  border-bottom: 1px solid var(--line-soft);
}
.tools { list-style: none; display: grid; gap: var(--s2); }

.tool {
  display: flex; align-items: center; gap: var(--s3);
  padding: .4rem .5rem; margin: -.4rem -.5rem;
  border-radius: var(--r-sm); transition: background-color .2s;
}
.tool:hover { background: var(--surface-2); }

.tool__mark {
  position: relative; flex: 0 0 auto;
  width: 2rem; height: 2rem; border-radius: 8px;
  display: grid; place-items: center; overflow: hidden;
  /* The tint chip carries brand recognition even with no logo file at all. */
  background: color-mix(in srgb, var(--tint, #7c8ea3) 16%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--tint, #7c8ea3) 34%, transparent);
}
/* Monogram is always in the box via a content attribute — no extra DOM. */
.tool__mark::before {
  content: attr(data-mono);
  font: 650 .66rem/1 var(--display); letter-spacing: .03em;
  color: color-mix(in srgb, var(--tint, #7c8ea3) 62%, var(--fg));
}
/* Logos are inlined into the page sprite rather than loaded as files. A
   `mask: url(...)` inside the stylesheet would resolve relative to the CSS
   file (assets/css/) and 404 — and an <img> of a flat-black Simple Icon is
   invisible on the dark theme. A <use> reference solves both at once. */
.tool__mark svg {
  position: relative; width: 62%; height: 62%;
  /* Mixed toward the foreground, exactly like the monogram, so a very dark
     brand colour (pandas is #150458) stays legible on the dark theme. */
  fill: color-mix(in srgb, var(--tint, #7c8ea3) 62%, var(--fg));
}
/* Hide the monogram when a real logo is present. Without :has() both render,
   but the logo sits on top of an opaque chip and simply covers it. */
.tool__mark:has(svg)::before { content: none; }

.tool__body { display: grid; min-width: 0; }
.tool__name { font-size: var(--fs-sm); color: var(--fg-2); font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool__lvl { font: 500 .64rem/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.tool[data-lvl="daily"] .tool__lvl { color: var(--accent-2-ink); }
.tool[data-lvl="advanced"] .tool__lvl { color: var(--accent-ink); }

/* --------------------------------------------------------------------------
   16. Recognition
   -------------------------------------------------------------------------- */
.recog { display: grid; grid-template-columns: 1fr; gap: clamp(1.5rem, 3.5vw, 2.5rem); }
.recog h3 { font: 650 var(--fs-label)/1.3 var(--mono); letter-spacing: var(--tr-label); text-transform: uppercase; color: var(--accent-ink); margin-bottom: var(--s4); }

.wins { list-style: none; display: grid; gap: var(--s3); }
.wins li { position: relative; padding-left: 1.7rem; color: var(--muted); font-size: .92rem; }
/* CSS glyph, not an emoji — renders identically on every platform. */
.wins li::before {
  content: ""; position: absolute; left: .1rem; top: .4em;
  width: .5rem; height: .85rem;
  border: solid var(--accent); border-width: 0 2px 2px 0; transform: rotate(42deg);
}

.edu { list-style: none; display: grid; gap: var(--s4); }
.edu li { border-left: 2px solid var(--line); padding-left: var(--s4); }
.edu strong { display: block; font-size: .97rem; }
.edu span { display: block; font: 500 .76rem/1.5 var(--mono); color: var(--muted); margin-top: .1rem; }

/* --------------------------------------------------------------------------
   17. Contact + footer
   -------------------------------------------------------------------------- */
.contact__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(225px, 1fr)); gap: var(--gap-grid); margin-top: var(--s5); }
.contact__card {
  position: relative; overflow: hidden; contain: layout paint;
  display: flex; align-items: center; gap: var(--s3);
  border: 1px solid var(--line-soft); border-radius: var(--r);
  background: var(--surface); padding: var(--pad-card);
  text-decoration: none; color: var(--fg);
  transition: transform .2s var(--ease), border-color .2s;
}
.contact__card:hover { transform: translateY(-3px); border-color: var(--accent); }
.contact__card .icon { position: relative; width: 1.3rem; height: 1.3rem; fill: var(--accent); flex: 0 0 auto; }
.contact__card b { display: block; font-size: .94rem; }
.contact__card > span { position: relative; }
.contact__card span span { display: block; font: 500 .76rem/1.4 var(--mono); color: var(--muted); word-break: break-word; }

.foot { border-top: 1px solid var(--line-soft); padding-block: var(--s6); font: 500 .76rem/1.7 var(--mono); color: var(--faint); }
.foot__in { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); align-items: center; justify-content: space-between; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--accent-ink); }

/* --------------------------------------------------------------------------
   18. Motion
   Everything that HIDES content lives under .js-anim, which main.js adds only
   after confirming IntersectionObserver exists AND reduced motion is off. If
   that class never lands, the page renders fully visible. That is the model.
   -------------------------------------------------------------------------- */
.js-anim .reveal {
  opacity: 0; transform: translateY(18px);
  transition: opacity .55s ease, transform .55s var(--ease);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.js-anim .reveal.is-in { opacity: 1; transform: none; }

/* Masked line reveal. The padding/margin pair stops overflow:hidden clipping
   the descender of the "j" in "Viraj" — the mask must sit at the baseline,
   not at the glyph box. */
.rv { display: block; }
.js-anim .rv { overflow: hidden; }
.js-anim .rv > span {
  display: block;
  padding-bottom: .14em; margin-bottom: -.14em;
  transform: translateY(106%);
  transition: transform .85s var(--ease);
  transition-delay: calc(var(--i, 0) * 95ms);
}
.js-anim .rv.is-in > span, .js-anim .is-in .rv > span { transform: none; }

/* Section h2: single clip wipe, no per-line markup needed. */
.js-anim .section__head h2 {
  clip-path: inset(0 0 100% 0); transform: translateY(12px);
  transition: clip-path .7s var(--ease), transform .7s var(--ease);
}
.js-anim .section__head.is-in h2 { clip-path: inset(0 -.6em -.2em -.6em); transform: none; }

.js-anim .arc__node > :not(.arc__bubble) {
  opacity: 0; transform: translateY(14px);
  transition: opacity .5s ease, transform .5s var(--ease); transition-delay: 120ms;
}
.js-anim .arc__node.is-in > :not(.arc__bubble) { opacity: 1; transform: none; }
.js-anim .arc__bubble { transform: scale(.4); opacity: 0; transition: transform .5s var(--pop), opacity .35s ease; }
.js-anim .arc__node.is-in .arc__bubble { transform: scale(1); opacity: 1; }

/* Scroll-driven polish. Enhancement ONLY — nothing here may be the sole
   thing that reveals content, because @supports is a capability check, not a
   correctness guarantee. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .js-anim .stat { animation: tile-rise linear both; animation-timeline: view(); animation-range: entry 8% cover 34%; }
    @keyframes tile-rise { from { transform: translateY(22px); opacity: .35; } to { transform: none; opacity: 1; } }
  }
}

/* View Transitions — circular wipe out of the theme toggle. The UA's default
   cross-fade must be cancelled or you get a muddy double-transition. */
.vt-theme::view-transition-old(root) { animation: none; z-index: 0; }
.vt-theme::view-transition-new(root) { animation: vt-wipe .45s var(--ease) both; z-index: 1; }
@keyframes vt-wipe {
  from { clip-path: circle(0 at var(--vt-x) var(--vt-y)); }
  to   { clip-path: circle(var(--vt-r) at var(--vt-x) var(--vt-y)); }
}

/* --------------------------------------------------------------------------
   19. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 719px) {
  /* Kill the only repainting layer on phones; static pipework stays as texture. */
  .pid-flow { display: none; }
  .hero__bg { opacity: .5; }
}
@media (min-width: 960px) {
  .arc__node { padding-left: 10.75rem; }
  .arc__bubble { left: 6.6rem; }
  .arc__node::before { left: 7.7125rem; }
  .arc__rail {
    position: absolute; left: 0; top: .5rem; width: 5.6rem;
    display: block; text-align: right; font-size: .73rem; line-height: 1.55;
  }
  .arc__rail .arc__loc { display: block; }
  .recog { grid-template-columns: 1.2fr 1fr; gap: var(--s7); }
}

/* --------------------------------------------------------------------------
   20. Reduced motion — blanket override, last so it always wins.
   Layer 1 of 3; the others are the .js-anim gate and the REDUCED
   short-circuit in main.js.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
    animation-timeline: none !important;
  }
  .pid-flow { display: none; }
  .hero__bg { transform: none !important; }
  .arc__node::before { transform: scaleY(1) !important; }
  .rail__fill { transform: scaleY(1) !important; animation: none !important; }
  .rv > span { transform: none !important; }
  .section__head h2 { clip-path: none !important; transform: none !important; }
  .card::after, .proj::after, .contact__card::after { display: none; }
  .btn::before { display: none; }
  .marq { overflow: visible; -webkit-mask-image: none; mask-image: none; }
  .marq__track { animation: none !important; flex-wrap: wrap; width: auto; }
  .marq__set { flex-wrap: wrap; }
  .marq__set[aria-hidden="true"] { display: none; }
  .marq__pause { display: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* --------------------------------------------------------------------------
   21. Print — a usable CV falls out of Ctrl+P, in either theme
   -------------------------------------------------------------------------- */
@media print {
  :root, [data-theme="dark"], [data-theme="light"] {
    --bg: #fff; --surface: #fff; --surface-2: #fff;
    --fg: #111; --fg-2: #222; --muted: #333; --faint: #555;
    --accent: #036; --accent-ink: #036; --accent-2: #036; --accent-2-ink: #036;
    --line: #ccc; --line-soft: #ddd; --grid-line: transparent;
    --chip: #fff; --chip-line: #ccc;
  }
  body::before, .hero::before, .hdr, .hero__bg, .skip, .rail,
  .projects__foot, .hero__cta, .foot, .marq__pause,
  .marq__set[aria-hidden="true"] { display: none !important; }
  .marq { overflow: visible; mask-image: none; }
  .marq__track { animation: none; flex-wrap: wrap; width: auto; }
  .section, .hero { padding-block: .8rem; break-inside: avoid; }
  .card, .proj, .skillgrp { border: 1px solid #ccc; break-inside: avoid; }
  .more > summary { display: none; }
  a { color: #036; text-decoration: none; }
}
