/* ==========================================================================
   GP SmartGrowth · tema propio · assets/css/theme.css
   Base del tema: reset mínimo, tipografía, ritmo vertical, contenedores y
   accesibilidad. Solo roles. Ningún hex: todo sale de theme.json
   (settings.custom.gp -> --wp--custom--gp--<token>).
   ========================================================================== */

:root {
  /* Alias cortos derivados de los tokens del tema (1:1, sin valores nuevos). */
  --gp-ink: var(--wp--custom--gp--surface-sheet);
  --gp-paper: var(--wp--custom--gp--surface-paper);
  --gp-body: var(--wp--custom--gp--text-body);
  --gp-muted: var(--wp--custom--gp--text-muted);
  --gp-on-ink: var(--wp--custom--gp--text-on-sheet);
  --gp-on-ink-muted: var(--wp--custom--gp--text-muted-on-sheet);
  --gp-route: var(--wp--custom--gp--accent-route);
  --gp-route-deep: var(--wp--custom--gp--accent-route-deep);
  --gp-route-hover: var(--wp--custom--gp--accent-route-hover);
  --gp-on-route: var(--wp--custom--gp--accent-route-ink);
  --gp-marker: var(--wp--custom--gp--accent-marker);
  --gp-marker-text: var(--wp--custom--gp--accent-marker-text);
  --gp-hairline: var(--wp--custom--gp--line-hairline);
  --gp-hairline-strong: var(--wp--custom--gp--line-hairline-strong);
  --gp-hairline-ink: var(--wp--custom--gp--line-hairline-on-sheet);
  --gp-field-line: var(--wp--custom--gp--line-field);
  --gp-danger: var(--wp--custom--gp--state-danger);
  --gp-focus: var(--wp--custom--gp--state-focus-on-paper);
  --gp-focus-ink: var(--wp--custom--gp--state-focus-on-sheet);
  --gp-mono: var(--wp--custom--gp--font-mono);
  --gp-ease: var(--wp--custom--gp--easing-enter);
  --gp-dur: var(--wp--custom--gp--duration-base);
}

/* ---------- reset mínimo (no normaliza lo que hace core) ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--wp--custom--gp--header-height) + 16px);
}

body {
  margin: 0;
  background-color: var(--gp-paper);
  color: var(--gp-body);
  font-family: var(--wp--custom--gp--font-body);
  font-size: var(--wp--custom--gp--size-body);
  line-height: var(--wp--custom--gp--lh-body);
  font-weight: var(--wp--custom--gp--weight-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

figure {
  margin: 0;
}

hr {
  border: 0;
  border-top: 1px solid var(--gp-hairline);
  margin: var(--wp--custom--gp--space-6) 0;
}

/* ---------- tipografía ---------- */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 var(--wp--custom--gp--space-3);
  font-family: var(--wp--custom--gp--font-display);
  font-weight: var(--wp--custom--gp--weight-display);
  letter-spacing: var(--wp--custom--gp--tracking-display);
  line-height: var(--wp--custom--gp--lh-display-2);
  color: var(--gp-body);
  text-wrap: balance;
}

h1 {
  font-size: var(--wp--custom--gp--size-display-1);
  line-height: var(--wp--custom--gp--lh-display-1);
  letter-spacing: var(--wp--custom--gp--tracking-display-1);
}

h2 {
  font-size: var(--wp--custom--gp--size-display-2);
  line-height: var(--wp--custom--gp--lh-display-2);
  letter-spacing: var(--wp--custom--gp--tracking-display-2);
}

h3 {
  font-size: var(--wp--custom--gp--size-display-3);
  line-height: var(--wp--custom--gp--lh-display-3);
  letter-spacing: 0;
}

h4,
h5,
h6 {
  font-size: var(--wp--custom--gp--size-ui);
  line-height: 1.25;
  letter-spacing: 0;
}

p {
  margin: 0 0 var(--wp--custom--gp--space-4);
  max-width: var(--wp--custom--gp--measure-body);
}

a {
  color: var(--gp-route-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--gp-dur) var(--gp-ease);
}

a:hover {
  color: var(--gp-route-hover);
}

strong,
b {
  font-weight: var(--wp--custom--gp--weight-body-strong);
}

small {
  font-size: var(--wp--custom--gp--size-meta);
  color: var(--gp-muted);
}

code,
kbd,
pre,
samp {
  font-family: var(--gp-mono);
  font-size: var(--wp--custom--gp--size-meta);
}

blockquote {
  margin: var(--wp--custom--gp--space-5) 0;
  padding-left: var(--wp--custom--gp--space-4);
  border-left: 2px solid var(--gp-route);
  color: var(--gp-muted);
  font-size: var(--wp--custom--gp--size-lede);
  line-height: var(--wp--custom--gp--lh-lede);
}

ul,
ol {
  padding-left: 1.2em;
}

li + li {
  margin-top: var(--wp--custom--gp--space-1);
}

/* ---------- contenedores ---------- */
/* El gutter va por fuera del ancho de medida: así el contenido mide
   --container (1280) *exactos* a 1440, como el mockup, en vez de
   container − 2·gutter (1152). Bajo esa anchura manda el gutter. */
.gp-wrap {
  width: 100%;
  max-width: calc(var(--wp--custom--gp--container) + 2 * var(--wp--custom--gp--gutter));
  margin-inline: auto;
  padding-inline: var(--wp--custom--gp--gutter);
}

/* ---------- ritmo vertical ---------- */
.gp-section {
  padding-block: var(--wp--custom--gp--section-space);
}

.gp-section--tight {
  padding-block: var(--wp--custom--gp--section-space-sm);
}

.gp-section--paper {
  background-color: var(--gp-paper);
  color: var(--gp-body);
}

.gp-section--paper-2 {
  background-color: var(--wp--custom--gp--surface-paper-2);
  color: var(--gp-body);
}

.gp-section--sheet {
  background-color: var(--gp-ink);
  color: var(--gp-on-ink);
}

.gp-section--sheet h1,
.gp-section--sheet h2,
.gp-section--sheet h3 {
  color: var(--gp-on-ink);
}

.gp-section--sheet a {
  color: var(--gp-marker);
}

.gp-section--sheet a:hover {
  color: var(--wp--custom--gp--text-on-sheet);
}

.gp-section--sheet p,
.gp-section--sheet li {
  color: var(--gp-on-ink-muted);
}

/* ---------- accesibilidad ---------- */
:where(a, button, summary, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--gp-focus);
  outline-offset: 3px;
  border-radius: var(--wp--custom--gp--radius-base);
}

.gp-section--sheet :where(a, button, summary, input, select, textarea):focus-visible {
  outline-color: var(--gp-focus-ink);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  padding: var(--wp--custom--gp--space-3) var(--wp--custom--gp--space-4);
  background-color: var(--gp-marker);
  color: var(--wp--custom--gp--accent-route-ink);
  font-size: var(--wp--custom--gp--size-ui);
  font-weight: var(--wp--custom--gp--weight-body-strong);
  text-decoration: none;
}

.skip-link:focus {
  left: var(--wp--custom--gp--space-4);
  top: var(--wp--custom--gp--space-4);
}

::selection {
  background-color: var(--gp-route);
  color: var(--wp--custom--gp--accent-route-ink);
}

/* ---------- utilidades de plano ---------- */
.gp-mono {
  font-family: var(--gp-mono);
  font-size: var(--wp--custom--gp--size-annotation);
  letter-spacing: var(--wp--custom--gp--tracking-annotation);
  text-transform: uppercase;
  color: var(--gp-muted);
}

.gp-measure {
  max-width: var(--wp--custom--gp--measure-prose);
}

.gp-rule {
  border: 0;
  border-top: 1px solid var(--gp-hairline);
  margin: 0;
}

/* Alineaciones de core dentro de nuestros contenedores. */
.alignwide {
  max-width: var(--wp--custom--gp--container);
}

.alignfull {
  max-width: none;
  width: 100%;
}

.wp-element-caption,
figcaption {
  font-size: var(--wp--custom--gp--size-ui);
  color: var(--gp-muted);
}

/* ---------- movimiento reducido (contrato del kit) ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: var(--wp--custom--gp--motion-reduced-duration) !important;
    animation-iteration-count: 1 !important;
    transition-duration: var(--wp--custom--gp--motion-reduced-duration) !important;
    scroll-behavior: auto !important;
  }

  [data-gp-reveal] {
    opacity: 1 !important;
    transform: none !important;
    transition-delay: 0ms !important;
  }

  /* Entrada de cabeceras: sin animación y en su sitio desde el primer frame. */
  .gp-hero > .gp-wrap > *,
  .gp-page-head > *,
  .gp-article__head > * {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* data-gp-reveal: visible por defecto; solo se oculta si hay JS activo. */
.js [data-gp-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity var(--wp--custom--gp--duration-reveal) var(--gp-ease),
    transform var(--wp--custom--gp--duration-reveal) var(--gp-ease);
}

.js [data-gp-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* Escalonado: cada unidad trae su retardo en --gp-reveal-delay (≤120 ms). */
.js [data-gp-reveal] {
  transition-delay: var(--gp-reveal-delay, 0ms);
}

/* Entrada de .gp-hero, .gp-page-head y .gp-article__head: CSS puro, arranca en
   el primer pintado (sin parpadeo: no depende del JS). Escalón 90 ms. */
@keyframes gp-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.gp-hero > .gp-wrap > *,
.gp-page-head > *,
.gp-article__head > * {
  animation: gp-enter var(--wp--custom--gp--duration-reveal) var(--gp-ease) backwards;
}

.gp-hero > .gp-wrap > *:nth-child(2),
.gp-page-head > *:nth-child(2),
.gp-article__head > *:nth-child(2) {
  animation-delay: 90ms;
}

.gp-hero > .gp-wrap > *:nth-child(3),
.gp-page-head > *:nth-child(3),
.gp-article__head > *:nth-child(3) {
  animation-delay: 180ms;
}

.gp-hero > .gp-wrap > *:nth-child(n + 4),
.gp-page-head > *:nth-child(n + 4),
.gp-article__head > *:nth-child(n + 4) {
  animation-delay: 270ms;
}
