/* ==========================================================================
   Editorial v2 — the network, drawn + the margin thread
   Layered on top of editorial.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Interlude: the network, drawn
   -------------------------------------------------------------------------- */
.network { padding-bottom: clamp(60px, 9vw, 130px); }

.network__inner { position: relative; }

.network__stage {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: 20px;
  align-items: end;
}

.network__year {
  grid-column: 1 / span 4;
  grid-row: 1;
  align-self: start;
  margin: 0;
  font-family: var(--serif);
  font-variation-settings: 'opsz' 144, 'SOFT' 0, 'WONK' 1;
  font-weight: 300;
  font-size: clamp(4.5rem, 11vw, 10rem);
  line-height: .8;
  letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  position: relative;
  z-index: 1;
}
.network__year-to {
  display: block;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: .75rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.is-animated .network__year-to { display: none; }

.network__map {
  grid-column: 1 / -1;
  grid-row: 1;
  width: 100%;
  height: auto;
  overflow: visible;
  margin-top: clamp(40px, 6vw, 90px);
}

/* Ink */
.net-ink { fill: none; stroke: var(--brick); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.net-line { vector-effect: non-scaling-stroke; }
.net-line--plane { stroke-dasharray: 2 7; stroke-width: 1.6; }
.net-node rect,
.net-node circle,
.net-node > path:first-child { fill: var(--paper); }
.net-node--cloud path { fill: var(--paper); }
.net-node .net-fill { fill: var(--brick); stroke: none; }

/* Labels */
.net-label text { text-anchor: middle; }
.net-label__yr {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .06em;
  fill: var(--brick);
}
.net-label__name {
  font-family: var(--serif);
  font-style: italic;
  font-size: 21px;
  fill: var(--ink);
}
.net-label .net-label__hand {
  font-family: var(--hand);
  font-size: 13px;
  fill: var(--brick);
  text-anchor: end;
}

.network__caption {
  grid-column: 8 / span 5;
  grid-row: 2;
  margin: 26px 0 0;
  padding-left: 14px;
  border-left: 1px solid var(--brick);
  font-family: var(--serif);
  font-variation-settings: 'opsz' 36, 'SOFT' 100;
  font-style: italic;
  font-size: 1.15rem;
  line-height: 1.45;
  color: var(--ink-soft);
  min-height: 3.4em;
  text-wrap: pretty;
}

/* The full milestone list: read by screen readers everywhere, shown on phones */
.network__legend {
  position: absolute;
  width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --------------------------------------------------------------------------
   The margin thread — a hand-drawn reading-progress line
   -------------------------------------------------------------------------- */
.thread {
  position: fixed;
  top: 0;
  left: max(10px, calc((100vw - var(--max)) / 2 - 28px));
  width: 40px;
  height: 100vh;
  z-index: 40;
  pointer-events: none;
  overflow: visible;
  display: none;
}
.thread__line {
  fill: none;
  stroke: var(--brick);
  stroke-width: 1.4;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  opacity: .7;
}

@media (min-width: 1280px) {
  .is-animated .thread { display: block; }
}

/* --------------------------------------------------------------------------
   Phones: the diagram becomes a picture; the list carries the story
   -------------------------------------------------------------------------- */
@media (max-width: 760px) {
  .network__year { grid-column: 1 / -1; font-size: clamp(4rem, 22vw, 6rem); }
  .network__map { margin-top: 28px; }
  /* Static fallback (reduced motion / no JS): picture + list */
  html:not(.is-animated) .net-label { display: none; }
  html:not(.is-animated) .network__caption { display: none; }

  .network__legend {
    position: static;
    width: auto; height: auto; margin: 32px 0 0; padding: 0;
    overflow: visible; clip: auto; white-space: normal;
    list-style: none;
    counter-reset: none;
  }
  .network__legend li {
    display: grid;
    grid-template-columns: 54px 1fr;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--rule);
    color: var(--ink-soft);
    font-size: .98rem;
  }
  .network__legend .mono { color: var(--brick); padding-top: 3px; }
}

/* Keep the pinned chapter inside one screen on desktop */
@media (min-width: 761px) {
  .network__map { max-height: calc(100vh - 400px); margin-top: 36px; }
  .network__caption { margin-top: 14px; }
}

/* Pencil underlay: the whole route, faintly, before the ink arrives */
.net-ghost { fill: none; stroke: var(--muted); stroke-width: 1; stroke-dasharray: 1 6; stroke-linecap: round; opacity: .35; }
.net-ghost * { fill: none !important; }
.net-ghost .net-fill { stroke: none; }

/* --------------------------------------------------------------------------
   Phones, animated: a tall, readable drawing the view pans across
   -------------------------------------------------------------------------- */
@media (max-width: 760px) {
  .is-animated .network__stage {
    --map-h: min(50svh, 380px);
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    overflow: hidden;
    grid-template-columns: repeat(12, minmax(0, 1fr));  /* the wide drawing must not stretch the grid */
  }
  .is-animated .network__map {
    height: var(--map-h);
    width: calc(var(--map-h) * 1200 / 560);
    max-width: none;
    max-height: none;
    margin-top: 72px;
  }
  .is-animated .network__year { font-size: clamp(3.6rem, 18vw, 5rem); }
  .is-animated .network__caption {
    display: block;
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 18px;
    font-size: 1.02rem;
    min-height: 4.4em;
  }
  .is-animated .network__legend {
    position: absolute;
    width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
}
