/* ==========================================================================
   Satyam Sangeet — portfolio
   Lab-notebook theme, shared with physics.html / chemistry.html:
   paper background, electric blue ink, mono labels, serif reading text.
   Light + dark themes. Canvas figures read the --rgb-* tokens via Theme.colors().
   ========================================================================== */

:root {
  /* Ink (primary blue) */
  --blue-50:  hsl(214, 100%, 97%);
  --blue-100: hsl(214, 100%, 93%);
  --blue-300: hsl(214, 100%, 75%);
  --blue-500: hsl(216, 100%, 50%);   /* #0066ff */
  --blue-600: hsl(218, 100%, 42%);
  --blue-800: hsl(222, 90%, 26%);
  --on-ink:   #ffffff;

  /* Warm greys (slightly yellow, like paper) */
  --paper:    hsl(60, 20%, 95%);     /* #f5f5f0 */
  --white:    hsl(60, 30%, 99%);     /* card / panel surface */
  --grey-200: hsl(50, 8%, 85%);
  --grey-300: hsl(50, 6%, 76%);
  --grey-500: hsl(45, 4%, 44%);
  --grey-700: hsl(40, 5%, 28%);
  --grey-900: hsl(40, 8%, 11%);

  --accent:   hsl(4, 85%, 60%);      /* the "velocity" red from FIG-001 */
  --purple:   hsl(272, 67%, 39%);
  --canvas-bg: hsl(60, 20%, 98%);
  --overlay-bg: hsla(0, 0%, 100%, 0.94);
  --nav-bg:   hsla(60, 20%, 95%, 0.88);
  --gridline: hsla(216, 60%, 50%, 0.045);

  /* Same colours as space-separated RGB, for canvas drawing with alpha */
  --rgb-ink: 0 102 255;
  --rgb-fg: 30 29 26;
  --rgb-muted: 118 116 108;
  --rgb-bg: 250 250 246;
  --rgb-surface: 253 253 250;
  --rgb-line: 205 203 195;
  --rgb-accent: 232 76 64;
  --rgb-teal: 32 158 148;

  /* Type */
  --mono:  'DM Mono', 'Courier New', monospace;
  --serif: 'Fraunces', Georgia, serif;

  /* Spacing scale: 4 8 12 16 24 32 48 64 96 128 */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px; --s10: 128px;

  --shadow-hard: 4px 4px 0 hsla(216, 100%, 50%, 0.14);
  --shadow-hard-lg: 8px 8px 0 hsla(216, 100%, 50%, 0.18);
  --radius: 6px;
  --maxw: 1080px;
  --rail-w: clamp(240px, 22vw, 340px);
  --nav-h: 60px;
  color-scheme: light;
}

/* ---------- Dark theme tokens ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --blue-50:  hsl(216, 45%, 15%);
    --blue-100: hsl(216, 45%, 21%);
    --blue-300: hsl(214, 70%, 46%);
    --blue-500: hsl(214, 100%, 66%);
    --blue-600: hsl(214, 100%, 74%);
    --blue-800: hsl(214, 100%, 84%);
    --on-ink:   hsl(222, 30%, 8%);
    --paper:    hsl(222, 18%, 8%);
    --white:    hsl(222, 16%, 12%);
    --grey-200: hsl(222, 12%, 19%);
    --grey-300: hsl(222, 10%, 27%);
    --grey-500: hsl(222, 8%, 62%);
    --grey-700: hsl(40, 8%, 78%);
    --grey-900: hsl(45, 20%, 93%);
    --accent:   hsl(4, 100%, 69%);
    --purple:   hsl(268, 85%, 76%);
    --canvas-bg: hsl(222, 18%, 10%);
    --overlay-bg: hsla(222, 18%, 12%, 0.94);
    --nav-bg:   hsla(222, 18%, 8%, 0.86);
    --gridline: hsla(214, 80%, 66%, 0.05);
    --rgb-ink: 92 158 255;
    --rgb-fg: 236 233 224;
    --rgb-muted: 150 154 164;
    --rgb-bg: 21 24 31;
    --rgb-surface: 26 30 38;
    --rgb-line: 58 64 78;
    --rgb-accent: 255 112 100;
    --rgb-teal: 78 205 196;
    --shadow-hard: 4px 4px 0 hsla(214, 100%, 66%, 0.16);
    --shadow-hard-lg: 8px 8px 0 hsla(214, 100%, 66%, 0.2);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --blue-50:  hsl(216, 45%, 15%);
  --blue-100: hsl(216, 45%, 21%);
  --blue-300: hsl(214, 70%, 46%);
  --blue-500: hsl(214, 100%, 66%);
  --blue-600: hsl(214, 100%, 74%);
  --blue-800: hsl(214, 100%, 84%);
  --on-ink:   hsl(222, 30%, 8%);
  --paper:    hsl(222, 18%, 8%);
  --white:    hsl(222, 16%, 12%);
  --grey-200: hsl(222, 12%, 19%);
  --grey-300: hsl(222, 10%, 27%);
  --grey-500: hsl(222, 8%, 62%);
  --grey-700: hsl(40, 8%, 78%);
  --grey-900: hsl(45, 20%, 93%);
  --accent:   hsl(4, 100%, 69%);
  --purple:   hsl(268, 85%, 76%);
  --canvas-bg: hsl(222, 18%, 10%);
  --overlay-bg: hsla(222, 18%, 12%, 0.94);
  --nav-bg:   hsla(222, 18%, 8%, 0.86);
  --gridline: hsla(214, 80%, 66%, 0.05);
  --rgb-ink: 92 158 255;
  --rgb-fg: 236 233 224;
  --rgb-muted: 150 154 164;
  --rgb-bg: 21 24 31;
  --rgb-surface: 26 30 38;
  --rgb-line: 58 64 78;
  --rgb-accent: 255 112 100;
  --rgb-teal: 78 205 196;
  --shadow-hard: 4px 4px 0 hsla(214, 100%, 66%, 0.16);
  --shadow-hard-lg: 8px 8px 0 hsla(214, 100%, 66%, 0.2);
  color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  font-family: var(--mono);
  background: var(--paper);
  color: var(--grey-900);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s, color .3s;
}

/* faint graph-paper grid behind everything */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--gridline) 1px, transparent 1px),
    linear-gradient(90deg, var(--gridline) 1px, transparent 1px);
  background-size: 24px 24px;
  z-index: -1;
}

a { color: inherit; }
img { display: block; max-width: 100%; }
::selection { background: var(--blue-500); color: var(--on-ink); }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--s5); }

/* ---------- Navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--grey-200);
}
.nav-inner {
  display: flex; align-items: center; gap: var(--s5);
  height: var(--nav-h); padding: 0 var(--s6);
}
.brand {
  font-weight: 500; font-size: 13px; letter-spacing: 3px;
  text-decoration: none; color: var(--blue-500); white-space: nowrap;
}
.brand span { color: var(--grey-500); }
.nav-links {
  display: flex; gap: var(--s5); list-style: none; overflow-x: auto; scrollbar-width: none;
  flex: 1; justify-content: flex-end; min-width: 0;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
  text-decoration: none; color: var(--grey-500); white-space: nowrap;
  padding: var(--s1) 0; border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--blue-500); border-bottom-color: var(--blue-500); }

.theme-toggle {
  flex: none; width: 36px; height: 36px; display: grid; place-items: center;
  background: transparent; border: 1px solid var(--grey-300); border-radius: 2px;
  color: var(--grey-700); cursor: pointer; transition: border-color .2s, color .2s, transform .2s;
}
.theme-toggle:hover { border-color: var(--blue-500); color: var(--blue-500); }
.theme-toggle:focus-visible { outline: 2px solid var(--blue-300); outline-offset: 2px; }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
}

/* ---------- Labels / dividers (theme primitives) ---------- */
.label {
  font-size: 11px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--grey-500);
}
.label.blue { color: var(--blue-500); }
.fig { font-size: 11px; letter-spacing: 2px; color: var(--blue-500); white-space: nowrap; }

.divider {
  height: 2px; width: 100%;
  background: repeating-linear-gradient(90deg, var(--grey-300) 0 8px, transparent 8px 16px);
}

/* ---------- Sections ---------- */
section { padding: var(--s9) 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s4); margin-bottom: var(--s7); flex-wrap: wrap;
}
.section-head h2 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(30px, 4.4vw, 44px); line-height: 1.1; letter-spacing: -0.5px;
}
.section-head h2 .num {
  font-family: var(--mono); font-size: 14px; font-weight: 400;
  color: var(--blue-500); letter-spacing: 2px; vertical-align: top; margin-right: var(--s3);
}
.section-head p { color: var(--grey-500); font-size: 13px; max-width: 420px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  padding: var(--s3) var(--s5);
  font-family: var(--mono); font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  background: var(--blue-500); color: var(--on-ink); border: 1px solid var(--blue-500);
  border-radius: 2px; transition: transform .15s, box-shadow .15s, background .15s;
}
.btn:hover { background: var(--blue-600); transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--blue-800); }
.btn:active { transform: none; box-shadow: none; }
.btn.ghost { background: transparent; color: var(--blue-500); }
.btn.ghost:hover { background: var(--blue-50); box-shadow: 4px 4px 0 var(--blue-300); }
.btn.sm { padding: var(--s2) var(--s4); font-size: 11px; }
.btn:focus-visible { outline: 2px solid var(--blue-300); outline-offset: 3px; }

.link-arrow {
  font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--blue-500); text-decoration: none; white-space: nowrap;
}
.link-arrow:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Panel (the simulator-wrapper look) ---------- */
.panel {
  background: var(--white);
  border: 2px solid var(--blue-500);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--grey-200);
}

/* ---------- Hero ---------- */
.hero { padding: var(--s8) 0 var(--s9); }
.hero-grid {
  display: grid; grid-template-columns: 1fr 1.1fr; gap: var(--s7); align-items: center;
}
.hero-grid > * { min-width: 0; }
.hero h1 {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(48px, 7vw, 84px); line-height: 0.95; letter-spacing: -2px;
  color: var(--grey-900); margin: var(--s4) 0 var(--s5);
}
.hero h1 em { font-style: italic; font-weight: 400; color: var(--blue-500); }
.hero .lede {
  font-family: var(--serif); font-size: 19px; line-height: 1.6; color: var(--grey-700);
  max-width: 34ch; margin-bottom: var(--s6);
}
.hero .lede b { font-weight: 600; color: var(--grey-900); }
.cta-row { display: flex; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s6); }

.social { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); list-style: none; }
.social a {
  font-size: 12px; letter-spacing: 1px; color: var(--grey-500); text-decoration: none;
}
.social a::before { content: "↗ "; color: var(--blue-300); }
.social a:hover { color: var(--blue-500); }

/* Hero figure carousel */
.sim .slides { display: grid; }
.sim .slide {
  grid-area: 1 / 1; opacity: 0; visibility: hidden; transform: translateX(16px);
  transition: opacity .45s ease, transform .45s ease, visibility 0s linear .45s;
}
.sim .slide.active {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity .45s ease, transform .45s ease, visibility 0s;
}
.sim .slide.before { transform: translateX(-16px); }
.sim .canvas-box {
  position: relative; height: 380px; background: var(--canvas-bg);
  overflow: hidden; cursor: crosshair; touch-action: pan-y;
}
.sim canvas { width: 100%; height: 100%; display: block; }
.readout {
  position: absolute; top: var(--s3); left: var(--s3);
  background: var(--overlay-bg);
  border: 1px solid var(--blue-500);
  padding: var(--s2) var(--s3);
  font-size: 11px; line-height: 1.8; pointer-events: none;
}
.readout.br { top: auto; left: auto; bottom: var(--s3); right: var(--s3); }
.readout.bl { top: auto; bottom: var(--s3); }
.readout.tr { left: auto; right: var(--s3); }
.readout div { display: flex; justify-content: space-between; gap: var(--s5); }
.readout span:first-child { color: var(--grey-500); letter-spacing: 1px; }
.readout span:last-child { color: var(--blue-500); font-weight: 500; min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }
.legend {
  position: absolute; top: var(--s3); right: var(--s3);
  background: var(--overlay-bg); border: 1px solid var(--blue-500);
  padding: var(--s2) var(--s3); font-size: 10px; line-height: 2; letter-spacing: 1px; pointer-events: none;
  color: var(--grey-700);
}
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: var(--s2); vertical-align: -1px; }
.legend i.dot { background: var(--blue-500); }
.legend i.ring { border: 1.5px solid var(--blue-500); }
.legend i.red { background: var(--accent); }
.legend i.dash { width: 12px; height: 0; border-radius: 0; border-top: 1.5px dashed var(--accent); vertical-align: 3px; }
.legend i.line { width: 12px; height: 0; border-radius: 0; border-top: 2px solid var(--blue-500); vertical-align: 3px; }
.legend i.sq { border-radius: 1px; background: var(--blue-100); border: 1px solid var(--blue-500); }

.sim-controls {
  display: grid; grid-template-columns: 1fr 1fr auto; gap: var(--s4); align-items: end;
  padding: var(--s4); border-top: 1px solid var(--grey-200);
}
.sim-controls .btns { display: flex; gap: var(--s2); }
.control-label {
  display: flex; justify-content: space-between; gap: var(--s2);
  font-size: 11px; letter-spacing: 1px; color: var(--grey-700); margin-bottom: var(--s2);
}
.control-label b { color: var(--blue-500); font-weight: 500; white-space: nowrap; }
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; background: var(--grey-200); border-radius: 2px; outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; background: var(--blue-500); border-radius: 2px; transition: transform .2s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; background: var(--blue-500); border: none; border-radius: 2px; }
input[type="range"]:focus-visible { outline: 2px solid var(--blue-300); outline-offset: 4px; }

/* radio-button slide picker */
.slide-nav {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--grey-200);
}
.slide-nav label {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--s1);
  padding: var(--s3) var(--s1); cursor: pointer; min-width: 0; text-align: center;
  font-size: 11px; letter-spacing: 0.5px; color: var(--grey-500);
  border-right: 1px dashed var(--grey-200); transition: color .2s, background .2s;
}
.slide-nav label:last-child { border-right: none; }
.slide-nav label:hover { color: var(--blue-500); background: var(--blue-50); }
.slide-nav input {
  -webkit-appearance: none; appearance: none; flex: none;
  width: 14px; height: 14px; border: 1.5px solid var(--grey-300); border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; margin: 0;
  transition: border-color .2s;
}
.slide-nav input::after {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--blue-500);
  transform: scale(0); transition: transform .2s;
}
.slide-nav input:checked { border-color: var(--blue-500); }
.slide-nav input:checked::after { transform: scale(1); }
.slide-nav input:focus-visible { outline: 2px solid var(--blue-300); outline-offset: 2px; }
.slide-nav label:has(input:checked) { color: var(--blue-500); }
.slide-nav label:has(input:checked)::before {
  content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: var(--blue-500);
}
.slide-nav .n { color: var(--blue-500); }
.slide-nav .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sim-caption { font-family: var(--serif); font-size: 14px; line-height: 1.55; color: var(--grey-500); margin-top: var(--s3); font-style: italic; min-height: 3.2em; }
.sim-caption b { font-style: normal; font-family: var(--mono); font-size: 11px; letter-spacing: 1px; color: var(--blue-500); font-weight: 500; }

/* ---------- Specimen rail (scroll-linked explode) ---------- */
.rail { display: none; }
@media (min-width: 1200px) {
  .has-rail .content { padding-right: var(--rail-w); }
  .rail {
    display: flex; flex-direction: column;
    position: fixed; top: var(--nav-h); right: 0; bottom: 0; width: var(--rail-w);
    border-left: 1px dashed var(--grey-300);
    background: linear-gradient(90deg, transparent, var(--gridline) 140%);
    z-index: 5;
  }
}
.rail-head, .rail-foot { padding: var(--s4) var(--s5); }
.rail-head { border-bottom: 1px dashed var(--grey-200); }
.rail-head .name { font-family: var(--serif); font-size: 20px; font-weight: 600; margin-top: var(--s1); line-height: 1.2; color: var(--grey-900); }
.rail-head .sub { font-size: 11px; color: var(--grey-500); margin-top: var(--s1); }
.rail-canvas { flex: 1; position: relative; min-height: 0; }
.rail-canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.rail-foot { border-top: 1px dashed var(--grey-200); font-size: 11px; color: var(--grey-500); }
.rail-foot .row { display: flex; justify-content: space-between; letter-spacing: 1px; }
.rail-foot .row b { color: var(--blue-500); font-weight: 500; font-variant-numeric: tabular-nums; }
.rail-ticks { display: flex; gap: var(--s1); margin-top: var(--s3); }
.rail-ticks i { flex: 1; height: 3px; background: var(--grey-200); transition: background .3s; }
.rail-ticks i.on { background: var(--blue-500); }

/* ---------- Icon links (hero + contact) ---------- */
.icon-links { display: flex; flex-wrap: wrap; gap: var(--s2); list-style: none; }
.icon-links a {
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 1px solid var(--grey-300); border-radius: 2px; color: var(--grey-700); background: var(--white);
  transition: color .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.icon-links a:hover { color: var(--blue-500); border-color: var(--blue-500); transform: translate(-2px, -2px); box-shadow: 3px 3px 0 var(--blue-100); }
.icon-links a:focus-visible { outline: 2px solid var(--blue-300); outline-offset: 2px; }
.icon-links svg { width: 18px; height: 18px; fill: currentColor; }

/* ---------- Skill graph ---------- */
.sg-body { display: grid; grid-template-columns: 1fr 300px; }
.sg-canvas { position: relative; height: 460px; background: var(--canvas-bg); border-right: 1px solid var(--grey-200); }
.sg-canvas svg { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
.sg-link { stroke: var(--grey-300); stroke-width: 1; transition: stroke .2s, opacity .2s; }
.sg-link.shared { stroke: var(--blue-300); stroke-dasharray: 3 3; }
.sg-link.hub { stroke: var(--grey-200); stroke-width: 2; }
.sg-node { cursor: grab; outline: none; }
.sg-node .hit { fill: transparent; }
.sg-node:active { cursor: grabbing; }
.sg-node circle { fill: var(--white); stroke: var(--blue-500); stroke-width: 1.5; transition: fill .2s, stroke-width .2s; }
.sg-node.evidenced circle { fill: var(--blue-500); fill-opacity: .85; }
.sg-node.hub circle { fill: var(--blue-500); fill-opacity: 1; stroke-width: 3; stroke: var(--blue-100); }
.sg-node text { font-family: var(--mono); font-size: 11px; fill: var(--grey-700); transition: fill .2s, opacity .2s; }
.sg-node.hub text { font-size: 10px; letter-spacing: 2px; fill: var(--blue-500); font-weight: 500; }
.sg-node:hover circle, .sg-node.focus circle { stroke-width: 3; }
.sg-node:focus-visible circle { stroke: var(--accent); stroke-width: 3; }
svg.dim .sg-node:not(.on) { opacity: .22; }
svg.dim .sg-link:not(.on) { opacity: .12; }
.sg-link.on { stroke: var(--accent); stroke-dasharray: none; stroke-width: 1.5; opacity: 1; }
.sg-node.on text { fill: var(--grey-900); }
.sg-node.focus text { fill: var(--accent); font-weight: 500; }
.sg-node { transition: opacity .2s; }
.sg-detail { padding: var(--s5); overflow-y: auto; max-height: 460px; }
.sg-detail h3 { font-family: var(--serif); font-size: 24px; font-weight: 600; line-height: 1.2; margin: var(--s2) 0 var(--s3); }
.sg-detail p { font-size: 13px; color: var(--grey-700); line-height: 1.7; }
.sg-sub { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--grey-500); margin: var(--s4) 0 var(--s2); }
.sg-work { list-style: none; }
.sg-work li { padding: var(--s2) 0; border-bottom: 1px dashed var(--grey-200); }
.sg-work a { display: block; font-family: var(--serif); font-size: 15px; line-height: 1.35; color: var(--grey-900); text-decoration: none; }
.sg-work a:hover { color: var(--blue-500); }
.sg-work span { font-size: 11px; color: var(--grey-500); }
.sg-tags { display: flex; flex-wrap: wrap; gap: var(--s1); list-style: none; margin-top: var(--s2); }
.sg-tags li { font-size: 11px; color: var(--blue-600); background: var(--blue-50); padding: 2px var(--s2); border-radius: 2px; }
.sg-filters { padding: var(--s3) var(--s4); border-top: 1px solid var(--grey-200); }

/* ---------- Contact form ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 336px; gap: var(--s7); align-items: start; }
.form-body { padding: var(--s5); display: flex; flex-direction: column; gap: var(--s4); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.field { display: flex; flex-direction: column; gap: var(--s2); }
.field span { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--grey-500); }
.field input, .field textarea {
  font-family: var(--mono); font-size: 14px; color: var(--grey-900);
  background: var(--canvas-bg); border: 1px solid var(--grey-300); border-radius: 2px;
  padding: var(--s3); outline: none; resize: vertical; transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder, .field textarea::placeholder { color: var(--grey-500); opacity: .7; }
.field input:focus, .field textarea:focus { border-color: var(--blue-500); box-shadow: 3px 3px 0 var(--blue-100); }
.field.invalid input, .field.invalid textarea { border-color: var(--accent); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }
.form-status { font-size: 12px; color: var(--grey-500); min-height: 1.4em; }
.form-status.ok { color: var(--blue-500); }
.form-status.err { color: var(--accent); }
.btn:disabled { opacity: .6; cursor: progress; transform: none; box-shadow: none; }
.contact-side .label { margin-bottom: var(--s2); }
.contact-side .label:not(:first-child) { margin-top: var(--s6); }
.side-email { font-size: 15px; color: var(--blue-500); text-decoration: none; border-bottom: 1px solid var(--blue-300); word-break: break-all; }
.side-email:hover { border-color: var(--blue-500); }
.side-loc { font-family: var(--serif); font-size: 18px; color: var(--grey-700); }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: var(--s8); }
.prose { font-family: var(--serif); font-size: 18px; line-height: 1.75; color: var(--grey-700); }
.prose p + p { margin-top: var(--s4); }
.prose.dropcap > p:first-child::first-letter {
  font-size: 64px; float: left; line-height: 0.85; margin: 6px var(--s3) 0 0;
  font-weight: 700; color: var(--blue-500);
}
.focus-list { list-style: none; border-top: 1px solid var(--grey-300); }
.focus-list li {
  display: grid; grid-template-columns: 40px 1fr; gap: var(--s3);
  padding: var(--s4) 0; border-bottom: 1px solid var(--grey-300);
}
.focus-list .n { font-size: 12px; color: var(--blue-500); letter-spacing: 1px; padding-top: 3px; }
.focus-list h3 { font-family: var(--serif); font-size: 20px; font-weight: 600; line-height: 1.3; }
.focus-list p { font-size: 13px; color: var(--grey-500); margin-top: var(--s1); }

/* ---------- Publications ---------- */
.pub-list { list-style: none; }
.pub {
  display: grid; grid-template-columns: 72px 1fr auto; gap: var(--s5);
  padding: var(--s5) 0; border-bottom: 1px solid var(--grey-300); align-items: start;
}
.pub:first-child { border-top: 1px solid var(--grey-300); }
.pub .ref { font-size: 12px; color: var(--blue-500); letter-spacing: 1px; padding-top: 4px; }
.pub .ref small { display: block; color: var(--grey-500); font-size: 11px; margin-top: var(--s1); }
.pub h3 { font-family: var(--serif); font-weight: 600; font-size: 20px; line-height: 1.35; }
.pub h3 a { text-decoration: none; background-image: linear-gradient(var(--blue-500), var(--blue-500)); background-size: 0 1px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .3s; }
.pub h3 a:hover { background-size: 100% 1px; color: var(--blue-600); }
.pub .authors { font-size: 13px; color: var(--grey-500); margin-top: var(--s2); }
.pub .authors b { color: var(--grey-900); font-weight: 500; }
.pub .journal { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--grey-700); margin-top: var(--s1); }
.pub details { margin-top: var(--s3); }
.pub summary { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--blue-500); cursor: pointer; list-style: none; }
.pub summary::-webkit-details-marker { display: none; }
.pub summary::before { content: "+ "; }
.pub details[open] summary::before { content: "− "; }
.pub details p { font-family: var(--serif); font-size: 15px; line-height: 1.7; color: var(--grey-700); margin-top: var(--s3); max-width: 70ch; }
.pub .doi { font-size: 11px; color: var(--grey-500); text-decoration: none; white-space: nowrap; padding-top: 4px; }
.pub .doi:hover { color: var(--blue-500); }
.tag-status { display: inline-block; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); border: 1px solid currentColor; padding: 0 6px; margin-left: var(--s2); vertical-align: 3px; font-family: var(--mono); font-style: normal; }

/* ---------- Project cards ---------- */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s5); perspective: 1200px; }
.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--white); border: 1px solid var(--grey-300); border-radius: var(--radius);
  transition: border-color .25s, box-shadow .25s, transform .25s ease-out;
  transform-style: preserve-3d; will-change: transform;
}
.card:hover { border-color: var(--blue-500); box-shadow: var(--shadow-hard-lg); }
.card .panel-head { border-bottom-style: dashed; }
.card .status { display: inline-flex; align-items: center; gap: 6px; }
.card .status::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--blue-500);
  animation: blink 1.6s steps(2, start) infinite; animation-play-state: paused;
}
.card-art { position: relative; height: 150px; border-bottom: 1px solid var(--grey-200); background: var(--canvas-bg); overflow: hidden; color: var(--blue-500); }
.card-art svg { width: 100%; height: 100%; display: block; }
.card-art .mute { stroke: var(--grey-300); }
.card-art .mute-fill { fill: var(--grey-500); }
.card-art .acc { stroke: var(--accent); }
.card-art .tealc { stroke: rgb(var(--rgb-teal)); }
.card-art text { font-family: var(--mono); font-size: 10px; fill: var(--grey-500); }
/* card scan line on hover */
.card-art::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -40%;
  background: linear-gradient(90deg, transparent, hsla(214, 100%, 60%, 0.12), transparent);
  pointer-events: none;
}
.card:hover .card-art::after { animation: sweep 1.1s ease-out; }
.card-body { padding: var(--s5); display: flex; flex-direction: column; gap: var(--s3); flex: 1; }
.card h3 { font-family: var(--serif); font-size: 24px; font-weight: 600; line-height: 1.2; }
.card h3 small { display: block; font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--grey-500); letter-spacing: 1px; margin-top: var(--s1); }
.card p { font-size: 13px; color: var(--grey-700); line-height: 1.7; }
.tags { display: flex; flex-wrap: wrap; gap: var(--s2); list-style: none; }
.tags li { font-size: 11px; color: var(--blue-600); background: var(--blue-50); padding: 2px var(--s2); border-radius: 2px; }
.card-links { display: flex; gap: var(--s4); margin-top: auto; padding-top: var(--s3); }

/* card entrance: plotted in from a baseline, staggered */
.cards .card.reveal { opacity: 0; transform: translateY(40px) rotateX(10deg); transform-origin: 50% 100%; }
.cards .card.reveal.in { opacity: 1; transform: none; transition: opacity .7s ease, transform .8s cubic-bezier(.2,.8,.2,1); }
.cards .card.reveal.in:nth-child(2) { transition-delay: .12s; }
.cards .card.reveal.in:nth-child(3) { transition-delay: .24s; }
.cards .card.reveal.in:nth-child(4) { transition-delay: .36s; }
.cards .card.reveal.in.settled { transition: border-color .25s, box-shadow .25s, transform .25s ease-out; transition-delay: 0s; }

/* animated card art — only runs while .playing */
.card-art * { animation-play-state: paused !important; }
.card.playing .card-art *, .card.playing .status::before { animation-play-state: running !important; }
.trace-draw { stroke-dasharray: 600; stroke-dashoffset: 600; animation: draw 5s ease-in-out infinite; }
.trace-draw.d2 { animation-delay: .25s; }
.scanline { animation: scan 5s ease-in-out infinite; }
.doc-line { transform-box: fill-box; transform-origin: 100% 50%; animation: condense 4.5s ease-in-out infinite; }
.sum-line { transform-box: fill-box; transform-origin: 0 50%; animation: grow 4.5s ease-in-out infinite; }
.arrow-pulse { animation: nudge 4.5s ease-in-out infinite; }
.node-pulse { transform-box: fill-box; transform-origin: center; animation: pulse 2.4s ease-in-out infinite; }

@keyframes draw { 0% { stroke-dashoffset: 600; } 55%, 85% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -600; } }
@keyframes scan { 0% { transform: translateX(0); } 55% { transform: translateX(376px); } 56%, 100% { transform: translateX(376px); opacity: 0; } }
@keyframes condense { 0%, 10% { transform: none; opacity: 1; } 40% { transform: scaleX(.15) translateX(40px); opacity: 0; } 85% { opacity: 0; transform: scaleX(.15); } 100% { transform: none; opacity: 1; } }
@keyframes grow { 0%, 35% { transform: scaleX(0); } 60%, 88% { transform: scaleX(1); } 100% { transform: scaleX(0); } }
@keyframes nudge { 0%, 15% { transform: translateX(0); opacity: .4; } 40% { transform: translateX(8px); opacity: 1; } 60%, 100% { transform: translateX(0); opacity: .4; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
@keyframes sweep { from { left: -40%; } to { left: 110%; } }
@keyframes blink { to { visibility: hidden; } }

/* ---------- Notebook (interactive articles) ---------- */
.notes { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s5); }
.note {
  display: grid; grid-template-columns: 140px 1fr; text-decoration: none;
  background: var(--white); border: 1px solid var(--grey-300); border-radius: var(--radius); overflow: hidden;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.note:hover { border-color: var(--blue-500); box-shadow: var(--shadow-hard-lg); transform: translate(-3px, -3px); }
.note .thumb { background: var(--canvas-bg); border-right: 1px dashed var(--grey-300); color: var(--blue-500); }
.note.purple .thumb { color: var(--purple); }
.note .thumb svg { width: 100%; height: 100%; display: block; }
.note .thumb .mute { stroke: var(--grey-300); }
.note .body { padding: var(--s5); }
.note h3 { font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.25; margin: var(--s2) 0; }
.note p { font-size: 13px; color: var(--grey-500); }
.note.purple .fig { color: var(--purple); }

/* ---------- Timeline ---------- */
.timeline-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s8); }
.timeline { list-style: none; border-left: 2px solid var(--blue-100); margin-top: var(--s5); }
.timeline li { position: relative; padding: 0 0 var(--s6) var(--s5); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: 6px;
  width: 12px; height: 12px; background: var(--paper); border: 2px solid var(--blue-500); border-radius: 50%;
}
.timeline li.now::before { background: var(--blue-500); box-shadow: 0 0 0 4px var(--blue-100); }
.timeline .when { font-size: 12px; color: var(--blue-500); letter-spacing: 1px; }
.timeline h3 { font-family: var(--serif); font-size: 20px; font-weight: 600; line-height: 1.3; margin-top: var(--s1); }
.timeline p { font-size: 13px; color: var(--grey-500); }

/* ---------- Toolkit ---------- */
.toolkit { display: grid; grid-template-columns: repeat(5, 1fr); border: 1px solid var(--grey-300); background: var(--white); border-radius: var(--radius); }
.tool-col { padding: var(--s5) var(--s4); border-right: 1px dashed var(--grey-300); }
.tool-col:last-child { border-right: none; }
.tool-col h3 { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--blue-500); font-weight: 500; margin-bottom: var(--s4); }
.tool-col ul { list-style: none; }
.tool-col li { font-size: 13px; color: var(--grey-700); padding: var(--s1) 0; }
.tool-col li::before { content: "› "; color: var(--blue-300); }

/* ---------- Mentors ---------- */
.mentors { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--s5); }
.mentors.three { grid-template-columns: repeat(3, 1fr); }
.mentor {
  background: var(--white); border: 1px solid var(--grey-300); border-radius: var(--radius);
  padding: var(--s5); text-decoration: none; display: flex; flex-direction: column; gap: var(--s3);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
a.mentor:hover { border-color: var(--blue-500); box-shadow: var(--shadow-hard); transform: translate(-2px, -2px); }
.mentor img {
  width: 72px; height: 72px; object-fit: cover; border-radius: 50%;
  border: 2px solid var(--blue-500); padding: 3px; background: var(--white);
}
.mentor h3 { font-family: var(--serif); font-size: 19px; font-weight: 600; line-height: 1.25; }
.mentor .role { font-size: 12px; color: var(--grey-700); }
.mentor .inst { font-size: 12px; color: var(--grey-500); }
.mentor .areas { font-size: 11px; color: var(--blue-600); letter-spacing: 0.5px; margin-top: auto; }

/* ---------- Contact ---------- */
.contact { text-align: center; padding: var(--s10) 0; }
.contact h2 { font-family: var(--serif); font-size: clamp(36px, 6vw, 64px); font-weight: 600; letter-spacing: -1px; line-height: 1.05; }
.contact h2 em { font-weight: 400; color: var(--blue-500); }
.contact p { font-family: var(--serif); font-size: 18px; color: var(--grey-500); max-width: 48ch; margin: var(--s5) auto var(--s6); }
.contact .email {
  display: inline-block; font-size: clamp(16px, 2.6vw, 24px); color: var(--blue-500); text-decoration: none;
  border-bottom: 2px solid var(--blue-500); padding-bottom: var(--s1); word-break: break-all;
}
.contact .email:hover { color: var(--blue-800); border-color: var(--blue-800); }
.contact .social { justify-content: center; margin-top: var(--s6); }
.contact .loc { font-size: 12px; letter-spacing: 2px; color: var(--grey-500); text-transform: uppercase; margin-top: var(--s5); }

footer { border-top: 1px solid var(--grey-300); padding: var(--s5) 0; }
footer .wrap { display: flex; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; font-size: 11px; letter-spacing: 1px; color: var(--grey-500); }
footer a { color: var(--grey-500); text-decoration: none; }
footer a:hover { color: var(--blue-500); }

/* ---------- Sub-page header ---------- */
.page-head { padding: var(--s8) 0 var(--s6); }
.page-head h1 { font-family: var(--serif); font-size: clamp(40px, 7vw, 72px); font-weight: 700; letter-spacing: -1.5px; line-height: 1; margin-top: var(--s3); }
.page-head p { font-family: var(--serif); font-size: 18px; color: var(--grey-500); margin-top: var(--s4); max-width: 56ch; }

.toolbar { display: flex; gap: var(--s4); align-items: center; flex-wrap: wrap; margin-bottom: var(--s6); }
.chips { display: flex; gap: var(--s2); flex-wrap: wrap; }
.chip {
  font-family: var(--mono); font-size: 12px; letter-spacing: 1px;
  padding: var(--s1) var(--s3); border: 1px solid var(--grey-300); background: var(--white); color: var(--grey-700);
  border-radius: 2px; cursor: pointer; transition: all .15s;
}
.chip:hover { border-color: var(--blue-500); color: var(--blue-500); }
.chip[aria-pressed="true"] { background: var(--blue-500); border-color: var(--blue-500); color: var(--on-ink); }
.chip .c { opacity: .6; margin-left: var(--s1); }
.search {
  flex: 1; min-width: 200px; font-family: var(--mono); font-size: 13px; color: var(--grey-900);
  padding: var(--s2) var(--s3); border: 1px solid var(--grey-300); background: var(--white); border-radius: 2px; outline: none;
}
.search:focus { border-color: var(--blue-500); box-shadow: 3px 3px 0 var(--blue-100); }
.count { font-size: 12px; color: var(--grey-500); margin-top: var(--s5); }
.empty { padding: var(--s7) 0; text-align: center; color: var(--grey-500); font-family: var(--serif); font-style: italic; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal, .cards .card.reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
  .card-art *, .card .status::before { animation: none !important; }
  .trace-draw { stroke-dashoffset: 0; }
  .sum-line { transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .hero-grid, .about-grid, .timeline-grid { grid-template-columns: 1fr; gap: var(--s7); }
  .hero .lede { max-width: 52ch; }
}
@media (max-width: 900px) {
  .sg-body, .contact-grid { grid-template-columns: 1fr; }
  .sg-canvas { border-right: none; border-bottom: 1px solid var(--grey-200); }
  .sg-detail { max-height: none; }
  .toolkit { grid-template-columns: repeat(2, 1fr); }
  .tool-col { border-bottom: 1px dashed var(--grey-300); }
  .notes, .cards, .mentors.three { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .sg-canvas { height: 620px; }
  .sg-node text { font-size: 10px; }
  .field-row { grid-template-columns: 1fr; }
  .wrap { padding: 0 var(--s4); }
  .nav-inner { padding: 0 var(--s4); gap: var(--s4); }
  section { padding: var(--s8) 0; }
  .hero { padding-top: var(--s6); }
  .sim .canvas-box { height: 340px; }
  .sim-controls { grid-template-columns: 1fr 1fr; }
  .sim-controls .btns { grid-column: 1 / -1; }
  .sim-controls .btns .btn { flex: 1; }
  .legend { display: none; }
  .slide-nav label { padding: var(--s2) var(--s1); font-size: 10px; }
  .slide-nav .t { max-width: 100%; white-space: normal; line-height: 1.35; }
  .pub { grid-template-columns: 1fr; gap: var(--s2); }
  .pub .ref small { display: inline; margin-left: var(--s2); }
  .note { grid-template-columns: 1fr; }
  .note .thumb { height: 120px; border-right: none; border-bottom: 1px dashed var(--grey-300); }
  .toolkit { grid-template-columns: 1fr; }
  .tool-col { border-right: none; }
  .brand span { display: none; }
  .panel-head .label { letter-spacing: 1.5px; font-size: 10px; }
}
