/* ============================================================
   Base — reset, type, page frame, screen transitions
   ============================================================ */

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

* {
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: 1.4;
  color: var(--text-1);
  background: var(--bg);
  min-height: 100dvh;
  overflow-x: hidden;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Atmosphere: perceived, never noticed. If you see the gradient
   before the content, it is too strong. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(130% 68% at 50% -10%, rgba(120,140,255,0.055), transparent 72%),
    radial-gradient(90% 44% at 50% 106%, rgba(255,255,255,0.022), transparent 72%);
}
:root[data-theme="light"] body::before {
  background:
    radial-gradient(120% 62% at 50% -8%, rgba(0,0,0,0.022), transparent 70%);
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  appearance: none;
  -webkit-appearance: none;
}
button { cursor: pointer; }
input, textarea { outline: none; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }
svg { display: block; }

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

/* Screen-reader-only, still focusable */
.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;
}

/* ---------- numerals ---------- */
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ---------- type scale ---------- */
.t-display {
  font-size: var(--t-display);
  font-weight: 700;
  letter-spacing: var(--tt-display);
  line-height: 1.05;
}
.t-title {
  font-size: var(--t-title);
  font-weight: 700;
  letter-spacing: var(--tt-title);
  line-height: 1.1;
}
.t-metric {
  font-size: var(--t-metric);
  font-weight: 700;
  letter-spacing: var(--tt-metric);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.t-section {
  font-size: var(--t-section);
  font-weight: 600;
  letter-spacing: var(--tt-section);
  line-height: 1.2;
}
.t-body      { font-size: var(--t-body); letter-spacing: var(--tt-body); }
.t-body-em   { font-size: var(--t-body); font-weight: 600; letter-spacing: var(--tt-body); }
.t-secondary { font-size: var(--t-secondary); color: var(--text-2); letter-spacing: -0.01em; }
.t-meta      { font-size: var(--t-meta); font-weight: 500; color: var(--text-2); letter-spacing: -0.005em; }
.t-label {
  font-size: var(--t-label);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* ============================================================
   Page frame + navigation stack
   ============================================================ */

#app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
}

.stack {
  position: relative;
  min-height: 100dvh;
}

.screen {
  width: 100%;
  min-height: 100dvh;
  padding:
    calc(var(--safe-top) + var(--s-3))
    var(--page-pad)
    var(--island-space);
  max-width: var(--page-max);
  margin: 0 auto;
}

/* During a transition both screens are absolutely positioned so
   they overlap cleanly. */
.stack.is-animating .screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* push: incoming from the trailing edge, outgoing parallaxes back */
@keyframes push-in   { from { transform: translate3d(100%,0,0); } to { transform: none; } }
@keyframes push-out  { from { transform: none; } to { transform: translate3d(-24%,0,0); opacity: .55; } }
@keyframes pop-in    { from { transform: translate3d(-24%,0,0); opacity: .55; } to { transform: none; opacity: 1; } }
@keyframes pop-out   { from { transform: none; } to { transform: translate3d(100%,0,0); } }
/* tab: no horizontal motion — a lateral move between roots */
@keyframes tab-in    { from { opacity: 0; transform: translate3d(0,8px,0); } to { opacity: 1; transform: none; } }
@keyframes tab-out   { from { opacity: 1; } to { opacity: 0; } }

.anim-push-in  { animation: push-in  var(--dur-standard) var(--glide) both; z-index: 2; box-shadow: -14px 0 34px rgba(0,0,0,.28); }
.anim-push-out { animation: push-out var(--dur-standard) var(--glide) both; z-index: 1; }
.anim-pop-in   { animation: pop-in   var(--dur-standard) var(--glide) both; z-index: 1; }
.anim-pop-out  { animation: pop-out  var(--dur-standard) var(--glide) both; z-index: 2; box-shadow: -14px 0 34px rgba(0,0,0,.28); }
.anim-tab-in   { animation: tab-in   var(--dur-fast) var(--settle) both; z-index: 2; }
.anim-tab-out  { animation: tab-out  var(--dur-fast) linear both; z-index: 1; }

/* interactive back-swipe drives transforms directly */
.stack.is-dragging .screen { transition: none; }

/* ---------- screen header ---------- */
.screen-head { padding-top: var(--s-2); }
.screen-head .eyebrow {
  font-size: var(--t-meta);
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: -0.005em;
  margin-top: 6px;
}

.nav-bar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  height: 44px;
  margin: 0 -6px var(--s-2);
}
.nav-bar .spacer { flex: 1 1 auto; }

.nav-btn {
  min-width: 44px;
  height: 44px;
  padding: 0 var(--s-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--accent);
  border-radius: var(--r-sm);
  transition: transform var(--dur-micro) var(--settle), opacity var(--dur-micro);
}
.nav-btn:active { transform: scale(0.92); opacity: .7; }
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn.is-plain { color: var(--text-1); }

/* ---------- sections ---------- */
.section { margin-top: var(--s-8); }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.section-head h2 {
  font-size: var(--t-section);
  font-weight: 600;
  letter-spacing: var(--tt-section);
}
.section-head .action {
  font-size: var(--t-secondary);
  font-weight: 500;
  color: var(--accent);
  padding: 6px 0 6px var(--s-3);
}

/* ---------- utility ---------- */
.stack-list { display: flex; flex-direction: column; gap: var(--s-2); }
.center { text-align: center; }
.hidden { display: none !important; }
.pressable {
  transition: transform var(--dur-micro) var(--settle),
              background-color var(--dur-micro) linear;
}
.pressable:active { transform: scale(0.98); }
