/* What every page on the site shares: the type, the pressable surfaces and the sticky
   header with the game switcher. Load it after the page's own stylesheet; colours
   (--bg, --card, --text, --text-2, --separator, and each game's --accent /
   --accent-text) come from there. */

:root {
  --font: "Figtree", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif;
  --display: "Archivo", var(--font);
  /* Pressable surfaces sit on an edge in a darker shade of their own colour. */
  --depth: 3px;
  --edge-ink: #1c1c1e;
  --bus: #d6362c;
  --bus-text: #c0302a;
  --river: #00adff;
  --river-text: #0a6fb0;
}
@media (prefers-color-scheme: dark) {
  :root {
    --edge-ink: #000000;
    --bus: #ff453a;
    --bus-text: #ff6961;
    --river-text: #5ac8ff;
  }
}

body { font-family: var(--font); }
[data-game="bus"] { --game: var(--bus); --game-text: var(--bus-text); }
[data-game="river"] { --game: var(--river); --game-text: var(--river-text); }

/* ---------------------------------------------------------------- pressable */

/* Buttons, chips and tiles: a 3 px edge underneath that the surface sinks into when
   pressed, so every tap answers straight away. Each sets --fill to its colour. */
.press, .btn, .play, .chip, .day, .switcher a {
  --edge: color-mix(in srgb, var(--fill, var(--card)), var(--edge-ink) 24%);
  border: 1px solid color-mix(in srgb, var(--fill, var(--card)), var(--edge-ink) 12%);
  box-shadow: 0 var(--depth) 0 var(--edge);
  transition: translate 90ms ease-out, box-shadow 90ms ease-out;
  -webkit-tap-highlight-color: transparent;
}
.press:active, .btn:active, .play:active, .chip:active, .day:active, .switcher a:active {
  translate: 0 var(--depth);
  box-shadow: 0 0 0 var(--edge);
}
/* Cards that hold things but aren't buttons: the same edge, standing still. */
.slab {
  --edge: color-mix(in srgb, var(--fill, var(--card)), var(--edge-ink) 16%);
  border: 1px solid color-mix(in srgb, var(--fill, var(--card)), var(--edge-ink) 10%);
  box-shadow: 0 var(--depth) 0 var(--edge);
}
@media (prefers-color-scheme: dark) {
  .press, .btn, .play, .chip, .day, .switcher a, .slab {
    border-color: color-mix(in srgb, var(--fill, var(--card)), #ffffff 8%);
  }
}

/* ---------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: 0 -16px;
  padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--separator);
}
.site-header-inner {
  display: flex;
  align-items: center;
  gap: .75rem;
  max-width: 60rem;
  height: 60px;
  margin: 0 auto;
}
.site-logo {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 800;
  font-stretch: 125%;
  font-variation-settings: "wdth" 125;
  letter-spacing: -.03em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.site-logo:hover { text-decoration: none; }
/* On the home page the headline says it, larger. */
.is-home .site-logo { display: none; }

.switcher { display: flex; gap: .5rem; }
.switcher a {
  --fill: var(--card);
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 40px;
  padding: 0 .85rem;
  border-radius: 999px;
  background: var(--fill);
  color: var(--text);
  font-weight: 700;
  font-size: .95rem;
  text-decoration: none;
}
.switcher a:hover { text-decoration: none; }
.switcher a::before {
  content: "";
  width: .6rem; height: .6rem;
  border-radius: 50%;
  background: var(--game);
}
.switcher a[aria-current="page"] { --fill: var(--game-text); color: #fff; }
.switcher a[aria-current="page"]::before { background: #fff; }
@media (prefers-color-scheme: dark) {
  .switcher a[aria-current="page"] { color: #000; }
  .switcher a[aria-current="page"]::before { background: #000; }
}

.site-timer {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin: 0 0 0 auto;
  font-size: .9rem;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.site-timer strong { color: var(--text); font-weight: 700; }
.site-timer svg { flex: none; }
@media (max-width: 400px) { .site-timer .label { display: none; } }
/* Phones: the logo and both games come first. A game page says when the next puzzle
   comes once you've played, so its header drops the timer. */
@media (max-width: 480px) {
  .site-header-inner { gap: .5rem; }
  .site-logo { font-size: 1.02rem; }
  .switcher { gap: .4rem; }
  .switcher a { padding: 0 .7rem; font-size: .9rem; }
  body:not(.is-home) .site-timer { display: none; }
}
@media (max-width: 330px) { .site-timer { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .press, .btn, .play, .chip, .day, .switcher a { transition: none; }
}
