/* Base: reset, type, chrome components shared by every page. */

@view-transition { navigation: auto; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--wall);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 400;
  font-stretch: 100%;
  line-height: 1.5;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
a { color: inherit; }
[hidden] { display: none !important; }

.vh {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.wrap { width: 100%; max-width: calc(var(--max) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }

/* UI headings: sentence case, 700, a touch wide */
.h-ui { font-weight: 700; font-stretch: 108%; line-height: 1.2; letter-spacing: -0.005em; }
.h-2 { font-size: 22px; }
.h-3 { font-size: 18px; }
.muted { color: var(--ink-2); }

/* Focus: 3px ink ring, 2px offset, 2px wall halo. Reads on wall, surfaces and every field. */
:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--wall);
}
:focus:not(:focus-visible) { outline: none; }
/* Headings that receive focus programmatically (dialog titles) do not show a ring */
[tabindex="-1"]:focus { outline: none; box-shadow: none; }

/* Icons: 24px grid, 2px stroke, round caps */
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Buttons: fully rounded, 44px targets */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; min-width: 44px; padding: 0 20px;
  border: 1px solid transparent; border-radius: var(--r-pill);
  font-weight: 600; font-size: 15px; line-height: 1; text-decoration: none; white-space: nowrap;
  cursor: pointer; background: transparent; color: var(--ink);
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease), border-color var(--t) var(--ease);
}
.btn--primary { background: var(--ink); color: var(--on-ink); }
.btn--primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--wall)); }
.btn--ghost { border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--quiet { padding-inline: 12px; }
.btn--quiet:hover { background: var(--surface-2); }
.btn--poster { background: var(--deep); color: #FFFFFF; }
.btn--poster:hover { background: color-mix(in srgb, var(--deep) 88%, #FFFFFF); }
.btn--icon { padding: 0; width: 44px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link, .link-btn {
  color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
  background: none; border: 0; padding: 0; cursor: pointer; font: inherit;
}
.link:hover, .link-btn:hover { text-decoration-thickness: 2px; }

/* Chips: non-interactive labels */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 500; line-height: 1; white-space: nowrap;
  background: var(--light); color: var(--deep);
}
.chip--deep { background: var(--deep); color: #FFFFFF; }
.chip--wall { background: var(--surface-2); color: var(--ink); }

/* Header */
.site-header { background: var(--wall); position: relative; z-index: 5; }
.site-header__in {
  display: flex; align-items: center; gap: 0 var(--s3); flex-wrap: wrap;
  min-height: var(--header-h); padding-block: 10px;
}
.wordmark {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
  text-decoration: none; color: var(--ink);
  font-weight: 900; font-stretch: 125%; font-size: 20px; letter-spacing: -0.01em; text-transform: uppercase; line-height: 1;
}
.wordmark svg { width: 30px; height: 30px; }
.site-nav { display: flex; align-items: center; gap: var(--s5); order: 3; width: 100%; }
.site-nav a, .site-nav button { min-height: 44px; display: inline-flex; align-items: center; font-weight: 500; font-size: 15px; }
.seg.theme-ctl { margin-left: auto; }
@media (min-width: 720px) {
  .site-header__in { gap: var(--s4) var(--s5); }
  .site-nav { order: 0; width: auto; margin-left: var(--s4); }
}

/* Segmented control (theme) */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-pill); padding: 2px; margin: 0; min-width: 0; }
.seg legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.seg label { position: relative; display: inline-flex; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg span {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 38px; min-width: 44px; padding: 0 12px; border-radius: var(--r-pill);
  font-size: 14px; font-weight: 500; color: var(--ink-2); pointer-events: none;
}
.seg label { min-height: 44px; align-items: center; margin-block: -3px; }
.seg input:checked + span { background: var(--ink); color: var(--on-ink); }
.seg input:hover:not(:checked) + span { color: var(--ink); }
.seg input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 2px var(--wall); }
@media (max-width: 419px) { .seg span { padding: 0 8px; } .wordmark { font-size: 18px; gap: 8px; } .wordmark svg { width: 26px; height: 26px; } }
@media (max-width: 359px) { .seg span { padding: 0 7px; font-size: 13px; } .wordmark { font-size: 16px; } }

/* Dialogs: native <dialog>, one shadow token */
.dlg {
  border: 0; padding: 0; border-radius: var(--r-card);
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  background: var(--surface); color: var(--ink); box-shadow: var(--dialog-shadow);
}
.dlg::backdrop { background: rgba(14, 16, 20, 0.55); }
.dlg__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: var(--s4) var(--s4) 0 var(--s5); }
.dlg__body { padding: var(--s4) var(--s5) var(--s5); }
.dlg__actions { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); margin-top: var(--s5); }
.dlg p + p { margin-top: var(--s3); }
.dlg ol { padding-left: 1.25em; }
.dlg ol li + li { margin-top: var(--s2); }
@media (prefers-reduced-motion: no-preference) {
  .dlg[open] { animation: dlg-in 200ms var(--ease); }
  @keyframes dlg-in { from { opacity: 0; transform: translateY(8px); } }
}

/* Figures (stats) */
.figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4) var(--s5); margin: 0; }
@media (min-width: 560px) { .figs--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.fig { margin: 0; }
.fig dt { font-size: 14px; color: var(--ink-2); }
.fig dd { margin: 0; font-size: 34px; font-weight: 800; font-stretch: 112.5%; line-height: 1.1; font-variant-numeric: tabular-nums; }
.best-list { margin: var(--s5) 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.best-list li { display: flex; justify-content: space-between; gap: var(--s4); padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.best-list .swatch-dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--field); margin-right: var(--s2); vertical-align: -1px; }

/* Week strip: seven day tiles, filled with the swatches solved that day */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 44px)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.week li { display: grid; gap: 4px; justify-items: center; font-size: 12px; color: var(--ink-2); }
.week .day {
  width: 100%; aspect-ratio: 1; border-radius: 4px; overflow: hidden;
  display: flex; flex-direction: column; border: 1.5px solid var(--line-strong);
}
.week .day.is-filled { border-color: transparent; }
.week .day i { flex: 1; background: var(--field); }
.week .day i + i { border-top: 2px solid var(--wall); }
.week li.is-today span { color: var(--ink); font-weight: 700; }

/* Toast: bottom center, one at a time */
.toast {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 50;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: var(--s2);
  max-width: calc(100vw - 32px); padding: 4px 4px 4px 18px; border-radius: var(--r-pill);
  background: var(--ink); color: var(--on-ink); font-weight: 500; font-size: 15px;
  box-shadow: var(--dialog-shadow);
}
.toast .btn { color: var(--on-ink); }
.toast .btn:hover { background: color-mix(in srgb, var(--on-ink) 14%, transparent); }
.toast .btn:focus-visible { outline-color: var(--on-ink); box-shadow: 0 0 0 2px var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toast-in 220ms var(--ease); }
  @keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }
}

/* Ad slots: blank sheets on the wall, fixed sizes, never shift */
.ad { display: flex; justify-content: center; margin-block: var(--s7); }
.ad__sheet {
  position: relative; flex: none;
  width: 320px; height: 100px; border-radius: var(--r-poster);
  background: var(--surface-2); color: var(--ink-2);
  display: grid; place-items: center; font-size: 13px;
}
.ad__label { position: absolute; top: 6px; left: 10px; font-size: 11px; letter-spacing: .02em; }
@media (min-width: 768px) { .ad__sheet { width: 728px; height: 90px; } }
.ad--rail { margin: 0; display: none; }
.ad--rail .ad__sheet { width: 300px; height: 600px; }
@media (min-width: 1280px) { .ad--rail { display: block; } }

/* Footer */
.site-footer { margin-top: var(--s8); border-top: 1px solid var(--line); padding-block: var(--s6) var(--s7); font-size: 15px; }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 0 var(--s5); padding: 0; list-style: none; }
.site-footer__links a { display: inline-flex; min-height: 44px; align-items: center; }
.site-footer__cols { display: grid; gap: var(--s5); margin-top: var(--s5); color: var(--ink-2); }
@media (min-width: 900px) { .site-footer__cols { grid-template-columns: 1fr 1fr 1.3fr; gap: var(--s6); } }
.site-footer h2 { font-size: 15px; color: var(--ink); margin-bottom: var(--s2); }
.site-footer .credits { padding: 0; list-style: none; }
.site-footer .credits li + li { margin-top: 4px; }
.site-footer .credits a { color: var(--ink-2); }
.site-footer__base { margin-top: var(--s6); color: var(--ink-2); display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); }

/* Notices and errors, in the interface voice */
.notice { padding: var(--s5); border-radius: var(--r-card); background: var(--surface); }

/* Cross-page morph: poster into band. Progressive enhancement only. */
::view-transition-group(*) { animation-duration: 380ms; animation-timing-function: var(--ease); }
::view-transition-old(*), ::view-transition-new(*) { height: 100%; width: 100%; object-fit: cover; overflow: clip; }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; scroll-behavior: auto !important;
  }
}

/* Skip link */
.skip { position: absolute; left: var(--s4); top: -100px; z-index: 60; padding: 10px 16px; border-radius: var(--r-pill); background: var(--ink); color: var(--on-ink); font-weight: 600; text-decoration: none; }
.skip:focus { top: var(--s2); }

.ico--flip { transform: scaleX(-1); }
.dlg__sub { margin: var(--s5) 0 var(--s3); }
.ad__size::after { content: '320 \00D7 100'; }
@media (min-width: 768px) { .ad__size::after { content: '728 \00D7 90'; } }
.ad--rail .ad__size::after { content: '300 \00D7 600'; }
