/* Story maps (/xeriteler/<story>/): the page around shared/story-map.js. Colours: --accent,
   --second and --third are the stories' travellers or parts, as route.json names them. */
  :root {
    --paper: #F4EFE6; --ink: #1A1410; --muted: #675E55; --rule: rgb(26 20 16 / .14); --frame: #E9E2D6;
    --accent: #A81E28; --second: #1F5C73; --third: #5B6B2E; --panel: rgb(244 239 230 / .96); --water: #E4DCCF; --land: #F4EFE6;
    --serif: 'Literata', Georgia, serif; --sans: 'Inter', system-ui, sans-serif;
    color-scheme: light dark;
  }
  @media (prefers-color-scheme: dark) {
    :root { --paper: #14100D; --ink: #F1EBE1; --muted: #A0968B; --rule: rgb(241 235 225 / .14); --frame: #1F1914;
      --accent: #DA5A61; --second: #6FB3CC; --third: #A9BC6A; --panel: rgb(20 16 13 / .95); --water: #0C0A08; --land: #1C1713; }
  }
  * { box-sizing: border-box; margin: 0; }
  html, body { height: 100%; }
  body { background: var(--paper); color: var(--ink); font: 400 .9375rem/1.5 var(--sans); -webkit-font-smoothing: antialiased; overflow: hidden; }
  a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 1px; text-decoration-color: var(--rule); }
  a:hover { text-decoration-color: currentColor; }
  button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
  [hidden] { display: none !important; }

  #map { position: fixed; inset: 0; background: var(--water); }
  .panel { position: fixed; top: 1rem; left: 1rem; bottom: 1rem; width: 25rem; display: flex; flex-direction: column;
    background: var(--panel); backdrop-filter: blur(8px); border: 1px solid var(--rule); border-radius: 4px;
    box-shadow: 0 1px 2px rgb(0 0 0 / .04), 0 8px 32px rgb(0 0 0 / .06); }
  .head { padding: 1.25rem 1.5rem 1rem; border-bottom: 1px solid var(--rule); }
  .top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
  .top nav { display: flex; align-items: center; gap: 1rem; font-size: .8125rem; color: var(--muted); }
  .brand { display: inline-flex; align-items: center; gap: .5rem; font-size: .8125rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
  .brand svg { width: 1rem; height: 1rem; }
  .star { fill: currentColor; } .gem { fill: var(--accent); }
  .langs { display: inline-flex; gap: .15rem; }
  .langs button { font-size: .6875rem; letter-spacing: .04em; padding: .1rem .3rem; border-radius: 2px; }
  .langs button[aria-pressed="true"] { color: var(--ink); box-shadow: inset 0 -1px currentColor; }
  h1 { margin-top: 1.25rem; font: 400 1.75rem/1.1 var(--serif); letter-spacing: -.02em; }
  .sub { margin-top: .35rem; font: italic 300 1rem/1.35 var(--serif); }

  .body { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
  .route h2 { padding: 1rem 1.5rem .35rem; font: 500 .75rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: .5rem; }
  .route h2::before { content: ''; width: 1.25rem; height: 2px; background: var(--c); }
  /* A story told in one order, each stop marked with its traveller's colour */
  .route .who { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; background: var(--c); margin-right: .45rem; vertical-align: .08em; }
  .route ol { list-style: none; padding: 0 0 .5rem; }
  .route li button { display: grid; grid-template-columns: 1.75rem 1fr; gap: .1rem .5rem; width: 100%; text-align: left; padding: .4rem 1.5rem; }
  .route li button:hover { background: var(--rule); }
  .route .n { grid-row: span 2; font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: .15rem; }
  .route .name { font-weight: 500; }
  .route .meta { font-size: .8125rem; color: var(--muted); }
  .note { padding: 1rem 1.5rem 1.5rem; font-size: .75rem; color: var(--muted); }

  .stop { padding: 1rem 1.5rem 1.5rem; }
  .stop-nav { display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-size: .8125rem; color: var(--muted); }
  .stop-nav button { padding: .25rem 0; }
  .stop-nav button:hover { color: var(--ink); }
  .stop-nav button[disabled] { opacity: .35; cursor: default; }
  .stop .part { margin-top: 1rem; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--c); font-weight: 500; }
  .stop h2 { margin-top: .25rem; font: 400 1.625rem/1.15 var(--serif); letter-spacing: -.015em; }
  .stop .approx { font-size: .75rem; color: var(--muted); }
  .stop .text { margin-top: .75rem; font: 400 1.0625rem/1.5 var(--serif); }
  .scene { margin-top: 1.25rem; }
  .scene h3 { font-size: .875rem; font-weight: 500; }
  .thumbs { display: flex; gap: .4rem; margin-top: .5rem; overflow-x: auto; scrollbar-width: none; padding-bottom: .25rem; }
  .thumbs::-webkit-scrollbar { display: none; }
  .thumbs img { height: 7rem; width: auto; display: block; border-radius: 2px; opacity: 0; transition: opacity .4s; }
  .thumbs img:not([width]) { aspect-ratio: 3 / 4; }
  .thumbs img.ok { opacity: 1; }
  .reads { margin-top: 1.25rem; padding-top: .75rem; border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; gap: .35rem .9rem; font-size: .8125rem; }
  .reads span { color: var(--muted); width: 100%; }
  .reads a { font-weight: 500; text-decoration: none; }
  .reads a:hover { color: var(--accent); }

  .maplibregl-ctrl-attrib { font: .6875rem var(--sans); background: var(--panel) !important; color: var(--muted); }
  .maplibregl-ctrl-attrib a { color: var(--muted); }
  .maplibregl-ctrl-group { background: var(--panel); border: 1px solid var(--rule); box-shadow: none !important; }
  @media (prefers-color-scheme: dark) { .maplibregl-ctrl-group .maplibregl-ctrl-icon { filter: invert(1); } }
  .maplibregl-popup-content { background: var(--paper); color: var(--ink); font: .8125rem var(--sans); padding: .4rem .6rem; border-radius: 3px; box-shadow: 0 2px 12px rgb(0 0 0 / .15); }
  .maplibregl-popup-tip { display: none; }

  /* Legend: on the map, always in view */
  .legend { position: fixed; top: 1rem; right: 1rem; z-index: 2; background: var(--panel); backdrop-filter: blur(8px); border: 1px solid var(--rule); border-radius: 4px; padding: .6rem .8rem; font-size: .75rem; display: grid; gap: .35rem; max-width: 15rem; box-shadow: 0 1px 2px rgb(0 0 0 / .04); }
  .legend div { display: grid; grid-template-columns: 2.25rem 1fr; align-items: center; gap: .5rem; }
  .legend svg { width: 2.25rem; height: .75rem; overflow: visible; }
  .legend .k { color: var(--muted); }

  .thumbs button { flex: none; background: var(--frame); border-radius: 2px; }

  @media (max-width: 48rem) {
    .legend { top: .5rem; left: .5rem; right: .5rem; max-width: none; display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .8rem; padding: .35rem .6rem; font-size: .6875rem; }
    .legend div { grid-template-columns: 1.25rem auto; gap: .3rem; }
    /* A colour ramp needs a row of its own, or the strip squeezes it to nothing */
    .legend .ramp, .legend .ticks { flex: 1 1 100%; min-width: 10rem; }
    .legend svg { width: 1.25rem; }
    .maplibregl-ctrl-top-right { top: 2.5rem; }
    .panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 55svh; border-radius: 12px 12px 0 0; border-bottom: 0; }
    .head { padding: 1rem 1rem .75rem; }
    h1 { margin-top: .75rem; font-size: 1.375rem; }
    .sub { display: none; }
    .route h2, .route li button, .stop, .note { padding-inline: 1rem; }
    .maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { bottom: 55svh; }
  }
  @media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
