/* ============================================================
   La Rebelión de los Fantasmas — Home (alta fidelidad)
   "Papiro & tinta" · editorial literario
   ============================================================ */

:root {
  --ink:      #20222e;   /* tinta navy (marca del autor) */
  --ink-2:    #34384a;
  --ink-soft: #6b6f80;
  --paper:    #f4efe4;   /* papiro */
  --paper-2:  #ece3d2;
  --paper-card: #fbf8f1;
  --accent:   #9a6b35;   /* bronce de la portada — primario (tweakable) */
  --accent-ink: #f4efe4;
  --gold:     #b08b4f;   /* oro — detalle metálico */
  --gold-2:   #caa869;
  --line:     rgba(32,34,46,.14);
  --band:     #1d1f2a;   /* bandas oscuras (no cambian con tema) */
  --band-2:   #16181f;

  --display: "Cormorant Garamond", Georgia, serif;
  --body:    "Spectral", Georgia, serif;
  --ui:      "Work Sans", system-ui, sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --page-x: clamp(22px, 5vw, 84px);
  --sec-y: clamp(64px, 11vw, 64px);
}

body.dark {
  --paper:    #161821;
  --paper-2:  #11131a;
  --paper-card: #1f2230;
  --ink:      #f1ecdf;
  --ink-2:    #d6d0c2;
  --ink-soft: #9ca0b0;
  --line:     rgba(241,236,223,.16);
}

* { box-sizing: border-box; }
.img-slot { height: auto; }  /* anula el alto por defecto (160px) del componente; cada regla con aspect-ratio o height explícito lo sobreescribe */
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background .5s var(--ease), color .5s var(--ease);
}

/* grano / textura papiro */
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: .05; mix-blend-mode: multiply;
  background-image: 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='0.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body.dark .grain { mix-blend-mode: screen; opacity: .04; }
body.no-grain .grain { display: none; }

/* ---------- tipografía base ---------- */
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.02; margin: 0; letter-spacing: .005em; }
p { margin: 0 0 1em; }
a { color: inherit; text-decoration: none; }

.eyebrow {
  font-family: var(--ui);
  text-transform: uppercase;
  letter-spacing: .28em;
  font-size: .7rem;
  font-weight: 600;
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  gap: 13px;
}
.eyebrow::before { content: ""; width: 26px; height: 1.5px; background: var(--gold); }
.eyebrow.center { justify-content: center; }

.rule { height: 1.5px; background: var(--gold); border: none; width: 64px; margin: 0; opacity: .8; }

.lead { font-family: var(--body); font-weight: 300; font-size: 1.18rem; color: var(--ink-2); line-height: 1.65; }

/* ---------- botones ---------- */
.btn {
  font-family: var(--ui);
  font-size: .76rem; font-weight: 600;
  letter-spacing: .15em; text-transform: uppercase;
  padding: 15px 30px;
  border: 1.5px solid var(--ink);
  background: transparent; color: var(--ink);
  cursor: pointer; display: inline-flex; align-items: center; gap: 10px;
  transition: all .35s var(--ease);
}
.btn .ar { transition: transform .35s var(--ease); }
.btn:hover .ar { transform: translateX(5px); }
.btn.solid { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.solid:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.ghost:hover { background: var(--ink); color: var(--paper); }
.btn.light { border-color: var(--gold); color: var(--paper); }
.btn.light:hover { background: var(--gold); color: var(--band); }
.btn.sm { padding: 11px 20px; font-size: .68rem; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 18px var(--page-x);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: padding .4s var(--ease), border-color .4s var(--ease), background .4s var(--ease);
}
.nav.scrolled { padding-top: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; cursor: pointer; }
.brand .gem { width: 8px; height: 8px; background: var(--gold); transform: rotate(45deg); flex: none; }
.brand .wm { font-family: var(--display); font-weight: 600; font-size: 1.18rem; line-height: 1; letter-spacing: .01em; }
.brand .wm em { font-style: italic; color: var(--accent); }
.nav-menu { display: flex; align-items: center; gap: 26px; }
.nav-menu a {
  font-family: var(--ui); font-size: .74rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .13em; color: var(--ink-soft);
  position: relative; padding: 4px 0;
}
.nav-menu a::after { content: ""; position: absolute; left: 0; bottom: -2px; height: 1.5px; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease); }
.nav-menu a:hover { color: var(--ink); }
.nav-menu a:hover::after { transform: scaleX(1); }
.nav-right { display: flex; align-items: center; gap: 14px; }
.nav-burger {
  display: none; width: 42px; height: 42px;
  border: 1.5px solid var(--ink); background: transparent; cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 0;
}
.nav-burger span { display: block; width: 18px; height: 1.6px; background: var(--ink); transition: transform .3s var(--ease), opacity .3s var(--ease); }
.nav.menu-open .nav-burger span:nth-child(1) { transform: translateY(6.6px) rotate(45deg); }
.nav.menu-open .nav-burger span:nth-child(2) { opacity: 0; }
.nav.menu-open .nav-burger span:nth-child(3) { transform: translateY(-6.6px) rotate(-45deg); }

/* ============================================================
   HERO — split editorial
   ============================================================ */
.hero { display: grid; grid-template-columns: 1.02fr 1fr; min-height: 90vh; position: relative; z-index: 2; }

.hero-visual {
  position: relative; overflow: hidden;
  background: linear-gradient(118deg, #f3ecd9 0%, #e9dfc6 38%, #d9cba8 72%, #c6b48a 100%);
  border-right: 1px solid var(--line);
  min-height: 90vh;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(40px, 6vw, 80px);
}
.hero-visual::after {  /* luz de ventana — cae también sobre el libro */
  content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background:
    linear-gradient(115deg, rgba(255,252,240,.45) 0%, rgba(255,252,240,0) 28%),
    linear-gradient(115deg, transparent 50%, rgba(96,74,40,.07) 54%, rgba(96,74,40,.16) 76%, rgba(96,74,40,.10) 88%, transparent 100%);
}
/* ---------- libro 3D ---------- */
.hero-visual { perspective: 1900px; }
.book3d {
  --bk-thick: 46px;
  position: relative; z-index: 3;
  width: clamp(250px, 26vw, 390px);
  aspect-ratio: 1595 / 2717;
  transform-style: preserve-3d;
  transform: rotateY(-18deg);
  transition: transform .9s var(--ease);
  background: #e9e0cb;
  border-radius: 3px 6px 6px 3px;
  box-shadow:
    44px 56px 80px rgba(86,62,28,.38),
    18px 22px 34px rgba(86,62,28,.26),
    0 2px 6px rgba(86,62,28,.22);
}
.book3d:hover { transform: rotateY(-9deg); }
.book3d::before {  /* canto de páginas */
  content: "";
  position: absolute; top: 0.9%; bottom: 0.9%; right: 0;
  width: var(--bk-thick);
  transform-origin: right center;
  transform: rotateY(90deg);
  background:
    linear-gradient(90deg, rgba(60,40,10,.28), rgba(60,40,10,0) 20%, rgba(60,40,10,.16) 97%),
    repeating-linear-gradient(90deg, #f6f0e1 0 2.5px, #d9cfb3 2.5px 4px);
}
.hero-book {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  transform: translateZ(var(--bk-thick));
  border-radius: 3px 6px 6px 3px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(120,90,40,.3);
}
.book-sheen {  /* bisagra del lomo + brillo — encima de la portada */
  position: absolute; inset: 0; z-index: 4; pointer-events: none;
  transform: translateZ(calc(var(--bk-thick) + 1px));
  border-radius: 3px 6px 6px 3px;
  background:
    linear-gradient(90deg, rgba(40,25,5,.20) 0, rgba(40,25,5,.06) 2.5%, rgba(255,255,255,.16) 5.5%, rgba(40,25,5,.07) 9%, transparent 14%),
    linear-gradient(115deg, transparent 44%, rgba(255,255,255,.09) 51%, transparent 58%);
}
.hero-visual .author-slot { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-visual .vignette {
  position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: linear-gradient(180deg, rgba(20,22,30,.30) 0%, rgba(20,22,30,0) 28%, rgba(20,22,30,.10) 60%, rgba(20,22,30,.62) 100%);
}
/* disco solar tenue (egipcio) */
.hero-visual .disc {
  position: absolute; top: 12%; left: 50%; transform: translateX(-50%);
  width: 320px; height: 320px; border-radius: 50%; z-index: 1;
  background: radial-gradient(circle, rgba(202,168,105,.34), rgba(202,168,105,0) 65%);
  filter: blur(2px);
}
.hero-cover {
  position: absolute; right: clamp(20px, 4vw, 52px); bottom: clamp(20px, 4vw, 48px); z-index: 3;
  width: clamp(120px, 13vw, 178px); height: clamp(176px, 19vw, 262px);
  box-shadow: 0 22px 50px rgba(0,0,0,.5), 0 0 0 1px rgba(202,168,105,.5);
}
.hero-cap {
  position: absolute; left: clamp(20px, 4vw, 44px); bottom: clamp(22px, 4vw, 44px); z-index: 3;
  font-family: var(--ui); text-transform: uppercase; letter-spacing: .22em; font-size: .64rem;
  color: rgba(72,56,28,.72); display: flex; align-items: center; gap: 10px;
}
.hero-cap::before { content: ""; width: 22px; height: 1px; background: #8a6c3c; }

.hero-text {
  display: flex; flex-direction: column; justify-content: center;
  gap: 26px; padding: clamp(40px, 6vw, 92px) var(--page-x);
  background: var(--paper);
}
.hero-text h1 { font-size: clamp(3rem, 6.4vw, 5.6rem); font-weight: 600; letter-spacing: -.01em; }
.hero-text h1 .soul { font-style: italic; color: var(--accent); }
.hero-sub { font-family: var(--display); font-style: italic; font-size: clamp(1.3rem, 2.3vw, 1.8rem); color: var(--ink-2); margin: 0; }
.hero-meta {
  font-family: var(--ui); font-size: .68rem; text-transform: uppercase; letter-spacing: .2em;
  color: var(--ink-soft); display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
}
.hero-meta .dot { width: 4px; height: 4px; background: var(--gold); border-radius: 50%; }
.hero-cta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 4px; }

/* entrada (sólo transform — nunca oculta el contenido) */
.rise { animation: rise .9s var(--ease) both; }
.rise-2 { animation: rise .9s .08s var(--ease) both; }
.rise-3 { animation: rise .9s .16s var(--ease) both; }
.rise-4 { animation: rise .9s .24s var(--ease) both; }
@keyframes rise { from { transform: translateY(18px); } to { transform: none; } }

/* ============================================================
   BANDA DE CITA
   ============================================================ */
.quote-band {
  position: relative; z-index: 2;
  background: var(--band); color: var(--paper);
  padding: clamp(70px, 9vw, 120px) var(--page-x);
  text-align: center;
}
.quote-band .qmark { font-family: var(--display); font-size: 5rem; color: var(--gold); line-height: .3; opacity: .8; }
.quote-band blockquote {
  margin: 18px auto 0; max-width: 22ch;
  font-family: var(--display); font-style: italic; font-weight: 500;
  font-size: clamp(1.9rem, 4.2vw, 3.2rem); line-height: 1.15;
}
.quote-band cite {
  display: block; margin-top: 26px; font-family: var(--ui); font-style: normal;
  text-transform: uppercase; letter-spacing: .22em; font-size: .68rem; color: var(--gold-2);
}

/* ============================================================
   1.2 BIENVENIDA DEL AUTOR
   ============================================================ */
.welcome { position: relative; z-index: 2; padding: var(--sec-y) var(--page-x); }
.welcome-grid { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: clamp(34px, 6vw, 80px); align-items: center; max-width: 1200px; margin: 0 auto; }
.welcome-photo { position: relative; aspect-ratio: 4/5; }
.welcome-photo .ps { width: 100%; height: 100%; }
.welcome-photo .frame-line { position: absolute; inset: 14px; border: 1px solid var(--gold); pointer-events: none; z-index: 4; mix-blend-mode: difference; }
.welcome-body h2 { font-size: clamp(2.1rem, 4vw, 3.1rem); margin: 16px 0 18px; }
.welcome-body p { color: var(--ink-2); font-weight: 300; max-width: 56ch; }
.welcome-body .sign { font-family: var(--display); font-style: italic; font-size: 1.7rem; color: var(--ink); margin-top: 8px; }
.welcome-body .more { font-family: var(--ui); text-transform: uppercase; letter-spacing: .15em; font-size: .74rem; font-weight: 600; color: var(--accent); display: inline-flex; gap: 9px; align-items: center; margin-top: 22px; }
.welcome-body .more .ar { transition: transform .35s var(--ease); }
.welcome-body .more:hover .ar { transform: translateX(5px); }

/* ============================================================
   1.3 ACCESOS RÁPIDOS
   ============================================================ */
.access { position: relative; z-index: 2; background: var(--paper-2); padding: var(--sec-y) var(--page-x); border-top: 1px solid var(--line); }
.access-head { text-align: center; max-width: 720px; margin: 0 auto clamp(40px, 5vw, 64px); display: flex; flex-direction: column; align-items: center; gap: 18px; }
.access-head h2 { font-size: clamp(2rem, 3.6vw, 2.9rem); }
.access-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); max-width: 1240px; margin: 0 auto; border: 1px solid var(--line); }
.access-card {
  background: var(--paper-card); padding: 36px 28px 30px;
  display: flex; flex-direction: column; gap: 14px; min-height: 280px;
  transition: background .4s var(--ease), transform .4s var(--ease);
  position: relative;
}
.access-card .idx { font-family: var(--display); font-size: 1.4rem; color: var(--gold); }
.access-card h3 { font-size: 1.85rem; line-height: 1.05; }
.access-card p { font-family: var(--body); font-weight: 300; font-size: .98rem; color: var(--ink-soft); margin: 0; }
.access-card .go { margin-top: auto; font-family: var(--ui); text-transform: uppercase; letter-spacing: .14em; font-size: .68rem; font-weight: 600; color: var(--accent); display: inline-flex; align-items: center; gap: 8px; }
.access-card .go .ar { transition: transform .35s var(--ease); }
.access-card::after { content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .4s var(--ease); }
.access-card:hover { background: var(--paper); transform: translateY(-4px); }
.access-card:hover::after { transform: scaleX(1); }
.access-card:hover .go .ar { transform: translateX(5px); }

/* ============================================================
   FOOTER
   ============================================================ */
.footer { position: relative; z-index: 2; background: var(--band-2); color: var(--paper); padding: clamp(60px, 8vw, 96px) var(--page-x) 36px; }
.footer-top { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 44px; max-width: 1200px; margin: 0 auto; padding-bottom: 50px; border-bottom: 1px solid rgba(244,239,228,.14); }
.footer .f-wm { font-family: var(--display); font-size: 1.9rem; line-height: 1.05; }
.footer .f-wm em { font-style: italic; color: var(--gold-2); }
.footer p.f-tag { color: rgba(244,239,228,.6); font-weight: 300; max-width: 34ch; margin-top: 14px; }
.footer h4 { font-family: var(--ui); text-transform: uppercase; letter-spacing: .2em; font-size: .68rem; font-weight: 600; color: var(--gold-2); margin: 0 0 18px; }
.footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.footer ul a { font-family: var(--body); color: rgba(244,239,228,.78); font-size: .98rem; }
.footer ul a:hover { color: var(--paper); }
.footer .news { display: flex; gap: 0; margin-top: 14px; max-width: 320px; }
.footer .news input { flex: 1; background: transparent; border: 1px solid rgba(244,239,228,.3); border-right: none; color: var(--paper); padding: 11px 14px; font-family: var(--body); font-size: .92rem; }
.footer .news button { background: var(--gold); border: 1px solid var(--gold); color: var(--band); padding: 0 18px; font-family: var(--ui); text-transform: uppercase; letter-spacing: .1em; font-size: .66rem; font-weight: 700; cursor: pointer; }
.footer-bot { max-width: 1200px; margin: 0 auto; padding-top: 26px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 14px; font-family: var(--ui); font-size: .68rem; letter-spacing: .08em; color: rgba(244,239,228,.5); text-transform: uppercase; }

/* ---------- reveals al scroll (activados por shell.js) ---------- */
body.js-reveal .rv {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .9s var(--ease), transform .9s var(--ease);
}
body.js-reveal .rv.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  body.js-reveal .rv { opacity: 1; transform: none; }
}

.news-ok {
  font-family: var(--ui); font-size: .78rem; letter-spacing: .08em;
  color: var(--gold-2); display: inline-block; padding: 12px 0;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .hero-visual { min-height: 64vh; border-right: none; border-bottom: 1px solid var(--line); }
  .access-grid { grid-template-columns: 1fr 1fr; }
  .welcome-grid { grid-template-columns: 1fr; }
  .footer-top { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 760px) {
  .nav-burger { display: flex; }
  .nav-menu {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 8px 0 10px;
    box-shadow: 0 24px 40px rgba(32,34,46,.14);
  }
  .nav.menu-open .nav-menu { display: flex; }
  .nav-menu a { padding: 13px var(--page-x); font-size: .82rem; }
  .nav-menu a::after { display: none; }
}
@media (max-width: 620px) {
  .access-grid { grid-template-columns: 1fr; }
  .hero-text { padding-top: 56px; padding-bottom: 56px; }
}
