/* What every page shares: the road-sign look (Atkinson Hyperlegible, sign blue on a
   cool grey, yellow for the places you pass), buttons, chips, the brand, the sign a
   playlist is headed by, and the list of its songs. */

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/static/fonts/AtkinsonHyperlegible-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/static/fonts/AtkinsonHyperlegible-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --ink: #16212c;
  --muted: #4a5663;
  --line: #d3dae1;
  --ground: #eef1f4;
  --panel: #ffffff;
  --accent: #1b57a6;        /* links, focus, the brand's "play" */
  --sign: #1b57a6;          /* a road sign's blue: keeps its colours in the dark */
  --sign-ink: #ffffff;
  --action: #16212c;        /* the main button on a page */
  --action-ink: #ffffff;
  --pass: #f5c518;          /* road-sign yellow: a place the road passes through */
  --pass-ink: #16212c;
  --arrive: #6a3a1c;        /* tourist-sign brown: the destination */
  --arrive-ink: #ffffff;
  --error: #b42318;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e7ecf1;
    --muted: #9eabb8;
    --line: #2e3a46;
    --ground: #0f161d;
    --panel: #16212c;
    --accent: #78a9f0;
    --action: #e7ecf1;
    --action-ink: #16212c;
    --arrive: #8a5530;
    --error: #ff8a80;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 16px/1.45 "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--ground);
}

a { color: var(--accent); }
h1 { margin: 0; font-size: 28px; line-height: 1.15; letter-spacing: -0.01em; }
h2 { margin: 0 0 4px; font-size: 20px; }
.muted { color: var(--muted); font-weight: 400; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  font: inherit;
  font-weight: 700;
  padding: 9px 16px;
  border: 2px solid var(--action);
  border-radius: 10px;
  background: var(--action);
  color: var(--action-ink);
  text-decoration: none;
  cursor: pointer;
}
button:disabled { opacity: 0.45; cursor: default; }
button:not(:disabled):active, .button:active { transform: translateY(1px); }
.quiet { background: var(--panel); color: var(--ink); border-color: var(--line); }
@media (hover: hover) {
  button:not(:disabled):hover, .button:hover { filter: brightness(1.15); }
  .quiet:not(:disabled):hover { filter: none; border-color: var(--muted); }
}
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* The brand: the road-ahead mark and the name, "play" in sign blue */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.wordmark span { color: var(--accent); }
.logo { width: 26px; height: 26px; flex: none; }
.logo path { fill: var(--sign); }
.logo rect { fill: var(--sign-ink); }

/* Chips to tick, and tags showing what was ticked: genres and decades go yellow,
   switches such as "avoid motorways" go dark. */
.chip { position: relative; display: inline-flex; }
.chip input { position: absolute; opacity: 0; }
.chip > span {
  display: inline-block;
  padding: 6px 11px;
  border: 2px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
}
.tag {                      /* what a saved playlist was limited to: not a control */
  display: inline-block;
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
}
.chip > span { cursor: pointer; background: var(--panel); }
.chip input:checked + span { background: var(--pass); border-color: var(--pass); color: var(--pass-ink); }
.chip.switch input:checked + span { background: var(--action); border-color: var(--action); color: var(--action-ink); }
.chip input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }

/* A playlist's sign: blue, with a white border inside, like the motorway signs it
   borrows from. The places on the way with their times, the destination last. */
.sign { background: var(--sign); color: var(--sign-ink); border-radius: 18px; padding: 7px; }
.sign-face {
  display: grid;
  gap: 10px;
  padding: 16px 18px 14px;
  border: 3px solid var(--sign-ink);
  border-radius: 12px;
}
.sign-head { display: flex; align-items: flex-start; gap: 12px; }
.sign-arrow { width: 30px; height: 30px; flex: none; fill: currentColor; }
.sign h1, .sign h2 { margin: 0; font-size: clamp(24px, 6vw, 30px); line-height: 1.1; letter-spacing: -0.01em; }
.sign-via { display: grid; gap: 3px; margin: 0; padding: 0; list-style: none; font-size: 18px; }
.sign-via li, .sign-to { display: flex; justify-content: space-between; gap: 16px; }
.sign-via li span:last-child, .sign-to span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sign-to {
  margin: 0;
  padding-top: 8px;
  border-top: 2px solid color-mix(in srgb, var(--sign-ink) 55%, transparent);
  font-size: 21px;
  font-weight: 700;
}

/* Place tags: yellow for a place the road passes through, outlined for one nearby
   with how far off it is, brown for the destination and the places around it. */
.place {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 2px 7px;
  border: 2px solid var(--pass);
  border-radius: 6px;
  background: var(--pass);
  color: var(--pass-ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
}
.place.nearby { background: var(--panel); border-color: var(--line); color: var(--ink); }
.place.arriving { background: var(--arrive); border-color: var(--arrive); color: var(--arrive-ink); }
.place.arriving.nearby { background: var(--panel); border-color: var(--arrive); color: var(--ink); }
.place-away { font-weight: 400; font-size: 13px; white-space: nowrap; }
.place.nearby .place-away { color: var(--muted); }

/* The key to the tags */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 15px;
  color: var(--muted);
}
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.legend-genre { color: var(--ink); }
.legend-break { flex-basis: 100%; height: 0; }   /* the genres on a line of their own */
.legend-genre .genre-icon { font-size: 18px; }

/* A genre family's emoji: on the chips, the key and each song that fits it */
.genre-icon {
  flex: none;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 15px;
  font-weight: 400;
  line-height: 1;
}
.track-genres { display: inline-flex; gap: 4px; margin-left: 8px; }
.chip > span:has(.genre-icon), .tag:has(.genre-icon) { display: inline-flex; align-items: center; gap: 6px; }
.legend + .tracks { margin-top: 16px; }

/* The songs, in driving order: each with its time, title, artist and year, and the
   place it plays for; "Leaving" and "Arriving" between them. */
.tracks { margin: 0; padding: 0; list-style: none; }
.track {
  display: grid;
  grid-template-columns: 3.1em minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: baseline;
  padding: 10px 4px;
  border-top: 1px solid var(--line);
}
.track-time { color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.track-what { display: flex; flex-direction: column; min-width: 0; }
.track-title { font-weight: 700; }
.track-by, .track-note { color: var(--muted); font-size: 15px; }
.track-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.track .place { max-width: 12em; }
.swap { min-height: 32px; padding: 3px 10px; font-size: 14px; border-width: 1px; }
@media (max-width: 520px) {        /* a phone: the tag under the artist, not beside */
  .track { grid-template-columns: 3.1em minmax(0, 1fr); }
  .track-side { grid-column: 2; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .track .place { max-width: none; }
}
.waypoint {
  padding: 14px 4px 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.waypoint:first-child { border-top: 0; padding-top: 0; }
.waypoint.arrival { color: var(--ink); }
.waypoint.arrival::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 2px;
  background: var(--arrive);
}
button.place { min-height: 0; cursor: pointer; font: inherit; font-size: 14px; font-weight: 700; }
@media (hover: hover) {
  button.place:hover { filter: none; box-shadow: 0 0 0 2px var(--accent); }
}
.track.focus { background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }

/* A page of its own: a saved playlist, or its absence */
.page { max-width: 720px; margin: 0 auto; padding: 24px 16px 48px; }
/* A saved playlist's buttons, kept in view while its songs scroll past */
.page-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  gap: 6px;
  margin: 0 -16px;
  padding: 10px 16px;
  background: var(--ground);
  border-bottom: 1px solid var(--line);
}
.page-bar[hidden] { display: none; }
.page-bar .hint:empty { display: none; }
.hint.about { margin: 12px 0 18px; }
.masthead { display: grid; gap: 14px; margin-bottom: 18px; }
.facts { margin: 0; font-size: 17px; }
.hint { margin: 0; max-width: 62ch; color: var(--muted); font-size: 14px; }
.sheet-panel { padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.colophon { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.colophon p { margin: 0 0 6px; }
.colophon a { color: inherit; }
.colophon button {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font-weight: 400;
  text-decoration: underline;
}

/* Asking about Google Analytics, over the foot of the page until it's answered.
   Yes and no look alike: neither is the easier one to press. */
.consent {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  display: grid;
  gap: 10px;
  max-width: 400px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
  font-size: 15px;
}
.consent p { margin: 0; }
.consent button { flex: 1; }
@media (max-width: 520px) {
  .consent { left: 8px; right: 8px; bottom: 8px; max-width: none; }
}

/* The terms and privacy pages: plain reading */
.prose { max-width: 62ch; }
.prose h2 { margin: 26px 0 6px; }
.prose p, .prose ul { margin: 0 0 12px; }
.prose ul { padding-left: 1.2em; }
.prose li + li { margin-top: 6px; }
