/* ============================================================
   PURA VIDA ATITLÁN — cosmovision.css
   Estilos unificados para la sección de Cosmovisión y Flipbook
   ============================================================ */

/* ── Variables de Color & Tema Pergamino Maya ── */
:root {
    --terracotta: #BC6C25;
    --terracotta-bright: #d96b27;
    --jungle: #1B3022;
    --gold: #D4A373;
    --gold-accent: #c68b27;
    --cream: #FEFAE0;
    --papyrus: #f6f1e3;
    --papyrus-dark: #e8decc;
    --sepia-text: #3d2d1d;
    --shadow-soft: rgba(45, 30, 15, 0.12);
    --bone: #f8f5ee;
    --muted: #6c757d;
}

html {
    scroll-behavior: smooth;
}

/* ── Estructura Principal & Visibilidad ── */
.content-center {
    width: 100%;
    min-height: 100vh;
    display: block;
}

/* ── Animaciones de Sección ── */
.animated-section {
    opacity: 0;
    transform: translateY(40px) scale(0.98);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.animated-section.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ── Sacred Prologue ──────────────────────────────────────── */
.sacred-text-box {
    padding: 3rem 0;
    margin-bottom: 4rem;
    border-bottom: 1px solid var(--stone);
    position: relative;
}

.popol-vuh-text {
    font-size: 1.4rem;
    line-height: 1.9;
    color: var(--jungle);
    font-style: italic;
    margin-bottom: 2rem;
    text-align: justify;
}

.glyph-cap {
    float: left;
    font-size: 5rem;
    line-height: 0.8;
    padding: 10px 15px 5px 0;
    color: var(--terracotta);
    font-family: serif;
    font-weight: 900;
    text-shadow: 2px 2px 0px var(--stone);
}

.source-attribution {
    text-align: right;
    border-right: 3px solid var(--terracotta);
    padding-right: 20px;
    margin-left: auto;
    max-width: 400px;
}

.source-detail {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.source-title {
    font-size: 1.2rem;
    letter-spacing: 3px;
    color: var(--terracotta);
    text-transform: uppercase;
}

/* ── Prólogo / Palabras al Lector ── */
.editorial-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.editorial-header .subtitle {
    display: inline-block;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--terracotta);
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.editorial-header h2 {
    font-size: 2.1rem;
    color: var(--jungle);
    font-weight: 800;
}

.book-prologue-card {
    background: var(--papyrus);
    background-image: radial-gradient(#e0d3be 1px, transparent 1px);
    background-size: 20px 20px;
    border: 1px solid rgba(188, 108, 37, 0.2);
    border-left: 6px solid var(--terracotta);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 10px 30px var(--shadow-soft);
    margin-bottom: 3.5rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.book-prologue-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
}

.book-prologue-card::before {
    content: "📜";
    position: absolute;
    top: -15px;
    right: 20px;
    font-size: 4rem;
    opacity: 0.15;
}

.prologue-lead {
    font-weight: 700;
    color: var(--terracotta);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.prologue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 1.5rem;
}

.prologue-col p {
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--sepia-text);
    margin-bottom: 1.2rem;
    text-align: justify;
}

.center-tag-container {
    text-align: center;
}

.book-welcome-tag {
    display: inline-block;
    margin-top: 1.5rem;
    background: linear-gradient(135deg, var(--terracotta), #9D5418);
    color: #fff;
    padding: 0.8rem 1.8rem;
    border-radius: 30px;
    font-weight: 600;
    letter-spacing: 1px;
    box-shadow: 0 6px 18px rgba(188, 108, 37, 0.3);
    animation: floatPulse 3s ease-in-out infinite;
}

@keyframes floatPulse {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* ── Flipbook Component ── */
.flipbook-app {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 2rem 0;
    box-sizing: border-box;
}

.flipbook-app .flipbook-viewport {
    width: 100%;
    max-width: 900px;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    transform: none !important;
    perspective: none !important;
}

.flipbook-app .flip-book {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.35), 0 0 20px rgba(188, 108, 37, 0.15);
    border-radius: 8px;
    overflow: hidden;
    margin: 0 auto;
    background-color: #1b1b1b;
}

.flipbook-app .page {
    padding: 0 !important;
    margin: 0 !important;
    background-color: #121212 !important;
    border: 1px solid #333;
    overflow: hidden;
    box-sizing: border-box;
    cursor: zoom-in;
}

.flipbook-app .full-page-content {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #1a1a1a;
}

.flipbook-app .page-full-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    user-select: none;
    transition: transform 0.2s ease;
}

/* Controles Unificados */
.flipbook-app .controls-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
}

.flipbook-app .controls-card {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    padding: 10px 24px;
    border-radius: 30px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(188, 108, 37, 0.2);
}

.flipbook-app .controls-card button {
    background: linear-gradient(135deg, #BC6C25, #9D5418);
    color: #ffffff;
    border: none;
    padding: 10px 18px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 13px;
    font-family: system-ui, -apple-system, sans-serif;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(188, 108, 37, 0.3);
    transition: transform 0.2s ease, background 0.3s ease;
}

.flipbook-app .controls-card button:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #d47a2a, #ad5d1b);
}

.flipbook-app .page-counter {
    font-size: 14px;
    font-weight: 600;
    color: var(--jungle);
    font-family: system-ui, -apple-system, sans-serif;
    min-width: 100px;
    text-align: center;
}

/* Fullscreen Zoom Lightbox */
.book-modal-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(10px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.book-modal-lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.book-modal-lightbox img {
    max-width: 92vw;
    max-height: 92vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}

.book-modal-close {
    position: absolute;
    top: 20px;
    right: 25px;
    color: #fff;
    font-size: 36px;
    font-weight: 300;
    cursor: pointer;
    user-select: none;
}

/* ── Índice / Línea de Tiempo del Libro ── */
.book-progress-section {
    margin: 4rem 0;
}

.timeline-nav {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 15px;
    margin-bottom: 2rem;
    border-bottom: 2px solid rgba(188, 108, 37, 0.2);
}

.timeline-tab {
    background: rgba(188, 108, 37, 0.1);
    color: var(--jungle);
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
    font-family: inherit;
}

.timeline-tab:hover,
.timeline-tab.active {
    background: var(--terracotta);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(188, 108, 37, 0.3);
}

.chapter-block {
    display: none;
    animation: fadeIn 0.5s ease forwards;
}

.chapter-block.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.index-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.index-card {
    background: white;
    border: 1px solid rgba(188, 108, 37, 0.2);
    border-radius: 10px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.index-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    border-color: var(--terracotta);
}

.page-badge {
    background: #fff5eb;
    color: var(--terracotta);
    font-weight: 800;
    font-size: 0.9rem;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(188,108,37,0.3);
    min-width: 60px;
    text-align: center;
}

.index-info h4 {
    color: var(--jungle);
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.index-info p {
    font-size: 0.88rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.4;
}

.index-thumb-placeholder {
    width: 100%;
    height: 120px;
    background: #e8decc;
    border: 2px dashed #bc6c25;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3d2d1d;
    font-size: 0.85rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.index-thumb {
    width: 100%;
    height: 120px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}

.index-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.index-card:hover .index-thumb img {
    transform: scale(1.05);
}

/* ── Secciones Secundarias / Utilidades ── */
.border-top-quote {
    margin-top: 1.5rem;
    border-top: 1px solid rgba(212,163,115,0.3);
    padding-top: 0.8rem;
}

.text-gold { color: var(--gold); }
.margin-zero { margin: 0; }

.subtitle-tzunun {
    color: #fff;
    font-size: 1.2rem;
    margin: 0.2rem 0 0 0;
}

.section-spacing { margin-top: 3.5rem; }

.iframe-container {
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(0,0,0,0.12);
    border: 1px solid rgba(188,108,37,0.2);
}

.nahual-iframe {
    width: 100%;
    height: 800px;
    border: none;
    display: block;
}

.footer-spacing {
    margin-top: 4rem;
    text-align: center;
    padding: 2rem 0;
    border-top: 1px solid rgba(188, 108, 37, 0.2);
}

.hero-bg {
    background-image: url('../images/background-C3.png');
}

/* Adaptación Responsiva */
@media (max-width: 850px) {
    .prologue-grid { grid-template-columns: 1fr; }
    .book-prologue-card { padding: 1.8rem; }
}