/* Savepoint Atlas: tokens from DESIGN.md, plus `ctl` (control borders, 3:1+ on ink and panel)
   and `hot-text` (accent for small text on panel, where #ff5d73 is only 4.4:1). */
/* Fonts are self-hosted (Latin subsets, SIL Open Font License: see assets/fonts/LICENSE-*.txt). No requests go to Google. */
@font-face { font-family: 'Big Shoulders Display'; font-style: normal; font-weight: 800; font-display: swap; src: url('fonts/big-shoulders-display-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'Big Shoulders Display'; font-style: normal; font-weight: 900; font-display: swap; src: url('fonts/big-shoulders-display-latin-900-normal.woff2') format('woff2'); }
@font-face { font-family: 'Instrument Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/instrument-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Instrument Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/instrument-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Instrument Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/instrument-sans-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); }

:root {
  --ink: #0b252c;
  --panel: #12353e;
  --line: #24505c;
  --ctl: #5a8a95;
  --sand: #f1e6d2;
  --mute: #9bb3b6;
  --hot: #ff5d73;
  --hot-text: #ff8a9a;
  --on-hot: #2a0a10;
  --ok: #5fd0a0;
  --warn: #f2b84b;
  --display: 'Big Shoulders Display', Impact, sans-serif;
  --body: 'Instrument Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--sand);
  font: 400 16px/1.55 var(--body);
}
:focus-visible { outline: 3px solid var(--hot); outline-offset: 2px; }
a { color: var(--hot-text); }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { max-width: 100%; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.wrap.narrow { max-width: 1000px; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; flex-wrap: wrap; gap: 14px; }
.row > * { flex: 1 1 320px; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--sand); color: var(--ink); padding: 12px 16px; border-radius: 8px; z-index: 10; }
.skip:focus { top: 12px; }

/* type */
h1, h2, .display {
  font-family: var(--display); font-weight: 900; text-transform: uppercase;
  line-height: .95; margin: 0; text-wrap: balance;
}
h1 { font-size: clamp(40px, 8vw, 64px); }
.landing h1 { font-size: clamp(52px, 10vw, 104px); line-height: .9; }
h2 { font-size: clamp(40px, 6vw, 56px); }
.card-title { font-family: var(--display); font-weight: 900; text-transform: uppercase; line-height: 1; font-size: 34px; margin: 0; }
.card-title.sm { font-size: 26px; }
.card-title.md { font-size: 30px; }
.label {
  font-family: var(--mono); font-size: 12px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--mute);
}
.label.xs { font-size: 11px; }
.muted { color: var(--mute); }
.prose { max-width: 60ch; }
.lede { font-size: 19px; color: var(--mute); max-width: 48ch; margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.accent { color: var(--hot); }
.accent-text { color: var(--hot-text); }
p { margin: 0; }

/* header / footer */
.topbar { border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: space-between; padding-top: 12px; padding-bottom: 12px; }
.brand {
  display: inline-flex; gap: 10px; align-items: center; min-height: 44px;
  font-family: var(--display); font-weight: 900; font-size: 26px; text-transform: uppercase;
  color: var(--sand); text-decoration: none;
}
.brand::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--hot); }
.nav { display: flex; flex-wrap: wrap; gap: 6px; font-family: var(--mono); font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  color: var(--mute); text-decoration: none; border-radius: 8px;
}
.nav a:hover { color: var(--sand); }
.nav a[aria-current="page"], .nav a.solid { background: var(--sand); color: var(--ink); }
.footer { border-top: 1px solid var(--line); margin-top: 24px; }
.footer .wrap { padding-top: 24px; padding-bottom: 32px; color: var(--mute); font-size: 14px; }
.footer p { max-width: 70ch; }

main { padding: 32px 0 56px; }

/* surfaces */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.card.featured { border: 2px solid var(--hot); }
.card.dashed { background: transparent; border-style: dashed; justify-content: center; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 12px 22px; border-radius: 10px;
  font-weight: 600; font-size: 16px; text-decoration: none; cursor: pointer; border: 0;
  text-align: center;
}
.btn-primary { background: var(--hot); color: var(--on-hot); }
.btn-primary:hover { background: #ff7487; }
.btn-secondary { background: var(--panel); color: var(--sand); border: 1px solid var(--ctl); }
.btn-secondary:hover { border-color: var(--sand); }
.btn-danger { background: transparent; color: var(--hot-text); border: 1px solid var(--hot); }
.btn-light { background: var(--sand); color: var(--ink); }
.btn[aria-disabled="true"], .btn:disabled { background: var(--line); color: var(--mute); cursor: not-allowed; }
.text-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; color: var(--hot-text); }
.on-ink .text-link, .text-link.on-ink { color: var(--hot); }

/* tags, chips, pills */
.tag {
  display: inline-block; width: fit-content; font-family: var(--mono); font-size: 11px;
  letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--line);
  color: var(--mute); border-radius: 99px; padding: 3px 10px;
}
.tag.warn { border-color: var(--warn); color: var(--warn); }
.tag.ok { border-color: var(--ok); color: var(--ok); }
.chip, .pill {
  font-family: var(--mono); font-size: 12px; letter-spacing: .05em; text-transform: uppercase;
  min-height: 44px; padding: 10px 14px; cursor: pointer; background: transparent;
  color: var(--mute); border: 1px solid var(--ctl);
}
.chip { border-radius: 99px; }
.chip[aria-pressed="true"] { background: var(--sand); border-color: var(--sand); color: var(--ink); }
.pill { border-radius: 8px; }
.pill[aria-pressed="true"] { border-color: var(--ok); color: var(--ok); }
.pill[aria-pressed="true"]::before { content: "✓ "; }

/* forms */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
.input {
  width: 100%; min-height: 44px; padding: 12px; border-radius: 8px;
  background: var(--ink); color: var(--sand); border: 1px solid var(--ctl); font-size: 15px;
}
.input::placeholder { color: #7f9a9e; }
.input[readonly] { color: var(--mute); }

/* custom checkbox (real input) */
.check {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none; cursor: pointer;
  width: 44px; height: 44px; border-radius: 8px; border: 2px solid var(--ctl); background: transparent;
  display: grid; place-content: center;
}
.check::after { content: ""; width: 14px; height: 24px; border: solid var(--ink); border-width: 0 4px 4px 0; transform: rotate(45deg) translate(-2px, -2px); opacity: 0; }
.check:checked { background: var(--ok); border-color: var(--ok); }
.check:checked::after { opacity: 1; }
.check.sm { width: 24px; height: 24px; border-radius: 6px; }
.check.sm::after { width: 7px; height: 13px; border-width: 0 3px 3px 0; }

/* switch */
.switch-row {
  display: flex; gap: 16px; align-items: center; justify-content: space-between; width: 100%;
  background: none; border: 0; border-top: 1px solid var(--line); text-align: left;
  padding: 14px 0; min-height: 56px; cursor: pointer; color: var(--sand);
}
.switch-row .t { font-weight: 600; display: block; }
.switch-row .d { font-size: 14px; color: var(--mute); display: block; }
.track { flex: none; width: 52px; height: 30px; border-radius: 99px; padding: 3px; background: var(--ctl); display: flex; transition: background .15s; }
.knob { width: 24px; height: 24px; border-radius: 50%; background: var(--sand); box-shadow: 0 0 0 1px rgba(11,37,44,.5); transition: transform .15s; }
.switch-row[aria-checked="true"] .track { background: var(--ok); }
.switch-row[aria-checked="true"] .knob { transform: translateX(22px); }

/* progress */
.ring { width: 130px; height: 130px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.ring > span {
  width: 102px; height: 102px; border-radius: 50%; background: var(--panel); display: grid; place-items: center;
  font-family: var(--display); font-weight: 900; font-size: 40px; font-variant-numeric: tabular-nums;
}
.bar { flex: 1 1 auto; height: 8px; background: var(--ink); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--hot); }
.bar.lg { height: 14px; }
.bar-row { display: flex; gap: 12px; align-items: center; font-family: var(--mono); font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--mute); }
.bar-row .name { width: 110px; flex: none; }
.bar-row .val { width: 48px; text-align: right; color: var(--sand); font-variant-numeric: tabular-nums; }

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

/* phone */
@media (max-width: 700px) {
  .row > * { flex-basis: 100%; }
  .brand { font-size: 22px; }
  .nav a { padding: 0 10px; }
  .bar-row .name { width: 84px; }
}

/* ---------- Atlas layer (shared by every page) ---------- */
.contours { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.contours g { fill: none; stroke: #1a434e; stroke-width: 1.5; }
.gridrefs { position: relative; display: flex; justify-content: space-between; padding-top: 10px; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: var(--ctl); }
.plate { font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); line-height: 1.4; margin: 0; }
.stripes { height: 56px; background: linear-gradient(180deg, #ffb35c 0 20%, transparent 20% 30%, #ff8a5c 30% 50%, transparent 50% 62%, var(--hot) 62% 78%, transparent 78% 88%, #c2308f 88% 100%); }
.has-stripes { position: relative; overflow: hidden; padding-top: 44px; }
.has-stripes > .stripes { position: absolute; top: 0; left: 0; right: 0; height: 24px; }
.sym { width: 8px; height: 8px; flex: none; display: block; }
.sym.free { border-radius: 50%; background: var(--sand); }
.sym.pro { transform: rotate(45deg); background: var(--hot); }
.keylist { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.keylist li { display: flex; gap: 10px; align-items: center; }

/* sheet header used by the app pages */
.sheet { position: relative; border-bottom: 1px solid var(--line); }
.sheet-inner { position: relative; display: flex; flex-direction: column; gap: 24px; padding-top: 28px; padding-bottom: 36px; }
.sheet-row { display: flex; flex-wrap: wrap; gap: 20px 28px; align-items: flex-end; justify-content: space-between; }
.sheet .lede-sm { color: var(--mute); max-width: 52ch; margin: 0; }

/* checklist: sunset progress strip */
.sun-strip { position: relative; height: 30px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; }
.sun-strip > i {
  display: block; height: 100%; width: 0; transition: width .6s ease-out;
  background:
    linear-gradient(180deg, transparent 0 22%, var(--panel) 22% 30%, transparent 30% 50%, var(--panel) 50% 60%, transparent 60% 78%, var(--panel) 78% 88%, transparent 88%),
    linear-gradient(90deg, #ffb35c, var(--hot) 60%, #c2308f);
}
.strip-ticks { display: flex; justify-content: space-between; margin-top: 6px; }

/* friends: race lanes */
.race { display: flex; flex-direction: column; gap: 10px; }
.lane { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
.lane .who { width: 200px; flex: none; display: flex; flex-direction: column; }
.lane .course { position: relative; flex: 1 1 300px; min-width: 0; height: 48px; margin: 0 22px; }
.lane .course::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px dashed var(--ctl); }
.lane .course::after { content: ""; position: absolute; right: -10px; top: 6px; bottom: 6px; width: 8px; border-radius: 2px; background: repeating-linear-gradient(var(--sand) 0 6px, var(--ink) 6px 12px); }
.lane .run { position: absolute; left: 0; top: calc(50% - 2px); height: 4px; border-radius: 2px; transition: width .8s ease-out; }
.lane .marker { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: var(--ink); border: 3px solid var(--ink); z-index: 1; transition: left .8s ease-out; }
.lane .big-pct { width: 72px; flex: none; text-align: right; font-family: var(--display); font-weight: 900; font-size: 32px; line-height: 1; font-variant-numeric: tabular-nums; }

@media (max-width: 700px) {
  .lane .who { width: auto; flex: 1 1 auto; }
  .lane .course { order: 3; flex-basis: calc(100% - 44px); }
}
@media (prefers-reduced-motion: reduce) {
  .sun-strip > i, .lane .run, .lane .marker { transition: none; }
}
