/* Atlas — walks (static/js/explore/walks.js): the place's walks as cards,
   and one walk: its paper map, the scrubber, a coloured card per stop, the
   guesses and the score.

   Colours come from the tokens (static/explore/tokens.css): the place's own
   (--place-*) on the map's route, its pins and the cards; a stop's card
   takes the colour of what it belongs to — an era's (--era-*, .by-era), a
   culture theme's (--theme-*, .by-theme), else the place's. The map's own
   inks (water, a park, a wall) have no data file to carry a hue, so they
   are here, as tokens.css keeps the history layers': the label inks
   (--wk-*-ink) are checked for contrast on the paper and on their own
   shape by tests/js/explore-contrast.test.mjs. */

:root {
  --wk-water: #a9cbd6;        /* a river, as a band */
  --wk-water-ink: #22495a;    /* its name */
  --wk-park: #cbdcaa;         /* a park, as a wash */
  --wk-park-ink: #44582a;     /* its name */
  --wk-wall: #8d6a45;         /* a wall, as a dashed line */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --wk-water: #2b4a55;
    --wk-water-ink: #9fd0df;
    --wk-park: #2f3d26;
    --wk-park-ink: #b9d295;
    --wk-wall: #b8976f;
  }
}
:root[data-theme="dark"] {
  --wk-water: #2b4a55;
  --wk-water-ink: #9fd0df;
  --wk-park: #2f3d26;
  --wk-park-ink: #b9d295;
  --wk-wall: #b8976f;
}

/* ── the page ── */
.wk-page { max-width: 1120px; margin: 0 auto; padding: 0 0 56px; display: flex; flex-direction: column; gap: 22px; }
.wk-trail ol { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; list-style: none; margin: 0; padding: 0; font-size: 14px; }
.wk-trail li + li::before { content: "›"; margin: 0 9px; color: var(--x-ink-2); }
.wk-trail a { color: var(--x-navy); font-weight: 600; text-decoration: none; }
.wk-trail a:hover { text-decoration: underline; text-decoration-color: var(--place-mark); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.wk-trail [aria-current] { color: var(--x-ink-2); }

/* the header: the place's colour on a torn sheet */
.wk-hero {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: center;
  padding: 30px 32px 46px; border-radius: var(--x-radius) var(--x-radius) 0 0; overflow: hidden;
  background-color: var(--place-fill); background-image: var(--x-grain); color: var(--place-on);
  -webkit-mask: var(--x-tear-b) left bottom / 240px 12px repeat-x, linear-gradient(#000 0 0) left top / 100% calc(100% - 11px) no-repeat;
  mask: var(--x-tear-b) left bottom / 240px 12px repeat-x, linear-gradient(#000 0 0) left top / 100% calc(100% - 11px) no-repeat;
}
.is-list .wk-hero { grid-template-columns: minmax(0, 1fr) minmax(200px, 360px); }
.wk-hero-text { display: grid; gap: 8px; justify-items: start; min-width: 0; }
.wk-hero-art {
  order: 2; align-self: stretch; min-height: 150px; transform: rotate(1.4deg); box-shadow: var(--x-shadow-lift);
  -webkit-mask: var(--x-tear-t) left top / 240px 12px repeat-x, var(--x-tear-b) left bottom / 240px 12px repeat-x, linear-gradient(#000 0 0) left center / 100% calc(100% - 22px) no-repeat;
  mask: var(--x-tear-t) left top / 240px 12px repeat-x, var(--x-tear-b) left bottom / 240px 12px repeat-x, linear-gradient(#000 0 0) left center / 100% calc(100% - 22px) no-repeat;
}
.wk-hero-art svg { display: block; width: 100%; height: 100%; }
.wk-kicker { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.wk-h1 { margin: 0; font-family: var(--serif); font-size: clamp(30px, 4.6vw, 50px); font-weight: 600; line-height: 1.05; letter-spacing: -0.012em; outline: none; color: inherit; max-width: 22ch; }
.wk-native { margin: 0; font-family: var(--serif); font-style: italic; font-size: clamp(18px, 2.2vw, 23px); }
.wk-answer, .wk-hero .wk-lede { margin: 4px 0 0; max-width: 60ch; font-size: 17px; line-height: 1.5; }
.wk-meta { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 6px 0 0; padding: 0; font-size: 14px; font-weight: 650; }
.wk-meta li { display: inline-flex; align-items: center; gap: 6px; }
.wk-meta .icon { flex: none; }
.wk-lede-box { max-width: 66ch; }
.wk-lede-box .wk-lede { margin: 0; font-size: 17px; line-height: 1.62; color: var(--text); }
.wk-lede-box .wk-lede + .wk-lede { margin-top: 10px; }

.wk-draft {
  display: inline-flex; align-items: center; min-height: 20px; padding: 0 8px; border-radius: 999px;
  border: 1.5px dashed currentColor; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: none;
}

/* ── the map and the scrubber ── */
.wk-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; align-items: start; }
.wk-mapcol { min-width: 0; }
.wk-map { margin: 0; }
.wk-stage {
  position: relative; width: min(100%, calc((100vh - 230px) * var(--wk-ar, 1.3))); min-width: min(100%, 300px); margin: 0 auto;
  overflow: hidden; border-radius: 4px;
  background: var(--x-paper-2) var(--x-grain); box-shadow: var(--x-shadow), inset 0 0 0 1.5px var(--x-line);
}
.wk-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.wk-river { fill: none; stroke: var(--wk-water); stroke-linecap: round; stroke-linejoin: round; }
.wk-river-in { fill: none; stroke: color-mix(in srgb, var(--wk-water) 55%, var(--x-paper-2)); stroke-linecap: round; stroke-linejoin: round; }
.wk-park { fill: var(--wk-park); stroke: color-mix(in srgb, var(--wk-park-ink) 30%, transparent); stroke-width: 1; vector-effect: non-scaling-stroke; }
.wk-square { fill: var(--x-paper-3); stroke: var(--x-line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.wk-wall { fill: none; stroke: var(--wk-wall); stroke-linecap: butt; }
.wk-route-under { fill: none; stroke: var(--place-wash); stroke-linecap: round; stroke-linejoin: round; }
.wk-route { fill: none; stroke: var(--place-mark); stroke-linecap: round; stroke-linejoin: round; }
.wk-route-done { fill: none; stroke: var(--place-mark); stroke-linecap: round; stroke-linejoin: round; opacity: 0.45; }
.wk-arrow { fill: var(--place-mark); }
.wk-walker-halo { fill: var(--x-red); opacity: 0.2; }
.wk-walker-dot { fill: var(--x-red); stroke: var(--x-paper-2); stroke-width: 2.5; vector-effect: non-scaling-stroke; }

.wk-over { position: absolute; inset: 0; pointer-events: none; }
.wk-lm {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap;
  font: italic 500 12.5px/1.1 var(--serif); letter-spacing: 0.02em; color: var(--x-ink-2);
}
.wk-lm.is-river { color: var(--wk-water-ink); font-weight: 600; letter-spacing: 0.08em; }
.wk-lm.is-park { color: var(--wk-park-ink); }

/* a stop: a numbered dot; the open one is red and says its name */
.wk-pin {
  position: absolute; width: 28px; height: 28px; margin: -14px 0 0 -14px; padding: 0; border: 0; border-radius: 50%;
  background: none; pointer-events: auto; cursor: pointer; font: inherit;
}
.wk-pin-n {
  display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%;
  background: var(--place-fill); color: var(--place-on); font-size: 13px; font-weight: 800;
  box-shadow: 0 0 0 2.5px var(--x-paper-2), 0 3px 6px -2px rgba(60, 40, 10, 0.45);
  transition: transform 0.15s, background 0.15s;
}
.wk-pin.is-done .wk-pin-n { background: var(--place-soft); color: var(--x-navy); }
.wk-pin.is-on { z-index: 2; }
.wk-pin.is-on .wk-pin-n { background: var(--x-red); color: var(--x-on); transform: scale(1.18); }
.wk-pin:hover .wk-pin-n { transform: scale(1.12); }
.wk-pin:focus-visible { outline: 3px solid var(--x-navy); outline-offset: 3px; }
.wk-pin-name {
  position: absolute; left: calc(100% + 8px); top: 50%; display: none; transform: translateY(-50%) rotate(-1.2deg);
  padding: 4px 13px 5px 11px; white-space: nowrap; background: var(--x-paper-2); color: var(--x-navy);
  font: 600 13.5px/1.1 var(--serif); box-shadow: var(--x-shadow);
  -webkit-mask: var(--x-tear-l) left top / 8px 160px repeat-y, var(--x-tear-r) right top / 8px 160px repeat-y, linear-gradient(#000 0 0) center / calc(100% - 14px) 100% no-repeat;
  mask: var(--x-tear-l) left top / 8px 160px repeat-y, var(--x-tear-r) right top / 8px 160px repeat-y, linear-gradient(#000 0 0) center / calc(100% - 14px) 100% no-repeat;
}
.wk-pin.is-on .wk-pin-name { display: block; }
.wk-pin.is-left .wk-pin-name { left: auto; right: calc(100% + 8px); }

/* a true scale, north, and where the city is */
/* each takes the corner walks.js found empty: .is-tl, .is-tr, .is-bl, .is-br */
.wk-scale, .wk-north, .wk-inset { position: absolute; }
.wk-scale.is-bl, .wk-north.is-bl, .wk-inset.is-bl { left: 3%; bottom: 3%; }
.wk-scale.is-br, .wk-north.is-br, .wk-inset.is-br { right: 3%; bottom: 3%; }
.wk-scale.is-tl, .wk-north.is-tl, .wk-inset.is-tl { left: 3%; top: 3%; }
.wk-scale.is-tr, .wk-north.is-tr, .wk-inset.is-tr { right: 3%; top: 3%; }
.wk-scale { display: grid; gap: 3px; }
.wk-scale-bar { display: flex; height: 7px; border: 1.5px solid var(--x-navy); background: var(--x-paper-2); }
.wk-scale-bar > span { flex: 1; }
.wk-scale-bar > span:first-child { background: var(--x-navy); }
.wk-scale-label { font-size: 11.5px; font-weight: 750; color: var(--x-navy); white-space: nowrap; }
.wk-north { display: grid; justify-items: center; gap: 1px; font: 700 12px/1 var(--serif); color: var(--x-navy); }
.wk-north svg { width: 15px; height: auto; display: block; }
.wk-north-a { fill: var(--x-navy); }
.wk-north-b { fill: var(--x-paper-2); stroke: var(--x-navy); stroke-width: 1.2; }
.wk-inset {
  width: clamp(84px, 24%, 168px);
  border: 3px solid var(--x-paper-2); box-shadow: var(--x-shadow); transform: rotate(1.2deg); background: var(--x-sea);
}
.wk-inset .xm-town-name { display: none; }
.wk-inset .xm-dot { width: 9px; height: 9px; background: var(--x-red); }

.wk-scrub {
  container-type: inline-size; display: grid; gap: 4px; max-width: 640px; margin: 12px auto 0;
  --w-fill: var(--place-fill); --w-ink: var(--place-ink); --w-mark: var(--place-mark); --w-soft: var(--place-soft); --w-wash: var(--place-wash); --w-on: var(--place-on);
}
.wk-scrub-label { display: grid; gap: 2px; font-size: 13px; font-weight: 650; color: var(--x-ink-2); }
.wk-scrub .xw-stepper { margin: 4px 0 0; }
.wk-scrub :focus-visible { outline: 2.5px solid var(--x-red); outline-offset: 2px; }

/* ── a stop ── */
.wk-stopcol { display: grid; gap: 18px; min-width: 0; }
.wk-stop {
  --k-fill: var(--place-fill); --k-on: var(--place-on); --k-ink: var(--place-ink); --k-mark: var(--place-mark); --k-wash: var(--place-wash);
  position: relative; padding: 28px 22px 18px; border-radius: var(--x-radius);
  background: var(--x-paper-2) var(--x-grain); color: var(--text); box-shadow: var(--x-shadow);
}
.wk-stop.by-era { --k-fill: var(--era-fill); --k-on: var(--era-on); --k-ink: var(--era-ink); --k-mark: var(--era-mark); --k-wash: var(--era-wash); }
.wk-stop.by-theme { --k-fill: var(--theme-fill); --k-on: var(--theme-on); --k-ink: var(--theme-ink); --k-mark: var(--theme-mark); --k-wash: var(--theme-wash); }
.wk-stop::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 13px; border-radius: var(--x-radius) var(--x-radius) 0 0;
  background: var(--k-mark);
  -webkit-mask: var(--x-tear-b) left bottom / 240px 12px repeat-x, linear-gradient(#000 0 0) left top / 100% calc(100% - 11px) no-repeat;
  mask: var(--x-tear-b) left bottom / 240px 12px repeat-x, linear-gradient(#000 0 0) left top / 100% calc(100% - 11px) no-repeat;
}
.wk-stop[hidden] { display: none; }
.wk-stop-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: start; }
.wk-stop-n {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  background: var(--k-fill); color: var(--k-on); font: 600 23px/1 var(--serif); box-shadow: 0 0 0 3px var(--x-paper-2), var(--x-shadow);
}
.wk-stop-kicker { margin: 0; font-size: 11.5px; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; color: var(--k-ink); }
.wk-stop-title { margin: 3px 0 0; font: 600 clamp(23px, 2.8vw, 29px)/1.12 var(--serif); color: var(--x-navy); outline: none; }
.wk-stop-native { margin: 3px 0 0; font: italic 500 17px/1.3 var(--serif); color: var(--k-ink); }
.wk-stop-meta { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; font-size: 13.5px; color: var(--x-ink-2); }
.wk-stop-meta .icon { flex: none; }
.wk-stop-text p { margin: 14px 0 0; max-width: 64ch; font-size: 16.5px; line-height: 1.62; }
/* a cited source (prose.js draws it): a small raised number in the card's ink */
.wk-page .xl-src { line-height: 0; }
.wk-page .xl-src-a { padding: 0 0 0 1px; font-size: 0.74em; font-weight: 750; color: var(--k-ink, var(--place-ink)); text-decoration: none; }
.wk-page .xl-src-a:hover { text-decoration: underline; }

.wk-stop .wk-guess { margin: 18px 0 4px; padding: 22px 16px 14px; box-shadow: inset 0 0 0 1.5px var(--x-line); background: var(--x-paper); }
.wk-guess .xw-prompt:empty { display: none; }
.wk-guess .xw-title { font-size: clamp(19px, 2.1vw, 22px); }

.wk-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.wk-chip { white-space: normal; min-height: 38px; padding: 6px 14px; line-height: 1.3; text-align: left; }
.wk-chip-when { font-weight: 500; }
.wk-chip-when::before { content: " · "; }

.wk-today { margin: 18px 0 0; padding: 14px 16px; border-radius: 4px; background: var(--k-wash); }
.wk-today-h { margin: 0 0 8px; font-size: 12px; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; color: var(--k-ink); }
.wk-today dl { margin: 0; display: grid; gap: 10px; }
.wk-today dt { font-size: 13.5px; font-weight: 750; color: var(--x-navy); }
.wk-today dd { margin: 2px 0 0; font-size: 15.5px; line-height: 1.55; color: var(--text); }

.wk-stop-nav { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin: 20px 0 0; }
.wk-stop-nav .x-btn { white-space: normal; text-align: left; line-height: 1.25; padding-top: 8px; padding-bottom: 8px; }
.wk-next { margin-left: auto; }
.wk-next-d { font-weight: 500; white-space: nowrap; }
.wk-next-d::before { content: " · "; }

/* ── the score ── */
.wk-score { padding: 16px 18px; border-radius: var(--x-radius); background: var(--x-paper-2); box-shadow: inset 0 0 0 1.5px var(--x-line); }
.wk-score.is-end { box-shadow: inset 0 0 0 2px var(--x-red), var(--x-shadow); }
.wk-score-h, .wk-route-h, .wk-sources-h { margin: 0; font: 600 20px/1.2 var(--serif); color: var(--x-navy); outline: none; }
.wk-score-dots { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; padding: 0; }
.wk-score-dot {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  border: 1.5px dashed var(--x-ink-2); color: var(--x-ink-2); font-size: 12.5px; font-weight: 750;
}
.wk-score-dot.is-close { border: 0; background: var(--place-fill); color: var(--place-on); }
.wk-score-dot.is-far { border-style: solid; background: var(--x-paper-3); }
.wk-score-line { margin: 0; font-size: 15.5px; font-weight: 650; color: var(--x-navy); }

/* ── the whole walk, stop by stop ── */
.wk-route { padding: 4px 0 0; }
.wk-route-h { margin-bottom: 8px; }
.wk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.wk-list > li { position: relative; }
.wk-list > li:not(:last-child)::after {
  content: ""; position: absolute; left: 23px; top: 38px; bottom: -8px; border-left: 2px dotted var(--place-mark); pointer-events: none;
}
.wk-list-item {
  width: 100%; min-height: 48px; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; align-items: center;
  padding: 8px 10px; border: 0; border-radius: 4px; background: none; color: var(--x-navy); font: inherit; text-align: left; cursor: pointer;
}
.wk-list-item:hover { background: var(--place-wash); }
.wk-list-item[aria-current] { background: var(--place-wash); box-shadow: inset 3px 0 0 var(--place-mark); }
.wk-list-item:focus-visible { outline: 2.5px solid var(--x-red); outline-offset: 1px; }
.wk-list-n { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--place-soft); color: var(--x-navy); font-size: 12.5px; font-weight: 800; position: relative; z-index: 1; }
.wk-list-item[aria-current] .wk-list-n { background: var(--x-red); color: var(--x-on); }
.wk-list-text { display: grid; gap: 1px; min-width: 0; }
.wk-list-text strong { font: 600 16px/1.25 var(--serif); }
.wk-list-text span { font-size: 13px; color: var(--x-ink-2); }
.wk-list-item:hover .wk-list-text span, .wk-list-item[aria-current] .wk-list-text span { color: var(--text); }

/* ── sources, and the way on ── */
.wk-sources { max-width: 72ch; }
.wk-sources ol { margin: 8px 0 0; padding-left: 24px; font-size: 14px; line-height: 1.5; }
.wk-sources li { margin: 5px 0; border-radius: 3px; }
.wk-sources li:focus { outline: 2px solid var(--x-red); outline-offset: 3px; }
.wk-src-pub { color: var(--x-ink-2); }
.wk-src-what { display: block; font-size: 13px; color: var(--x-ink-2); }
.wk-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding-top: 18px; border-top: 1.5px solid var(--x-line); }
.wk-empty { padding: 20px; }
.wk-empty p { margin: 0 0 8px; }

/* ── the cards: the place's shelf, the list ── */
.wk-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 12px; }
.wk-cards > li { display: flex; min-width: 0; }
.wk-card {
  flex: 1; min-width: 0; display: grid; grid-template-columns: 96px minmax(0, 1fr) 20px; align-items: center; gap: 14px;
  padding: 14px; border-radius: 4px; text-decoration: none; color: var(--x-navy);
  background: var(--place-wash) var(--x-grain); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--place-mark) 40%, transparent);
  transition: transform 0.18s, box-shadow 0.18s;
}
.wk-card.is-big { grid-template-columns: 120px minmax(0, 1fr) 20px; padding: 18px; }
.wk-card:hover { transform: translateY(-3px) rotate(-0.4deg); box-shadow: var(--x-shadow-lift); }
.wk-card:focus-visible { outline: 3px solid var(--x-navy); outline-offset: 3px; }
.wk-art { display: block; width: 100%; height: auto; overflow: visible; }
.wk-art-route { fill: none; stroke: var(--place-mark); stroke-width: 2.6; stroke-dasharray: 0 6; stroke-linecap: round; stroke-linejoin: round; }
.wk-art-pin { fill: var(--place-fill); stroke: var(--x-paper-2); stroke-width: 1.6; }
.wk-art-pin.is-start { fill: var(--x-red); }
.wk-card-text { display: grid; gap: 4px; min-width: 0; }
.wk-card-kicker { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px; font-size: 11px; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; color: var(--place-ink); }
.wk-card-kicker .icon { flex: none; }
.wk-card-title { font: 600 19px/1.15 var(--serif); }
.wk-card-q { font-size: 14px; line-height: 1.45; color: var(--text); }
.wk-card-meta { font-size: 12.5px; font-weight: 750; color: var(--place-ink); }
.wk-card-go { display: inline-flex; color: var(--x-navy); transition: transform 0.15s; }
.wk-card:hover .wk-card-go { transform: translateX(3px); }

/* ── wide: the map stays while the stops go by ── */
@media (min-width: 960px) {
  .wk-grid { grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 32px; }
  .wk-mapcol { position: sticky; top: 14px; }
  .wk-stage { width: min(100%, calc((100vh - 200px) * var(--wk-ar, 1.3))); }
}

/* ── a phone ── */
@media (max-width: 760px) {
  .wk-hero, .is-list .wk-hero { grid-template-columns: minmax(0, 1fr); padding: 22px 20px 38px; gap: 14px; }
  .wk-hero-art { order: 0; min-height: 0; height: 92px; transform: rotate(-1deg); }
  .wk-stop { padding: 26px 16px 16px; }
  .wk-stop-head { gap: 12px; }
  .wk-stop-n { width: 40px; height: 40px; font-size: 20px; }
  .wk-stage { width: 100%; min-width: 0; }
  .wk-card.is-big { grid-template-columns: 84px minmax(0, 1fr) 20px; padding: 14px; gap: 12px; }
  .wk-card { grid-template-columns: 80px minmax(0, 1fr) 20px; }
  .wk-lm { font-size: 11px; }
  .wk-pin { width: 24px; height: 24px; margin: -12px 0 0 -12px; }
  .wk-pin-n { font-size: 12px; }
  .wk-pin-name { font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .wk-card, .wk-card-go, .wk-pin-n { transition: none; }
  .wk-card:hover { transform: none; }
  .wk-pin.is-on .wk-pin-n, .wk-pin:hover .wk-pin-n { transform: none; }
}
