/* ============================================================
   vansh-gupta.com — AN ATLAS OF IDEAS
   Hand-built. One CSS file. No framework.
   Concept + rules: docs/DESIGN.md
   ============================================================ */

/* ---------- fonts ---------- */
@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/Fraunces-normal-100-900.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/Fraunces-italic-100-900.woff2') format('woff2');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('../fonts/SourceSerif4-normal-200-900.woff2') format('woff2');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('../fonts/SourceSerif4-italic-200-900.woff2') format('woff2');
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../fonts/IBMPlexMono-normal-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../fonts/IBMPlexMono-normal-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../fonts/IBMPlexMono-italic-400.woff2') format('woff2');
  font-weight: 400; font-style: italic; font-display: swap;
}

/* ---------- tokens ---------- */
:root {
  --ink: #191c24;
  --ink-soft: #232733;
  --paper: #f4f3ef;
  --paper-deep: #e9e8e2;
  --vermillion: #d8260f;
  --vermillion-dark: #b01f0c;
  --graphite: #5b5e66;
  --fog: #9b9da4;           /* muted on ink */
  --hairline: #d6d5ce;      /* rules on paper */
  --hairline-ink: #2c303a;  /* rules on ink */
  --contour: #232836;       /* contour lines on ink */

  --display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --mono: 'IBM Plex Mono', 'SFMono-Regular', Menlo, monospace;

  --measure: 66ch;
  --gutter: clamp(1.25rem, 4vw, 4rem);
  --section-gap: clamp(4.5rem, 10vh, 8rem);
}

::selection { background: var(--vermillion); color: var(--paper); }

/* ---------- crossing between sheets (view transitions) ---------- */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation-duration: 110ms; }
  ::view-transition-new(root) { animation-duration: 190ms; }
}
.site-head { view-transition-name: site-head; }

/* ---------- the survey line (route progress) ---------- */
.survey-line {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: var(--vermillion);
  transform: scaleX(0);
  transform-origin: 0 50%;
  z-index: 20;
  pointer-events: none;
}
@supports (animation-timeline: scroll()) {
  .survey-line {
    animation: survey-draw linear both;
    animation-timeline: scroll(root);
  }
  @keyframes survey-draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}
@media (prefers-reduced-motion: reduce) { .survey-line { display: none; } }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10;
  font-family: var(--mono);
  font-size: 0.8rem;
  background: var(--vermillion);
  color: var(--paper);
  padding: 0.6rem 1rem;
}
.skip:focus { left: 0; }

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--serif);
  font-size: clamp(1.0rem, 0.95rem + 0.3vw, 1.125rem);
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; }

/* ---------- mono voice (marginalia) ---------- */
.m {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
}
.m-lc { /* mono, lowercase, for inline metadata */
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: none;
  font-weight: 400;
}

/* ============================================================
   HEADER / NAV  (ink band on every page)
   ============================================================ */
.site-head {
  background: var(--ink);
  color: var(--paper);
  padding: 1.4rem var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem 2rem;
  flex-wrap: wrap;
}
.site-head .ident { line-height: 1.5; }
.site-head .ident a { text-decoration: none; }
.site-head .ident .name { color: var(--paper); }
.site-head .ident .coords { color: var(--fog); display: block; font-weight: 400; letter-spacing: 0.08em; }
.site-nav { display: flex; gap: clamp(0.9rem, 2.5vw, 1.8rem); flex-wrap: wrap; }
.site-nav a {
  color: var(--fog);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 150ms ease, border-color 150ms ease;
}
.site-nav a:hover { color: var(--paper); border-color: var(--vermillion); }
.site-nav a[aria-current="page"] { color: var(--paper); border-bottom: 2px solid var(--vermillion); }

/* ============================================================
   HERO  (index only)
   ============================================================ */
.hero {
  position: relative;
  background: var(--ink);
  color: var(--paper);
  min-height: calc(100svh - 4.5rem);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--gutter);
  padding-bottom: clamp(2.5rem, 7vh, 5rem);
  overflow: hidden;
}
.hero .contours {
  position: absolute;
  inset: -20%;
  width: 140%;
  height: 140%;
  pointer-events: none;
  opacity: 0.9;
}
@media (prefers-reduced-motion: no-preference) {
  .hero .contours { animation: drift 140s linear infinite alternate; }
  @keyframes drift {
    from { transform: translate3d(0, 0, 0); }
    to   { transform: translate3d(-3.5%, -2.5%, 0); }
  }
}
.hero-inner { position: relative; max-width: 60rem; }
.hero .plate { color: var(--fog); margin-bottom: 1.4rem; }
.hero .plate .tick { color: var(--vermillion); }
.hero h1 {
  font-family: var(--display);
  font-weight: 560;
  font-size: clamp(2.7rem, 9.5vw, 7rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
  font-variation-settings: 'opsz' 144, 'SOFT' 0, 'WONK' 1;
  text-wrap: balance;
}
.hero h1 em {
  font-style: italic;
  font-weight: 480;
  color: var(--vermillion);
}
.hero .standfirst {
  margin-top: 1.8rem;
  max-width: 46ch;
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.3rem);
  line-height: 1.55;
  color: #c9cad0;
}
.hero .standfirst strong { color: var(--paper); font-weight: 600; }

/* load-in: the one animation */
@media (prefers-reduced-motion: no-preference) {
  .rise { opacity: 0; transform: translateY(14px); animation: rise 1.1s cubic-bezier(0.2, 0.6, 0.2, 1) forwards; }
  .rise.d1 { animation-delay: 90ms; }
  .rise.d2 { animation-delay: 200ms; }
  @keyframes rise { to { opacity: 1; transform: none; } }
}

/* the live relief: WebGL canvas takes over from the hand-drawn sheet */
.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1100ms ease;
}
.hero--3d .hero-canvas { opacity: 1; }
.hero--3d .contours { opacity: 0; transition: opacity 900ms ease; animation: none; }

/* live coordinate readout that follows the cursor across the whole site;
   exclusion blend keeps it legible on both ink and paper */
.cursor-readout {
  position: fixed;
  left: 0; top: 0;
  z-index: 30;
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  font-weight: 400;
  color: #cfd0d6;
  mix-blend-mode: exclusion;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  opacity: 0;
  transition: opacity 350ms ease;
}
.cursor-readout.on { opacity: 0.85; }
@media print { .cursor-readout { display: none; } }

/* ============================================================
   SECTIONS on paper
   ============================================================ */
.sheet { padding: 0 var(--gutter); }
.section { max-width: 72rem; margin: 0 auto; padding: var(--section-gap) 0 0; }
.section:last-of-type { padding-bottom: var(--section-gap); }

.section-rule {
  display: flex;
  align-items: baseline;
  gap: 1.1rem;
  border-top: 1px solid var(--ink);
  padding-top: 0.7rem;
  margin-bottom: clamp(1.8rem, 4vh, 3rem);
}
.section-rule .no { color: var(--vermillion); }
.section-rule .ttl { color: var(--ink); }
.section-rule .note { margin-left: auto; color: var(--graphite); text-transform: none; letter-spacing: 0.04em; font-weight: 400; }

h2.display {
  font-family: var(--display);
  font-weight: 540;
  font-variation-settings: 'opsz' 80;
  font-size: clamp(1.8rem, 4.2vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
  max-width: 24ch;
  margin-bottom: 1.6rem;
  text-wrap: balance;
}
h2.display em { font-style: italic; color: var(--vermillion); }

.prose { max-width: var(--measure); }
.prose p + p { margin-top: 1.05em; }
.prose a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--graphite);
  transition: text-decoration-color 150ms ease, color 150ms ease;
}
.prose a:hover { color: var(--vermillion); text-decoration-color: var(--vermillion); }

/* two-column: prose + margin notes */
.cols {
  display: grid;
  grid-template-columns: minmax(0, var(--measure)) minmax(11rem, 16rem);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
}
.margin-note { color: var(--graphite); line-height: 1.7; }
.margin-note .m { display: block; color: var(--ink); margin-bottom: 0.4rem; }
.margin-note p { font-size: 0.92rem; }
.margin-note + .margin-note, .margin-block + .margin-block { margin-top: 1.6rem; }

/* portrait */
.portrait {
  width: min(13rem, 40vw);
  aspect-ratio: 1 / 1;
  height: auto;
  object-fit: cover;
  filter: grayscale(1) contrast(1.05);
  border: 1px solid var(--ink);
}
.portrait-wrap { position: relative; display: inline-block; }
.portrait-wrap::after {
  content: '';
  position: absolute;
  inset: 0.6rem -0.6rem -0.6rem 0.6rem;
  border: 1px solid var(--vermillion);
  z-index: -1;
}
.portrait-cap { margin-top: 1.1rem; color: var(--graphite); letter-spacing: 0.08em; }

/* ============================================================
   THE LEGEND (research agenda as map legend)
   ============================================================ */
.legend { border: 1px solid var(--ink); background: var(--paper); }
.legend-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.4rem;
  border-bottom: 1px solid var(--ink);
  color: var(--graphite);
}
.legend-head .lk { color: var(--ink); }
.legend-row {
  display: grid;
  grid-template-columns: 4.4rem minmax(8rem, 14rem) 1fr;
  gap: 1.4rem;
  padding: 1.5rem 1.4rem;
  align-items: start;
  text-decoration: none;
  transition: background 160ms ease;
}
.legend-row + .legend-row { border-top: 1px solid var(--hairline); }
.legend-row:hover { background: var(--paper-deep); }
.legend-row:hover .legend-sym .stroke { stroke: var(--vermillion); }
.legend-row:hover .legend-sym .fill { fill: var(--vermillion); }
.legend-sym { width: 2.6rem; height: 2.6rem; margin-top: 0.15rem; }
.legend-sym .stroke { stroke: var(--ink); transition: stroke 160ms ease; }
.legend-sym .fill { fill: var(--ink); transition: fill 160ms ease; }
.legend-row h3 {
  font-family: var(--display);
  font-weight: 560;
  font-size: 1.25rem;
  line-height: 1.25;
}
.legend-row .sub { display: block; margin-top: 0.35rem; color: var(--graphite); }
.legend-row p { color: var(--ink); font-size: 0.98rem; max-width: 52ch; }
.legend-row p .qsub { color: var(--graphite); font-style: italic; }

/* the legend lives: each symbol behaves like what it depicts, on hover */
@media (prefers-reduced-motion: no-preference) {
  .legend-sym .stroke circle,
  .legend-sym .stroke path,
  .legend-sym .stroke rect { transform-box: fill-box; transform-origin: center; }

  /* incentives — the benchmark pings, like a struck instrument */
  .legend-row:nth-of-type(1):hover .legend-sym .stroke circle {
    animation: lg-ping 850ms ease-in-out infinite alternate;
  }
  /* place — the triangulation station re-draws itself */
  .legend-row:nth-of-type(2):hover .legend-sym .stroke path {
    stroke-dasharray: 97;
    animation: lg-draw-97 700ms ease-out forwards;
  }
  /* brains — the river starts to flow */
  .legend-row:nth-of-type(3):hover .legend-sym .stroke path:nth-of-type(-n+2) {
    stroke-dasharray: 5 4;
    animation: lg-flow 1.3s linear infinite;
  }
  /* government — the built-up grid is surveyed in (one continuous stroke) */
  .legend-row:nth-of-type(4):hover .legend-sym .stroke path {
    stroke-dasharray: 108;
    animation: lg-draw-108 900ms ease-out forwards;
  }

  @keyframes lg-ping     { from { transform: scale(1); } to { transform: scale(1.16); } }
  @keyframes lg-draw-97  { from { stroke-dashoffset: 97; } to { stroke-dashoffset: 0; } }
  @keyframes lg-draw-108 { from { stroke-dashoffset: 108; } to { stroke-dashoffset: 0; } }
  @keyframes lg-flow    { to { stroke-dashoffset: -18; } }
}

/* ============================================================
   PAPER LIST (typeset, hanging indent, no cards)
   ============================================================ */
.papers { max-width: 56rem; }
.paper {
  position: relative;
  padding: 1.7rem 0 1.7rem 2.1rem;
  border-top: 1px solid var(--hairline);
}
.paper:last-child { border-bottom: 1px solid var(--hairline); }
.paper::before {            /* survey benchmark mark */
  content: '';
  position: absolute;
  left: 0;
  top: 2.18rem;
  width: 9px; height: 9px;
  border: 1.5px solid var(--graphite);
  border-radius: 50%;
  transition: border-color 160ms ease, background 160ms ease;
}
.paper:hover::before { border-color: var(--vermillion); background: var(--vermillion); }
.paper h3 {
  font-family: var(--display);
  font-weight: 560;
  font-variation-settings: 'opsz' 40;
  font-size: clamp(1.25rem, 2.4vw, 1.6rem);
  line-height: 1.22;
  max-width: 30ch;
  text-wrap: balance;
}
.paper h3 a { text-decoration: none; }
.paper h3 a:hover { color: var(--vermillion); }
.paper .meta { margin-top: 0.55rem; color: var(--graphite); line-height: 1.8; }
.paper .meta .vm { color: var(--vermillion-dark); font-weight: 500; }
.paper .hook { margin-top: 0.8rem; max-width: 60ch; font-size: 0.99rem; }
.paper .links { margin-top: 0.8rem; display: flex; gap: 1.4rem; flex-wrap: wrap; }
.paper .links a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 1px;
  transition: color 150ms ease, border-color 150ms ease;
}
.paper .links a:hover { color: var(--vermillion); border-color: var(--vermillion); }
.paper.compact { padding-top: 1.2rem; padding-bottom: 1.2rem; }
.paper.compact::before { top: 1.68rem; }
.paper.compact h3 { font-size: 1.15rem; }

/* hand-sketched field figures beside survey entries */
.paper.has-fig {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 13rem;
  column-gap: 2.6rem;
}
.paper.has-fig > :not(.fig) { grid-column: 1; }
.paper.has-fig > .fig {
  grid-column: 2;
  grid-row: 1 / 9;
  align-self: center;
  margin: 0;
}
.paper.compact.has-fig { grid-template-columns: minmax(0, 1fr) 9.5rem; }
.fig svg { display: block; width: 100%; height: auto; overflow: visible; }
.fig .ax { stroke: var(--graphite); stroke-width: 1.1; fill: none; }
.fig .ln { stroke: var(--ink); stroke-width: 1.5; fill: none; }
.fig .ev { stroke: var(--graphite); stroke-width: 1; stroke-dasharray: 3 4; fill: none; }
.fig .vm { stroke: var(--vermillion); fill: var(--vermillion); }
.fig .bar { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.fig text {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  fill: var(--graphite);
}
.fig figcaption {
  margin-top: 0.55rem;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--graphite);
}
@media (max-width: 740px) {
  .paper.has-fig { display: block; }
  .paper.has-fig > .fig { max-width: 14rem; margin-top: 1.2rem; }
}

/* "see the full survey" link */
.lead-out { margin-top: 2.2rem; }
.lead-out a {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.2rem;
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
  transition: color 150ms ease, border-color 150ms ease;
}
.lead-out a:hover { color: var(--vermillion); border-color: var(--vermillion); }
.lead-out .arrow { font-family: var(--mono); font-style: normal; font-size: 0.95rem; }

/* ============================================================
   TIMELINE (CV page)
   ============================================================ */
.timeline { max-width: 56rem; }
.tl-row {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 1.6rem;
  padding: 1.15rem 0;
  border-top: 1px solid var(--hairline);
}
.tl-row:last-child { border-bottom: 1px solid var(--hairline); }
.tl-row .when { color: var(--graphite); padding-top: 0.3rem; }
.tl-row h3 { font-family: var(--display); font-weight: 560; font-size: 1.15rem; line-height: 1.3; }
.tl-row p { color: var(--ink); font-size: 0.96rem; max-width: 56ch; margin-top: 0.25rem; }
.tl-row p .sub { color: var(--graphite); }

/* ============================================================
   COLOPHON (ink footer)
   ============================================================ */
.colophon {
  background: var(--ink);
  color: var(--fog);
  margin-top: var(--section-gap);
  padding: clamp(3rem, 7vh, 5rem) var(--gutter) 2.2rem;
  position: relative;
  overflow: hidden;
}
.colophon-inner { max-width: 72rem; margin: 0 auto; position: relative; }
.colophon .reach {
  display: flex;
  gap: 1.6rem 2.2rem;
  flex-wrap: wrap;
  padding-bottom: 2.4rem;
  border-bottom: 1px solid var(--hairline-ink);
}
.colophon .reach a {
  color: var(--paper);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline-ink);
  padding-bottom: 2px;
  transition: border-color 150ms ease, color 150ms ease;
}
.colophon .reach a:hover { color: var(--vermillion); border-color: var(--vermillion); }
.colophon .closing {
  font-family: var(--display);
  font-weight: 480;
  font-style: italic;
  font-size: clamp(1.5rem, 3.4vw, 2.4rem);
  color: var(--paper);
  line-height: 1.25;
  max-width: 26ch;
  margin: 2.6rem 0;
  text-wrap: balance;
}
.colophon .closing a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--hairline-ink); transition: color 150ms ease, border-color 150ms ease; }
.colophon .closing a:hover { color: var(--vermillion); border-color: var(--vermillion); }
.colophon .fine {
  display: flex;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
  color: var(--graphite);
  letter-spacing: 0.06em;
  line-height: 2;
}
.colophon .stamp {
  position: absolute;
  right: 0;
  bottom: 4.5rem;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--paper);
  border: 1px solid currentColor;
  padding: 0.45rem 0.7rem;
  transform: rotate(-4deg);
  opacity: 0.16;
  transition: opacity 400ms ease, color 400ms ease;
  user-select: none;
}
.colophon .stamp:hover { opacity: 0.9; color: var(--vermillion); }

/* ============================================================
   SUBPAGE HEADER BAND
   ============================================================ */
.page-band {
  background: var(--ink);
  color: var(--paper);
  padding: clamp(2.6rem, 7vh, 4.6rem) var(--gutter) clamp(2.2rem, 5vh, 3.4rem);
  position: relative;
  overflow: hidden;
}
.page-band .band-inner { max-width: 72rem; margin: 0 auto; position: relative; }
.page-band .plate { color: var(--fog); margin-bottom: 1rem; }
.page-band .plate .tick { color: var(--vermillion); }
.page-band h1 {
  font-family: var(--display);
  font-weight: 540;
  font-variation-settings: 'opsz' 110;
  font-size: clamp(2.2rem, 6vw, 4.2rem);
  line-height: 1.05;
  letter-spacing: -0.012em;
  text-wrap: balance;
}
.page-band h1 em { font-style: italic; color: var(--vermillion); }
.page-band .standfirst { margin-top: 1.2rem; max-width: 52ch; color: #c9cad0; font-size: 1.05rem; }
.page-band .standfirst a { color: var(--paper); }

/* map page */
.map-frame {
  width: 100%;
  height: min(72vh, 46rem);
  border: 1px solid var(--ink);
  display: block;
}

/* cv actions */
.actions { display: flex; gap: 1.6rem; flex-wrap: wrap; margin: 1.8rem 0 0; }
.actions a {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--paper);
  background: var(--ink);
  text-decoration: none;
  padding: 0.75rem 1.2rem;
  border: 1px solid var(--ink);
  transition: background 150ms ease, color 150ms ease;
}
.actions a:hover { background: var(--vermillion); border-color: var(--vermillion); color: var(--paper); }
.actions a.ghost { background: transparent; color: var(--ink); }
.actions a.ghost:hover { background: transparent; color: var(--vermillion); border-color: var(--vermillion); }
.page-band .actions a { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.page-band .actions a:hover { background: var(--vermillion); color: var(--paper); border-color: var(--vermillion); }
.page-band .actions a.ghost { background: transparent; color: var(--paper); border-color: var(--hairline-ink); }
.page-band .actions a.ghost:hover { color: var(--vermillion); border-color: var(--vermillion); }

/* 404 */
.lost {
  min-height: 70svh;
  display: grid;
  place-content: center;
  text-align: left;
  padding: var(--gutter);
  background: var(--ink);
  color: var(--paper);
}
.lost h1 { font-family: var(--display); font-size: clamp(2.4rem, 8vw, 5rem); font-weight: 540; line-height: 1.05; max-width: 18ch; }
.lost h1 em { color: var(--vermillion); font-style: italic; }
.lost p { margin-top: 1.4rem; color: var(--fog); }
.lost a { color: var(--paper); }

/* ============================================================
   SURFACING — entries rise as they enter the sheet
   ============================================================ */
/* native: scroll-driven, scrubbed by the reader's own pace */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .section-rule, .paper, .tl-row, .legend-row {
      animation: surface linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 60%;
    }
  }
}
/* fallback: IntersectionObserver (atlas.js) adds .rv then .seen */
html.io-reveal .rv {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 600ms ease, transform 600ms cubic-bezier(0.2, 0.6, 0.2, 1);
}
html.io-reveal .rv.seen { opacity: 1; transform: none; }
@keyframes surface {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 880px) {
  .cols { grid-template-columns: 1fr; }
  .margin-rail { display: flex; flex-wrap: wrap; gap: 1.6rem 2.6rem; border-top: 1px solid var(--hairline); padding-top: 1.6rem; }
  .margin-note + .margin-note { margin-top: 0; }
  .legend-row { grid-template-columns: 3rem 1fr; }
  .legend-row p { grid-column: 1 / -1; }
  .colophon .stamp { position: static; display: inline-block; margin-top: 2rem; transform: rotate(-3deg); }
}
@media (max-width: 560px) {
  .tl-row { grid-template-columns: 1fr; gap: 0.3rem; }
  .section-rule .note { display: none; }
  .hero { min-height: calc(96svh - 7rem); }
}

/* ---------- sheet 05: the network (map.html) ---------- */
.net-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 215px; gap: 2.4rem; align-items: start; }
.net-rail { position: sticky; top: 4.5rem; }
#net-info p { margin: 0.3rem 0 0; }
#net-info-d { font-size: 0.82rem; line-height: 1.5; color: var(--graphite); }

.net-plate {
  margin: 0;
  border: 1px solid var(--hairline);
  background: var(--paper);
  padding: clamp(0.4rem, 1.4vw, 1.1rem);
  transform: rotate(var(--sheet-rot, 0deg)) translate(var(--sheet-dx, 0px), var(--sheet-dy, 0px));
}
.net-plate figcaption { margin-top: 0.7rem; font-size: 0.66rem; letter-spacing: 0.09em; color: var(--graphite); }
.net-svg { display: block; width: 100%; height: auto; }

/* plate furniture */
.net-svg text { font-family: var(--mono); }
.net-h { font-family: var(--display); font-size: 42px; font-weight: 580; font-style: italic; fill: var(--ink); }
.np-cap  { font-size: 12px; letter-spacing: 0.2em; fill: var(--ink); }
.np-fine { font-size: 9.5px; letter-spacing: 0.1em; fill: var(--graphite); }
.np-grat path { stroke: var(--ink); opacity: 0.045; stroke-width: 1; }
.np-contour path { fill: none; stroke: var(--ink); opacity: 0.055; stroke-width: 1.4; }
.np-frame rect { fill: none; stroke: var(--ink); }
.np-frame rect:first-of-type { stroke-width: 1.5; }
.np-frame rect:last-of-type { stroke-width: 0.6; opacity: 0.7; }
.np-reg { stroke: var(--graphite); stroke-width: 1; opacity: 0.7; fill: none; }
.np-north line { stroke: var(--ink); stroke-width: 1.6; }
.np-north path { fill: var(--ink); }
.np-north text { font-size: 11px; text-anchor: middle; fill: var(--ink); }
.np-box { fill: var(--paper-deep); stroke: var(--hairline); }
.np-scale { stroke: var(--ink); stroke-width: 1.2; fill: none; }

/* the lines: one ink, five stroke grammars */
.ln .rail { fill: none; stroke: var(--ink); stroke-linecap: round; stroke-linejoin: round; }
.ln-route .rail  { stroke-width: 5; }
.ln-gov .rail    { stroke-width: 3.4; stroke-dasharray: 13 5 2 5; }
.ln-place .rail  { stroke-width: 3.6; stroke-dasharray: 0.1 8; }
.ln-incent .rail { stroke-width: 3.4; stroke-dasharray: 11 6; }
.ln-brains .rail-case { stroke-width: 5.4; }
.ln-brains .rail-core { stroke: var(--paper); stroke-width: 2.2; }
.ln-minor .rail { stroke: var(--graphite); stroke-width: 2.2; }
.ln .ext .rail { opacity: 0.55; }
.ln .arrow { fill: none; stroke: var(--ink); stroke-width: 2; opacity: 0.55; stroke-linejoin: round; }

/* marks */
.tick-mk { stroke: var(--ink); stroke-width: 2.2; }
.ln-minor .tick-mk { stroke: var(--graphite); stroke-width: 2; }
.term-mk { stroke: var(--ink); stroke-width: 4; }
.ln-minor .term-mk { stroke: var(--graphite); stroke-width: 3; }
.roundel { fill: var(--paper); stroke: var(--ink); stroke-width: 2.6; }
.hollow  { fill: var(--paper); stroke: var(--graphite); stroke-width: 2; }
.depot   { fill: var(--paper); stroke: var(--ink); stroke-width: 1.8; }
.hit { fill: transparent; stroke: none; }
.mit-capsule { fill: var(--paper); stroke: var(--vermillion); stroke-width: 3; }
.mit-pt { fill: var(--ink); }
.vm-here { fill: var(--vermillion); font-size: 10px; letter-spacing: 0.16em; }

/* station type */
.nl { font-size: 11px; fill: var(--ink); }
.ns { font-size: 9.5px; fill: var(--graphite); }
.nt { font-size: 11.5px; font-weight: 600; letter-spacing: 0.05em; fill: var(--ink); }
.stn { cursor: pointer; }
.stn:focus-visible { outline: 2px solid var(--vermillion); outline-offset: 3px; }
.stn:hover .nl, .stn:focus .nl,
.stn:hover .nt, .stn:focus .nt { fill: var(--vermillion); }

/* legend samples mirror the line grammars */
.lg { fill: none; stroke: var(--ink); stroke-linecap: round; }
.lg-route  { stroke-width: 5; }
.lg-gov    { stroke-width: 3.4; stroke-dasharray: 13 5 2 5; }
.lg-place  { stroke-width: 3.6; stroke-dasharray: 0.1 8; }
.lg-incent { stroke-width: 3.4; stroke-dasharray: 11 6; }
.lg-brains-c { stroke-width: 5.4; }
.lg-brains-i { stroke: var(--paper-deep); stroke-width: 2.2; }
.lg-minor  { stroke: var(--graphite); stroke-width: 2.2; }

/* rolling stock: JS-built capsules riding the rails */
.train rect { fill: var(--ink); stroke: var(--paper); stroke-width: 1.5; }
.train circle { fill: var(--paper); }

/* focus mode: hovering a line dims the rest of the network */
.ln { transition: opacity 240ms ease; }
#net.focus .ln { opacity: 0.22; }
#net.focus .ln.lit { opacity: 1; }

@media (prefers-reduced-motion: no-preference) {
  .stn:hover :is(.roundel, .hollow, .depot, .mit-capsule),
  .stn:focus :is(.roundel, .hollow, .depot, .mit-capsule) {
    animation: net-ping 700ms ease;
    transform-box: fill-box;
    transform-origin: center;
  }
  @keyframes net-ping { 50% { transform: scale(1.3); } }
}

/* the descent: WebGL overlay, JS-created */
.descent {
  position: fixed; inset: 0; z-index: 60;
  width: 100%; height: 100%;
  pointer-events: none;
  background: var(--paper);
  opacity: 1;
  transition: opacity 560ms ease;
}
.descent.gone { opacity: 0; }
.descent-hud {
  position: fixed; left: 50%; bottom: 8vh; transform: translateX(-50%);
  z-index: 61; margin: 0; pointer-events: none; white-space: nowrap;
  font-size: 0.64rem; letter-spacing: 0.16em; color: var(--graphite);
  font-variant-numeric: tabular-nums;
  transition: opacity 560ms ease;
}
@media (max-width: 700px) { .descent-hud { font-size: 0.52rem; letter-spacing: 0.1em; } }

/* big desks get the full drafting table: only the plate widens */
@media (min-width: 1480px) {
  .section--plate { max-width: 96rem; }
  .net-wrap { grid-template-columns: minmax(0, 1fr) 235px; gap: 3.2rem; }
}
@media (min-width: 1800px) {
  .section--plate { max-width: 110rem; }
}

@media (max-width: 940px) {
  .net-wrap { grid-template-columns: 1fr; }
  .net-rail { position: static; }
  .net-plate { overflow-x: auto; }
  .net-svg { min-width: 880px; }
  .net-plate figcaption::after { content: " · DRAG THE SHEET SIDEWAYS TO PAN"; }
}

/* touch: invisible halo widens small tap targets without moving any ink */
@media (pointer: coarse) {
  .site-nav a, .reach a, .paper .links a, .lead-out a { position: relative; }
  .site-nav a::after, .reach a::after, .paper .links a::after, .lead-out a::after {
    content: '';
    position: absolute;
    inset: -10px -6px;
  }
}

/* ---------- print: the site IS a document ---------- */
@media print {
  .site-head, .colophon, .hero .contours, .survey-line, .hero-readout, .descent, .net-rail { display: none; }
  body { background: #fff; }
}
