/* ==========================================================================
   base.css — design system baseline for static-site-builder
   Do not edit. Override tokens in site.css :root instead.
   ========================================================================== */

/* --- Tokens --------------------------------------------------------------- */

:root {
  /* Type. Override --font-display / --font-body per project. */
  --font-display: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  /* Fluid type scale, ~1.25 ratio, 320px → 1280px viewport */
  --step--1: clamp(0.83rem, 0.80rem + 0.15vw, 0.94rem);
  --step-0:  clamp(1.00rem, 0.95rem + 0.25vw, 1.13rem);
  --step-1:  clamp(1.20rem, 1.11rem + 0.44vw, 1.41rem);
  --step-2:  clamp(1.44rem, 1.29rem + 0.74vw, 1.76rem);
  --step-3:  clamp(1.73rem, 1.50rem + 1.16vw, 2.20rem);
  --step-4:  clamp(2.07rem, 1.72rem + 1.76vw, 2.75rem);
  --step-5:  clamp(2.49rem, 1.96rem + 2.62vw, 3.43rem);

  --leading-tight: 1.15;
  --leading-snug: 1.35;
  --leading-normal: 1.6;
  --measure: 66ch;

  /* Spacing scale */
  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs:  0.75rem;
  --space-s:   1rem;
  --space-m:   1.5rem;
  --space-l:   2rem;
  --space-xl:  3rem;
  --space-2xl: 4.5rem;
  --space-3xl: 7rem;

  /* Section rhythm — the vertical gap between major page sections */
  --section-y: clamp(3rem, 8vw, 6.5rem);

  /* Color. --accent is the one knob most projects need to turn. */
  --accent: #1d4ed8;
  --accent-contrast: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);

  --bg: #ffffff;
  --bg-subtle: #f6f6f5;
  --surface: #ffffff;
  --text: #17171a;
  --text-muted: #5c5c66;
  --border: #e3e3e0;

  --radius-s: 4px;
  --radius-m: 8px;
  --radius-l: 16px;
  --radius-full: 999px;

  --shadow-s: 0 1px 2px rgb(0 0 0 / 0.05);
  --shadow-m: 0 4px 12px rgb(0 0 0 / 0.07);

  --width-content: 68rem;
  --width-narrow: 42rem;

  /* Minimum hit area for standalone controls. WCAG 2.5.8 exempts links that
     sit inline in a sentence, so .prose links are deliberately left alone. */
  --tap: 44px;

  --transition: 160ms ease;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101012;
    --bg-subtle: #17171a;
    --surface: #1b1b1f;
    --text: #f2f2f0;
    --text-muted: #a3a3ad;
    --border: #2c2c31;
    --shadow-s: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-m: 0 4px 12px rgb(0 0 0 / 0.5);
  }
}

/* --- Reset ---------------------------------------------------------------- */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: var(--leading-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }

ul[class], ol[class] { list-style: none; margin: 0; padding: 0; }

img, picture, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}

input, button, textarea, select { font: inherit; color: inherit; }

/* --- Typography ----------------------------------------------------------- */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: var(--leading-tight);
  text-wrap: balance;
  font-weight: 650;
  letter-spacing: -0.015em;
}

h1 { font-size: var(--step-5); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p { text-wrap: pretty; max-width: var(--measure); }

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--transition);
}
a:hover { color: var(--accent); }

:where(a, button, input, textarea, select, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-s);
}

.lead {
  font-size: var(--step-1);
  line-height: var(--leading-snug);
  color: var(--text-muted);
  max-width: 46ch;
}

.eyebrow {
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--accent);
}

.muted { color: var(--text-muted); }

/* --- Layout primitives ---------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--width-content);
  margin-inline: auto;
  padding-inline: clamp(1rem, 5vw, 2rem);
}

.container--narrow { max-width: var(--width-narrow); }

/* Vertical rhythm: uniform spacing between children */
.stack > * + * { margin-block-start: var(--flow, var(--space-s)); }
.stack--s  { --flow: var(--space-2xs); }
.stack--m  { --flow: var(--space-m); }
.stack--l  { --flow: var(--space-l); }

/* Horizontal group that wraps gracefully */
.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s);
  align-items: center;
}

/* Responsive grid, no media queries needed */
.grid {
  display: grid;
  gap: var(--space-m);
  grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr));
}
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr)); }

.section { padding-block: var(--section-y); }
.section--subtle { background: var(--bg-subtle); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--space-s);
  top: -4rem;
  z-index: 100;
  padding: var(--space-2xs) var(--space-s);
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: var(--radius-m);
  transition: top var(--transition);
}
.skip-link:focus { top: var(--space-s); }

/* --- Site chrome ---------------------------------------------------------- */

.site-header {
  border-block-end: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-m);
  padding-block: var(--space-s);
  flex-wrap: wrap;
}

.site-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-1);
  letter-spacing: -0.02em;
  text-decoration: none;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  column-gap: clamp(var(--space-s), 3vw, var(--space-l));
  row-gap: var(--space-3xs);
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Nav links, buttons, and anything marked .tap get a real 44px hit area
   rather than the ~19px a bare text link renders at. Sizing the element
   itself (instead of expanding it with a pseudo-element) means auditing
   tools and thumbs agree on the target size. */
.site-nav a,
.tap {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
}

.site-nav a {
  text-decoration: none;
  font-size: var(--step-0);
  color: var(--text-muted);
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--text); }
.site-nav a[aria-current="page"] { font-weight: 600; }

/* Nav with many items: past ~6 links a wrapped row gets unwieldy on a phone.
   Wrap the <ul> in <details class="nav-disclosure"> for a no-JS menu. */
.nav-disclosure summary {
  cursor: pointer;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  list-style: none;
}
.nav-disclosure summary::-webkit-details-marker { display: none; }
.nav-disclosure summary::after { content: "▾"; }
.nav-disclosure[open] summary::after { content: "▴"; }
@media (min-width: 48rem) {
  .nav-disclosure summary { display: none; }
  .nav-disclosure > ul { display: flex !important; }
}
@media (max-width: 47.99rem) {
  .nav-disclosure:not([open]) > ul { display: none; }
  .nav-disclosure > ul { flex-direction: column; width: 100%; }
}

.site-footer {
  border-block-start: 1px solid var(--border);
  padding-block: var(--space-xl);
  color: var(--text-muted);
  font-size: var(--step--1);
}

/* --- Components ----------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  padding: 0.7em 1.4em;
  min-height: var(--tap);
  border: 1px solid transparent;
  border-radius: var(--radius-m);
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  font-size: var(--step-0);
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.btn:hover { color: var(--accent-contrast); filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }

.btn--secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn--secondary:hover { color: var(--text); border-color: var(--text-muted); background: var(--bg-subtle); }

.btn--ghost { background: transparent; color: var(--accent); padding-inline: 0; }
.btn--ghost:hover { color: var(--accent); text-decoration: underline; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: var(--space-m);
}
.card h3 { font-size: var(--step-1); }
.card p { color: var(--text-muted); }

.hero { padding-block: clamp(3rem, 10vw, 7rem); }
.hero h1 { max-width: 18ch; }

.prose { max-width: var(--measure); }
.prose > * + * { margin-block-start: var(--space-s); }
.prose h2 { margin-block-start: var(--space-xl); }
.prose h3 { margin-block-start: var(--space-l); }
.prose ul, .prose ol { padding-inline-start: 1.25em; }
.prose li + li { margin-block-start: var(--space-3xs); }
.prose img { border-radius: var(--radius-m); margin-block: var(--space-m); }
.prose blockquote {
  border-inline-start: 3px solid var(--accent);
  padding-inline-start: var(--space-m);
  font-size: var(--step-1);
  line-height: var(--leading-snug);
  color: var(--text-muted);
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-subtle);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-s);
}
.prose pre {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: var(--space-s);
  overflow-x: auto;
}
.prose pre code { background: none; padding: 0; }

table { border-collapse: collapse; width: 100%; }
th, td { text-align: start; padding: var(--space-2xs) var(--space-s); border-block-end: 1px solid var(--border); }
th { font-weight: 600; }

/* Forms */
.field { display: grid; gap: var(--space-3xs); }
.field label { font-size: var(--step--1); font-weight: 600; }
.field input, .field textarea, .field select {
  padding: 0.6em 0.75em;
  min-height: var(--tap);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--surface);
  width: 100%;
  /* iOS Safari zooms the page when a focused input is under 16px */
  font-size: max(16px, var(--step-0));
}
.field input:focus, .field textarea:focus { border-color: var(--accent); }
