/*
 * Two maps, one question — home page §A ("What it is").
 *
 * Builds on site.css. A split frame of the same Chicago corridor: the
 * inherited 'L' as it runs today on the left, the same ground with one new
 * line on the right, and between them the weekday figure the engine gives,
 * in Barlow, with a mono attribution under it. Signage register: white
 * ground, ink plates over each map, heavy rules, one blue accent — which
 * here is a line, so it is allowed to be a line. The CTA's own colours are
 * on the CTA's own lines and nowhere else.
 *
 * Everything here is the RESTING state: the line drawn, every station in,
 * every figure final. js/corridors.js opts into the motion with Web
 * Animations (fill: backwards), so with the script off — or under
 * prefers-reduced-motion — the first corridor simply stands, complete.
 *
 * Layout: on a phone the panels stack — today, the figure, then the same
 * ground with one line — so the question sits between the two maps there
 * too. From 600 px the maps sit side by side with the figure beneath; from
 * 900 px the figure moves BETWEEN the maps, which is where the question is.
 */

.corr {
  --cr-ground: var(--map-ground, #F7F8FA);
  --cr-water: #CBDFEE;
  --cr-water-edge: #A9C6DD;
  --cr-freeway: #C6CED6;
  --cr-casing: #FFFFFF;
  --cr-station: #FFFFFF;
  --cr-ink: var(--ink);
  --cr-new: var(--accent);

  margin: 0 0 clamp(2rem, 4vw, 3rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "today after"
    "read  read"
    "strip strip"
    "cite  cite";
  gap: 0.75rem 0.75rem;
  align-items: start;
}
@media (max-width: 599.98px) {
  .corr {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "today"
      "read"
      "after"
      "strip"
      "cite";
    gap: 1rem;
  }
  /* Between the maps the figure is ruled top and bottom, as a plate is. */
  .corr__read { border-bottom: 2px solid var(--ink); padding-bottom: 0.9rem; }
}
@media (min-width: 900px) {
  .corr {
    grid-template-columns: minmax(0, 1fr) minmax(15rem, 0.62fr) minmax(0, 1fr);
    grid-template-areas:
      "today read  after"
      "strip strip strip"
      "cite  cite  cite";
    gap: 1rem 1.25rem;
  }
}

/* ── The two maps ──────────────────────────────────────────────────────── */

.corr__panel { position: relative; min-inline-size: 0; perspective: 1100px; }
.corr__panel--today { grid-area: today; }
.corr__panel--after { grid-area: after; }

.corr__map {
  border: 1px solid var(--ink);
  background: var(--cr-ground);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  transform-origin: 50% 0;
}
.corr__map svg { display: block; inline-size: 100%; block-size: auto; aspect-ratio: 1 / 1; }

/* The plate sits over the map's top-left corner, as a sign does. */
.corr__plate {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  z-index: 1;
  min-height: 1.75rem;
  font-size: 0.8125rem;
  letter-spacing: 0.1em;
  padding-left: 0.55rem;
  padding-right: 0.65rem;
  transform-origin: 0 0;
}
@media (min-width: 600px) { .corr__plate { min-height: 2rem; font-size: 0.875rem; } }

/* The ground, in the hero's own cartographic palette. */
.corr__ground { fill: var(--cr-ground); }
.corr__water { fill: var(--cr-water); stroke: var(--cr-water-edge); stroke-width: 0.5; }
.corr__freeway { fill: none; stroke: var(--cr-freeway); stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; }
.corr__casing { fill: none; stroke: var(--cr-casing); stroke-width: 4.2; stroke-linecap: round; stroke-linejoin: round; }
.corr__l { fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.corr__stop { fill: var(--cr-station); stroke: var(--cr-ink); stroke-width: 0.8; }
.corr__ic { fill: var(--cr-station); stroke: var(--cr-ink); stroke-width: 1.2; }
.corr__scale line { stroke: var(--ink-2); stroke-width: 0.8; }
.corr__scale text { font-family: var(--mono); font-size: 8px; fill: var(--ink-3); }

/* The one new line: the page's accent, because here a line is meant. */
.corr__new-casing { fill: none; stroke: var(--cr-casing); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.corr__new { fill: none; stroke: var(--cr-new); stroke-width: 4.2; stroke-linecap: round; stroke-linejoin: round; }
.corr__new-st { fill: var(--cr-station); stroke: var(--cr-new); stroke-width: 1.6; transform-box: fill-box; transform-origin: center; }
.corr__label {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 9px;
  letter-spacing: 0.12em;
  fill: var(--cr-new);
  paint-order: stroke;
  stroke: var(--cr-ground);
  stroke-width: 3px;
  stroke-linejoin: round;
}

/* ── The answer ────────────────────────────────────────────────────────── */

.corr__read {
  grid-area: read;
  border-top: 2px solid var(--ink);
  padding-top: 0.75rem;
  min-inline-size: 0;
  align-self: center;
  transform-origin: 0 0;
}
@media (min-width: 900px) { .corr__read { padding-top: 1rem; } }

.corr__figure {
  margin: 0 0 0.6rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.5rem;
  line-height: 1;
}
.corr__v {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2rem, 6vw, 2.75rem);
  line-height: 1;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.corr__v--to { color: var(--ink); font-weight: 700; }
.corr__arrow { font-family: var(--display); font-weight: 500; font-size: clamp(1.4rem, 4vw, 2rem); color: var(--ink-3); }
.corr__unit {
  flex-basis: 100%;
  margin-top: 0.4rem;
  font-size: 0.875rem;
  color: var(--ink-2);
}
.corr__delta {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.4rem, 4vw, 1.75rem);
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  margin-top: 0.5rem;
}
@media (min-width: 900px) {
  /* Stacked in the narrow middle column: from, arrow, to, one under another. */
  .corr__figure { flex-direction: column; align-items: flex-start; gap: 0.35rem 0; }
  .corr__arrow { line-height: 0.8; }
  .corr__unit { flex-basis: auto; margin-top: 0.1rem; }
  .corr__delta { margin-top: 0.4rem; }
}

.corr__name { margin: 0 0 0.6rem; font-size: 0.875rem; line-height: 1.5; color: var(--ink-2); }
.corr__name b { color: var(--ink); font-weight: 600; transform-origin: 0 70%; display: inline-block; }
.corr__attr {
  margin: 0 0 0.35rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.55;
  color: var(--ink-3);
}
.corr__attr--share { color: var(--ink-2); }

/* ── The picker ────────────────────────────────────────────────────────── */

/* Six plates; only when the script runs, since only then do they do anything. */
.corr__strip {
  grid-area: strip;
  display: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  margin-top: 0.25rem;
}
.corr[data-live] .corr__strip { display: grid; }
@media (min-width: 600px) { .corr__strip { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

.corr__pick {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  min-block-size: 2.75rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--rule-2);
  border-left: 4px solid var(--rule-2);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.corr__pick b {
  color: inherit;
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
}
.corr__pick small { font-family: var(--mono); font-size: 0.7rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.corr__pick:hover { border-color: var(--ink); }
.corr__pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.corr__pick[aria-pressed="true"] { border-color: var(--ink); border-left-color: var(--accent); background: var(--ink); color: var(--ground); }
.corr__pick[aria-pressed="true"] small { color: var(--ground); opacity: 0.8; }

/* ── The citation ──────────────────────────────────────────────────────── */

.corr__cite {
  grid-area: cite;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.55;
  color: var(--ink-3);
  border-top: 1px solid var(--rule);
  padding-top: 0.5rem;
}

/* Night: the map keeps daylight water on the night ground, as the game does. */
@media (prefers-color-scheme: dark) {
  .corr {
    --cr-water: #16283A;
    --cr-water-edge: #243B52;
    --cr-freeway: #2A3340;
    --cr-casing: #0E1116;
    --cr-station: #0E1116;
  }
}

@media (prefers-reduced-motion: reduce) {
  .corr__map, .corr__read, .corr__plate, .corr__name b, .corr__pick {
    transform: none;
  }
}
