/* ==========================================================================
   Base: reset, background, typography scale, utilities
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.4;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  overflow-wrap: break-word;
}

/* Calm gradient field the glass floats over. Fixed so it does not scroll. */
body::before {
  content: "";
  position: fixed;
  inset: -10vmax;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(40vmax 34vmax at 8% 6%, var(--bg-grad-1), transparent 70%),
    radial-gradient(38vmax 32vmax at 96% 18%, var(--bg-grad-2), transparent 70%),
    radial-gradient(42vmax 36vmax at 82% 96%, var(--bg-grad-3), transparent 70%),
    radial-gradient(36vmax 30vmax at 10% 88%, var(--bg-grad-4), transparent 70%),
    var(--bg);
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
ul[role="list"], ol[role="list"], .list, .plain-list { list-style: none; margin: 0; padding: 0; }
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: var(--tint-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

.icon { flex: none; display: inline-block; vertical-align: middle; }

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

::selection { background: var(--blue-soft); }

/* ---------- Typography scale (Apple HIG names) ---------- */
.t-display    { font-family: var(--font-rounded); font-size: var(--fs-display); font-weight: 700; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.t-largetitle { font-size: var(--fs-largetitle); font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.t-title1     { font-size: var(--fs-title1); font-weight: 700; line-height: 1.2; letter-spacing: -0.015em; }
.t-title2     { font-size: var(--fs-title2); font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }
.t-title3     { font-size: var(--fs-title3); font-weight: 600; line-height: 1.25; }
.t-headline   { font-size: var(--fs-headline); font-weight: 600; line-height: 1.3; }
.t-body       { font-size: var(--fs-body); font-weight: 400; line-height: 1.4; }
.t-callout    { font-size: var(--fs-callout); line-height: 1.4; }
.t-subhead    { font-size: var(--fs-subhead); line-height: 1.35; }
.t-footnote   { font-size: var(--fs-footnote); line-height: 1.35; }
.t-caption    { font-size: var(--fs-caption); line-height: 1.3; font-weight: 500; }
.t-overline   { font-size: var(--fs-caption); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.t-num        { font-variant-numeric: tabular-nums; }
.t-rounded    { font-family: var(--font-rounded); }
.t-bold       { font-weight: 700; }
.t-semibold   { font-weight: 600; }
.t-center     { text-align: center; }
.t-right      { text-align: right; }
.t-truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.muted        { color: var(--text-2); }
.subtle       { color: var(--text-3); }
.accent-ink   { color: var(--accent-ink); }

/* ---------- Layout utilities ---------- */
.stack     { display: flex; flex-direction: column; gap: var(--sp-3); }
.stack-sm  { display: flex; flex-direction: column; gap: var(--sp-2); }
.stack-lg  { display: flex; flex-direction: column; gap: var(--sp-6); }
.row       { display: flex; align-items: center; gap: var(--sp-2); }
.row-wrap  { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.grow      { flex: 1 1 auto; min-width: 0; }
.grid-2    { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.grid-3    { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--sp-3); }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: var(--sp-2); } .mt-4 { margin-top: var(--sp-4); } .mt-6 { margin-top: var(--sp-6); }
.mb-2 { margin-bottom: var(--sp-2); } .mb-4 { margin-bottom: var(--sp-4); }

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

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