/* base.css
   Page-level typography, type scale (brief Section 11), focus rings, motion and spacing settings.
   All sizes use rem so the Text size setting (100 / 112.5 / 125%) scales everything. Colors only from tokens. */

:root {
  --radius-card: 14px;
  --radius-btn: 10px;
  --shadow-card: 0 1px 2px rgba(20, 20, 30, .04), 0 4px 16px rgba(20, 20, 30, .05);
  --shadow-lift: 0 2px 4px rgba(20, 20, 30, .05), 0 8px 24px rgba(20, 20, 30, .08);
  --shadow-pop: 0 8px 40px rgba(20, 20, 30, .16);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --gap: 1rem;
  --pad: 1.25rem;
  --lh: 1.55;
  --sidebar-w: 264px;
  --rail-w: 88px;
  --bottombar-h: 64px;
  --content-max: 1200px;
  --reading-max: 680px;
}
@media (min-width: 768px) { :root { --gap: 1.5rem; --pad: 1.5rem; } }
[data-roomy="true"] { --gap: 1.15rem; --lh: 1.78; }
@media (min-width: 768px) { [data-roomy="true"] { --gap: 1.725rem; } }
[data-theme="dark"] { --shadow-card: 0 1px 2px rgba(0, 0, 0, .25), 0 4px 16px rgba(0, 0, 0, .2); --shadow-pop: 0 8px 40px rgba(0, 0, 0, .5); }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: var(--lh);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

h1, h2, h3, h4 { color: var(--heading); margin: 0; font-weight: 500; }
.font-display, h1, h2, .display {
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 50, "WONK" 0;
}
.font-hand { font-family: var(--font-hand); font-weight: 500; }
.h1 { font-family: var(--font-display); font-size: 1.625rem; font-weight: 500; letter-spacing: -0.01em; line-height: 1.2; }
.h2 { font-family: var(--font-display); font-size: 1.25rem; font-weight: 500; line-height: 1.3; }
.card-title { font-family: var(--font-body); font-size: 1rem; font-weight: 600; color: var(--heading); line-height: 1.35; }
.display { font-size: 2.5rem; font-weight: 400; line-height: 1.1; }
.stat-num { font-family: var(--font-display); font-size: 1.75rem; font-weight: 500; line-height: 1.1; }
.small, .helper { font-size: .875rem; color: var(--text-muted); }
.label { font-size: .8125rem; font-weight: 600; }
.text-muted { color: var(--text-muted); }
.nums, .stat-num, .tabular { font-variant-numeric: lining-nums tabular-nums; }
@media (min-width: 768px) {
  .h1 { font-size: 1.875rem; }
  .h2 { font-size: 1.375rem; }
  .card-title { font-size: 1.0625rem; }
  .display { font-size: 3.25rem; }
  .stat-num { font-size: 2rem; }
}

p { margin: 0; }
a { color: var(--link); text-underline-offset: 2px; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
input, select, textarea { font-size: 1rem; } /* 16px stops iOS zoom */
::placeholder { color: var(--text-muted); opacity: 1; }
hr { border: 0; border-top: 1px solid var(--divider); margin: 1rem 0; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

[hidden] { display: none !important; }

.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; }

.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 1000;
  background: var(--btn-primary-bg); color: var(--btn-primary-text);
  padding: 10px 16px; border-radius: var(--radius-btn); font-weight: 600; text-decoration: none;
  transition: top .15s var(--ease);
}
.skip-link:focus { top: 12px; }

.reading { max-width: var(--reading-max); }

/* ---------- motion ---------- */
@keyframes gp-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes gp-rise-sm { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes gp-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes gp-slide-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes gp-pop { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
@keyframes gp-toast { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes gp-shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }
@keyframes gp-tick-pop { 0% { transform: scale(1); } 50% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes gp-float-away { to { opacity: 0; transform: translateY(-40px) rotate(-6deg); } }
@keyframes gp-slide-in-top { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes gp-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }

.page-enter { animation: gp-rise 200ms var(--ease) both; }
.fade-in { animation: gp-fade 150ms var(--ease) both; }
.stagger > * { animation: gp-rise-sm 220ms var(--ease) both; }
.stagger > *:nth-child(2) { animation-delay: 40ms; }
.stagger > *:nth-child(3) { animation-delay: 80ms; }
.stagger > *:nth-child(4) { animation-delay: 120ms; }
.stagger > *:nth-child(5) { animation-delay: 160ms; }
.stagger > *:nth-child(6) { animation-delay: 200ms; }

[data-reduce-motion="true"] *, [data-reduce-motion="true"] *::before, [data-reduce-motion="true"] *::after {
  animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; scroll-behavior: auto !important;
}

/* No double-tap zoom delay on controls (iPad and iPhone). */
button, a, [role="button"], .chip, .tab { touch-action: manipulation; }
.bottom-bar { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
