/* =====================================================================
   Nov — portfolio
   Calm, near-monochrome frame; the game art supplies the colour.
   Interaction motif: a production blueprint. Gold marks whatever is
   active — the cursor, the traced dependency path, the lit dots.
   ===================================================================== */

/* ---------- Tokens ---------- */
:root {
  /* The image optimizer mattes transparent art onto --surface (20,20,22), so keep them in sync. */
  --bg: #0c0c0d;
  --surface: #141416;
  --surface-2: #1b1b1e;
  --surface-3: #232327;
  --line: rgba(236, 235, 230, 0.09);
  --line-strong: rgba(236, 235, 230, 0.18);
  --text: #ecebe6;
  --text-2: #b6b5ae;
  --muted: #7d7c76;
  --accent: #f2c230;
  --accent-soft: rgba(242, 194, 48, 0.12);
  --accent-ink: #141006;

  --font-sans: 'Archivo', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --gutter: clamp(16px, 4vw, 56px);
  --max: 1440px;
  --radius: 14px;
  --radius-sm: 8px;
  --header-h: 72px;
  --section-y: clamp(96px, 13vw, 184px);

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: dark;
}

/* ---------- 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(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
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; }
h1, h2, h3, h4, h5, p, ul, ol, dl, dd, figure { margin: 0; }
h1, h2, h3, h4 { text-wrap: balance; }
ul, ol { padding: 0; list-style: none; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
html.nav-open, html.lb-open { overflow: hidden; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: 12px; left: 12px; z-index: 100;
  padding: 10px 16px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 600;
  transform: translateY(-160%); transition: transform 0.2s var(--ease);
}
.skip-link:focus { transform: none; }

.container { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.muted { color: var(--muted); }

/* ---------- Type primitives ---------- */
.label, .eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  display: flex; align-items: center; gap: 10px;
}
.label .num { color: var(--accent); }
.eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px rgba(242, 194, 48, 0.14);
}
.eyebrow-sep { color: var(--muted); }

.section { position: relative; padding-block: var(--section-y); }
.section-rule {
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: var(--line); transform-origin: left center;
}
.section-head { display: grid; gap: 22px; margin-bottom: clamp(48px, 7vw, 96px); }
.section-title {
  font-size: clamp(2.5rem, 6.2vw, 5.75rem);
  line-height: 0.98;
  font-weight: 650;
  font-stretch: 112%;
  letter-spacing: -0.035em;
}
.section-intro { max-width: 66ch; color: var(--text-2); font-size: clamp(1.05rem, 1.4vw, 1.2rem); }
.section-intro em { font-style: normal; color: var(--text); }
.subhead {
  margin: clamp(80px, 10vw, 136px) 0 28px;
  font-family: var(--font-mono); font-weight: 400; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2);
}

/* ---------- Buttons & links ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 24px; border-radius: 999px;
  font-weight: 600; font-size: 15px; letter-spacing: 0.005em; white-space: nowrap;
  border: 1px solid transparent;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.btn-small { height: 40px; padding: 0 18px; font-size: 14px; }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: #ffd54a; }
.btn-ghost { border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--text); }
.text-link {
  display: inline-flex; gap: 6px; color: var(--text);
  border-bottom: 1px solid var(--line-strong); padding-bottom: 2px;
  transition: border-color 0.2s var(--ease);
}
.text-link:hover { border-color: var(--accent); }

/* Magnetic controls: springy return, tight follow while the pointer is on them. */
[data-magnetic] { transition: transform 0.6s var(--ease-out), background-color 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease); }
[data-magnetic].is-magnet { transition: transform 0.12s linear, background-color 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease); }
[data-magnetic-inner] { display: inline-flex; align-items: center; gap: 10px; transition: transform 0.6s var(--ease-out); }
.is-magnet [data-magnetic-inner] { transition: transform 0.12s linear; }

/* ---------- Custom cursor (fine pointers only, added by fx.js) ---------- */
html.has-cursor, html.has-cursor * { cursor: none !important; }
.cursor { position: fixed; inset: 0; z-index: 2147483000; pointer-events: none; transition: opacity 0.3s var(--ease); }
.cursor.is-hidden { opacity: 0; }
.cursor-ring {
  position: absolute; left: 0; top: 0; width: 36px; height: 36px; border-radius: 18px;
  border: 1.5px solid rgba(236, 235, 230, 0.5);
  display: grid; place-items: center; overflow: hidden;
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease);
  will-change: transform, width, height;
}
.cursor-dot {
  position: absolute; left: -3px; top: -3px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); will-change: transform; transition: opacity 0.2s var(--ease), scale 0.2s var(--ease);
}
.cursor-label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent-ink); opacity: 0; transition: opacity 0.2s var(--ease);
}
.cursor[data-mode='link'] .cursor-ring { border-color: var(--accent); }
.cursor[data-mode='stick'] .cursor-ring { border-color: rgba(242, 194, 48, 0.7); background: rgba(242, 194, 48, 0.06); }
.cursor[data-mode='stick'] .cursor-dot { scale: 0.6; }
.cursor[data-mode='view'] .cursor-ring,
.cursor[data-mode='trace'] .cursor-ring,
.cursor[data-mode='open'] .cursor-ring,
.cursor[data-mode='drag'] .cursor-ring { background: var(--accent); border-color: var(--accent); }
.cursor[data-mode='view'] .cursor-label,
.cursor[data-mode='trace'] .cursor-label,
.cursor[data-mode='open'] .cursor-label,
.cursor[data-mode='drag'] .cursor-label { opacity: 1; }
.cursor[data-mode='view'] .cursor-dot,
.cursor[data-mode='trace'] .cursor-dot,
.cursor[data-mode='open'] .cursor-dot,
.cursor[data-mode='drag'] .cursor-dot { opacity: 0; }
.cursor.is-down .cursor-ring { background-color: rgba(242, 194, 48, 0.22); }

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 50;
  height: var(--header-h);
  transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease), backdrop-filter 0.35s var(--ease);
  border-bottom: 1px solid transparent;
}
.site-header.is-scrolled {
  background: rgba(12, 12, 13, 0.78);
  -webkit-backdrop-filter: saturate(140%) blur(16px);
  backdrop-filter: saturate(140%) blur(16px);
  border-bottom-color: var(--line);
}
.scroll-progress {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: var(--accent); transform: scaleX(0); transform-origin: left center; opacity: 0;
  transition: opacity 0.35s var(--ease);
}
.site-header.is-scrolled .scroll-progress { opacity: 1; }
.header-inner { height: 100%; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 800; font-stretch: 125%; font-size: 17px; letter-spacing: -0.02em;
}
.brand-text { display: grid; line-height: 1.1; font-weight: 700; font-stretch: 112%; font-size: 17px; letter-spacing: -0.01em; }
.brand-sub {
  display: block; overflow: hidden; height: 1.35em;
  font-family: var(--font-mono); font-weight: 400; font-stretch: 100%; font-size: 10.5px; color: var(--muted);
  letter-spacing: 0.06em; text-transform: uppercase;
}
.brand-sub-track { display: block; }

.site-nav ul { display: flex; gap: 4px; }
.site-nav a {
  position: relative; display: block; padding: 8px 14px; border-radius: 999px;
  font-size: 15px; color: var(--text-2); transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current] { color: var(--text); background: var(--surface-2); }

.menu-toggle { display: none; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line-strong); place-items: center; }
.menu-toggle-bars, .menu-toggle-bars::before, .menu-toggle-bars::after {
  display: block; width: 18px; height: 1.5px; background: var(--text); border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.2s;
}
.menu-toggle-bars { position: relative; }
.menu-toggle-bars::before, .menu-toggle-bars::after { content: ''; position: absolute; left: 0; }
.menu-toggle-bars::before { top: -6px; }
.menu-toggle-bars::after { top: 6px; }
.nav-open .menu-toggle-bars { background: transparent; }
.nav-open .menu-toggle-bars::before { transform: translateY(6px) rotate(45deg); }
.nav-open .menu-toggle-bars::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 899px) {
  .menu-toggle { display: grid; }
  .header-cta { display: none; }
  .site-nav {
    position: fixed; inset: var(--header-h) 0 0; z-index: 49;
    background: var(--bg);
    padding: 24px var(--gutter);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), visibility 0s linear 0.3s;
  }
  .nav-open .site-nav { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
  /* backdrop-filter would make the header the containing block for the fixed menu, so drop it while open. */
  .nav-open .site-header { background: var(--bg); border-bottom-color: var(--line); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav li { border-bottom: 1px solid var(--line); }
  .site-nav a {
    padding: 18px 0; border-radius: 0;
    font-size: clamp(1.75rem, 8vw, 2.5rem); font-weight: 650; font-stretch: 112%; letter-spacing: -0.03em; color: var(--text);
  }
  .site-nav a[aria-current] { background: none; color: var(--accent); }
  .nav-open .site-nav li { animation: nav-in 0.5s var(--ease) both; }
  .nav-open .site-nav li:nth-child(2) { animation-delay: 40ms; }
  .nav-open .site-nav li:nth-child(3) { animation-delay: 80ms; }
  .nav-open .site-nav li:nth-child(4) { animation-delay: 120ms; }
  .nav-open .site-nav li:nth-child(5) { animation-delay: 160ms; }
}
@keyframes nav-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Hero ---------- */
.hero { position: relative; padding-top: calc(var(--header-h) + clamp(40px, 7vw, 96px)); }
.hero-field {
  position: absolute; top: 0; left: 0; pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
}
.hero-inner { position: relative; z-index: 1; }
.hero-eyebrow { margin-bottom: clamp(24px, 4vw, 40px); flex-wrap: wrap; }
.hero-title {
  font-size: clamp(2.9rem, 9vw, 9.25rem);
  line-height: 0.9;
  font-weight: 700;
  font-stretch: 115%;
  letter-spacing: -0.045em;
}
.hero-title .line { display: block; }
.hero-title .word { display: inline-block; white-space: nowrap; }
.hero-title .char { display: inline-block; font-variation-settings: "wght" 700, "wdth" 115; }
.hero-title em { font-style: normal; color: var(--accent); }
.js .hero-title .char { opacity: 0; transform: translateY(0.42em) rotate(5deg); transform-origin: 0 100%; }
.type-in .hero-title .char {
  opacity: 1; transform: none;
  transition: opacity 0.7s var(--ease), transform 1.1s var(--ease-out);
  transition-delay: calc(var(--i) * 16ms + 100ms);
}
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 32px 64px;
  margin-top: clamp(32px, 5vw, 64px);
}
.hero-lede { max-width: 56ch; font-size: clamp(1.08rem, 1.5vw, 1.28rem); color: var(--text-2); line-height: 1.55; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.discipline-index {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: clamp(48px, 7vw, 88px);
  border-top: 1px solid var(--line);
}
.discipline-index a {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  padding: 18px 16px 18px 0;
  font-size: 15px; color: var(--text-2);
  transition: color 0.2s var(--ease);
}
.discipline-index a::before {
  content: ''; position: absolute; top: -1px; left: 0; height: 1px; width: 100%;
  background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform 0.5s var(--ease-out);
}
.discipline-index a:hover { color: var(--text); }
.discipline-index a:hover::before { transform: scaleX(1); }
.discipline-index span { font-family: var(--font-mono); font-size: 11px; color: var(--accent); letter-spacing: 0.06em; }

.hero-media { margin-top: clamp(24px, 4vw, 48px); position: relative; }
.hero-media-frame { overflow: hidden; }
.hero-media img {
  width: 100%; height: clamp(300px, 54vw, 780px); object-fit: cover; object-position: 60% 50%;
  will-change: transform;
}
.hero-media figcaption {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-top: 14px; padding-bottom: 14px;
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}

/* ---------- Facts ---------- */
.facts { padding-block: clamp(56px, 8vw, 96px); border-top: 1px solid var(--line); }
.facts-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 28px; }
.facts-grid > div { padding: 8px 24px 8px 20px; border-left: 1px solid var(--line); }
.facts-grid > div:first-child { border-left: 0; padding-left: 0; }
/* Number above label visually; in a column-reverse box flex-start is the bottom, so numbers share a baseline even when a label wraps. */
.facts-grid div { display: flex; flex-direction: column-reverse; justify-content: flex-start; gap: 6px; }
.facts-grid dt { font-size: 14px; color: var(--muted); }
.facts-grid dd {
  font-size: clamp(2.4rem, 5vw, 4.5rem); line-height: 1; font-weight: 650; font-stretch: 112%; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(48px, 8vw, 128px); }
.about-copy { display: grid; gap: 24px; color: var(--text-2); max-width: 62ch; }
.about-copy .lead { color: var(--text); font-size: clamp(1.3rem, 2.1vw, 1.75rem); line-height: 1.4; letter-spacing: -0.01em; }
.principles { display: grid; align-content: start; border-top: 1px solid var(--line); }
.principles li { padding: 22px 0; border-bottom: 1px solid var(--line); }
.principles h3 { font-size: 18px; font-weight: 650; font-stretch: 108%; letter-spacing: -0.01em; margin-bottom: 6px; }
.principles p { color: var(--text-2); font-size: 15.5px; }

/* ---------- Expertise ---------- */
.exp-list { border-top: 1px solid var(--line); }
.exp {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) minmax(0, 0.8fr);
  gap: 24px clamp(24px, 4vw, 64px);
  padding: clamp(32px, 4.5vw, 56px) 0;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: calc(var(--header-h) + 24px);
}
.exp-num { font-family: var(--font-mono); font-size: 13px; color: var(--muted); padding-top: 12px; transition: color 0.3s var(--ease); }
.exp:hover .exp-num { color: var(--accent); }
.exp-body h3 {
  font-size: clamp(1.9rem, 3.6vw, 3.25rem); line-height: 1.02; font-weight: 650; font-stretch: 112%; letter-spacing: -0.035em;
  margin-bottom: 18px; transition: transform 0.6s var(--ease-out);
}
.exp:hover .exp-body h3 { transform: translateX(10px); }
.exp-body > p { color: var(--text-2); max-width: 54ch; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.tags li {
  font-size: 13px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--text-2);
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}
.exp:hover .tags li { border-color: rgba(236, 235, 230, 0.28); color: var(--text); }
.exp-media { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--surface); align-self: start; }
.exp-media img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }

/* ---------- 3D tilt with glare (pointer driven by fx.js) ---------- */
[data-tilt] {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.7s var(--ease-out);
}
[data-tilt].is-tilting { transition: transform 0.12s linear; }
[data-tilt] img {
  transform: scale(1.06) translate3d(calc(var(--mx, 0) * -14px), calc(var(--my, 0) * -14px), 0);
  transition: transform 0.7s var(--ease-out);
}
[data-tilt].is-tilting img { transition: transform 0.15s linear; }
.exp-media::after, .jg-glare {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, 0.2), transparent 55%);
  opacity: 0; transition: opacity 0.4s var(--ease);
  mix-blend-mode: soft-light;
}
.is-tilting.exp-media::after, .is-tilting .jg-glare { opacity: 1; }

/* ---------- Workflow: production methodology ---------- */
.method-principles {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
  margin-bottom: clamp(48px, 6vw, 72px);
}
.method-principles li {
  padding: 26px 26px 28px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.mp-num {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  font-family: var(--font-mono); font-size: 12px; color: var(--accent);
  border: 1px solid rgba(242, 194, 48, 0.4); margin-bottom: 18px;
}
.method-principles h3 { font-size: 20px; font-weight: 650; font-stretch: 108%; letter-spacing: -0.015em; margin-bottom: 8px; }
.method-principles p { color: var(--text-2); font-size: 15px; }

.method {
  position: relative;
  padding: clamp(20px, 3vw, 40px);
  border-radius: 20px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 1px 1px, rgba(236, 235, 230, 0.07) 1px, transparent 1.5px) 0 0 / 26px 26px,
    #101012;
}
.method-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.method-title { font-size: clamp(1.4rem, 2.2vw, 1.9rem); font-weight: 650; font-stretch: 110%; letter-spacing: -0.025em; }
.method-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; color: var(--text-2); }
.method-legend li { display: flex; align-items: center; gap: 8px; }
.lg { display: inline-block; }
.lg-dep { width: 22px; height: 0; border-top: 1.5px solid var(--accent); }
.lg-loop { width: 22px; height: 0; border-top: 1.5px dashed var(--text-2); }
.lg-gate { width: 9px; height: 9px; border: 1.5px solid var(--accent); transform: rotate(45deg); }
.method-hint { margin: 8px 0 clamp(24px, 3vw, 36px); color: var(--muted); font-size: 14px; }
.method-fallback { list-style: decimal; padding-left: 20px; color: var(--text-2); }

/* Graph */
.mg { position: relative; padding-bottom: 76px; }
.mg-edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; z-index: 0; }
.mg-cols { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 clamp(40px, 4.5vw, 72px); }
.mg-col { display: flex; flex-direction: column; gap: 14px; }
.mg-phase {
  display: flex; align-items: baseline; gap: 10px; padding-bottom: 12px; margin-bottom: 4px;
  border-bottom: 1px solid var(--line-strong);
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2);
}
.mg-phase-n { color: var(--accent); }
.mg-node {
  position: relative; display: grid; gap: 6px; text-align: left;
  padding: 16px 18px 18px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line-strong);
  transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease), opacity 0.35s var(--ease), transform 0.4s var(--ease-out), box-shadow 0.3s var(--ease);
}
.mg-node:hover { border-color: rgba(236, 235, 230, 0.4); }
.mg-node-n { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; color: var(--muted); transition: color 0.3s var(--ease); }
.mg-node-t { font-size: 16px; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
.mg-node-s { font-size: 13.5px; line-height: 1.45; color: var(--text-2); }
.mg-node.is-active {
  border-color: var(--accent); background: #1c190f;
  box-shadow: 0 0 0 4px rgba(242, 194, 48, 0.12), 0 18px 40px -18px rgba(242, 194, 48, 0.35);
  transform: translateY(-2px);
}
.mg-node.is-active .mg-node-n, .mg-node.is-up .mg-node-n { color: var(--accent); }
.mg-node.is-up { border-color: rgba(242, 194, 48, 0.5); }
.mg-node.is-down { border-color: rgba(236, 235, 230, 0.45); }
.mg-node.is-down .mg-node-n { color: var(--text); }
.mg-node.is-dim { opacity: 0.4; }
.mg-node.is-dim:hover { opacity: 0.85; }
.js .mg:not(.is-drawn) .mg-node { opacity: 0; }
.mg.is-drawn .mg-node { animation: mg-node-in 0.7s var(--ease) backwards; animation-delay: calc(var(--i) * 70ms); }
@keyframes mg-node-in { from { opacity: 0; transform: translateY(14px); } }

/* Edges: a base line that draws itself in, plus a flowing "signal" on the traced path. */
.mg-path {
  fill: none; stroke: rgba(236, 235, 230, 0.2); stroke-width: 1.5;
  stroke-dasharray: 1; stroke-dashoffset: 1;
  transition: stroke 0.3s var(--ease), opacity 0.3s var(--ease);
}
.mg.is-drawn .mg-path { stroke-dashoffset: 0; marker-end: url(#mg-arrow); transition: stroke-dashoffset 1.1s var(--ease) var(--d), stroke 0.3s var(--ease), opacity 0.3s var(--ease); }
.mg-edge--loop .mg-path { stroke-dasharray: 0.012 0.014; stroke-dashoffset: 0; opacity: 0; }
.mg.is-drawn .mg-edge--loop .mg-path { opacity: 1; transition: opacity 0.6s var(--ease) calc(var(--d) + 600ms), stroke 0.3s var(--ease); }
.mg-flow { fill: none; stroke-width: 2; stroke-dasharray: 5 11; stroke-linecap: round; opacity: 0; transition: opacity 0.3s var(--ease); }
.mg-edge.is-up .mg-path { stroke: rgba(242, 194, 48, 0.5); marker-end: url(#mg-arrow-up); }
.mg-edge.is-up .mg-flow { stroke: var(--accent); opacity: 1; animation: mg-flow 0.9s linear infinite; }
.mg-edge.is-down .mg-path { stroke: rgba(236, 235, 230, 0.5); marker-end: url(#mg-arrow-down); }
.mg-edge.is-down .mg-flow { stroke: var(--text); opacity: 0.85; animation: mg-flow 0.9s linear infinite; }
.mg-edge.is-loop-hot .mg-path { stroke: var(--accent); opacity: 1; marker-end: url(#mg-arrow-up); }
.mg-edge.is-dim .mg-path { stroke: rgba(236, 235, 230, 0.09); }
@keyframes mg-flow { to { stroke-dashoffset: -32; } }

/* Decision gates sit in the gutters between phases (placed by workflow.js). */
.mg-gate { position: absolute; top: 34px; bottom: -58px; width: 0; border-left: 1px dashed rgba(236, 235, 230, 0.2); z-index: -1; }
.mg-gate-d {
  position: absolute; bottom: 26px; left: -6.5px; width: 12px; height: 12px;
  border: 1.5px solid var(--accent); background: var(--bg); transform: rotate(45deg);
}
.mg-gate-t {
  position: absolute; bottom: 0; left: 0; transform: translateX(-50%); white-space: nowrap;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; color: var(--text-2);
}
.mg-gate--key { border-left-color: rgba(242, 194, 48, 0.45); }
.mg-gate--key .mg-gate-d { background: var(--accent); box-shadow: 0 0 0 5px rgba(242, 194, 48, 0.16); }
.mg-gate--key .mg-gate-t { color: var(--accent); }

/* Detail panel */
.mp-panel { margin-top: 8px; padding-top: clamp(24px, 3vw, 36px); border-top: 1px solid var(--line-strong); min-height: 380px; }
.mp-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.mp-step { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.mp-nav { display: flex; gap: 8px; }
.mp-arrow {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line-strong); font-size: 16px;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease), opacity 0.2s;
}
.mp-arrow:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.mp-arrow:disabled { opacity: 0.3; cursor: default; }
.mp-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(28px, 5vw, 72px); }
.mp-title { font-size: clamp(1.6rem, 2.8vw, 2.4rem); line-height: 1.05; font-weight: 650; font-stretch: 110%; letter-spacing: -0.03em; margin-bottom: 18px; }
.mp-text { color: var(--text-2); max-width: 62ch; }
.mp-points { display: grid; gap: 10px; margin-top: 22px; }
.mp-points li { position: relative; padding-left: 22px; font-size: 15.5px; }
.mp-points li::before {
  content: ''; position: absolute; left: 2px; top: 0.62em; width: 7px; height: 7px;
  border: 1.5px solid var(--accent); transform: rotate(45deg);
}
.mp-side { display: grid; gap: 22px; align-content: start; }
.mp-block h5 { font-family: var(--font-mono); font-weight: 400; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.mp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.mp-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); font-size: 13.5px; text-align: left;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.mp-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.mp-chip-n { font-family: var(--font-mono); font-size: 11px; color: var(--accent); }
.mp-empty { color: var(--text-2); font-size: 14.5px; }
.mp-outputs { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14.5px; color: var(--text); }
.mp-outputs li::before { content: '→ '; color: var(--muted); }
.mp-loop, .mp-gate {
  position: relative; padding: 12px 14px 12px 40px; border-radius: 10px; font-size: 14px; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--line);
}
.mp-loop::before { content: '↺'; position: absolute; left: 15px; top: 10px; color: var(--accent); font-size: 16px; }
.mp-gate::before {
  content: ''; position: absolute; left: 17px; top: 17px; width: 9px; height: 9px;
  border: 1.5px solid var(--accent); transform: rotate(45deg);
}
.mp-gate--key { color: var(--text); border-color: rgba(242, 194, 48, 0.35); }
.mp-gate--key::before { background: var(--accent); }

/* Cost-of-change chart */
.cost {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px); align-items: center;
  margin-top: clamp(72px, 9vw, 120px);
}
.cost-copy { display: grid; gap: 18px; }
.cost-copy h3 { font-size: clamp(1.8rem, 3.2vw, 2.75rem); line-height: 1.02; font-weight: 650; font-stretch: 112%; letter-spacing: -0.035em; }
.cost-copy p { color: var(--text-2); max-width: 54ch; }
.cost-chart { padding: clamp(16px, 2.4vw, 28px); border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.cost-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.cost-chart figcaption { margin-top: 12px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; color: var(--text-2); }
.cc-swatch { display: inline-block; width: 9px; height: 9px; margin-right: 10px; background: var(--accent); transform: rotate(45deg); }
.cc-zone { fill: rgba(242, 194, 48, 0.07); }
.cc-zone-label { fill: var(--accent); font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.02em; }
.cc-gate { stroke: rgba(236, 235, 230, 0.2); stroke-dasharray: 3 4; }
.cc-gate--key { stroke: rgba(242, 194, 48, 0.7); }
.cc-diamond { fill: var(--surface); stroke: var(--text-2); stroke-width: 1.5; }
.cc-diamond--key { fill: var(--accent); stroke: var(--accent); }
.cc-area { fill: rgba(236, 235, 230, 0.045); }
.cc-curve { fill: none; stroke: var(--text); stroke-width: 2.5; stroke-linecap: round; }
.cc-point { fill: var(--accent); }
.cc-point--late { fill: var(--text); }
.cc-note { fill: var(--text-2); font-family: var(--font-mono); font-size: 12px; }
.cc-axis { stroke: var(--line-strong); }
.cc-label { fill: var(--text-2); font-family: var(--font-mono); font-size: 12.5px; }
.cc-axis-title { fill: var(--muted); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; }
.js .cost-chart .cc-curve { stroke-dasharray: 1; stroke-dashoffset: 1; }
.js .cost-chart .cc-area, .js .cost-chart .cc-point, .js .cost-chart .cc-note, .js .cost-chart .cc-zone, .js .cost-chart .cc-zone-label { opacity: 0; }
.js .cost-chart.is-in .cc-curve { stroke-dashoffset: 0; transition: stroke-dashoffset 2s var(--ease) 0.2s; }
.js .cost-chart.is-in .cc-zone, .js .cost-chart.is-in .cc-zone-label { opacity: 1; transition: opacity 0.8s var(--ease) 0.1s; }
.js .cost-chart.is-in .cc-area, .js .cost-chart.is-in .cc-point, .js .cost-chart.is-in .cc-note { opacity: 1; transition: opacity 0.8s var(--ease) 1.6s; }

/* Tools */
.tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tool {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px;
  padding: 24px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  transition: border-color 0.25s var(--ease), background-color 0.25s var(--ease);
}
.tool:hover { border-color: var(--line-strong); background: var(--surface-2); }
.tool-glyph {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px;
  background: var(--surface-3); border: 1px solid var(--line-strong);
  font-weight: 700; font-stretch: 115%; font-size: 17px; letter-spacing: -0.02em;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.tool:hover .tool-glyph { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tool h4 { font-size: 19px; font-weight: 650; letter-spacing: -0.01em; }
.tool-role { font-family: var(--font-mono); font-size: 11.5px; color: var(--accent); letter-spacing: 0.04em; margin: 4px 0 12px; }
.tool p:last-child { color: var(--text-2); font-size: 15px; line-height: 1.55; }

/* ---------- Projects ---------- */
.work .section-head { margin-bottom: clamp(32px, 5vw, 64px); }
.project { padding-block: clamp(48px, 7vw, 96px); }
.project + .project { border-top: 1px solid var(--line); }
.project--featured { padding-top: 0; }

.project-head { display: grid; gap: clamp(24px, 3vw, 40px); margin-bottom: clamp(28px, 4vw, 48px); }
.project-head .project-intro {
  grid-template-columns: minmax(0, 1fr) auto; align-items: end; justify-items: stretch; gap: 24px clamp(32px, 6vw, 96px);
}
.project-head .project-intro .btn { justify-self: end; }
.project-title {
  margin-top: 18px;
  font-size: clamp(3rem, 9vw, 8.5rem); line-height: 0.88; font-weight: 750; font-stretch: 118%; letter-spacing: -0.05em;
}
.project-title--sm { font-size: clamp(2.25rem, 4.2vw, 3.6rem); line-height: 0.98; margin-bottom: 20px; }
.project-intro { display: grid; gap: 24px; justify-items: start; }
.project-summary { color: var(--text-2); font-size: clamp(1.02rem, 1.3vw, 1.15rem); max-width: 56ch; }

.project-cover {
  display: block; width: 100%; border-radius: var(--radius); overflow: hidden; background: var(--surface);
}
.project-cover img { width: 100%; will-change: transform; }

.project-detail {
  display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(32px, 5vw, 80px);
  padding-block: clamp(40px, 6vw, 72px);
}
.meta { display: grid; border-top: 1px solid var(--line); }
.meta > div { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.meta dt { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
.meta dd { font-size: 15px; color: var(--text); }
.highlights { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 40px; align-content: start; }
.highlights h4 { font-size: 13px; font-family: var(--font-mono); font-weight: 400; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.highlights p { color: var(--text-2); font-size: 15.5px; }

.gallery-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap;
  padding: 20px 0; margin-bottom: 20px;
  border-top: 1px solid var(--line);
}
.gallery-title { font-size: 22px; font-weight: 650; font-stretch: 110%; letter-spacing: -0.02em; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--text-2); font-size: 14px;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--text-2); }
.chip[aria-pressed='true'] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip-count { font-family: var(--font-mono); font-size: 11px; opacity: 0.6; }

/* Justified gallery (row maths in main.js). Before JS lays it out, a flex fallback keeps aspect ratios. */
.jg { --row: 300px; --gap: 12px; display: flex; flex-wrap: wrap; gap: var(--gap); }
.jg::after { content: ''; flex-grow: 1e4; }
.jg-item {
  position: relative; overflow: hidden; border-radius: var(--radius-sm);
  flex-grow: var(--r); flex-basis: calc(var(--r) * var(--row));
  background: var(--surface);
}
.jg-item[hidden] { display: none; }
.jg.is-laid .jg-item { flex: none; }
.jg-item img { width: 100%; height: 100%; object-fit: cover; }
.jg-cap {
  position: absolute; inset: auto 0 0; padding: 36px 14px 12px;
  font-size: 13px; line-height: 1.4; color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), transparent);
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
  text-align: left;
}
.jg-item:hover .jg-cap, .jg-item:focus-visible .jg-cap { opacity: 1; transform: none; }

/* Secondary projects */
.project-row { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(32px, 5vw, 80px); align-items: start; }
.project-side { position: sticky; top: calc(var(--header-h) + 24px); display: grid; }
.project-side .project-summary { margin-bottom: 28px; }
.project-side .meta { margin-bottom: 24px; }

.placeholder {
  display: grid; place-content: center; justify-items: center; gap: 14px; text-align: center;
  aspect-ratio: 16 / 9; padding: 32px; border-radius: var(--radius);
  border: 1px dashed var(--line-strong);
  background: repeating-linear-gradient(135deg, transparent 0 14px, rgba(236, 235, 230, 0.03) 14px 15px), var(--surface);
}
.placeholder p { color: var(--text-2); max-width: 40ch; font-size: 15px; }
.placeholder-tag {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted);
}
.noscript { color: var(--text-2); }

/* ---------- Armory: rotatable viewer + spec sheet ---------- */
.armory-grid {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); align-items: start;
  margin-bottom: clamp(56px, 7vw, 96px);
}
/* Width is capped by viewport height so the whole viewer, buttons included, fits on screen (renders are 1400x1700). */
.tt { position: sticky; top: calc(var(--header-h) + 24px); width: min(50vw, calc((100svh - var(--header-h) - 150px) * 0.8235)); }
.tt-stage {
  position: relative; overflow: hidden; border-radius: var(--radius);
  /* Matches the light studio backdrop of the renders, so letterboxing never shows a seam. */
  background: radial-gradient(120% 90% at 50% 35%, #d8d8d8, #a9a9ab);
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
  outline-offset: 4px;
}
.tt-frame { position: absolute; inset: 0; opacity: 0; transform: scale(1.015); transition: opacity 0.45s var(--ease), transform 0.8s var(--ease-out); }
.tt-frame.is-active { opacity: 1; transform: none; }
.tt-frame img { width: 100%; height: 100%; object-fit: cover; -webkit-user-drag: none; pointer-events: none; }
.tt-stage.is-dragging .tt-frame { transition-duration: 0.18s; }
.tt-hint {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  padding: 6px 12px; border-radius: 999px; white-space: nowrap;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: #fff; background: rgba(12, 12, 13, 0.62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  pointer-events: none; transition: opacity 0.4s var(--ease);
}
.tt-stage.is-dragging .tt-hint { opacity: 0; }
.tt-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; }
.tt-controls {
  position: relative; display: inline-flex; padding: 4px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface);
}
.tt-btn {
  position: relative; z-index: 1; min-width: 56px; height: 36px; padding: 0 14px; border-radius: 999px;
  font-size: 14px; color: var(--text-2); transition: color 0.3s var(--ease);
}
.tt-btn:hover { color: var(--text); }
.tt-btn[aria-pressed='true'] { color: var(--accent-ink); }
.tt-indicator {
  position: absolute; z-index: 0; top: 4px; left: 0; height: 36px; border-radius: 999px; background: var(--accent);
  transition: transform 0.45s var(--ease-out), width 0.45s var(--ease-out);
}
.tt-count { font-family: var(--font-mono); font-size: 12px; color: var(--muted); letter-spacing: 0.06em; }
.armory-specs { display: grid; gap: clamp(32px, 4vw, 48px); }
.armory-points { display: grid; gap: 0; border-top: 1px solid var(--line); }
.armory-points li { padding: 22px 0; border-bottom: 1px solid var(--line); }
.armory-points h4 {
  display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
  font-size: 18px; font-weight: 650; font-stretch: 108%; letter-spacing: -0.01em;
}
.armory-points h4::before {
  content: ''; flex: none; width: 8px; height: 8px; border: 1.5px solid var(--accent); transform: rotate(45deg);
}
.armory-points p { color: var(--text-2); font-size: 15.5px; }
.armory .meta > div { grid-template-columns: 96px minmax(0, 1fr); }

/* ---------- Contact ---------- */
.contact { padding-bottom: clamp(72px, 9vw, 128px); }
.contact-title {
  margin-top: 28px;
  font-size: clamp(2.6rem, 7.6vw, 7.25rem); line-height: 0.95; font-weight: 700; font-stretch: 115%; letter-spacing: -0.045em;
}
.contact-copy { margin-top: 32px; max-width: 52ch; color: var(--text-2); font-size: clamp(1.05rem, 1.4vw, 1.2rem); }
.contact-links { margin-top: clamp(40px, 6vw, 72px); border-top: 1px solid var(--line); }
.contact-links a {
  position: relative; display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; align-items: center; gap: 16px;
  padding: clamp(20px, 3vw, 32px) 0; border-bottom: 1px solid var(--line); overflow: hidden;
  transition: color 0.3s var(--ease), padding 0.45s var(--ease-out);
}
.contact-links a::before {
  content: ''; position: absolute; inset: auto 0 -1px 0; height: 1px; background: var(--accent);
  transform: scaleX(0); transform-origin: left; transition: transform 0.6s var(--ease-out);
}
.contact-note { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.contact-label { font-size: clamp(1.4rem, 3vw, 2.4rem); font-weight: 650; font-stretch: 110%; letter-spacing: -0.03em; line-height: 1.1; }
.contact-arrow { font-size: clamp(1.4rem, 3vw, 2.2rem); color: var(--muted); transition: transform 0.45s var(--ease-out), color 0.3s var(--ease); }
.contact-links a:hover { color: var(--accent); padding-left: 14px; }
.contact-links a:hover::before { transform: scaleX(1); }
.contact-links a:hover .contact-arrow { color: var(--accent); transform: translate(6px, -6px) rotate(0deg); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding-block: 28px; font-size: 14px; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.footer-note { margin-right: auto; }
.to-top:hover { color: var(--text); }

/* ---------- Lightbox (morph transitions in main.js) ---------- */
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: transparent; color: var(--text); overflow: hidden;
}
.lightbox::backdrop { background: rgba(6, 6, 7, 0.94); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: opacity 0.45s var(--ease); }
.lightbox[open]::backdrop { animation: lb-fade 0.45s var(--ease); }
.lightbox.is-closing::backdrop { opacity: 0; }
@keyframes lb-fade { from { opacity: 0; } }
.lb-frame { position: relative; width: 100%; height: 100%; display: grid; place-items: center; padding: 64px clamp(16px, 7vw, 104px) 24px; }
.lb-figure { display: grid; gap: 16px; justify-items: center; }
.lb-stage { display: grid; place-items: center; }
.lb-img {
  display: block; object-fit: contain; border-radius: 8px; background: var(--surface);
  transform-origin: 0 0; will-change: transform; user-select: none; -webkit-user-drag: none; touch-action: pan-y;
}
.lb-caption { display: flex; gap: 16px; align-items: baseline; max-width: 80ch; min-height: 24px; font-size: 14.5px; color: var(--text-2); text-align: left; }
.lb-count { font-family: var(--font-mono); font-size: 12px; color: var(--accent); flex: none; }
.lb-progress { position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--line); }
.lb-progress span { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform 0.5s var(--ease); }
.lb-btn {
  position: absolute; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  background: rgba(236, 235, 230, 0.08); border: 1px solid var(--line-strong); font-size: 18px;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), opacity 0.35s var(--ease);
}
.lb-btn:hover { background: rgba(236, 235, 230, 0.16); border-color: var(--text-2); }
.lb-btn[hidden] { display: none; }
.lb-close { top: 14px; right: 14px; }
.lb-prev { left: 16px; top: 50%; translate: 0 -50%; }
.lb-next { right: 16px; top: 50%; translate: 0 -50%; }
.lightbox .lb-caption, .lightbox .lb-btn, .lightbox .lb-progress { opacity: 0; transition: opacity 0.35s var(--ease) 0.3s; }
.lightbox.is-ready .lb-caption, .lightbox.is-ready .lb-btn, .lightbox.is-ready .lb-progress { opacity: 1; }
.lightbox.is-closing .lb-caption, .lightbox.is-closing .lb-btn, .lightbox.is-closing .lb-progress { opacity: 0; transition-delay: 0s; transition-duration: 0.15s; }

/* ---------- Reveal ---------- */
.js [data-reveal] {
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.js [data-reveal='media'] { transform: none; clip-path: inset(6% 4% 0 4% round var(--radius)); transition: opacity 1s var(--ease), clip-path 1.4s var(--ease-out); }
.js [data-reveal].is-in { opacity: 1; transform: none; }
.js .project-cover[data-reveal='media'].is-in { clip-path: inset(0 0 0 0 round var(--radius)); }

/* Headings rise line by line out of a mask (lines split by fx.js). */
.js [data-reveal='lines'], .js [data-reveal='rule'], .js [data-reveal='chart'] { opacity: 1; transform: none; }
.ln { display: block; overflow: hidden; padding-bottom: 0.12em; margin-bottom: -0.12em; }
.ln-in { display: block; }
.js [data-reveal='lines'] .ln-in { transform: translateY(108%); transition: transform 1.1s var(--ease-out); transition-delay: calc(var(--l) * 90ms + 60ms); }
.js [data-reveal='lines'].is-in .ln-in { transform: none; }
/* Section dividers draw across as each section arrives. */
.js .section-rule { transform: scaleX(0); transition: transform 1.6s var(--ease-out); }
.js .section-rule.is-in { transform: scaleX(1); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
  .js [data-reveal], .js .hero-title .char, .js [data-reveal='lines'] .ln-in, .js .section-rule { opacity: 1; transform: none; clip-path: none; }
  .mg-flow { display: none; }
  [data-tilt], [data-tilt] img { transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .exp { grid-template-columns: 56px minmax(0, 1fr); }
  .exp-media { grid-column: 2; max-width: 640px; }
  .project-detail, .project-row, .cost, .armory-grid { grid-template-columns: minmax(0, 1fr); }
  .project-side, .tt { position: static; }
  .tt { width: 100%; max-width: 620px; }
  .facts-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 32px; }
  .facts-grid > div:nth-child(4) { border-left: 0; padding-left: 0; }
  .tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mg-node { padding: 14px 14px 16px; }
  .mg-node-s { display: none; }
  .mp-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 899px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .discipline-index { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .discipline-index li { border-bottom: 1px solid var(--line); }
  .about-grid { grid-template-columns: minmax(0, 1fr); }
  .project-head .project-intro { grid-template-columns: minmax(0, 1fr); }
  .project-head .project-intro .btn { justify-self: start; }
  .method-principles { grid-template-columns: minmax(0, 1fr); }

  /* Graph stacks into a sequence; the detail panel opens under the selected stage. */
  .mg { padding-bottom: 0; }
  .mg-edges { display: none; }
  .mg-cols { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .mg-node-s { display: block; }
  .mg-gate {
    position: static; width: auto; display: flex; align-items: center; gap: 12px; margin-top: 10px; padding-top: 16px;
    border-left: 0; border-top: 1px dashed rgba(236, 235, 230, 0.2); z-index: auto;
  }
  .mg-gate--key { border-top-color: rgba(242, 194, 48, 0.45); }
  .mg-gate-d { position: static; flex: none; }
  .mg-gate-t { position: static; transform: none; white-space: normal; }
  .mg-col .mp-panel {
    margin: 2px 0 6px; padding: 20px; min-height: 0;
    border: 1px solid rgba(242, 194, 48, 0.35); border-radius: 12px; background: var(--surface);
  }
  .mp-head { flex-wrap: wrap; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .exp { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .exp-media { grid-column: auto; }
  .exp-num { padding-top: 0; }
  .facts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts-grid > div { border-left: 0; padding-left: 0; }
  .highlights { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .tools { grid-template-columns: minmax(0, 1fr); }
  .jg { --gap: 8px; }
  .contact-links a { grid-template-columns: minmax(0, 1fr) auto; }
  .contact-note { grid-column: 1 / -1; }
  .lb-prev, .lb-next { top: auto; bottom: 16px; translate: none; }
  .lb-frame { padding: 64px 12px 84px; }
  .hero-media figcaption { flex-direction: column; gap: 4px; }
  .meta > div { grid-template-columns: 76px minmax(0, 1fr); }
  .method { padding: 16px; border-radius: 16px; }
  /* The chart scales down to ~0.65x on phones, so its labels are set larger in SVG units. */
  .cost-chart { padding: 12px 8px; }
  .cc-label { font-size: 16px; }
  .cc-zone-label { font-size: 14px; }
  .cc-note { font-size: 16px; }
  .cc-axis-title { font-size: 14px; }
}
