/* ============================================================
   Base: reset, typography, focus, scrollbars, utilities
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-gutter: stable; background: var(--bg); }
body {
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: var(--lh);
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
img, svg, video, canvas { display: block; max-width: 100%; }
/* an icon nobody sized stays icon-sized instead of filling its box (zero specificity: any real rule wins) */
:where(svg[viewBox="0 0 24 24"]:not([width])) { width: 1.25em; height: 1.25em; flex-shrink: 0; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; text-align: inherit; }
button:disabled { cursor: not-allowed; }
input, textarea, select { border: 0; outline: 0; background: none; }
textarea { resize: vertical; }
h1, h2, h3, h4, h5 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.015em; line-height: var(--lh-tight); color: var(--text); }
p { text-wrap: pretty; }
ul, ol { list-style: none; }
table { border-collapse: collapse; }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--text); }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; }
/* "Skip to content": out of sight until a keyboard reaches it (it floats, so it's opaque) */
.skip-link { position: fixed; left: 12px; top: 10px; z-index: 1000; padding: 9px 14px; border-radius: var(--r); font-weight: 700; font-size: var(--fs-sm); color: var(--text); background: var(--surface-solid); border: 1px solid var(--border-strong); box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .6); transform: translateY(-160%); }
.skip-link:focus-visible { transform: none; }
#view:focus { outline: none; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text) 16%, transparent); border-radius: var(--r); border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--text) 26%, transparent); border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text) 18%, transparent) transparent; }

/* utilities */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.accent { color: var(--accent-text); }
.mono { font-family: var(--font-mono); }
.display { font-family: var(--font-display); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row-top { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
/* (a sentence in a row that wraps keeps a readable width: the buttons beside it move to the next line instead) */
.row.wrap > p.grow { min-width: min(240px, 100%); }
.spacer { flex: 1; }
.center { display: grid; place-items: center; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; } .gap-24 { gap: 24px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-4 { margin-bottom: 4px; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-20 { margin-bottom: 20px; } .mb-24 { margin-bottom: 24px; }
.red-text { color: var(--red-text); } .green-text { color: var(--green-text); }
.text-xs { font-size: var(--fs-xs); } .text-sm { font-size: var(--fs-sm); } .text-lg { font-size: var(--fs-lg); }
.center-row { justify-content: center; }
.text-body { color: var(--text-body); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
.bold { font-weight: 700; } .semibold { font-weight: 600; }
.tabular { font-variant-numeric: tabular-nums; }

/* entrance animation for routed views */
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* 'backwards', not 'both': a transform left in effect after the animation would trap position:fixed children */
.view-enter { animation: view-in var(--t-slow) var(--ease-out) backwards; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
@keyframes pulse-dot { 0%, 100% { opacity: .35; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }
@keyframes heart-pop { 0% { transform: scale(1); } 30% { transform: scale(1.32); } 60% { transform: scale(.92); } 100% { transform: scale(1); } }
