/* ==========================================================================
   SEITEL — Base: reset, typography, layout primitives, a11y, motion
   (DESIGN.md v2.0)
   ========================================================================== */

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--white);
  color: var(--ink-900);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, ul, ol, figure, blockquote, dl, dd { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
img, picture, video, svg { display: block; max-width: 100%; }
img, video { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

/* Lock page scroll while an overlay is open */
html.is-locked { overflow: hidden; }

/* ---------- Typography (§4 — Montserrat only) ----------
   Headings inherit: --ink-900 on light (v2.0 §3.2), white inside dark blocks. */
h1, h2, h3, h4 { color: inherit; }

.t-display,
.t-h2,
.t-h3-lg {
  font-weight: 600;
  text-wrap: balance;
}

.t-display {
  font-size: var(--fs-display);
  line-height: 1.02;
  letter-spacing: var(--ls-display);
}

.t-h2 {
  font-size: var(--fs-h2);
  line-height: 1.06;
  letter-spacing: var(--ls-h2);
}

.t-h3-lg {
  font-size: var(--fs-h3-lg);
  line-height: 1.15;
  letter-spacing: var(--ls-h3-lg);
}

.t-h3 {
  font-size: var(--fs-h3);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: var(--ls-h3);
}

.t-stat {
  font-size: var(--fs-stat);
  font-weight: 500;
  line-height: 1;
  letter-spacing: var(--ls-stat);
  font-variant-numeric: tabular-nums;
}

/* One color per heading (§4.1 v2.1): no colored phrase inside a heading. */
h1 em, h2 em, h3 em, h4 em,
.t-display em, .t-h2 em, .t-h3-lg em, .t-h3 em {
  font-style: inherit;
  color: inherit;
}

p, li, dd, figcaption { text-wrap: pretty; }

.t-lead {
  font-size: var(--fs-lead);
  line-height: 1.6;
  max-width: 62ch;
}

.t-body { font-size: var(--fs-body); line-height: 1.65; max-width: 62ch; }

.t-small {
  font-size: var(--fs-small);
  font-weight: 500;
  line-height: 1.4;
}

.t-osd {
  font-size: var(--fs-osd);
  font-weight: 600;
  line-height: 1;
  letter-spacing: var(--ls-osd);
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.tabular { font-variant-numeric: tabular-nums; }

@media (max-width: 767px) {
  .t-display { line-height: 1.08; }
  .t-h2 { line-height: 1.12; }
  .t-h3-lg { line-height: 1.2; }
}

/* ---------- Layout: ONE container (§5.1) ----------
   The nav pill, every section and the footer share these two edges.
   Only backgrounds and images may bleed past them. */
.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--pad-x));
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gutter);
}

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

/* The footer skips style/layout/paint until it nears the viewport (main-thread work on
   mobile). Only the footer: on sections above #contacto the estimated height made
   cross-page anchor jumps ("/#contacto" from internal pages) land ~1000px off. */
.footer {
  content-visibility: auto;
  contain-intrinsic-size: auto 700px;
}

/* Section title (+ lead) → content: 32–40px (§5.2) */
.section-head { margin-bottom: var(--title-gap); }

/* Anchored sections are not hidden under the sticky nav (§14) */
[id] { scroll-margin-top: calc(var(--nav-top) + var(--nav-h) + var(--s-5)); }

/* Pages without a hero: the fixed nav floats above the content, reserve its height */
body:not(.has-hero) main { padding-top: calc(var(--nav-top) + var(--nav-h)); }

/* ---------- Alignment debug (§5.1): ?debug-grid draws the two container edges ---------- */
body.debug-grid::after {
  content: "";
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 9999;
  width: min(var(--container), calc(100vw - 2 * var(--pad-x)));
  transform: translateX(-50%);
  border-inline: 1px solid var(--error);
  pointer-events: none;
}

/* ---------- Icons ---------- */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: currentColor;
}
.icon--24 { width: 24px; height: 24px; }

/* ---------- Accessibility ---------- */
.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;
  top: var(--s-3);
  left: var(--s-3);
  z-index: 100;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-pill);
  background: var(--ink-900);
  color: var(--white);
  font-size: var(--fs-small);
  font-weight: 500;
  transform: translateY(-200%);
  transition: transform var(--dur-fast) var(--ease);
}
.skip-link:focus-visible { transform: none; }

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

/* Blue ring is invisible on ink: dark surfaces switch the ring to white */
.mobile-menu,
.on-dark,
.manifesto,
.contact__block,
.project-cta__block,
.wa-card { --focus: var(--white); }
.form-card { --focus: var(--blue-600); }

::selection {
  background: var(--sky-400);
  color: var(--ink-900);
}

/* ---------- Reveal (§10) — opt-in via [data-reveal], JS adds .is-visible ---------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity var(--dur-slow) var(--ease),
    transform var(--dur-slow) var(--ease);
  transition-delay: calc(var(--reveal-i, 0) * 60ms);
}
.js [data-reveal].is-visible { opacity: 1; transform: none; }

/* ---------- Reduced motion: disable everything ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
  .js [data-reveal] { opacity: 1; transform: none; }
}

/* Dark/rounded blocks sit 12px inside the viewport (§5.1) but their content must keep
   the page edges: the inner container gives back those 12px of side padding. */
.block-inset {
  margin-inline: var(--inset);
  border-radius: var(--r-block);
}
.block-inset > .container {
  max-width: calc(var(--container) + 2 * (var(--pad-x) - var(--inset)));
  padding-inline: calc(var(--pad-x) - var(--inset));
}
