/* ==========================================================================
   El Despertar del Calendario Azteca — hoja de estilos
   ========================================================================== */

:root {
  /* Paleta tomada de la portada del libro */
  --ink: #17120e;
  --ink-2: #221a14;
  --ink-3: #2e241c;
  --paper: #f7f2ea;
  --paper-2: #efe6d8;
  --surface: #ffffff;
  --line: #e4d9c8;
  --text: #2a211a;
  --muted: #6e6156;
  --terracota: #b4513a;
  --terracota-600: #9a4130;
  --terracota-700: #7f3426;
  --oro: #d1a650;
  --oro-claro: #ecd29a;
  --jade: #1f5e63;

  --font-display: "Cinzel", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(23, 18, 14, .06), 0 2px 8px rgba(23, 18, 14, .05);
  --shadow: 0 10px 30px -12px rgba(23, 18, 14, .25), 0 4px 12px rgba(23, 18, 14, .06);
  --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, .55);
  --header-h: 68px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; letter-spacing: .01em; }
h2 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.6rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
svg { width: 1.15em; height: 1.15em; flex-shrink: 0; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 20px; }
.section { padding-block: clamp(64px, 9vw, 112px); }
.eyebrow {
  font-size: .78rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase;
  color: var(--terracota); margin-bottom: .9rem;
}
.section-head { max-width: 680px; margin: 0 auto clamp(36px, 5vw, 56px); text-align: center; }
.section-head p:last-child { color: var(--muted); font-size: 1.05rem; margin: 0; }

.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--oro); outline-offset: 2px; border-radius: 6px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  padding: .85em 1.4em; border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 600; font-size: .95rem; line-height: 1; text-decoration: none; cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, transform .2s var(--ease), box-shadow .2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--terracota); color: #fff; box-shadow: 0 6px 18px -6px rgba(180, 81, 58, .55); }
.btn-primary:hover { background: var(--terracota-600); transform: translateY(-1px); }
.btn-ghost { background: transparent; border-color: rgba(255, 255, 255, .28); color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .5); }
.btn-outline { border-color: var(--line); background: var(--surface); color: var(--text); }
.btn-outline:hover { border-color: var(--terracota); color: var(--terracota); }
.btn-text { background: none; color: var(--muted); padding-inline: .8em; }
.btn-text:hover { color: var(--terracota); }
.btn-light { background: #fff; color: var(--terracota-700); }
.btn-light:hover { background: var(--paper); transform: translateY(-1px); }
.btn-sm { padding: .62em 1.1em; font-size: .88rem; }
.btn-block { width: 100%; padding-block: 1.05em; }

/* ---------- Encabezado ---------- */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 50; height: var(--header-h);
  color: #fff; transition: background .3s, box-shadow .3s, backdrop-filter .3s;
}
.site-header.scrolled {
  background: rgba(23, 18, 14, .86);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06);
}
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand span { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; line-height: 1.05; letter-spacing: .02em; }
.brand em { display: block; font-style: normal; font-weight: 500; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--oro-claro); }
.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav a:not(.btn) {
  text-decoration: none; font-size: .92rem; font-weight: 500; padding: .5em .8em; border-radius: 8px;
  color: rgba(255, 255, 255, .82); transition: color .2s, background .2s;
}
.main-nav a:not(.btn):hover, .main-nav a.active { color: #fff; background: rgba(255, 255, 255, .08); }
.main-nav .btn { margin-left: 10px; }
.nav-toggle { display: none; background: none; border: 0; color: #fff; padding: 8px; cursor: pointer; }
.nav-toggle svg { width: 26px; height: 26px; }
.nav-toggle .ico-close { display: none; }

/* ---------- Hero ---------- */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  background: var(--ink); color: #fff;
  padding-top: calc(var(--header-h) + clamp(40px, 7vw, 90px));
  padding-bottom: clamp(64px, 9vw, 120px);
}
.hero-bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 60% 70% at 78% 45%, rgba(209, 166, 80, .22), transparent 60%),
    linear-gradient(90deg, var(--ink) 30%, rgba(23, 18, 14, .78) 65%, rgba(23, 18, 14, .55)),
    url("../img/hero-piedra.jpg") right center / cover no-repeat;
}
.hero-bg::after {
  content: ""; position: absolute; inset: auto 0 0; height: 140px;
  background: linear-gradient(transparent, var(--ink));
}
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: clamp(32px, 6vw, 80px); }
.hero .eyebrow { color: var(--oro); }
.hero h1 { font-size: clamp(2.4rem, 1.4rem + 4.4vw, 4.4rem); font-weight: 700; margin-bottom: .45em; text-wrap: balance; }
.hero h1 span { display: block; color: var(--oro-claro); }
.hero .lead { font-size: clamp(1.05rem, 1rem + .4vw, 1.22rem); color: rgba(255, 255, 255, .78); max-width: 34em; margin-bottom: 2rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.today {
  margin-top: 2.6rem; display: inline-flex; flex-direction: column; gap: 2px;
  padding: 14px 20px; border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1);
  border-left: 3px solid var(--oro);
}
.today-label { font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .6); }
.today-value { font-family: var(--font-display); font-size: 1.15rem; color: #fff; }
.today-value small { font-family: var(--font-body); font-size: .85rem; font-weight: 400; color: var(--oro-claro); margin-left: .4em; }

.hero-book { display: flex; justify-content: center; perspective: 1400px; }
.book { position: relative; width: min(100%, 380px); border-radius: 4px 10px 10px 4px; box-shadow: var(--shadow-lg); }
.hero .book { transform: rotateY(-14deg) rotateX(2deg); transition: transform .8s var(--ease); }
.hero .book:hover { transform: rotateY(-4deg); }
.book img { width: 100%; height: auto; border-radius: inherit; }
.book::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,.35) 0, rgba(255,255,255,.18) 2.2%, rgba(0,0,0,.08) 4%, transparent 9%, transparent 92%, rgba(255,255,255,.08));
}

/* ---------- Cifras ---------- */
.stats { background: var(--ink-2); color: #fff; border-top: 1px solid rgba(255, 255, 255, .06); }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.stats-grid div { padding: 30px 16px; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.stats-grid div + div { border-left: 1px solid rgba(255, 255, 255, .08); }
.stats strong { font-family: var(--font-display); font-size: clamp(2rem, 1.5rem + 2vw, 2.8rem); color: var(--oro); line-height: 1; }
.stats span { font-size: .88rem; color: rgba(255, 255, 255, .66); }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- Calculadora ---------- */
.field { border: 0; padding: 0; margin: 0 0 22px; min-width: 0; }
.field > label, .field legend { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 8px; padding: 0; }
.optional { font-weight: 400; color: var(--muted); }
.sub { display: block; font-size: .78rem; color: var(--muted); margin-bottom: 4px; }
input, select {
  width: 100%; height: 48px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: #fdfbf8;
  transition: border-color .2s, box-shadow .2s, background .2s;
  -moz-appearance: textfield;
}
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background: #fdfbf8 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236e6156' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 14px center;
}
select:invalid { color: #9a8f86; }
input::placeholder { color: #a99e94; }
input:focus, select:focus { outline: none; border-color: var(--terracota); background-color: #fff; box-shadow: 0 0 0 4px rgba(180, 81, 58, .12); }
.invalid { border-color: #c0392b !important; background-color: #fff6f4 !important; }
.field-error { color: #b03224; font-size: .88rem; margin: 10px 0 0; }
.form-note { text-align: center; font-size: .82rem; color: var(--muted); margin: 14px 0 0; }

/* Escenario oscuro */
.calc {
  /* "clip" (no "hidden") para que la piedra pueda quedarse fija con sticky */
  position: relative; isolation: isolate; overflow: hidden; overflow: clip; color: #fff;
  padding-block: clamp(64px, 9vw, 112px);
  background:
    radial-gradient(ellipse 50% 45% at 28% 62%, rgba(209, 166, 80, .16), transparent 70%),
    radial-gradient(ellipse 55% 45% at 88% 18%, rgba(31, 94, 99, .22), transparent 70%),
    linear-gradient(180deg, #120e0b, #1c1511 55%, #120e0b);
}
.calc .eyebrow { color: var(--oro); }
.calc .section-head p:last-child { color: rgba(255, 255, 255, .66); }
.sky { position: absolute; inset: 0; z-index: -1; pointer-events: none; transition: opacity .8s; }
/* Viaje en el tiempo: estelas de estrellas */
.warp { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .5s; }
.warp.on { opacity: 1; }
.calc.warping .sky { opacity: .2; }
/* Mientras se viaja, el resultado anterior se atenúa */
.reveal-body { transition: opacity .5s; }
.traveling .reveal-body { opacity: .3; }
/* Primer viaje: el resultado ya ocupa su lugar (invisible) para que la sección no cambie de tamaño */
.reveal-body.pendiente { visibility: hidden; }
/* El escenario llena al menos la pantalla: durante el viaje no asoma la sección siguiente */
@media (min-width: 1081px) {
  .stage { min-height: calc(100vh - var(--header-h) - 40px); }
}
.ro-value { line-height: 1.25; min-height: 1.9rem; display: flex !important; align-items: center; justify-content: center; }
.readout.dating .ro-value { text-transform: none; font-size: clamp(1.02rem, .8rem + 1.2vw, 1.3rem); white-space: nowrap; }
.star {
  position: absolute; width: var(--s, 2px); height: var(--s, 2px); border-radius: 50%;
  background: #fff6df; opacity: .15; animation: titilar var(--d, 4s) ease-in-out var(--delay, 0s) infinite;
}
@keyframes titilar { 50% { opacity: var(--o, .8); transform: scale(1.5); } }

/* Barra del formulario */
.calc-bar {
  position: relative; z-index: 5;
  display: grid; grid-template-columns: 1.5fr 88px 1.15fr 108px auto; gap: 12px; align-items: end;
  max-width: 1000px; margin: 0 auto; padding: 18px;
  background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .1); border-radius: 18px;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, .7);
}
.cb-field { min-width: 0; }
.cb-field label { display: block; font-size: .76rem; font-weight: 500; letter-spacing: .05em; color: rgba(255, 255, 255, .62); margin: 0 0 6px 4px; }
.calc .optional { color: rgba(255, 255, 255, .38); }
.calc input, .calc select { background-color: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .14); color: #fff; }
.calc input::placeholder { color: rgba(255, 255, 255, .34); }
.calc select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23ecd29a' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E"); }
.calc select:invalid { color: rgba(255, 255, 255, .4); }
.calc select option { color: var(--text); background: #fff; }
.calc input:focus, .calc select:focus { border-color: var(--oro); background-color: rgba(255, 255, 255, .09); box-shadow: 0 0 0 4px rgba(209, 166, 80, .16); }
.calc .invalid { border-color: #e0705e !important; background-color: rgba(224, 112, 94, .12) !important; }
.calc .field-error { text-align: center; color: #f3a896; margin: 14px 0 0; }

.btn-gold { background: linear-gradient(135deg, #f0d08c, #c9973f); color: #24190f; box-shadow: 0 8px 24px -8px rgba(209, 166, 80, .6); }
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 14px 30px -8px rgba(209, 166, 80, .8); }
.btn-gold:disabled { opacity: .75; cursor: progress; transform: none; }
.btn-text-light { background: none; color: rgba(255, 255, 255, .6); padding-inline: .8em; }
.btn-text-light:hover { color: var(--oro-claro); }
.cb-submit { height: 48px; padding-inline: 1.6em; }
.cb-submit .lbl-busy { display: none; }
.busy .cb-submit .lbl { display: none; }
.busy .cb-submit .lbl-busy { display: inline; }

/* Escenario: piedra + información */
.stage {
  display: grid; grid-template-columns: minmax(0, 470px) minmax(0, 1fr);
  gap: clamp(36px, 5vw, 72px); align-items: start; margin-top: clamp(48px, 6vw, 72px);
}
.stage-stone { position: sticky; top: calc(var(--header-h) + 40px); perspective: 1100px; padding: 6%; }
.tilt { position: relative; transform-style: preserve-3d; transition: transform .5s var(--ease); }
.halo {
  position: absolute; inset: -16%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(240, 200, 120, .42), rgba(209, 166, 80, .12) 45%, transparent 68%);
  animation: respirar 6s ease-in-out infinite;
}
@keyframes respirar { 50% { transform: scale(1.07); opacity: .7; } }
/* Anillos decorativos fijos: no representan ningún astro, así que no se mueven */
.orbit { position: absolute; border-radius: 50%; pointer-events: none; }
.orbit-a { inset: -5%; border: 1px dashed rgba(236, 210, 154, .26); }
.orbit-b { inset: -11%; border: 1px solid rgba(236, 210, 154, .09); }

.stone {
  position: relative; width: 100%; aspect-ratio: 600 / 594; overflow: hidden;
  filter: drop-shadow(0 30px 45px rgba(0, 0, 0, .55)) drop-shadow(0 0 30px rgba(240, 190, 100, .25));
}
.stone .layer { position: absolute; inset: 0; width: 100%; height: 100%; }
/* Signos: los mueve JS día por día (18° por paso). Tonatiuh: un cuarto de vuelta por estación. */
.stone .layer-signos, .stone .layer-tonatiuh { will-change: transform; }
.stone .layer-tonatiuh { transition: transform var(--dur-sol, 1.6s) cubic-bezier(.45, 0, .2, 1); }

/* Marcador del día que muestra la piedra */
.readout {
  margin: 26px auto 0; max-width: 340px; text-align: center; padding: 12px 18px 14px;
  border-radius: 14px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .09);
}
.ro-label { display: block; font-size: .7rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: rgba(255, 255, 255, .5); }
.ro-value { display: block; font-family: var(--font-display); font-size: 1.5rem; color: var(--oro-claro); text-transform: capitalize; font-variant-numeric: tabular-nums; margin: 2px 0; }
.ro-sub { display: block; font-size: .85rem; color: #8fd0c8; text-transform: capitalize; min-height: 1.3em; }
.traveling .readout { border-color: rgba(209, 166, 80, .45); }
/* Cuenta en marcha: cada día el anillo de signos se desliza 18° */
.stone.walking .layer-signos { transition: transform .9s cubic-bezier(.45, 0, .2, 1); }
.ro-btn {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 6px 12px;
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, .14); background: transparent;
  color: rgba(255, 255, 255, .6); font-size: .78rem; cursor: pointer; transition: color .2s, border-color .2s;
}
.ro-btn:hover { color: var(--oro-claro); border-color: rgba(209, 166, 80, .5); }
.ro-btn svg { width: 12px; height: 12px; }
.ro-btn .ico-play, .ro-btn.paused .ico-pause { display: none; }
.ro-btn.paused .ico-play { display: inline; }
.traveling .moons li, .traveling .signs li { transition: none; }
.pulse { position: absolute; inset: 0; border-radius: 50%; border: 2px solid #f0d08c; opacity: 0; pointer-events: none; }
.pulse.go { animation: onda 1.3s ease-out; }
@keyframes onda { 0% { opacity: .9; transform: scale(.92); } 100% { opacity: 0; transform: scale(1.4); } }

/* Estado inicial */
.intro h3 { font-size: clamp(1.5rem, 1.2rem + 1vw, 1.9rem); color: var(--oro-claro); }
.intro > p { color: rgba(255, 255, 255, .66); font-size: 1.05rem; max-width: 30em; }
.legend { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 12px; }
.legend li {
  display: flex; gap: 16px; align-items: center; padding: 16px 18px; border-radius: 14px;
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .08);
}
.lg-ico { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; color: var(--oro); border: 1px solid rgba(209, 166, 80, .45); background: rgba(209, 166, 80, .08); }
.lg-ico svg { width: 22px; height: 22px; }
.legend strong { display: block; font-family: var(--font-display); font-size: 1.05rem; }
.legend span { color: rgba(255, 255, 255, .6); font-size: .92rem; }

/* Resultado */
.reveal-body > * { animation: subir .8s var(--ease) both; animation-delay: calc(var(--i, 0) * 110ms); }
@keyframes subir { from { opacity: 0; transform: translateY(18px); } }
.r-greet { color: rgba(255, 255, 255, .62); letter-spacing: .03em; margin-bottom: 12px; }
.r-headline { display: flex; align-items: center; gap: 22px; }
.r-badge {
  flex: none; width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 2.6rem; font-weight: 700; color: #2a1c0e;
  background: radial-gradient(circle at 34% 28%, #fcecc0, #e0b765 52%, #9a6d26);
  box-shadow: 0 0 0 5px rgba(209, 166, 80, .18), 0 0 0 11px rgba(209, 166, 80, .07), 0 12px 34px -6px rgba(240, 190, 100, .6);
}
.r-title { font-size: clamp(2.5rem, 1.6rem + 3.4vw, 3.8rem); margin: 0; line-height: 1; text-transform: capitalize; color: #fff; }
.r-nahuatl { margin: 8px 0 0; font-family: var(--font-display); font-size: 1.15rem; letter-spacing: .08em; color: #8fd0c8; text-transform: capitalize; }
.r-date { margin: 18px 0 30px; color: rgba(255, 255, 255, .5); font-size: .95rem; }

/* Fichas tipo códice (papel amate) */
.codex-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.codex {
  position: relative; text-align: center; padding: 30px 16px 20px; color: #3a2a1c; border-radius: 12px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .3 0 0 0 0 .12 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 50% 38%, #fbf1da, #ecd8b2 62%, #d9bd8e);
  box-shadow:
    inset 0 0 0 1px rgba(120, 80, 30, .4), inset 0 0 0 6px rgba(251, 241, 218, .55),
    inset 0 0 0 7px rgba(150, 100, 40, .5), inset 0 0 50px rgba(130, 80, 25, .28),
    0 22px 44px -20px rgba(0, 0, 0, .8);
  transition: transform .4s var(--ease);
}
.codex:hover { transform: translateY(-4px) rotate(-.4deg); }
.codex::before, .codex::after {
  content: ""; position: absolute; left: 18px; right: 18px; height: 7px; opacity: .6;
  background:
    linear-gradient(90deg, transparent 0 2px, var(--terracota) 2px 6px, transparent 6px 8px) 0 0 / 8px 7px repeat-x;
  -webkit-mask: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.codex::before { top: 14px; }
.codex::after { bottom: 12px; }
.codex-tag {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  padding: 5px 14px; border-radius: 999px; font-size: .68rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase;
  color: #fff; background: linear-gradient(135deg, var(--terracota), var(--terracota-700));
  box-shadow: 0 6px 14px -4px rgba(127, 52, 38, .7);
}
.codex-art { display: flex; align-items: center; justify-content: center; gap: 2px; height: 116px; margin: 8px 0 12px; }
.codex-art > img, .codex-art .stack { height: 100%; width: auto; aspect-ratio: 1; }
.codex-art .stack { position: relative; }
.codex-art .stack img { position: absolute; inset: 0; width: 100%; height: 100%; }
.codex-art img { filter: drop-shadow(0 2px 1px rgba(70, 35, 10, .28)); }
.codex h4 { margin: 0; font-family: var(--font-display); font-size: 1.4rem; color: var(--terracota-700); text-transform: capitalize; }
.codex p { margin: 2px 0 0; font-size: .92rem; font-weight: 500; color: var(--jade); text-transform: capitalize; }

/* Paneles */
.panel { background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .09); border-radius: 14px; padding: 16px 18px 18px; margin-bottom: 14px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.panel-head h4 { margin: 0; font-family: var(--font-body); font-size: .72rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: rgba(255, 255, 255, .55); }
.panel-head span { font-family: var(--font-display); font-size: 1rem; color: var(--oro-claro); text-transform: capitalize; text-align: right; }
.panel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.signs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(10, 1fr); gap: 7px; }
.signs li {
  position: relative; aspect-ratio: 1; border-radius: 9px; padding: 3px;
  background: radial-gradient(circle at 50% 40%, #f6ead0, #dcc394);
  opacity: .32; filter: grayscale(.65); transition: opacity .4s, filter .4s, transform .5s var(--ease), box-shadow .4s;
}
.signs li img { width: 100%; height: 100%; object-fit: contain; }
.signs li:hover, .signs li:focus-visible { opacity: 1; filter: none; }
.signs li.on {
  opacity: 1; filter: none; transform: scale(1.18); z-index: 1;
  box-shadow: 0 0 0 2px #f0d08c, 0 0 22px 4px rgba(240, 200, 120, .55);
  animation: brillo 2.4s ease-in-out infinite;
}
@keyframes brillo { 50% { box-shadow: 0 0 0 2px #f0d08c, 0 0 30px 8px rgba(240, 200, 120, .75); } }

.moons { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(13, 1fr); gap: 6px; }
.moons li {
  aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  font-size: .72rem; font-weight: 600; color: rgba(255, 255, 255, .4); border: 1px solid rgba(255, 255, 255, .14);
  transition: all .5s var(--ease); transition-delay: calc(var(--k, 0) * 45ms);
}
.moons li.past { color: rgba(255, 255, 255, .8); border-color: rgba(236, 210, 154, .35); background: rgba(236, 210, 154, .16); }
.moons li.on {
  color: #2a1c0e; border-color: transparent; transform: scale(1.25);
  background: radial-gradient(circle at 35% 30%, #fdf1cf, #e2bd6e 55%, #a2762b);
  box-shadow: 0 0 18px 2px rgba(240, 200, 120, .7);
}

.seg { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.seg li {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 7px 2px 6px; border-radius: 10px;
  font-size: .66rem; color: rgba(255, 255, 255, .42); text-align: center; transition: all .5s var(--ease);
}
.seg svg { width: 18px; height: 18px; }
.seg li.on { color: #24190f; font-weight: 600; background: linear-gradient(160deg, #f3d696, #c9973f); box-shadow: 0 8px 20px -8px rgba(209, 166, 80, .8); }

.result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.calc .toast { margin: 14px 0 0; font-size: .9rem; color: #8fd0c8; }

/* ---------- Selector de mes propio ---------- */
.native-hidden { position: absolute !important; width: 1px; height: 1px; opacity: 0; pointer-events: none; overflow: hidden; clip: rect(0 0 0 0); }
.pick { position: relative; }
.pick-btn {
  width: 100%; height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 14px; border-radius: var(--radius-sm); cursor: pointer; text-align: left;
  background: rgba(255, 255, 255, .06); border: 1.5px solid rgba(255, 255, 255, .14); color: #fff;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.pick-btn:hover { border-color: rgba(209, 166, 80, .5); }
.pick.open .pick-btn, .pick-btn:focus-visible { outline: none; border-color: var(--oro); background: rgba(255, 255, 255, .09); box-shadow: 0 0 0 4px rgba(209, 166, 80, .16); }
.pick-val { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-val.is-empty { color: rgba(255, 255, 255, .4); }
.pick-chev { width: 12px; height: 8px; color: var(--oro-claro); transition: transform .25s var(--ease); }
.pick.open .pick-chev { transform: rotate(180deg); }
.pick-list {
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: 340px; z-index: 30;
  list-style: none; margin: 0; padding: 10px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  background: linear-gradient(180deg, #2a2019, #1d1611); border: 1px solid rgba(209, 166, 80, .35); border-radius: 16px;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .85), 0 0 0 1px rgba(0, 0, 0, .3);
  animation: abrirLista .22s var(--ease) both; outline: none;
}
@keyframes abrirLista { from { opacity: 0; transform: translateX(-50%) translateY(-6px) scale(.97); } }
.pick-list li {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 9px 4px; border-radius: 10px; cursor: pointer;
  font-size: .9rem; color: rgba(255, 255, 255, .82); border: 1px solid transparent; transition: background .15s, color .15s, border-color .15s;
}
.pk-num { font-size: .66rem; letter-spacing: .1em; color: rgba(236, 210, 154, .5); }
.pick-list li.activo { background: rgba(209, 166, 80, .14); border-color: rgba(209, 166, 80, .4); color: #fff; }
.pick-list li[aria-selected="true"] { background: linear-gradient(160deg, #f3d696, #c9973f); color: #24190f; font-weight: 600; }
.pick-list li[aria-selected="true"] .pk-num { color: rgba(36, 25, 15, .6); }
.calc .pick-btn.invalid { border-color: #e0705e; background: rgba(224, 112, 94, .12); }

/* ---------- Nombres al pasar el cursor (signos y lunas) ---------- */
[data-tip] { position: relative; cursor: help; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  white-space: nowrap; padding: 5px 10px; border-radius: 7px; z-index: 6; pointer-events: none;
  font-size: .72rem; font-weight: 500; letter-spacing: 0; color: #f6e7c6; background: #0f0b08;
  border: 1px solid rgba(209, 166, 80, .45); box-shadow: 0 8px 20px -6px rgba(0, 0, 0, .7);
}
[data-tip]:focus-visible { outline: 2px solid var(--oro); outline-offset: 2px; }

/* ---------- Rueda del año y cielo ---------- */
.viz { display: flex; justify-content: center; margin: -2px 0 12px; }
.viz svg { width: 100%; height: auto; overflow: visible; }
#viz-anio svg { max-width: 150px; }
#viz-cielo svg { max-width: 240px; border-radius: 12px; }
.arco { fill: none; stroke-width: 11; opacity: .25; transition: opacity .6s; }
.arco.on { opacity: 1; }
.rueda-mes { font: 600 6.5px var(--font-body); fill: rgba(255, 255, 255, .45); text-anchor: middle; }
.rueda-dia { font: 700 17px var(--font-display); fill: #f6e7c6; text-anchor: middle; }
.rueda-sub { font: 600 6.5px var(--font-body); fill: rgba(236, 210, 154, .7); text-anchor: middle; letter-spacing: .12em; }
.giro { transform-origin: 60px 60px; transition: transform 1.8s cubic-bezier(.45, 0, .2, 1); }
.giro-cielo { transform-origin: 80px 70px; transition: transform 1.6s cubic-bezier(.45, 0, .2, 1); }
.cielo-capa, .cielo-estrellas, .cielo-luna { transition: opacity .9s; opacity: 0; }
.cielo-capa.on, .cielo-estrellas.on, .cielo-luna.on { opacity: 1; }

/* ---------- Divisor con greca entre la calculadora y el libro ---------- */
.calc::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 18px; pointer-events: none; opacity: .55;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='18' viewBox='0 0 36 18'%3E%3Cpath d='M0 17h6V7h12v6h-6v-3' fill='none' stroke='%23d1a650' stroke-width='2'/%3E%3Cpath d='M18 17h6V7h12' fill='none' stroke='%23d1a650' stroke-width='2'/%3E%3Cpath d='M24 13h6v-3' fill='none' stroke='%23d1a650' stroke-width='2'/%3E%3C/svg%3E") repeat-x left bottom / 36px 18px;
}

/* ---------- Libro ---------- */
.book-section { background: var(--paper); }
.book-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(36px, 6vw, 80px); align-items: center; }
.book-media { display: flex; justify-content: center; }
.book-sm { width: min(100%, 340px); }
.lead-sm { font-size: 1.12rem; color: var(--text); }
.book-copy > p:not(.eyebrow):not(.lead-sm) { color: var(--muted); }
.spec { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 28px; margin: 28px 0; padding: 22px 0; border-block: 1px solid var(--line); }
.spec .wide { grid-column: 1 / -1; }
.spec dt { font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.spec dd { margin: 2px 0 0; font-weight: 600; }
.book-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 28px; }
.qr { display: flex; align-items: center; gap: 12px; text-decoration: none; padding: 6px 14px 6px 6px; border-radius: var(--radius-sm); transition: background .2s; }
.qr:hover { background: var(--paper); }
.qr img { width: 64px; height: 64px; border-radius: 6px; }
.qr span { font-size: .82rem; color: var(--muted); line-height: 1.35; }
.qr strong { display: block; color: var(--text); font-size: .92rem; }

/* ---------- Secuencias ---------- */
.dark { background: var(--ink); color: #fff; }
.dark .section-head p:last-child { color: rgba(255, 255, 255, .64); }
.dark .eyebrow { color: var(--oro); }
.seq-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.seq {
  padding: 28px 24px; border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .02));
  border: 1px solid rgba(255, 255, 255, .08); transition: border-color .3s, transform .3s var(--ease);
}
.seq:hover { border-color: rgba(209, 166, 80, .5); transform: translateY(-3px); }
.seq svg { width: 40px; height: 40px; color: var(--oro); margin-bottom: 18px; }
.seq h3 { font-size: 1.12rem; }
.seq p { color: rgba(255, 255, 255, .66); font-size: .95rem; margin: 0; }

/* ---------- Historia ---------- */
.timeline { list-style: none; margin: 0 auto; padding: 0; max-width: 780px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 132px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--oro), var(--terracota)); opacity: .5; }
.timeline li { position: relative; display: grid; grid-template-columns: 112px 1fr; gap: 0 44px; padding-bottom: 36px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: 126px; top: 6px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--paper); border: 3px solid var(--terracota);
}
.tl-date { grid-row: span 2; text-align: right; font-family: var(--font-display); font-weight: 600; color: var(--terracota); font-size: .98rem; padding-top: 2px; }
.timeline h3 { margin-bottom: .3em; }
.timeline p { color: var(--muted); margin: 0; }

/* ---------- Autor ---------- */
.author-section { background: var(--paper-2); }
.author-grid { display: grid; grid-template-columns: 240px 1fr; gap: clamp(28px, 5vw, 64px); align-items: center; max-width: 960px; }
.author-photo { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 50%; border: 6px solid var(--surface); box-shadow: var(--shadow); }
.author-grid p:not(.eyebrow) { color: var(--muted); font-size: 1.05rem; }
blockquote {
  margin: 22px 0 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--oro);
  font-family: var(--font-display); font-size: 1.15rem; line-height: 1.5; color: var(--text);
}

/* ---------- Galería ---------- */
.gallery-section { background: var(--surface); }
.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.g-item { position: relative; padding: 0; border: 0; border-radius: var(--radius-sm); overflow: hidden; cursor: zoom-in; aspect-ratio: 1; background: var(--paper-2); }
.g-wide { grid-column: span 2; grid-row: span 2; }
.g-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease), filter .4s; }
.g-item::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 55%, rgba(23, 18, 14, .5)); opacity: 0; transition: opacity .3s; }
.g-item:hover img { transform: scale(1.05); }
.g-item:hover::after { opacity: 1; }

.lightbox {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  background: rgba(12, 9, 7, .94); padding: 60px 70px; animation: aparecer .25s ease both;
}
.lightbox figure { margin: 0; max-width: min(92vw, 900px); text-align: center; }
.lightbox img { max-height: 78vh; width: auto; margin: 0 auto; border-radius: 8px; box-shadow: var(--shadow-lg); }
.lightbox figcaption { color: rgba(255, 255, 255, .78); margin-top: 14px; font-size: .95rem; }
.lb-btn {
  position: absolute; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .06); color: #fff; cursor: pointer; transition: background .2s;
}
.lb-btn:hover { background: rgba(255, 255, 255, .16); }
.lb-btn svg { width: 22px; height: 22px; }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }

/* ---------- CTA y pie ---------- */
.cta-band { background: linear-gradient(120deg, var(--terracota-700), var(--terracota) 60%, #c4683f); color: #fff; padding-block: 56px; }
.cta-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px 40px; flex-wrap: wrap; }
.cta-inner h2 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); margin-bottom: .25em; }
.cta-inner p { margin: 0; color: rgba(255, 255, 255, .82); }

.site-footer { background: var(--ink); color: rgba(255, 255, 255, .62); padding-block: 32px; font-size: .88rem; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer-brand { display: flex; align-items: center; gap: 14px; }
.footer-brand strong { display: block; color: #fff; font-family: var(--font-display); font-weight: 600; }
.social { display: flex; gap: 8px; }
.social a { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .14); transition: background .2s, color .2s; }
.social a:hover { background: var(--terracota); color: #fff; border-color: var(--terracota); }

/* ---------- Animación al hacer scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.visible { opacity: 1; transform: none; }

/* ==========================================================================
   Responsivo
   ========================================================================== */
/* Calculadora */
@media (max-width: 1080px) {
  .stage { grid-template-columns: 1fr; }
  .stage-stone { position: relative; top: 0; width: min(100%, 440px); margin-inline: auto; }
  .stage-info { width: 100%; max-width: 700px; margin-inline: auto; }
}
@media (max-width: 860px) {
  .calc-bar { grid-template-columns: 76px 1fr 96px; padding: 16px; }
  .cb-name, .cb-submit { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .pick { position: static; }
  .pick-list { left: 12px; right: 12px; width: auto; transform: none; top: auto; margin-top: 8px; }
  @keyframes abrirLista { from { opacity: 0; transform: translateY(-6px); } }
  .stage-stone { width: min(100%, 330px); }
  .r-headline { gap: 16px; }
  .r-badge { width: 68px; height: 68px; font-size: 1.9rem; }
  .r-title { font-size: 2.4rem; }
  .codex-row { gap: 12px; }
  .codex { padding: 26px 8px 16px; }
  .codex-art { height: 72px; }
  .codex h4 { font-size: 1.08rem; }
  .codex p { font-size: .8rem; }
  .signs { grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .moons { gap: 3px; }
  .moons li { font-size: .6rem; }
  .panel { padding: 14px 12px 14px; }
  .panel-row { grid-template-columns: 1fr; gap: 0; }
  .result-actions .btn { flex: 1 1 100%; }
}
@media (max-width: 980px) {
  .seq-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .main-nav {
    position: fixed; inset: var(--header-h) 0 auto; flex-direction: column; align-items: stretch; gap: 2px;
    padding: 12px 20px 22px; background: rgba(23, 18, 14, .98);
    border-top: 1px solid rgba(255, 255, 255, .06);
    transform: translateY(-8px); opacity: 0; visibility: hidden; transition: all .25s var(--ease);
  }
  .main-nav a:not(.btn) { padding: .8em .6em; font-size: 1rem; }
  .main-nav .btn { margin: 10px 0 0; padding-block: .95em; }
  .nav-open .main-nav { transform: none; opacity: 1; visibility: visible; }
  .nav-open .site-header { background: rgba(23, 18, 14, .98); }
  .nav-open .nav-toggle .ico-open { display: none; }
  .nav-open .nav-toggle .ico-close { display: block; }

  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero .lead { margin-inline: auto; }
  .hero-actions { justify-content: center; }
  .hero-book { order: -1; }
  .hero .book { width: 210px; transform: none; }
  .hero-bg { background:
    radial-gradient(ellipse 80% 50% at 50% 25%, rgba(209, 166, 80, .2), transparent 60%),
    linear-gradient(rgba(23, 18, 14, .7), var(--ink) 75%),
    url("../img/hero-piedra.jpg") center top / cover no-repeat; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid div:nth-child(3) { border-left: 0; }
  .stats-grid div:nth-child(n+3) { border-top: 1px solid rgba(255, 255, 255, .08); }

  .book-grid, .author-grid { grid-template-columns: 1fr; }
  .book-sm { width: 220px; }
  .author-grid { text-align: center; }
  .author-photo { width: 180px; margin-inline: auto; }
  blockquote { text-align: left; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .container { padding-inline: 16px; }
  .brand em { display: none; }
  .hero-actions .btn { width: 100%; }
  .today { width: 100%; }
  .seq-grid { grid-template-columns: 1fr; }
  .spec { grid-template-columns: 1fr; }
  .timeline::before { left: 7px; }
  .timeline li { grid-template-columns: 1fr; padding-left: 34px; }
  .timeline li::before { left: 0; }
  .tl-date { grid-row: auto; text-align: left; font-size: .88rem; }
  .cta-inner { text-align: center; justify-content: center; }
  .lightbox { padding: 64px 12px; }
  .lb-prev, .lb-next { top: auto; bottom: 14px; transform: none; }
  .lb-prev { left: calc(50% - 58px); }
  .lb-next { right: calc(50% - 58px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
