/* ══════════════════════════════════════════════════════════════════════════
   [MARCA] — hoja de estilos única
   BEM: block__element--modifier · estados .is-* (los alterna el JS)
   Los hooks .js-* NUNCA se estilizan.

   TABLA DE CONTENIDOS
   01 · Tokens (:root)
   02 · Reset y base
   03 · Accesibilidad
   04 · Tipografía y layout
   05 · Botones
   06 · Encabezado y navegación
   07 · Hero
   08 · Placeholders de imagen
   09 · Pie de página
   10 · Revelado (fail-safe)
   11 · Páginas legales (.page-legal)
   12 · Utilidades
   13 · Impresión
   ══════════════════════════════════════════════════════════════════════════ */


/* ══ 01 · TOKENS ═════════════════════════════════════════════════════════ */

:root {
  /* Marca — variantes derivadas con oklch() para consistencia perceptual */
  --brand:        oklch(0.55 0.13 250);
  --brand-deep:   oklch(0.42 0.12 250);
  --brand-soft:   oklch(0.95 0.03 250);
  --accent:       oklch(0.68 0.16 150);

  /* Superficies */
  --bg:           oklch(0.99 0.004 250);
  --surface:      oklch(1 0 0);
  --surface-deep: oklch(0.96 0.006 250);
  --ink:          oklch(0.21 0.02 250);

  /* Escala semántica de texto — no usar colores sueltos por sección */
  --text-clear:   var(--ink);
  --text-mid:     color-mix(in oklch, var(--ink) 72%, var(--bg));
  --text-faint:   color-mix(in oklch, var(--ink) 50%, var(--bg));
  --text-invert:  oklch(0.99 0 0);

  /* Líneas */
  --line:         color-mix(in oklch, var(--ink) 12%, transparent);
  --line-strong:  color-mix(in oklch, var(--ink) 28%, transparent);

  /* Tipografía — fallback encadenado; ver @font-face al final de esta sección */
  --font-sans:    "[FuenteTexto]", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "[FuenteTitulos]", var(--font-sans);
  --font-mono:    ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;

  /* Escala tipográfica fluida */
  --text-xs:   clamp(0.75rem, 0.72rem + 0.15vw, 0.82rem);
  --text-sm:   clamp(0.875rem, 0.85rem + 0.15vw, 0.95rem);
  --text-base: clamp(1rem, 0.96rem + 0.2vw, 1.08rem);
  --text-lg:   clamp(1.13rem, 1.05rem + 0.4vw, 1.35rem);
  --text-xl:   clamp(1.35rem, 1.2rem + 0.8vw, 1.85rem);
  --text-2xl:  clamp(1.7rem, 1.4rem + 1.5vw, 2.6rem);
  --text-3xl:  clamp(2.1rem, 1.5rem + 3vw, 4rem);

  /* Ritmo y medida */
  --radius:     14px;
  --radius-sm:  8px;
  --radius-lg:  24px;
  --pad-x:      clamp(1.25rem, 5vw, 3rem);
  --maxw:       1200px;
  --measure:    68ch;
  --gap:        clamp(1rem, 2.5vw, 2rem);
  --section-y:  clamp(3.5rem, 9vw, 7rem);
  --header-h:   72px;

  /* Sombras por rol */
  --shadow-soft: 0 1px 2px color-mix(in oklch, var(--ink) 6%, transparent);
  --shadow-base: 0 1px 2px color-mix(in oklch, var(--ink) 6%, transparent),
                 0 12px 28px -18px color-mix(in oklch, var(--ink) 45%, transparent);
  --shadow-deep: 0 24px 60px -28px color-mix(in oklch, var(--ink) 55%, transparent);

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Fuentes self-hosted: solo los pesos usados, font-display:swap.
   Colocar los .woff2 en /assets/fonts/ y descomentar.
@font-face {
  font-family: "[FuenteTexto]";
  src: url("/assets/fonts/[fuente-texto]-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "[FuenteTitulos]";
  src: url("/assets/fonts/[fuente-titulos]-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
*/


/* ══ 02 · RESET Y BASE ═══════════════════════════════════════════════════ */

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

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

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text-clear);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0 0 0.5em;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }

p { margin: 0 0 1em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

a { color: inherit; text-underline-offset: 0.18em; }

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

ul, ol { margin: 0 0 1em; padding-left: 1.25rem; }

address { font-style: normal; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }


/* ══ 03 · ACCESIBILIDAD ══════════════════════════════════════════════════ */

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -100%;
  z-index: 999;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--text-invert);
  text-decoration: none;
}
.skip-link:focus-visible { top: 0.5rem; }

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

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
  border-radius: 4px;
}


/* ══ 04 · TIPOGRAFÍA Y LAYOUT ════════════════════════════════════════════ */

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

.section { padding-block: var(--section-y); }
.section--tint { background: var(--surface-deep); }

/* Kicker/eyebrow: etiqueta de sección, NO es heading (no rompe la jerarquía). */
.kicker {
  margin: 0 0 0.75rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.lede {
  max-width: var(--measure);
  font-size: var(--text-lg);
  color: var(--text-mid);
}

/* Sin el minmax(0,1fr) el contenido largo desborda la columna. */
.grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
}
.grid > * { min-width: 0; }


/* ══ 05 · BOTONES ════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  min-height: 44px;            /* objetivo táctil mínimo */
  padding: 0.7rem 1.35rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--brand);
  color: var(--text-invert);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.btn:hover { background: var(--brand-deep); }
.btn:active { transform: translateY(1px); }

.btn__icon { width: 1.15em; height: 1.15em; flex: none; }

.btn--lg { padding: 0.95rem 1.75rem; font-size: var(--text-lg); }

.btn--wa { background: oklch(0.63 0.16 150); }
.btn--wa:hover { background: oklch(0.55 0.15 150); }

.btn--ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: inherit;
}
.btn--ghost:hover { background: color-mix(in oklch, currentColor 8%, transparent); }

/* Fila de CTAs */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}


/* ══ 06 · ENCABEZADO Y NAVEGACIÓN ════════════════════════════════════════ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in oklch, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.site-header.is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: var(--shadow-soft);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  min-height: var(--header-h);
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

.brand { text-decoration: none; }
.brand__name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Hamburguesa → X: tres <span>, sin iconos externos. */
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.nav-toggle__box {
  position: relative;
  display: block;
  width: 20px; height: 14px;
}
.nav-toggle__box span {
  position: absolute;
  left: 0;
  width: 100%; height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.25s var(--ease), opacity 0.2s var(--ease);
}
.nav-toggle__box span:nth-child(1) { top: 0; }
.nav-toggle__box span:nth-child(2) { top: 6px; }
.nav-toggle__box span:nth-child(3) { top: 12px; }

.nav-toggle[aria-expanded="true"] .nav-toggle__box span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__box span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__box span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.nav__list {
  display: flex;
  gap: clamp(0.75rem, 2vw, 1.75rem);
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-mid);
  text-decoration: none;
}
.nav__link:hover { color: var(--text-clear); text-decoration: underline; }

/* Escritorio */
@media (min-width: 861px) {
  .nav { display: flex; align-items: center; gap: clamp(1rem, 3vw, 2rem); }
  .nav-toggle { display: none; }
}

/* Móvil: panel desplegable. Sin JS el menú permanece visible (no display:none). */
@media (max-width: 860px) {
  .nav {
    position: absolute;
    inset-inline: 0;
    top: 100%;
    display: grid;
    gap: 0.5rem;
    padding: 1rem var(--pad-x) 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-base);
  }
  .nav__list { flex-direction: column; gap: 0; }
  .nav__link { min-height: 48px; font-size: var(--text-base); }
  .nav__cta { margin-top: 0.5rem; }

  /* El JS colapsa el menú solo cuando confirmó que puede volver a abrirlo. */
  body.nav-ready .nav { display: none; }
  body.nav-ready .nav.is-open { display: grid; }
}


/* ══ 07 · HERO ═══════════════════════════════════════════════════════════ */

.hero {
  position: relative;
  display: grid;
  align-items: end;
  min-height: min(88svh, 780px);
  isolation: isolate;
  background: var(--ink);
  color: var(--text-invert);
}

.hero__bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    to top,
    color-mix(in oklch, var(--ink) 88%, transparent) 0%,
    color-mix(in oklch, var(--ink) 55%, transparent) 45%,
    color-mix(in oklch, var(--ink) 25%, transparent) 100%
  );
}

.hero__inner { padding-block: clamp(3rem, 12vh, 7rem); }

.hero .kicker { color: color-mix(in oklch, var(--text-invert) 75%, transparent); }

.hero__title {
  max-width: 20ch;
  margin-bottom: 0.4em;
}

.hero__lede {
  max-width: 54ch;
  font-size: var(--text-lg);
  color: color-mix(in oklch, var(--text-invert) 88%, transparent);
}

.hero .btn--ghost {
  border-color: color-mix(in oklch, var(--text-invert) 45%, transparent);
  color: var(--text-invert);
}


/* ══ 08 · PLACEHOLDERS DE IMAGEN ═════════════════════════════════════════ */

/* Reserva el espacio (anti-CLS) y grita que falta el asset definitivo. */
.ph {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  padding: 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-deep);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-align: center;
}
.ph--square { aspect-ratio: 1; }
.ph--portrait { aspect-ratio: 3 / 4; }


/* ══ 09 · PIE DE PÁGINA ══════════════════════════════════════════════════ */

.site-footer {
  padding-block: var(--section-y) 2rem;
  background: var(--ink);
  color: color-mix(in oklch, var(--text-invert) 82%, transparent);
}

.site-footer__inner {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  align-items: start;
}
.site-footer__inner > * { min-width: 0; }

.site-footer .brand--footer { color: var(--text-invert); }

.site-footer__note { font-size: var(--text-sm); }

.site-footer__links { margin: 0; padding: 0; list-style: none; }
.site-footer__links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: var(--text-sm);
}

.nap__line { margin: 0 0 0.5rem; font-size: var(--text-sm); }
.nap__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.site-footer__legal {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid color-mix(in oklch, var(--text-invert) 15%, transparent);
  font-size: var(--text-xs);
  color: color-mix(in oklch, var(--text-invert) 60%, transparent);
}


/* ══ 10 · REVELADO (FAIL-SAFE) ═══════════════════════════════════════════
   El contenido NACE VISIBLE. Solo se oculta para animar si el JS confirmó
   capacidad real (body.anim-ready). Con un rAF muerto o JS caído, nunca
   queda un opacity:0 atascado.
   ══════════════════════════════════════════════════════════════════════════ */

body.anim-ready [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
body.anim-ready [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  body.anim-ready [data-reveal] { opacity: 1; transform: none; }
}


/* ══ 11 · PÁGINAS LEGALES ════════════════════════════════════════════════ */

.page-legal { background: var(--surface); }

.page-legal .legal {
  max-width: 78ch;
  margin-inline: auto;
  padding-block: clamp(2.5rem, 7vw, 5rem);
}

.page-legal h1 { font-size: var(--text-2xl); }
.page-legal h2 {
  margin-top: 2.5em;
  font-size: var(--text-xl);
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.page-legal h3 { margin-top: 2em; font-size: var(--text-lg); }
.page-legal li { margin-bottom: 0.4em; }

.legal__updated {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-faint);
}

/* Ficha del responsable: tabla clave/valor, imprimible y fácil de rellenar. */
.controller-card {
  width: 100%;
  margin: 1.5rem 0 2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  font-size: var(--text-sm);
  text-align: left;
}
.controller-card th,
.controller-card td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.controller-card tr:last-child th,
.controller-card tr:last-child td { border-bottom: 0; }
.controller-card th {
  width: 34%;
  background: var(--surface-deep);
  font-weight: 600;
  color: var(--text-mid);
}

/* Aviso destacado (anti-fraude, dominio oficial, enlaces a terceros). */
.callout {
  margin: 2rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line-strong);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  background: var(--surface-deep);
  font-size: var(--text-sm);
}
.callout__title {
  margin: 0 0 0.35em;
  font-weight: 700;
  font-size: var(--text-sm);
}


/* ══ 12 · UTILIDADES ═════════════════════════════════════════════════════ */

.stack > * + * { margin-top: var(--gap); }
.center { text-align: center; margin-inline: auto; }
.measure { max-width: var(--measure); }
.mono { font-family: var(--font-mono); }


/* ══ 13 · IMPRESIÓN ══════════════════════════════════════════════════════ */

@media print {
  :root { --bg: #fff; --ink: #000; }

  body { background: #fff; color: #000; font-size: 11pt; }

  .site-header,
  .nav,
  .nav-toggle,
  .skip-link,
  .hero__bg,
  .hero__veil,
  .actions,
  .btn,
  .site-footer__links { display: none !important; }

  .hero, .site-footer { background: #fff !important; color: #000 !important; }

  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; word-break: break-all; }

  .legal, .container { max-width: none; padding: 0; }

  h2, h3 { break-after: avoid; }
  .controller-card { break-inside: avoid; }
}
