/* Visiones de Ana Catalina Emmerick — El Estudio / cosasdemiguel.com */

/* Tipografías propias (sin CDN de terceros) */
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/cormorant-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: italic;
  font-weight: 400 600;
  font-display: swap;
  src: url('../fonts/cormorant-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url('../fonts/inter.woff2') format('woff2');
}
@font-face {
  font-family: 'Material Icons Outlined';
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url('../fonts/material-icons-outlined.woff2') format('woff2');
}
.material-icons-outlined {
  font-family: 'Material Icons Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
}

:root {
  --night-1: #1a1330;
  --night-2: #2e1f4a;
  --night-3: #4a3568;
  --violet: #6b4c93;
  --violet-light: #8a6bb0;
  --gold: #c9a45c;
  --gold-soft: rgba(201, 164, 92, 0.15);
  --ink: #241c33;
  --ink-soft: #4a4258;
  --paper: #faf7f2;
  --paper-alt: #f1ecf6;
  --border: #e4dcef;
  --draft-bg: #fdf6e8;
  --draft-border: #e4c584;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Inter', -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink); font-weight: 600; }

a { color: var(--violet); text-decoration: none; }
a:hover { color: var(--gold); }

.material-icons-outlined { vertical-align: middle; }

/* ---------- Nav ---------- */
#main-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 247, 242, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  white-space: nowrap;
}
.nav-logo:hover { color: var(--ink); }
.nav-logo-icon { color: var(--gold); font-size: 1.3rem; }

.nav-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}
.nav-links a {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.92rem;
  color: var(--ink-soft);
  font-weight: 500;
}
.nav-links a:hover, .nav-links a.active {
  background: var(--paper-alt);
  color: var(--violet);
}

.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.nav-toggle span {
  display: block; width: 22px; height: 2px; background: var(--ink); margin: 4px 0; border-radius: 2px;
}

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--paper);
    flex-direction: column;
    padding: 8px 16px 16px;
    border-bottom: 1px solid var(--border);
  }
  .nav-links.open { display: flex; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 68vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-align: center;
  padding: 60px 24px;
}
.hero.hero-compact { min-height: 34vh; padding: 56px 24px; }

.hero-bg {
  position: absolute; inset: 0;
  background: linear-gradient(160deg, var(--night-1) 0%, var(--night-2) 55%, var(--night-3) 100%);
}
.hero-glow {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 30%, var(--gold-soft) 0%, transparent 70%);
}
.hero-stars {
  position: absolute; inset: 0; opacity: 0.5;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(255,255,255,0.6) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 70% 20%, rgba(255,255,255,0.5) 50%, transparent 100%),
    radial-gradient(1px 1px at 85% 55%, rgba(255,255,255,0.5) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 40% 70%, rgba(255,255,255,0.4) 50%, transparent 100%),
    radial-gradient(1px 1px at 55% 45%, rgba(255,255,255,0.5) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 10% 80%, rgba(255,255,255,0.4) 50%, transparent 100%);
}

.hero-content { position: relative; z-index: 2; max-width: 780px; }
.hero-icon { font-size: 2.2rem; color: var(--gold); margin-bottom: 18px; opacity: 0.85; }
.hero h1 { color: #fff; font-size: clamp(2.1rem, 5vw, 3.2rem); margin-bottom: 14px; }
.hero-subtitle { color: var(--gold); font-size: 1.15rem; font-style: italic; margin-bottom: 16px; }
.hero-desc { color: rgba(255,255,255,0.8); font-size: 1.02rem; max-width: 620px; margin: 0 auto 28px; }

.hero-stats { display: flex; gap: 36px; justify-content: center; margin-bottom: 32px; flex-wrap: wrap; }
.stat { text-align: center; }
.stat-num { display: block; font-family: var(--font-display); font-size: 2rem; color: var(--gold); font-weight: 700; }
.stat-label { font-size: 0.8rem; color: rgba(255,255,255,0.65); text-transform: uppercase; letter-spacing: 0.05em; }

.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.breadcrumb {
  position: relative; z-index: 2; font-size: 0.85rem; color: rgba(255,255,255,0.6); margin-bottom: 14px;
}
.breadcrumb a { color: rgba(255,255,255,0.75); }
.breadcrumb a:hover { color: var(--gold); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: 8px; font-size: 0.95rem; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; transition: all 0.2s ease;
}
.btn-primary { background: var(--gold); color: var(--night-1); }
.btn-primary:hover { background: #d9b968; color: var(--night-1); }
.btn-secondary { background: transparent; color: #fff; border-color: rgba(255,255,255,0.35); }
.btn-secondary:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* ---------- Sections ---------- */
main { max-width: 1200px; margin: 0 auto; padding: 64px 24px; }
.section-header { text-align: center; max-width: 700px; margin: 0 auto 48px; }
.section-header h2 { font-size: 2rem; margin-bottom: 10px; }
.section-header p { color: var(--ink-soft); font-size: 1.05rem; }

.intro-text { max-width: 760px; margin: 0 auto 48px; color: var(--ink-soft); font-size: 1.02rem; }
.intro-text p + p { margin-top: 14px; }

/* ---------- Card grid (hub) ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}
.explore-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 24px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.explore-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(42, 28, 64, 0.1);
  border-color: var(--violet-light);
}
.explore-card .card-icon {
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--paper-alt); color: var(--violet);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px; font-size: 1.4rem;
}
.explore-card h3 { font-size: 1.25rem; margin-bottom: 8px; color: var(--ink); }
.explore-card p { color: var(--ink-soft); font-size: 0.94rem; }

/* ---------- Tomo grid (visiones) ---------- */
.tomo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.tomo-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
  position: relative;
}
.tomo-num {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--gold);
  font-size: 0.85rem;
  margin-bottom: 6px;
}
.tomo-card h3 { font-size: 1.08rem; margin-bottom: 8px; line-height: 1.35; }
.tomo-meta { font-size: 0.82rem; color: var(--ink-soft); }
.badge-soon {
  position: absolute; top: 16px; right: 16px;
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--violet); background: var(--paper-alt);
  padding: 3px 8px; border-radius: 20px;
}

/* ---------- Cronología ---------- */
.chrono-block {
  border-left: 3px solid var(--gold);
  padding: 4px 0 4px 24px;
  margin-bottom: 36px;
  position: relative;
}
.chrono-block::before {
  content: '';
  position: absolute; left: -7px; top: 6px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--gold);
}
.chrono-num { font-size: 0.8rem; color: var(--violet); font-weight: 700; letter-spacing: 0.04em; }
.chrono-block h3 { font-size: 1.3rem; margin: 4px 0 10px; }
.chrono-block ul { list-style: none; }
.chrono-block li {
  padding: 6px 0; color: var(--ink-soft); font-size: 0.96rem;
  border-bottom: 1px dashed var(--border);
}
.chrono-block li:last-child { border-bottom: none; }

/* ---------- Personajes ---------- */
.personaje-list {
  display: flex; flex-wrap: wrap; gap: 10px;
  max-width: 800px; margin: 0 auto;
}
.personaje-chip {
  padding: 8px 16px; border-radius: 20px;
  background: var(--paper-alt); color: var(--ink-soft);
  font-size: 0.9rem; border: 1px solid var(--border);
}

/* ---------- Draft note ---------- */
.draft-note {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--draft-bg); border: 1px solid var(--draft-border);
  border-radius: 10px; padding: 14px 18px; margin: 0 auto 40px;
  max-width: 760px; font-size: 0.9rem; color: #6b4f1a;
}
.draft-note .material-icons-outlined { color: #b8860b; font-size: 1.2rem; }

/* ---------- Article body ---------- */
.article-body { max-width: 720px; margin: 0 auto; }
.article-body h2 { font-size: 1.5rem; margin: 36px 0 12px; }
.article-body h2:first-child { margin-top: 0; }
.article-body p { color: var(--ink-soft); margin-bottom: 16px; font-size: 1.02rem; }
.article-body blockquote {
  border-left: 3px solid var(--violet-light);
  padding: 4px 20px; margin: 20px 0;
  font-style: italic; color: var(--ink);
  background: var(--paper-alt); border-radius: 0 8px 8px 0;
}
.article-body .source-note { font-size: 0.82rem; color: var(--ink-soft); margin-top: -6px; }

/* ---------- Tomo header (overview + section pages) ---------- */
.tomo-eyebrow {
  color: var(--gold); font-size: 0.85rem; text-transform: uppercase;
  letter-spacing: 0.08em; margin-bottom: 8px; font-weight: 600;
}

/* ---------- Section stepper ---------- */
.stepper-wrap {
  position: sticky; top: 61px; z-index: 90;
  background: rgba(250, 247, 242, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.stepper {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 6px;
  overflow-x: auto; scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.stepper::-webkit-scrollbar { height: 4px; }
.stepper::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.step {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  font-size: 0.8rem; font-weight: 600; color: var(--ink-soft);
  background: var(--paper-alt); border: 1px solid var(--border);
  text-decoration: none; transition: all 0.15s ease;
}
.step:hover { border-color: var(--violet-light); color: var(--violet); }
.step.current { background: var(--violet); color: #fff; border-color: var(--violet); }
.step.done { background: var(--gold-soft); color: var(--gold); border-color: var(--gold); }
.step-sep { flex: 0 0 auto; width: 14px; height: 1px; background: var(--border); }
.stepper-label {
  flex: 0 0 auto; font-size: 0.8rem; color: var(--ink-soft);
  margin-left: 8px; white-space: nowrap;
}

/* ---------- Chapter blocks (reading view) ---------- */
.chapter {
  max-width: 720px; margin: 0 auto 48px;
  padding-bottom: 40px; border-bottom: 1px solid var(--border);
}
.chapter:last-child { border-bottom: none; }
.chapter-num {
  display: inline-block; font-family: var(--font-display);
  font-size: 1rem; font-weight: 700; color: var(--gold);
  letter-spacing: 0.05em; margin-bottom: 6px;
}
.chapter h2 { font-size: 1.55rem; margin: 0 0 18px; }
.chapter p { color: var(--ink-soft); font-size: 1.04rem; margin-bottom: 16px; }
.chapter-sample-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.76rem; color: var(--violet); background: var(--paper-alt);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 4px 12px; margin-top: 4px;
}
.chapter-sample-tag .material-icons-outlined { font-size: 1rem; }

.gap-note {
  max-width: 720px; margin: 0 auto 40px;
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--paper-alt); border: 1px dashed var(--violet-light);
  border-radius: 10px; padding: 14px 18px;
  font-size: 0.88rem; color: var(--ink-soft);
}
.gap-note .material-icons-outlined { color: var(--violet); font-size: 1.2rem; }

/* ---------- Prev / next section nav ---------- */
.section-pager {
  max-width: 720px; margin: 40px auto 0;
  display: flex; justify-content: space-between; gap: 16px;
}
.pager-link {
  flex: 1; display: flex; flex-direction: column; gap: 4px;
  padding: 16px 20px; border: 1px solid var(--border); border-radius: 10px;
  transition: border-color 0.15s ease;
}
.pager-link:hover { border-color: var(--violet-light); }
.pager-link.next { text-align: right; align-items: flex-end; }
.pager-link .pager-dir {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ink-soft);
  display: flex; align-items: center; gap: 4px;
}
.pager-link.next .pager-dir { flex-direction: row-reverse; }
.pager-link .pager-title { font-family: var(--font-display); font-size: 1.05rem; color: var(--ink); }
.pager-link.disabled {
  opacity: 0.35; pointer-events: none;
}

/* ---------- Back to top ---------- */
.back-to-top {
  position: fixed; bottom: 24px; right: 24px; z-index: 95;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--night-1); color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(26, 19, 48, 0.35);
  border: none; cursor: pointer;
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: all 0.25s ease;
}
.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--night-2); }

@media (max-width: 640px) {
  main { padding: 48px 16px; }
  .hero { padding: 48px 16px; }
  .stepper-wrap { top: 57px; }
  .section-pager { flex-direction: column; }
  .pager-link.next { text-align: left; align-items: flex-start; }
  .pager-link.next .pager-dir { flex-direction: row; }
  .back-to-top { bottom: 16px; right: 16px; width: 42px; height: 42px; }
}

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.88rem;
}
footer p { margin-bottom: 4px; }
footer a { color: var(--violet); }

@media (max-width: 640px) {
  main { padding: 48px 16px; }
  .hero { padding: 48px 16px; }
}
