/* Feels Like — "a window, not a dashboard".
   The page wears the mystery city's sky (palette.js sets --top/--bottom/--ink/--muted/--accent).
   One column, a newspaper-weather-report rhythm: big serif clock, quiet labels, hairline rules. */

@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('../fonts/newsreader-latin-opsz-normal.woff2') format('woff2-variations');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('../fonts/newsreader-latin-ext-opsz-normal.woff2') format('woff2-variations');
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/geist-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/geist-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

:root {
  /* Defaults = the night palette, so first paint matches palette.js before JS runs. */
  --top: #0e1320;
  --bottom: #1b2335;
  --ink: #ece8e1;
  --muted: #a9afbd;
  --accent: #f2c879;
  --line: color-mix(in srgb, var(--ink) 14%, transparent);
  --wash: color-mix(in srgb, var(--ink) 6%, transparent);
  --serif: 'Newsreader', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --measure: 34rem;
  --gutter: clamp(1rem, 5vw, 2rem);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: dark;
}
:root[data-tone='light'] {
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--top);
  color: var(--ink);
  font: 400 1rem/1.5 var(--sans);
  font-feature-settings: 'kern' 1;
  -webkit-font-smoothing: antialiased;
  transition:
    color 600ms var(--ease),
    background-color 600ms var(--ease);
}

/* The sky gradient lives on a fixed layer rather than `background-attachment: fixed`, which iOS
   Safari ignores and which bands on long pages. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, var(--top) 0%, var(--bottom) 100%);
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
}
a:hover {
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -3rem;
  padding: 0.5rem 0.75rem;
  background: var(--ink);
  color: var(--top);
  border-radius: 6px;
  z-index: 10;
}
.skip:focus {
  top: 0.75rem;
}

/* ----------------------------------------------------------------- top bar */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: max(0.75rem, env(safe-area-inset-top)) var(--gutter) 0;
}

.wordmark {
  font: 500 1.125rem/1 var(--serif);
  font-variation-settings: 'opsz' 24;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.bar-actions {
  display: flex;
  gap: 0.25rem;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  min-width: 2.75rem;
  height: 2.75rem;
  padding: 0 0.5rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: 500 0.95rem/1 var(--sans);
  cursor: pointer;
  transition: background-color 200ms var(--ease);
}
.icon-btn:hover {
  background: var(--wash);
}
.icon-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* ----------------------------------------------------------------- layout */

main {
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter) 2rem;
}

.meta {
  margin: clamp(1.5rem, 6vh, 3.5rem) 0 1.25rem;
  color: var(--muted);
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

/* ----------------------------------------------------------------- the clock */

.hero {
  margin-top: 0.25rem;
}

.clock {
  margin: 0;
  font-family: var(--serif);
  font-weight: 300;
  font-variation-settings: 'opsz' 72;
  font-size: clamp(5.5rem, 30vw, 10rem);
  line-height: 0.92;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums lining-nums;
}

.clock-colon {
  display: inline-block;
  margin: 0 0.02em;
  transform: translateY(-0.06em);
  transition: opacity 500ms var(--ease);
}
.clock.is-tick .clock-colon {
  opacity: 0.35;
}

.clock-sub {
  margin: 0.75rem 0 0;
  color: var(--muted);
}

/* ----------------------------------------------------------------- the sky now */

.now {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0 0;
  padding: 1.25rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.now-icon {
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  color: var(--accent);
}
.now-icon svg {
  width: 100%;
  height: 100%;
  stroke-width: 1.25;
}

.now-main {
  margin: 0;
  font: 400 1.75rem/1.15 var(--serif);
  font-variation-settings: 'opsz' 36;
}

.now-detail {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ----------------------------------------------------------------- the report (more clues) */

.report {
  list-style: none;
  margin: 0;
  padding: 0;
}

.clue {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
}

.clue-label {
  padding-top: 0.2rem;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.clue-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.clue-main {
  font: 400 1.125rem/1.35 var(--serif);
  font-variation-settings: 'opsz' 18;
  font-variant-numeric: tabular-nums;
}

.clue-detail {
  color: var(--muted);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

/* Locked rows stay at full --muted contrast (AA); they read as secondary through size and the
   sans face, not through transparency — an opacity fade failed the axe contrast audit. */
.clue-locked {
  color: var(--muted);
  font-size: 0.9375rem;
}

.clue.is-open .clue-body {
  animation: reveal 700ms var(--ease) both;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

/* ----------------------------------------------------------------- guessing */

.play {
  margin-top: 2rem;
}

.combo {
  position: relative;
}

#guess-input {
  width: 100%;
  height: 3.5rem;
  padding: 0 3.5rem 0 1.1rem;
  border: 1px solid color-mix(in srgb, var(--ink) 28%, transparent);
  border-radius: 14px;
  background: var(--wash);
  color: inherit;
  font: 400 1.25rem/1 var(--serif);
  font-variation-settings: 'opsz' 24;
  transition:
    border-color 200ms var(--ease),
    background-color 200ms var(--ease);
}
#guess-input::placeholder {
  color: var(--muted);
  opacity: 1;
}
#guess-input:focus {
  outline: none;
  border-color: var(--ink);
}
#guess-input:disabled {
  opacity: 0.6;
}

.guess-go {
  position: absolute;
  top: 0.375rem;
  right: 0.375rem;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 10px;
  background: var(--ink);
  color: var(--top);
  cursor: pointer;
}
.guess-go svg {
  width: 1.25rem;
  height: 1.25rem;
}
.guess-go:disabled {
  opacity: 0.4;
  cursor: default;
}

.options {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: calc(100% + 0.375rem);
  margin: 0;
  padding: 0.375rem;
  list-style: none;
  border-radius: 14px;
  background: var(--bottom);
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px -18px rgb(0 0 0 / 0.45);
}
.options li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.75rem;
  border-radius: 9px;
  cursor: pointer;
}
.options li[aria-selected='true'] {
  background: var(--wash);
}
.opt-name {
  font: 400 1.0625rem/1.3 var(--serif);
}
.opt-country {
  color: var(--muted);
  font-size: 0.875rem;
  text-align: right;
}

.guess-count {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.guesses {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}

.guess {
  display: grid;
  grid-template-columns: 1.5rem 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
  animation: reveal 500ms var(--ease) both;
}
.guess:last-child {
  border-bottom: 1px solid var(--line);
}

.guess-n {
  color: var(--muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.guess-place {
  font: 400 1.0625rem/1.3 var(--serif);
  min-width: 0;
  overflow-wrap: anywhere;
}

.guess-fb {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.guess-arrow {
  display: inline-grid;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--accent);
}
.guess-arrow svg,
.guess-fb > svg {
  width: 100%;
  height: 100%;
}
.guess-fb > svg {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--accent);
}

.guess-same {
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.75rem;
}

.guess.is-correct .guess-place {
  font-weight: 500;
}

/* ----------------------------------------------------------------- result */

.result {
  margin-top: 2rem;
  padding: 1.5rem 0 0.5rem;
  border-top: 1px solid var(--ink);
}

.result-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-line {
  margin: 0.5rem 0 0;
  font: 400 clamp(1.6rem, 6vw, 2.1rem) / 1.2 var(--serif);
  font-variation-settings: 'opsz' 48;
  text-wrap: balance;
}
.result-line strong {
  font-weight: 600;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.result-next {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 3rem;
  padding: 0 1.25rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--top);
  font: 500 1rem/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
}
.btn svg {
  width: 1.1rem;
  height: 1.1rem;
}
.btn-quiet {
  background: transparent;
  color: var(--ink);
  border-color: color-mix(in srgb, var(--ink) 35%, transparent);
}

/* ----------------------------------------------------------------- map */

.map {
  margin: 2.5rem 0 0;
}
.map canvas {
  display: block;
  width: 100%;
}

.status {
  margin: 1rem 0 0;
  color: var(--muted);
}
.status:empty {
  display: none;
}
.status .btn {
  display: flex;
  width: fit-content;
  margin-top: 0.75rem;
}

/* ----------------------------------------------------------------- footer */

.foot {
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 1.5rem var(--gutter) max(2rem, env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.8125rem;
}
.foot p {
  margin: 0.25rem 0;
}

/* ----------------------------------------------------------------- dialogs */

.sheet {
  width: min(30rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 1.25rem 1.5rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--bottom);
  color: var(--ink);
  box-shadow: 0 30px 80px -30px rgb(0 0 0 / 0.6);
}
.sheet::backdrop {
  background: rgb(5 8 14 / 0.55);
  backdrop-filter: blur(4px);
}
.sheet[open] {
  animation: reveal 300ms var(--ease) both;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.sheet h2 {
  margin: 0;
  font: 400 1.75rem/1.2 var(--serif);
  font-variation-settings: 'opsz' 36;
}

.rules {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}
.rules li {
  margin: 0.6rem 0;
  padding-left: 0.25rem;
}
.rules em {
  font-style: normal;
  font-weight: 600;
}

.fine {
  color: var(--muted);
  font-size: 0.875rem;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 1rem 0 0;
  text-align: center;
}
.stat-row dd {
  margin: 0;
  font: 300 2.25rem/1 var(--serif);
  font-variation-settings: 'opsz' 48;
  font-variant-numeric: tabular-nums;
}
.stat-row dt {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dist-title {
  margin: 1.5rem 0 0.5rem;
  color: var(--muted);
  font: 500 0.75rem/1 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.dist {
  list-style: none;
  margin: 0;
  padding: 0;
}
.dist li {
  display: grid;
  grid-template-columns: 1.25rem 1fr;
  align-items: center;
  gap: 0.5rem;
  margin: 0.3rem 0;
  font-variant-numeric: tabular-nums;
}
.dist-bar {
  width: var(--w, 4%);
  min-width: 1.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: var(--wash);
  text-align: right;
  font-size: 0.8125rem;
}
.dist li.is-today .dist-bar {
  background: var(--accent);
  color: var(--top);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(1.5rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100vw - 2rem);
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--top);
  font-size: 0.9375rem;
  white-space: pre-line;
  box-shadow: 0 12px 30px -12px rgb(0 0 0 / 0.5);
}

/* ----------------------------------------------------------------- about page */

.prose {
  margin-top: clamp(1.5rem, 6vh, 3.5rem);
}
.prose h1 {
  font: 300 clamp(2.5rem, 9vw, 3.5rem) / 1.05 var(--serif);
  font-variation-settings: 'opsz' 72;
  letter-spacing: -0.02em;
  margin: 0 0 1.5rem;
}
.prose h2 {
  font: 400 1.375rem/1.3 var(--serif);
  margin: 2rem 0 0.5rem;
}
.prose p,
.prose li {
  color: color-mix(in srgb, var(--ink) 88%, var(--muted));
}

@media (min-width: 40rem) {
  .clue {
    grid-template-columns: 7rem 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Back to the other games at ringanybells.xyz: one quiet line above the bar, on every page. The
   link is relative, so it reaches the hub's home from /<game>/ and /<game>/about alike. */
.hub {
  box-sizing: border-box;
  width: 100%;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: max(0.5rem, env(safe-area-inset-top)) var(--gutter) 0;
  font: 500 0.75rem/1 var(--sans);
  letter-spacing: 0.04em;
}
.hub a {
  display: inline-block;
  padding: 0.4rem 0;
  color: var(--muted);
  text-decoration: none;
}
.hub a:hover {
  color: var(--ink);
}
.hub + .bar {
  padding-top: 0.25rem;
}
