/* ============================================================================
   BASE — reset, document defaults, typography, layout helpers, a11y
   Buildable in plain CSS. No frameworks.
   ============================================================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  font-weight: var(--fw-regular);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv01", "ss01", "cv11";
  min-height: 100vh;
  overflow-x: hidden;
}

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

input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

ul, ol { list-style: none; padding: 0; }

/* ---- Headings ------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--fw-semibold);
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-snug);
  color: var(--ink);
  text-wrap: balance;
}
h1 { font-size: var(--fs-3xl); letter-spacing: var(--tracking-tight); line-height: var(--lh-snug); }
h2 { font-size: var(--fs-2xl); letter-spacing: var(--tracking-tight); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
h5 { font-size: var(--fs-md); }

p { text-wrap: pretty; }

code, kbd, samp, pre { font-family: var(--font-mono); font-feature-settings: normal; }

/* ---- Inline code on prose ------------------------------------------------- */
:not(pre) > code.tok,
.prose :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--code-inline-bg);
  color: var(--code-inline-ink);
  padding: 0.12em 0.4em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  white-space: nowrap;
}

/* ---- Selection ------------------------------------------------------------ */
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--ink); }

/* ---- Focus (visible, keyboard only) --------------------------------------- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}
a:focus-visible, button:focus-visible,
.btn:focus-visible, .lang-switch button:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* ---- Skip link ------------------------------------------------------------ */
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  transform: translateY(-150%);
  transition: transform var(--dur) var(--ease);
}
.skip-link:focus { transform: translateY(0); text-decoration: none; }

/* ---- Layout helpers ------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container-wide { max-width: var(--container-wide); }
.container-narrow { max-width: var(--container-narrow); }

.section { padding-block: clamp(56px, 9vw, 112px); }
.section-sm { padding-block: clamp(40px, 6vw, 72px); }

.stack > * + * { margin-top: var(--flow, var(--space-4)); }

.grid { display: grid; gap: var(--space-5); }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

/* ---- Eyebrow / kicker ----------------------------------------------------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--fs-mono-xs);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--accent-text);
}
.eyebrow::before {
  content: "";
  width: 18px; height: 1px;
  background: var(--accent);
  display: inline-block;
}
.eyebrow.no-rule::before { display: none; }

/* ---- Lead paragraph ------------------------------------------------------- */
.lead {
  font-size: var(--fs-md);
  line-height: var(--lh-relaxed);
  color: var(--ink-2);
}

.muted { color: var(--ink-3); }
.mono { font-family: var(--font-mono); }
.text-center { text-align: center; }

/* ---- Visually hidden ------------------------------------------------------ */
.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;
}

/* ---- Scroll reveal (progressive enhancement; visible unless JS opts in) --- */
@media (prefers-reduced-motion: no-preference) {
  html.js .reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
    will-change: opacity, transform;
  }
  html.js .reveal.is-in { opacity: 1; transform: none; }
}

/* ---- Bilingual: show one language at a time ------------------------------- */
[data-lang-en] [lang="es"] { display: none; }
[data-lang-es] [lang="en"] { display: none; }
/* inline variant for swapping spans without layout shift */
.i18n > [lang] { display: none; }
[data-lang-en] .i18n > [lang="en"],
[data-lang-es] .i18n > [lang="es"] { display: revert; }
