/* Shade or Shortcut — shared styles for the hand-written pages (dark base, monospace labels; warm = sun, cyan = shade, violet = indoors). */
:root {
  --bg: #07080b;
  --panel: rgba(12, 14, 19, 0.82);
  --card: rgba(255, 255, 255, 0.04);
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.22);
  --ink: #e8e6df;
  --dim: #8b8a84;
  --sun: #ff8a3d;
  --sun-soft: #ffc078;
  --bldg: #5b8cff;
  --tree: #43c27a;
  --indoor: #b48cff;
  --cool: #35d0e0;
  --display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --body: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "Space Mono", ui-monospace, Menlo, monospace;
  --nav-h: 52px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
/* page changes between the story, the tool and the map cross-fade instead of flashing (where browsers support it) */
@view-transition { navigation: auto; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--body); }
a { color: var(--cool); }
a:hover { color: #fff; }

/* ---- top navigation (shared with the Quarto pages) */
.nav {
  position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h); z-index: 50;
  display: flex; align-items: center; gap: 22px; padding: 0 20px;
  background: linear-gradient(to bottom, rgba(7, 8, 11, 0.92), rgba(7, 8, 11, 0.55));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.nav .brand { font-family: var(--display); font-weight: 600; letter-spacing: 0.02em; color: var(--ink); text-decoration: none; margin-right: auto; white-space: nowrap; }
.nav .brand span { color: var(--cool); }
.nav .links { display: flex; gap: 22px; }
.nav a.link { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--dim); text-decoration: none; }
.nav a.link:hover, .nav a.link.on { color: var(--ink); }
.nav .menu { display: none; }
@media (max-width: 1000px) {
  .nav { padding: 0 14px; }
  .nav .menu { display: block; font: 11px var(--mono); text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink);
    background: transparent; border: 1px solid var(--line-strong); border-radius: 6px; padding: 6px 10px; cursor: pointer; }
  .nav .links { display: none; position: absolute; top: var(--nav-h); left: 0; right: 0; flex-direction: column; gap: 0;
    background: rgba(7, 8, 11, 0.97); border-bottom: 1px solid var(--line); }
  .nav.open .links { display: flex; }
  .nav .links a.link { padding: 13px 16px; border-top: 1px solid var(--line); font-size: 12px; }
}

/* ---- collapsible side panels (phones) */
.panel h1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.collapse { display: none; font: 18px/1 var(--mono); color: var(--ink); background: transparent; border: 1px solid var(--line-strong);
  border-radius: 6px; width: 30px; height: 30px; cursor: pointer; flex: 0 0 auto; }
@media (max-width: 760px) {
  .collapse { display: block; }
  .panel.collapsed > :not(h1):not(.keep) { display: none; }
}

/* ---- labels and numbers */
.label { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--dim); }
.big { font-family: var(--display); font-weight: 500; line-height: 1.02; letter-spacing: -0.02em; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sun { color: var(--sun); } .cool { color: var(--cool); } .indoor { color: var(--indoor); }

/* ---- panels */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
  backdrop-filter: blur(8px);
}
.legend-swatch { display: inline-block; width: 18px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
/* route swatches drawn like the lines: shortest solid, coolest dashed over a dim track, indoors dotted */
.ls-short { background: var(--sun); }
.ls-cool { background: repeating-linear-gradient(to right, var(--cool) 0 6px, #1d6b73 6px 10px); }
.ls-indoor { background: radial-gradient(circle, var(--indoor) 1.8px, #4b3d73 2.2px) 0 50% / 6px 4px repeat-x; }

/* ---- form controls */
input[type=range] { width: 100%; accent-color: var(--cool); }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { flex: 1; font: 12px var(--body); color: var(--dim); background: transparent; border: 0; padding: 8px 6px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: rgba(53, 208, 224, 0.16); color: var(--ink); }
.seg-sm { flex: 0 0 auto; }
.seg-sm button { flex: 0 0 auto; padding: 4px 10px; font-size: 11px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.msg { font-size: 13px; color: var(--sun-soft); margin-top: 8px; }
.msg:empty { display: none; }
.credits { font-size: 11px; color: var(--dim); margin-top: 12px; line-height: 1.5; }
.credits a { color: var(--dim); }
button.ghost { font: 12px var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink); background: transparent;
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 12px; cursor: pointer; }
button.ghost:hover { border-color: var(--cool); }

.maplibregl-ctrl-attrib { background: rgba(7, 8, 11, 0.7) !important; color: var(--dim); }
.maplibregl-ctrl-attrib a { color: var(--dim) !important; }
.maplibregl-ctrl-group { background: var(--panel) !important; }
.maplibregl-ctrl-group button span { filter: invert(1); }

/* ---- tool and map: one side panel, one legend, one time bar (shared components in common.js) */
.side { position: fixed; top: calc(var(--nav-h) + 14px); left: 14px; width: 320px; max-height: calc(100vh - var(--nav-h) - 28px);
  overflow-y: auto; z-index: 5; scrollbar-width: thin; }
.side h1 { font-family: var(--display); font-weight: 500; font-size: 22px; line-height: 1.15; margin: 4px 0 6px; }
.side .block { margin-top: 16px; }
.side .block > .label { display: block; margin-bottom: 6px; }
.hint { font-size: 12px; line-height: 1.45; color: var(--dim); margin: 6px 0 0; }
.hint b { color: var(--ink); font-weight: 500; }
.legend-title { font: 11px var(--mono); text-transform: uppercase; letter-spacing: 0.12em; color: var(--dim); margin-bottom: 6px; }
.ramp { height: 8px; border-radius: 4px; }
.ticks { position: relative; height: 16px; margin: 3px 4px 0; font: 10px var(--mono); color: var(--dim); }
.ticks span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.ticks span:first-child { transform: none; margin-left: -4px; }
.ticks span:last-child { transform: translateX(-100%); margin-left: 4px; }
.note { font-size: 11px; line-height: 1.4; color: var(--dim); margin: 4px 0 0; }
.ends2 { display: flex; justify-content: space-between; font: 11px var(--mono); margin-top: 1px; }
.swatches { display: grid; gap: 4px; font-size: 12px; }
.swatches i { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-right: 8px; vertical-align: -1px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { font: 12px var(--body); color: var(--dim); background: transparent; border: 1px solid var(--line); border-radius: 14px;
  padding: 4px 10px; cursor: pointer; }
.chips button:hover { color: var(--ink); border-color: var(--line-strong); }
.chips button.on { background: rgba(53, 208, 224, 0.16); border-color: rgba(53, 208, 224, 0.5); color: var(--ink); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; cursor: pointer; }
.switch input { appearance: none; width: 30px; height: 16px; border-radius: 8px; background: var(--line-strong); position: relative;
  cursor: pointer; margin: 0; flex: 0 0 auto; transition: background 0.2s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--ink);
  transition: transform 0.2s; }
.switch input:checked { background: rgba(53, 208, 224, 0.6); }
.switch input:checked::after { transform: translateX(14px); }
.seg button:disabled { opacity: 0.35; cursor: not-allowed; }
table.cmp { width: 100%; border-collapse: collapse; }
table.cmp th { font: 10px var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); font-weight: 400; text-align: right;
  padding: 4px 0; }
table.cmp td { text-align: right; padding: 5px 0; border-top: 1px solid var(--line); font: 12px/1.3 var(--mono); white-space: nowrap; }
table.cmp th:first-child, table.cmp td:first-child { text-align: left; font-family: var(--body); }
table.cmp th + th, table.cmp td + td { padding-left: 10px; }
table.cmp td small { display: block; color: var(--dim); font-size: 11px; }
.details h2 { font: 500 16px var(--display); margin: 0 0 2px; }
.details .sub { font-size: 12px; color: var(--dim); margin-bottom: 8px; }
.sun-t { color: var(--sun); } .cool-t { color: var(--cool); }

/* the time bar floats at the bottom centre of the map area (right of the panel), above the credits line */
.timebar { position: fixed; z-index: 6; bottom: 22px; left: calc(348px + (100vw - 348px) / 2); transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; padding: 8px 14px; width: min(620px, calc(100vw - 380px)); }
.timebar .tb-play { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line-strong); background: transparent;
  color: var(--ink); cursor: pointer; display: grid; place-items: center; padding: 0; }
.timebar .tb-play:hover, .timebar .tb-play.on { border-color: var(--cool); color: var(--cool); }
.timebar .tb-track { flex: 1 1 auto; min-width: 0; }
.timebar input[type=range] { display: block; margin: 0; }
.timebar .tb-ticks { display: flex; justify-content: space-between; font: 10px var(--mono); color: var(--dim); margin-top: 2px; }
.timebar .tb-ticks span { width: 18px; text-align: center; cursor: pointer; }
.timebar .tb-ticks span.on { color: var(--ink); }
.timebar .tb-now { flex: 0 0 auto; font-size: 18px; min-width: 56px; text-align: right; }
@media (max-width: 760px) {
  .side { left: 8px; right: 8px; width: auto; top: auto; bottom: 8px; max-height: 46vh; }
  .timebar { top: calc(var(--nav-h) + 8px); bottom: auto; left: 8px; right: 8px; width: auto; transform: none; gap: 8px; padding: 6px 10px; }
  .timebar .tb-now { font-size: 15px; min-width: 44px; }
  .timebar .tb-ticks span:nth-child(even) { visibility: hidden; }
}
