/* "How do the eight courses compare?" Every class is cr- prefixed; tokens from digest.css. */
.cr-tools, .cr-grid, .cr-detail, .cr-caption { --cr-ease: cubic-bezier(.23, 1, .32, 1); --cr-ease-io: cubic-bezier(.32, .72, 0, 1);
  --cr-gl: #e8ecec; --cr-ghost: #8d979c; --cr-dot: #8d979c; }

/* Order: dots choose one, one compact row (hidden until the script runs) */
.cr-tools { display: none; gap: 0 18px; margin: -12px 0 12px; }
.is-interactive .cr-tools { display: flex; flex-wrap: wrap; }
.cr-tools button { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 0; font-size: 14px; color: var(--muted); white-space: nowrap; }
.cr-tools button::before { content: ''; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--cr-dot);
  transition: background-color var(--feedback) var(--cr-ease), border-color var(--feedback) var(--cr-ease); }
.cr-tools button[aria-pressed="true"] { color: var(--ink); }
.cr-tools button[aria-pressed="true"]::before { background: var(--accent); border-color: var(--accent); }
@media (max-width: 360px) { .cr-tools { gap: 0 12px; } .cr-tools button { font-size: 13px; gap: 6px; } }

/* Grid: one map box for all eight (sized by the widest course); each map is as tall as its own course */
.cr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px 16px; }
@media (min-width: 900px) { .cr-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 56px 32px; } }
.cr-cell { min-width: 0; display: grid; grid-template-rows: subgrid; grid-row: span 5; row-gap: 0; padding-top: 10px; border-top: 1px solid var(--line); }
.cr-cell > * { min-width: 0; }
.cr-cell.is-open { border-top-color: var(--accent); }
.cr-name { font-family: var(--display); font-weight: 400; font-size: clamp(22px, 2.3vw, 30px); line-height: 1.1; letter-spacing: -.03em; }
.cr-open { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.is-interactive .cr-open::after { content: '↗'; margin-left: 5px; font-family: var(--reading); font-size: .5em; color: var(--muted); }
.cr-open:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.cr-open[aria-expanded="true"] { color: var(--accent); }
.is-interactive .cr-open[aria-expanded="true"]::after { content: '×'; color: var(--accent); }
.cr-meta { font-size: 12.5px; line-height: 1.4; color: var(--muted); }

.cr-map { align-self: center; margin-top: 14px; }
.is-interactive .cr-map { cursor: pointer; }
.cr-mapsvg { display: block; width: 100%; height: auto; overflow: visible; }
:is(.cr-route, .cr-ghost, .cr-done) { fill: none; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.cr-route { stroke: var(--ink); stroke-width: 1.6; }
.cr-map:hover .cr-route { stroke-width: 2.2; }
:is(.cr-start, .cr-start-in, .cr-finish, .cr-marker, .cr-runner, .cr-halo, .cr-lm-dot, .cr-lm-in, .cr-pmark, .cr-pmark-in) { fill: none; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.cr-start { stroke: var(--ink); stroke-width: 8; }
.cr-start-in { stroke: var(--paper); stroke-width: 4; }
.cr-finish { stroke: var(--ink); stroke-width: 7; }
.cr-marker { stroke: var(--accent); stroke-width: 11; }
.cr-bar { position: relative; display: block; height: 5px; margin-top: 10px; border: 1px solid var(--muted); border-top: 0; }
.cr-bar i { position: absolute; left: calc(100% + 6px); top: -3px; font-style: normal; font-size: 11px; line-height: 1; color: var(--muted); white-space: nowrap; }

/* Profiles: one height span for all eight (stated once in the caption) */
.cr-prof { position: relative; margin-top: 14px; touch-action: pan-y; }
.is-interactive .cr-prof { cursor: ew-resize; }
.cr-plot { position: relative; }
.cr-profsvg { display: block; width: 100%; height: auto; aspect-ratio: 4; overflow: visible; }
.cr-gl { stroke: var(--cr-gl); stroke-width: 1; vector-effect: non-scaling-stroke; }
.cr-base { stroke: #b9c1c4; stroke-width: 1; vector-effect: non-scaling-stroke; }
.cr-area { fill: var(--soft); }
.cr-pline { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.cr-bridge { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.cr-cursor { stroke: var(--accent); stroke-width: 1; vector-effect: non-scaling-stroke; }
.cr-pmark { stroke: var(--accent); stroke-width: 9; }
.cr-pmark.is-bridge { stroke: var(--muted); }
.cr-pmark-in { stroke: var(--paper); stroke-width: 4.5; }
.cr-cell .cr-prof { min-height: 44px; display: flex; align-items: center; }
.cr-cell .cr-plot { flex: 1; }
.cr-cell .cr-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }
.cr-prof:has(.cr-range:focus-visible) .cr-plot { outline: 3px solid var(--accent); outline-offset: 5px; }
.cr-read { min-height: 2.9em; margin-top: 10px; font-size: 12.5px; line-height: 1.45; color: var(--muted); font-variant-numeric: tabular-nums; }
.cr-read b { font-weight: 600; color: var(--ink); }
.cr-onbridge { color: var(--ink); }

/* Caption: the legend and each course's provenance, under the grid */
.cr-caption { max-width: none; margin-top: 36px; }
.cr-caption > p { max-width: 78ch; }
.cr-srcs { margin: 14px 0 0; padding: 0; list-style: none; columns: 2 340px; column-gap: 40px; font-size: 12.5px; line-height: 1.55; }
.cr-srcs li { break-inside: avoid; padding: 6px 0; border-top: 1px solid var(--line); }
.cr-srcs b { font-weight: 600; color: var(--ink); }

/* Draw once on entry (armed by the script; reduced motion never arms) */
.cr-cover { position: absolute; inset: -2px -4px -2px 0; background: var(--paper); transform-origin: 100% 50%; transform: scaleX(0); pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  .cr-grid.is-armed .cr-route { stroke-dasharray: 1 1; stroke-dashoffset: 1; }
  .cr-grid.is-armed .cr-cover { transform: scaleX(1); }
  .cr-grid.is-armed .cr-cell:not(.is-drawn) :is(.cr-start, .cr-start-in, .cr-finish) { opacity: 0; }
  .cr-grid.is-armed .cr-cell.is-drawn .cr-route { stroke-dashoffset: 0; transition: stroke-dashoffset 900ms var(--cr-ease-io) var(--d, 0ms); }
  .cr-grid.is-armed .cr-cell.is-drawn .cr-cover { transform: scaleX(0); transition: transform 900ms var(--cr-ease-io) calc(var(--d, 0ms) + 120ms); }
  .cr-grid.is-armed .cr-cell :is(.cr-start, .cr-start-in, .cr-finish) { transition: opacity 260ms var(--cr-ease) var(--d, 0ms); }
  .cr-grid.is-armed .cr-cell.is-drawn .cr-finish { transition-delay: calc(var(--d, 0ms) + 820ms); }
}

/* Detail: a full-width row after the opened city's row. Map large, readout beside it. */
.cr-detail { grid-column: 1 / -1; padding: 22px 0 12px; border-top: 2px solid var(--accent); }
.cr-detail[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .cr-detail.is-entering { animation: cr-in 480ms var(--cr-ease) both; }
  .cr-detail.is-entering .cr-ghost { stroke-dasharray: 1 1; animation: cr-draw 900ms var(--cr-ease-io) 120ms both; }
}
@keyframes cr-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes cr-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.cr-dhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.cr-dhead h3 { font-family: var(--display); font-weight: 400; font-size: clamp(36px, 5vw, 64px); line-height: 1; letter-spacing: -.045em; }
.cr-dhead h3:focus { outline: none; }
.cr-dhead p { margin-top: 10px; font-size: 14px; line-height: 1.45; color: var(--muted); }
.cr-close { flex: none; padding: 0; width: 44px; height: 44px; display: grid; place-items: center; font-size: 26px; line-height: 1; border: 1px solid var(--line); border-radius: 50%; }
.cr-close:hover { border-color: var(--ink); }

.cr-dbody { display: flex; flex-direction: column; gap: 22px; margin-top: 22px; }
.cr-dmap { --mh: 38svh; width: 100%; max-width: calc(var(--mh) * var(--ar)); margin-inline: auto; }
.cr-ghost { stroke: var(--cr-ghost); stroke-width: 2; }
.cr-done { stroke: var(--ink); stroke-width: 3.5; }
.cr-lm { cursor: pointer; }
.cr-lm-dot { stroke: var(--ink); stroke-width: 9; transition: stroke var(--feedback) var(--cr-ease); }
.cr-lm-in { stroke: var(--paper); stroke-width: 4.5; }
.cr-lm:not(.is-derived) .cr-lm-in { display: none; }
.cr-lm.is-now .cr-lm-dot { stroke: var(--accent); }
.cr-halo { stroke: var(--accent); stroke-width: 30; opacity: .14; }
.cr-runner { stroke: var(--accent); stroke-width: 13; }

/* Readout (from "Run the course"): big serif figures, serif landmark caption */
.cr-dside { display: grid; gap: 14px; }
.cr-read2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.cr-read2 p { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 5px; }
.cr-num { font-family: var(--display); font-size: 44px; line-height: .95; letter-spacing: -.04em; font-variant-numeric: tabular-nums lining-nums; }
.cr-unit { font-size: 15px; color: var(--muted); }
.cr-sub { flex-basis: 100%; margin-top: 4px; font-size: 12.5px; line-height: 1.35; color: var(--muted); }
.cr-del.is-bridge .cr-num { font-size: 19px; line-height: 1.25; letter-spacing: -.01em; }
.cr-cap { min-height: 3.6em; padding-top: 10px; border-top: 1px solid var(--line); }
.cr-cap-name { font-family: var(--display); font-size: 22px; line-height: 1.15; letter-spacing: -.02em; }
.cr-cap-km { margin-top: 3px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.cr-dprof { position: relative; padding-left: 34px; }
.cr-ytitle { margin: 0 0 8px -34px; font-size: 12px; color: var(--muted); }
.cr-dprof .cr-prof { margin-top: 0; }
.cr-dprof .cr-profsvg { aspect-ratio: auto; height: 120px; }
.cr-detail .cr-pline { stroke: var(--cr-ghost); stroke-width: 1.5; }
.cr-detail .cr-bridge { stroke: var(--cr-ghost); }
.cr-detail .cr-past .cr-area { fill: rgba(24, 33, 38, .1); }
.cr-detail .cr-past .cr-pline { stroke: var(--ink); stroke-width: 2; }
.cr-detail .cr-past .cr-bridge { stroke: var(--ink); }
.cr-detail .cr-cursor { stroke: var(--ink); }
.cr-yl { position: absolute; right: calc(100% + 7px); font-size: 11px; line-height: 1; color: var(--muted); transform: translateY(-50%); font-variant-numeric: tabular-nums; }
.cr-tick { position: absolute; bottom: -8px; width: 1px; height: 6px; background: var(--cr-dot); }
.cr-tick.is-now { width: 2px; background: var(--accent); }
.cr-xl { position: relative; height: 22px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cr-xl span { position: absolute; top: 10px; transform: translateX(-50%); white-space: nowrap; }
.cr-xl span:first-child { transform: none; }
/* Scrubber: the thumb's centre travels exactly across the plot (thumb 22 px) */
.cr-scrub { display: block; width: calc(100% + 22px); height: 44px; margin: 0 -11px; background: none; -webkit-appearance: none; appearance: none; cursor: pointer; }
.cr-scrub::-webkit-slider-runnable-track { height: 2px; background: var(--line); }
.cr-scrub::-moz-range-track { height: 2px; background: var(--line); }
.cr-scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -10px; border-radius: 50%; background: var(--accent); border: 3px solid var(--paper); box-shadow: 0 0 0 1px rgba(199, 67, 50, .35); }
.cr-scrub::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 3px solid var(--paper); box-shadow: 0 0 0 1px rgba(199, 67, 50, .35); }
.cr-scrub:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.cr-lms { display: grid; }
.cr-lms li { border-top: 1px solid var(--line); }
.cr-lms button { width: 100%; min-height: 44px; display: grid; grid-template-columns: 12px 5.4em minmax(0, 1fr); align-items: baseline; gap: 8px; padding: 10px 0; text-align: left; font-size: 14px; line-height: 1.35; }
.cr-lms button::before { content: ''; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--cr-dot); }
.cr-lms button[aria-pressed="true"]::before { background: var(--accent); border-color: var(--accent); }
.cr-lms button[aria-pressed="true"] .cr-lm-name { color: var(--accent); }
.cr-lm-km { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cr-lms button:hover .cr-lm-name { text-decoration: underline; text-underline-offset: 3px; }
.cr-dnote { max-width: 78ch; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.cr-dnote a, .cr-srcs a, .cr-photo a { color: var(--muted); }
.cr-photo img { display: block; width: 100%; height: auto; background: var(--soft); }
.cr-photo figcaption { margin-top: 8px; font-size: 12px; line-height: 1.5; color: var(--muted); }

@media (min-width: 900px) {
  .cr-dbody { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); column-gap: 56px; row-gap: 28px; align-items: start;
    grid-template-rows: auto auto auto auto 1fr; grid-template-areas: "map side" "map lms" "prof lms" "note lms" "photo lms"; }
  .cr-dmap { --mh: 64svh; grid-area: map; }
  .cr-dside { grid-area: side; gap: 18px; }
  .cr-dprof { grid-area: prof; }
  .cr-lms { grid-area: lms; }
  .cr-dnote { grid-area: note; }
  .cr-photo { grid-area: photo; max-width: 520px; }
  .cr-read2 { grid-template-columns: 1fr; gap: 20px; }
  .cr-num { font-size: 72px; }
  .cr-unit { font-size: 19px; }
  .cr-del.is-bridge .cr-num { font-size: 24px; }
  .cr-cap-name { font-size: 28px; }
  .cr-dprof .cr-profsvg { height: 160px; }
}

:is(.cr-tools button, .cr-open, .cr-close, .cr-lms button):focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
/* Phones: the readout and caption keep the height of their tallest state (a bridge
   note, a two-line landmark), so the slider below never moves under a finger. */
@media (max-width: 899px) {
  .cr-read2 { min-height: 96px; }
  .cr-cap { min-height: 84px; }
  .cr-cap-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .cr-cell, .cr-detail, .cr-detail * { transition: none !important; animation: none !important; } }
