/* ==========================================================================
   WREN — pages/tunnels.css
   Chaptered editorial long-scroll + transit line-map progress rail.
   Newsreader leads; the rail is wayfinding (transit blue), the current
   position is her (sodium).
   ========================================================================== */

/* ---- Line-map rail ------------------------------------------------------- */
.line-map {
  position: fixed;
  left: clamp(10px, 2.5vw, 36px);
  top: 50%;
  transform: translateY(-50%);
  height: 58vh;
  z-index: 50;
  display: flex;
  gap: 10px;
}

.line-map__track {
  position: relative;
  width: 4px;
  height: 100%;
  background: color-mix(in srgb, var(--transit) 45%, var(--tunnel));
  border-radius: 2px;
}

/* --lm-p (0–100) is set by main.js from scroll progress */
.line-map__filled {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(var(--lm-p, 0) * 1%);
  background: var(--transit);
  border-radius: 2px;
}

.line-map__dot {
  position: absolute;
  left: 50%;
  top: calc(var(--lm-p, 0) * 1%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--sodium);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sodium) 25%, transparent);
}

.line-map__stops {
  position: relative;
  height: 100%;
}

.line-map__stops li {
  position: absolute;
  left: 0;
  transform: translateY(-50%);
}

/* Stops distributed evenly: 5 stops → 0 / 25 / 50 / 75 / 100% */
.line-map__stops li:nth-child(1) { top: 0%; }
.line-map__stops li:nth-child(2) { top: 25%; }
.line-map__stops li:nth-child(3) { top: 50%; }
.line-map__stops li:nth-child(4) { top: 75%; }
.line-map__stops li:nth-child(5) { top: 100%; }

.line-map__stops a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--concrete);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
  transition: color 0.25s var(--ease-house);
}

.line-map__marker {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid var(--transit);
  background: var(--tunnel);
  flex: none;
  /* optically sit on the track (track is left of the list) */
  margin-left: -20px;
  transition: background-color 0.25s var(--ease-house), border-color 0.25s var(--ease-house);
}

.line-map__stops a:hover,
.line-map__stops a:focus-visible {
  color: var(--tile);
}

.line-map__stops a.is-passed .line-map__marker {
  background: var(--transit);
}

.line-map__stops a.is-active {
  color: var(--sodium);
}

.line-map__stops a.is-active .line-map__marker {
  border-color: var(--sodium);
  background: var(--sodium);
}

/* Horizontal variant — narrow viewports (rail on top, under the nav;
   main.js sets --linemap-top from the real nav height) */
@media (max-width: 1023px) {
  .line-map {
    left: 0;
    right: 0;
    top: var(--linemap-top, 5rem);
    transform: none;
    height: auto;
    flex-direction: column;
    gap: 6px;
    padding: 10px var(--gutter) 8px;
    background: color-mix(in srgb, var(--tunnel) 92%, transparent);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
  }

  .line-map__track {
    width: 100%;
    height: 4px;
  }

  .line-map__filled {
    width: calc(var(--lm-p, 0) * 1%);
    height: 100%;
  }

  .line-map__dot {
    top: 50%;
    left: calc(var(--lm-p, 0) * 1%);
  }

  .line-map__stops {
    height: auto;
    width: 100%;
  }

  .line-map__stops li {
    transform: translateX(-50%);
  }

  .line-map__stops li:nth-child(1) { top: auto; left: 0%; transform: none; }
  .line-map__stops li:nth-child(2) { top: auto; left: 25%; }
  .line-map__stops li:nth-child(3) { top: auto; left: 50%; }
  .line-map__stops li:nth-child(4) { top: auto; left: 75%; }
  .line-map__stops li:nth-child(5) { top: auto; left: 100%; transform: translateX(-100%); }

  .line-map__marker {
    margin-left: 0;
  }

  /* labels get tight on phones: number-free dots + tiny labels */
  .line-map__label {
    display: none;
  }

  @media (min-width: 560px) {
    .line-map__label {
      display: inline;
    }
  }
}

/* ---- Article ---------------------------------------------------------------- */
.tunnels {
  padding-block: var(--space-6) var(--space-7);
}

/* clear the fixed vertical rail */
@media (min-width: 1024px) {
  .tunnels {
    padding-left: clamp(6rem, 12vw, 10rem);
  }
}

@media (max-width: 1023px) {
  .tunnels {
    padding-top: calc(var(--space-6) + 3rem); /* clear the horizontal rail */
  }
}

.tunnels__eyebrow {
  color: var(--transit-text); /* --transit fails AA at this size on dark */
  margin-bottom: var(--space-3);
}

.tunnels__title {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-4);
}

.tunnels__lede {
  font-size: 1.3rem;
  color: var(--tile);
}

/* ---- Stops -------------------------------------------------------------------- */
.stop {
  padding-top: var(--space-7);
  /* anchor offset so #stop-n lands below the fixed nav */
  scroll-margin-top: 6rem;
}

.stop__body {
  display: grid;
  gap: var(--space-4);
  max-width: var(--measure-ed);
}

.stop__body .t-editorial {
  max-width: none;
}

.stop__media {
  margin-block: var(--space-3);
}

.stop__media--pair {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: var(--space-3);
  align-items: start;
}

/* the viral clip: phone-framed portrait beside its aftermath */
.stop__media--moment {
  display: grid;
  grid-template-columns: minmax(180px, 280px) 1fr;
  gap: var(--space-3);
  align-items: start;
}

@media (max-width: 640px) {
  .stop__media--pair,
  .stop__media--moment {
    grid-template-columns: 1fr;
  }
}

.stop__quote {
  border-left: 3px solid var(--sodium);
  padding-left: var(--space-4);
  margin-block: var(--space-2);
}

.stop__quote p {
  font-family: var(--font-editorial);
  font-style: italic;
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  line-height: 1.4;
  color: var(--sodium);
}

.stop__cta {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-4);
}
