/* Vega Studio · sistema común del sitio (tokens, base, nav, botones, footer, movimiento).
   Lo propio de cada página queda en la página. Sin librerías: el movimiento es CSS
   atado al scroll (animation-timeline) y, sin soporte, todo se ve estático y completo. */

:root {
  /* Color */
  --ink: #0A0A0A;
  --paper: #F2EFE9;
  --mute: rgba(242,239,233,.62);
  /* .50 mantiene el escalón visual por debajo de --mute y pasa WCAG AA (4.87:1)
     sobre --ink. A .36 el texto chico quedaba en 2.97:1 y no pasaba. */
  --faint: rgba(242,239,233,.50);
  --ink-mute: rgba(10,10,10,.68); /* texto secundario sobre --paper: 6.4:1 */
  --gold: #C4902A;
  --gold-bright: #E0AC45;
  --gold-soft: rgba(196,144,42,.4);
  --gold-dim: rgba(196,144,42,.14);
  --acero: #8AA4B8;
  --acero-soft: rgba(138,164,184,.42);
  --line: rgba(242,239,233,.09);
  --line-strong: rgba(242,239,233,.18);
  --surface: #111110;

  /* Tipografía */
  --font: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --fs-body: clamp(1rem, .95rem + .25vw, 1.0625rem);
  --fs-small: .84rem;
  --fs-mono: .7rem;
  --fs-h1: clamp(2.6rem, 1rem + 5.4vw, 6rem);
  --fs-h2: clamp(2.2rem, 1.2rem + 4vw, 4.6rem);
  --fs-h3: clamp(1.15rem, 1.05rem + .6vw, 1.45rem);
  --track-display: -.05em;
  --track-mono: .16em;

  /* Espacio y forma */
  --max: 1240px;
  --pad: clamp(16px, 5vw, 56px);
  --nav-h: 64px;
  --section: clamp(80px, 10vw, 140px);
  --radius: 4px;

  /* Movimiento */
  --ease: cubic-bezier(.22,.61,.2,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
  --ease-pop: cubic-bezier(.3,1.5,.5,1);
  --dur-fast: .25s;
  --dur: .45s;
  --dur-slow: 1.1s;
  --stagger: 110ms;
}

/* ---------- Transición entre documentos (cambio de idioma y navegación interna) ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out var(--dur) var(--ease) both; }
::view-transition-new(root) { animation: vt-in .7s var(--ease-out) both; }
@keyframes vt-out { to { opacity: 0; filter: blur(6px); } }
@keyframes vt-in { from { clip-path: inset(0 0 100% 0); } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  background: var(--ink); color: var(--paper);
  font: 400 var(--fs-body)/1.65 var(--font); letter-spacing: -.006em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: hidden;
}
/* Grano fijo, sin animación */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 200; pointer-events: none; opacity: .08; mix-blend-mode: overlay;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
img { max-width: 100%; display: block; }
a { color: inherit; }
::selection { background: var(--gold); color: var(--ink); }
[hidden] { display: none !important; }
p, li { text-wrap: pretty; }
strong, b { font-weight: 600; }

:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--gold-bright); outline-offset: 3px; border-radius: 2px;
}
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 300; background: var(--gold); color: var(--ink); padding: 12px 20px; font-weight: 700; text-decoration: none; }
.skip-link:focus { left: 12px; top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.wrap { max-width: var(--max); margin: 0 auto; padding-inline: var(--pad); }
.nowrap { white-space: nowrap; }

/* ---------- Tipografía ---------- */
h1, h2, h3 { line-height: 1; text-wrap: balance; }
h1 { font-size: var(--fs-h1); font-weight: 900; letter-spacing: var(--track-display); line-height: .92; }
h2 { font-size: var(--fs-h2); font-weight: 800; letter-spacing: -.045em; line-height: .96; }
h3 { font-size: var(--fs-h3); font-weight: 600; letter-spacing: -.015em; line-height: 1.25; }
.serif { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -.01em; }
.mono-tag, .eyebrow { font: 500 var(--fs-mono)/1.5 var(--mono); letter-spacing: var(--track-mono); text-transform: uppercase; color: var(--faint); }
.eyebrow { display: inline-flex; align-items: center; gap: 12px; color: var(--gold); }
.eyebrow::before { content: ""; width: 28px; height: 1px; background: currentColor; flex: none; }
.lede { color: var(--mute); max-width: 58ch; }
/* La segunda voz de un título (<em> en el copy) va en serif dorada */
h1 em, h2 em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -.01em; color: var(--gold-bright); }
/* Frase de cierre: serif con filete dorado */
.close-line { max-width: 34ch; padding-left: 20px; border-left: 1px solid var(--gold); font: italic 400 clamp(1.35rem, 1.1rem + 1.1vw, 2rem)/1.25 var(--serif); }

/* Grilla de puntos que se desvanece: fondo de los momentos con el objeto vivo */
.dots { position: relative; }
.dots::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(circle, rgba(242,239,233,.13) 1px, transparent 1.4px) 0 0 / 24px 24px;
  mask: radial-gradient(ellipse at var(--dots-at, 70% 45%), #000 0, transparent 62%);
}

/* ---------- El objeto vivo (dibujado en assets/vega.js) ---------- */
canvas.vega { display: block; width: 100%; height: 100%; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: 13px 24px; border-radius: 999px;
  font: 600 .95rem/1.2 var(--font); letter-spacing: -.005em; text-decoration: none; text-align: center; text-wrap: balance; cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-pop), background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn-gold { background: var(--gold); color: var(--ink); border: 1px solid var(--gold); }
.btn-gold:hover { background: var(--gold-bright); border-color: var(--gold-bright); }
.btn-ghost { background: none; color: var(--paper); border: 1px solid var(--line-strong); }
.btn-ghost:hover { border-color: var(--paper); }
.btn-line {
  color: var(--gold); font-weight: 600; text-decoration: none;
  border-bottom: 1px solid var(--gold-soft); padding: 10px 0; transition: border-color var(--dur-fast);
}
.btn-line:hover { border-color: var(--gold); }

.lang-toggle {
  display: inline-flex; align-items: center; min-height: 38px; padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 999px;
  font: 500 var(--fs-mono) var(--mono); letter-spacing: var(--track-mono); color: var(--mute); text-decoration: none;
  transition: color var(--dur-fast), border-color var(--dur-fast);
}
.lang-toggle:hover { color: var(--paper); border-color: var(--paper); }

/* ---------- Nav y menú móvil ---------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 100; height: var(--nav-h);
  display: flex; align-items: center; border-bottom: 1px solid transparent;
  background: color-mix(in srgb, var(--ink) 55%, transparent); backdrop-filter: blur(16px);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.nav.scrolled { background: color-mix(in srgb, var(--ink) 80%, transparent); border-bottom-color: var(--line); }
.nav-inner { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; }
.brand .mark { width: 34px; height: 34px; flex: none; }
.brand img { height: 30px; width: auto; }
.nav-links { display: none; align-items: center; gap: 24px; list-style: none; }
.nav-links a:not(.btn, .lang-toggle) {
  position: relative; padding: 10px 0; text-decoration: none; white-space: nowrap;
  font: 500 var(--fs-mono) var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--mute);
  transition: color var(--dur-fast);
}
.nav-links a:not(.btn, .lang-toggle)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 4px; height: 1px; background: var(--gold);
  transform: scaleX(0); transform-origin: left; transition: transform var(--dur) var(--ease);
}
.nav-links a:not(.btn, .lang-toggle):hover { color: var(--paper); }
.nav-links a:not(.btn, .lang-toggle):hover::after { transform: scaleX(1); }
.nav-links .btn { min-height: 40px; padding: 8px 18px; font-size: .88rem; white-space: nowrap; }

.burger { display: flex; flex-direction: column; justify-content: center; gap: 6px; width: 48px; height: 48px; padding: 12px; background: none; border: 0; cursor: pointer; }
.burger span { height: 2px; background: var(--paper); transition: transform var(--dur-fast) var(--ease), opacity var(--dur-fast); }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

.menu {
  position: fixed; inset: 0; z-index: 99; overflow-y: auto;
  display: flex; flex-direction: column; justify-content: center; gap: 24px; padding: var(--nav-h) var(--pad) 40px;
  background: color-mix(in srgb, var(--ink) 88%, transparent); backdrop-filter: blur(22px);
  opacity: 0; visibility: hidden; transition: opacity var(--dur) var(--ease), visibility var(--dur);
}
.menu.open { opacity: 1; visibility: visible; }
.menu ul { list-style: none; }
.menu a:not(.btn, .lang-toggle) { display: block; padding: 8px 0; text-decoration: none; font-size: clamp(1.8rem, 8vw, 2.4rem); font-weight: 800; letter-spacing: -.035em; transition: color var(--dur-fast); }
.menu a:not(.btn, .lang-toggle):hover { color: var(--gold); }
.menu .lang-toggle { align-self: flex-start; }
.menu-foot { margin-top: auto; }
@media (min-width: 1024px) {
  .nav-links { display: flex; }
  .burger, .menu { display: none; }
}

/* ---------- Secciones ---------- */
/* Lo que entra corrido de costado (.in con --x/--r) no puede ensanchar la página.
   clip y no hidden: no crea contenedor de scroll, así view() sigue atado a la ventana. */
main { overflow-x: clip; }
section { position: relative; padding: var(--section) 0; }
main > section + section { border-top: 1px solid var(--line); }
.sec-head { display: flex; flex-direction: column; gap: 20px; margin-bottom: clamp(36px, 5vw, 64px); }
.sec-head h2 { max-width: 18ch; }

/* Hero de las páginas internas: texto a la izquierda, la estrella a la derecha (arriba en el celular) */
.page-hero { min-height: 82svh; display: grid; align-content: center; padding: calc(var(--nav-h) + 40px) 0 64px; --dots-at: 80% 40%; }
.page-hero-grid { display: grid; align-items: center; gap: 8px; }
.page-hero-txt { display: flex; flex-direction: column; align-items: flex-start; gap: 26px; }
.page-hero h1 { max-width: 15ch; }
.page-hero .lede { font-size: clamp(1.02rem, .98rem + .45vw, 1.22rem); }
.page-sky { width: min(140px, 40vw); aspect-ratio: 1; }
@media (min-width: 900px) {
  .page-hero-grid { grid-template-columns: 1.6fr 1fr; gap: 40px; }
  .page-sky { width: min(420px, 30vw); order: 2; justify-self: end; }
}

/* Cierre con CTA: la estrella vuelve a aparecer */
.final { text-align: center; --dots-at: 50% 30%; }
.final .wrap { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.final-sky { width: min(200px, 50vw); aspect-ratio: 1; margin-bottom: -20px; }
.final h2 { max-width: 14ch; }
.final p { color: var(--mute); max-width: 46ch; }

/* El único bloque claro de cada página */
.light { background: var(--paper); color: var(--ink); border-radius: 40px 40px 0 0; }
main > .light + section { border-top: 0; }
.light .lede { color: var(--ink-mute); }
.light .btn-line { color: var(--ink); border-color: var(--gold); }

/* Superficie de tarjeta */
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color var(--dur) var(--ease); }
.card:hover { border-color: var(--line-strong); }
/* Esquinas doradas solo donde hay una decisión */
.hud::before, .hud::after { content: ""; position: absolute; width: 14px; height: 14px; border: 0 solid var(--gold); pointer-events: none; }
.hud::before { left: -1px; top: -1px; border-left-width: 1px; border-top-width: 1px; }
.hud::after { right: -1px; bottom: -1px; border-right-width: 1px; border-bottom-width: 1px; }

/* ---------- Cinta en movimiento ---------- */
.tape { position: relative; overflow: hidden; padding: 36px 0; }
.belt { display: flex; width: max-content; white-space: nowrap; font: italic 400 clamp(26px, 4vw, 48px)/1 var(--serif); }
.belt > div { display: flex; flex: none; animation: belt 48s linear infinite; }
.belt span::after { content: ""; display: inline-block; width: .22em; height: .22em; margin: 0 .8em; border-radius: 50%; background: var(--gold); vertical-align: middle; }
.belt.a { padding: 14px 0; background: var(--paper); color: var(--ink); rotate: -1.5deg; }
.belt.b { padding: 12px 0; border-block: 1px solid var(--line-strong); color: var(--mute); rotate: 1deg; margin-top: -4px; }
.belt.b > div { animation-direction: reverse; animation-duration: 60s; }
@keyframes belt { to { transform: translateX(-100%); } }

/* ---------- FAQ ---------- */
.faq { max-width: 880px; border-top: 1px solid var(--line-strong); }
.faq details { border-bottom: 1px solid var(--line-strong); }
.faq summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 24px 0; min-height: 56px; font-size: clamp(1.1rem, 1rem + .5vw, 1.35rem); font-weight: 600; letter-spacing: -.015em; line-height: 1.3;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex: none; font: 300 1.9rem/1 var(--font); color: var(--gold); transition: transform var(--dur) var(--ease-pop); }
.faq details[open] summary::after { transform: rotate(135deg); }
.faq .ans { color: var(--mute); max-width: 66ch; padding: 0 0 28px; }

/* ---------- Footer y CTA fijo móvil ---------- */
.footer { border-top: 1px solid var(--line); padding: 64px 0 120px; }
.footer-grid { display: flex; flex-direction: column; gap: 36px; }
.footer-cols { display: grid; gap: 30px; }
.footer h4 { font: 500 var(--fs-mono) var(--mono); letter-spacing: var(--track-mono); text-transform: uppercase; color: var(--gold); margin-bottom: 14px; }
.footer ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer a { color: var(--mute); text-decoration: none; display: inline-block; padding: 2px 0; transition: color var(--dur-fast); }
.footer a:hover { color: var(--paper); }
.footer .loc { color: var(--mute); margin-top: 14px; }
.footer .brand img { height: 36px; }
.footer-sig { display: flex; align-items: center; gap: 10px; }
.footer-sig .mark { width: 26px; height: 26px; }
.footer-bottom { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 24px; color: var(--faint); font-size: var(--fs-small); }
@media (min-width: 760px) {
  .footer-cols { grid-template-columns: repeat(3, 1fr); }
  .footer { padding-bottom: 64px; }
}
.mobile-cta {
  position: fixed; inset: auto 0 0; z-index: 90; padding: 10px var(--pad) calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--ink) 80%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  transition: transform var(--dur) var(--ease);
}
.mobile-cta .btn { width: 100%; }
.mobile-cta.hidden { transform: translateY(110%); }
@media (min-width: 760px) { .mobile-cta { display: none; } }

/* ---------- Movimiento ---------- */
/* Entrada del hero: cada línea sube con desenfoque, escalonada por --d */
.rise { animation: rise var(--dur-slow) var(--ease-out) both; animation-delay: calc(var(--d, 0) * var(--stagger)); }
@keyframes rise { from { opacity: 0; transform: translateY(40%); filter: blur(10px); } }

/* Transiciones atadas al scroll. Sin soporte o con movimiento reducido, todo queda visible y quieto. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .in { animation: in linear both; animation-timeline: view(); animation-range: entry 0% entry 75%; }
    @keyframes in { from { opacity: 0; transform: translate(var(--x, 0), 60px) rotate(var(--r, 0deg)); filter: blur(6px); } }
    .belt.a { animation: tilt linear both; animation-timeline: view(); }
    @keyframes tilt { from { rotate: 2deg; } to { rotate: -2deg; } }
    .light { animation: lift linear both; animation-timeline: view(); animation-range: entry 0% entry 60%; }
    @keyframes lift { from { clip-path: inset(0 4% 0 4% round 160px 160px 0 0); } to { clip-path: inset(0 round 40px 40px 0 0); } }
  }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after, ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; transition: none !important; }
}
