/* ===== GLOBAL RESET & SCROLL SNAP ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html {
    height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
}
body {
    width: 100%; min-height: 100%;
    font-family: 'Cormorant Garamond', serif;
    background: #0a0502; color: #f5e6c8;
    overflow-x: hidden;
}
.snap-page {
    position: relative; width: 100vw; height: 100vh;
    scroll-snap-align: start; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}

/* ===== PROGRESS BAR & PAGE INDICATOR ===== */
.progress-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 3px;
    background: rgba(10, 5, 2, 0.3); z-index: 10000;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(to right, #ff8c00, #d4af37);
    width: 0%; transition: width 0.3s ease;
}
.page-indicator {
    position: fixed; top: 15px; left: 30px;
    font-family: 'Playfair Display', serif; font-size: 0.9rem;
    color: #f5e6c8; z-index: 10000;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    letter-spacing: 0.1em;
    background: rgba(10, 5, 2, 0.7);
    padding: 8px 15px; border-radius: 3px;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

/* ===== LOADING SCREEN ===== */
.loading-screen {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: #0a0502; z-index: 9999;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    opacity: 1; transition: opacity 1s ease;
}
.loading-screen.loaded { opacity: 0; pointer-events: none; }
.loading-title {
    font-family: 'Great Vibes', cursive;
    font-size: clamp(3rem, 6vw, 5rem); color: #f5e6c8;
    text-shadow: 0 0 30px rgba(255, 69, 0, 0.4), 0 2px 4px rgba(0,0,0,0.8);
    margin-bottom: 40px; opacity: 0;
    animation: loadingFadeIn 1s ease 0.5s forwards;
}
.loading-subtitle {
    font-family: 'Cormorant Garamond', serif; font-style: italic;
    font-size: 1.1rem; color: #e8d4a8; letter-spacing: 0.15em;
    opacity: 0; animation: loadingFadeIn 1s ease 1s forwards;
}
.loading-divider {
    width: 0; height: 1px;
    background: linear-gradient(to right, transparent, rgba(255, 140, 0, 0.6), transparent);
    margin: 30px 0; animation: loadingDivider 1.5s ease 1.5s forwards;
}
@keyframes loadingFadeIn { to { opacity: 1; } }
@keyframes loadingDivider { to { width: 200px; } }

/* ===== SHADOW BRIDGES ===== */
.shadow-bridge-top, .shadow-bridge-bottom {
    position: absolute; left: 0; width: 100%; height: 180px;
    z-index: 4; pointer-events: none;
}
.shadow-bridge-top {
    top: 0;
    background: linear-gradient(to bottom, #0a0502 0%, transparent 100%);
}
.shadow-bridge-bottom {
    bottom: 0;
    background: linear-gradient(to top, #0a0502 0%, transparent 100%);
}

/* =========================================
   ARCHIVIST TAB STYLES (With Pulse Animation)
   ========================================= */
@keyframes pulseTab {
    0% { transform: translateY(-50%) scale(1); box-shadow: 2px 2px 8px rgba(0,0,0,0.4); }
    50% { transform: translateY(-50%) scale(1.08); box-shadow: 0 0 15px rgba(139, 0, 0, 0.8); }
    100% { transform: translateY(-50%) scale(1); box-shadow: 2px 2px 8px rgba(0,0,0,0.4); }
}
.archivist-tab-btn {
    position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    background-color: #8b0000; color: #f5e6c8; border: none;
    padding: 16px 10px; border-radius: 0 6px 6px 0;
    cursor: pointer; z-index: 100;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.4);
    transition: background-color 0.3s ease;
    animation: pulseTab 3s infinite ease-in-out; 
}
.archivist-tab-btn:hover {
    background-color: #a00000; animation: none;
    transform: translateY(-50%) scale(1.05);
}
.tab-icon { font-size: 1.3rem; display: block; }

.archivist-panel {
    position: absolute; top: 0; left: -400px; width: 320px; height: 100%;
    background-color: #4a0404; color: #f5e6c8; z-index: 101;
    padding: 50px 30px 30px 30px; box-shadow: 5px 0 20px rgba(0,0,0,0.6);
    transition: left 0.5s cubic-bezier(0.25, 1, 0.5, 1); overflow-y: auto;
}
.archivist-panel.open { left: 0; }
.close-panel-btn {
    position: absolute; top: 15px; right: 20px;
    background: none; border: none; color: #f5e6c8;
    font-size: 2rem; cursor: pointer; line-height: 1;
    transition: color 0.3s ease;
}
.close-panel-btn:hover { color: #d4af37; }
.panel-content { padding-top: 20px; }
.panel-title {
    font-family: 'Playfair Display', serif; font-size: 1.3rem;
    color: #f5e6c8; margin-bottom: 8px; line-height: 1.3;
}
.panel-subtitle {
    font-family: 'Cormorant Garamond', serif; font-style: italic;
    font-size: 1.05rem; color: #d4af37; margin-bottom: 25px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3); padding-bottom: 12px;
}
.panel-details p {
    font-family: 'Cormorant Garamond', serif; font-size: 1rem;
    line-height: 1.5; margin-bottom: 12px; color: #e8d4a8;
}
.panel-details em { color: #d4af37; font-style: italic; }

/* =========================================
   CITATION POP-UPS (CLICKABLE TOOLTIPS)
   ========================================= */
.citation-pop {
    color: #ff8c00; font-style: italic; cursor: pointer;
    border-bottom: 1px dotted rgba(255, 140, 0, 0.5);
    transition: color 0.3s ease, border-color 0.3s ease; position: relative;
}
.citation-pop:hover { color: #ffa500; border-bottom-color: #ffa500; }
.citation-pop.active { color: #ffa500; border-bottom-color: #ffa500; font-weight: 600; }

#citation-tooltip {
    position: fixed; bottom: 40px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(10, 5, 2, 0.95); color: #f5e6c8;
    padding: 15px 25px; border: 1px solid #d4af37; border-radius: 4px;
    font-family: 'Cormorant Garamond', serif; font-size: 1.05rem;
    font-style: italic; max-width: 600px; width: 90%; text-align: center;
    opacity: 0; visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    z-index: 10000; box-shadow: 0 5px 20px rgba(0,0,0,0.7);
    pointer-events: none; line-height: 1.5;
}
#citation-tooltip.visible {
    opacity: 1; visibility: visible;
    transform: translateX(-50%) translateY(0); pointer-events: auto;
}

/* =========================================
   NAVIGATION BUTTONS
   ========================================= */
.navigation-container {
    position: absolute; bottom: 40px; left: 50%;
    transform: translateX(-50%); z-index: 10;
    display: flex; gap: 20px; opacity: 0;
    transition: opacity 1s ease 2.5s;
}
/* Note: You will change .page-s7-1 to your actual last page class */
.page-s7-12.in-view .navigation-container { opacity: 1; } 

.nav-btn {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 25px; background: rgba(10, 5, 2, 0.8);
    border: 2px solid #d4af37; color: #f5e6c8; text-decoration: none;
    font-family: 'Playfair Display', serif; font-size: 1rem;
    letter-spacing: 0.1em; text-transform: uppercase; border-radius: 4px;
    transition: all 0.3s ease;
}
.nav-btn:hover { background: rgba(212, 175, 55, 0.9); color: #0a0502; }
.btn-arrow { width: 20px; height: 20px; }

/* =========================================
   MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 768px) {
    #citation-tooltip { bottom: 20px; font-size: 0.95rem; padding: 12px 20px; }
    .archivist-panel { width: 100%; left: -100%; }
    .navigation-container {
        bottom: 30px; flex-direction: column; width: 80%;
    }
    .nav-btn { justify-content: center; width: 100%; }
}
/* =========================================
   PAGE 1: TRIVULZIAN 1080 MANUSCRIPT
   ========================================= */
.page-s7-1 {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1a0f0a;
}
.page-s7-1-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('images/section-7-trivulzian.jpg');
    background-size: cover;
    background-position: center;
    z-index: 1;
    transform: scale(1.05);
    transition: transform 2s cubic-bezier(0.25, 1, 0.5, 1);
}
.page-s7-1.in-view .page-s7-1-bg {
    transform: scale(1);
}

/* Mobile Responsiveness for Page 1 */
@media (max-width: 768px) {
    .page-s7-1-bg {
        background-position: center center;
    }
}
/* =========================================
   PAGE 2: TRIVULZIAN 1080 (PURGATORIO/PARADISO)
   ========================================= */
.page-s7-2 {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1a0f0a;
}
.page-s7-2-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('images/section-7-trivulzian-bis.jpg');
    background-size: cover;
    background-position: center;
    z-index: 1;
    transform: scale(1.05);
    transition: transform 2s cubic-bezier(0.25, 1, 0.5, 1);
}
.page-s7-2.in-view .page-s7-2-bg {
    transform: scale(1);
}

/* Mobile Responsiveness for Page 2 */
@media (max-width: 768px) {
    .page-s7-2-bg {
        background-position: center center;
    }
}
/* =========================================
   PAGE 3: COMEDIA DI DANTHE (1529 EDITION)
   ========================================= */
.page-s7-3 {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1a0f0a;
}
.page-s7-3-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('images/section-7-comedia.jpg');
    background-size: cover;
    background-position: center;
    z-index: 1;
    transform: scale(1.05);
    transition: transform 2s cubic-bezier(0.25, 1, 0.5, 1);
}
.page-s7-3.in-view .page-s7-3-bg {
    transform: scale(1);
}

/* =========================================
   RIGHT-SIDE ARCHIVIST TAB STYLES
   ========================================= */
.archivist-tab-btn-right {
    position: absolute; right: 0; top: 50%; transform: translateY(-50%);
    background-color: #8b0000; color: #f5e6c8; border: none;
    padding: 16px 10px; border-radius: 6px 0 0 6px; /* Rounded corners on the left */
    cursor: pointer; z-index: 100;
    box-shadow: -2px 2px 8px rgba(0,0,0,0.4);
    transition: background-color 0.3s ease;
    animation: pulseTab 3s infinite ease-in-out; 
}
.archivist-tab-btn-right:hover {
    background-color: #a00000; animation: none;
    transform: translateY(-50%) scale(1.05);
}

.archivist-panel-right {
    position: absolute; top: 0; right: -400px; width: 320px; height: 100%;
    background-color: #4a0404; color: #f5e6c8; z-index: 101;
    padding: 50px 30px 30px 30px; box-shadow: -5px 0 20px rgba(0,0,0,0.6);
    transition: right 0.5s cubic-bezier(0.25, 1, 0.5, 1); overflow-y: auto;
}
.archivist-panel-right.open { right: 0; }

/* Close button positioned on the left for right-side panel */
.archivist-panel-right .close-panel-btn {
    position: absolute; top: 15px; left: 20px;
    background: none; border: none; color: #f5e6c8;
    font-size: 2rem; cursor: pointer; line-height: 1;
    transition: color 0.3s ease;
}
.archivist-panel-right .close-panel-btn:hover { color: #d4af37; }

/* Mobile Responsiveness for Right Panel */
@media (max-width: 768px) {
    .archivist-panel-right { width: 100%; right: -100%; }
}

/* Mobile Responsiveness for Page 3 */
@media (max-width: 768px) {
    .page-s7-3-bg {
        background-position: center center;
    }
}
/* =========================================
   PAGE 4: LANDINO EDITION (1529)
   ========================================= */
.page-s7-4 {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1a0f0a;
}
.page-s7-4-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('images/section-7-landino.jpg');
    background-size: cover;
    background-position: center;
    z-index: 1;
    transform: scale(1.05);
    transition: transform 2s cubic-bezier(0.25, 1, 0.5, 1);
}
.page-s7-4.in-view .page-s7-4-bg {
    transform: scale(1);
}

/* Mobile Responsiveness for Page 4 */
@media (max-width: 768px) {
    .page-s7-4-bg {
        background-position: center center;
    }
}
/* =========================================
   PAGE 5: THREE WOODCUTS (LYON 1575)
   ========================================= */
.page-s7-5 {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1a0f0a;
}
.page-s7-5-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('images/section-7-treixilo.jpg');
    background-size: cover;
    background-position: center;
    z-index: 1;
    transform: scale(1.05);
    transition: transform 2s cubic-bezier(0.25, 1, 0.5, 1);
}
.page-s7-5.in-view .page-s7-5-bg {
    transform: scale(1);
}

/* Mobile Responsiveness for Page 5 */
@media (max-width: 768px) {
    .page-s7-5-bg {
        background-position: center center;
    }
}
/* =========================================
   PAGE 6: HELL DIAGRAM (MANETTI)
   ========================================= */
.page-s7-6 {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1a0f0a;
}
.page-s7-6-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('images/section-7-hell-diagram.jpg');
    background-size: cover;
    background-position: center;
    z-index: 1;
    transform: scale(1.05);
    transition: transform 2s cubic-bezier(0.25, 1, 0.5, 1);
}
.page-s7-6.in-view .page-s7-6-bg {
    transform: scale(1);
}

/* Mobile Responsiveness for Page 6 */
@media (max-width: 768px) {
    .page-s7-6-bg {
        background-position: center center;
    }
}
/* =========================================
   PAGE 7: FOUR EDITIONS (VERNON)
   ========================================= */
.page-s7-7 {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1a0f0a;
}
.page-s7-7-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('images/section-7-4-editions.jpg');
    background-size: cover;
    background-position: center;
    z-index: 1;
    transform: scale(1.05);
    transition: transform 2s cubic-bezier(0.25, 1, 0.5, 1);
}
.page-s7-7.in-view .page-s7-7-bg {
    transform: scale(1);
}

/* Mobile Responsiveness for Page 7 */
@media (max-width: 768px) {
    .page-s7-7-bg {
        background-position: center center;
    }
}
/* =========================================
   PAGE 8: HELL GATE (ZUCCARI)
   ========================================= */
.page-s7-8 {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1a0f0a;
}
.page-s7-8-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('images/section-7-hell-gate.jpg');
    background-size: cover;
    background-position: center;
    z-index: 1;
    transform: scale(1.05);
    transition: transform 2s cubic-bezier(0.25, 1, 0.5, 1);
}
.page-s7-8.in-view .page-s7-8-bg {
    transform: scale(1);
}

/* Mobile Responsiveness for Page 8 */
@media (max-width: 768px) {
    .page-s7-8-bg {
        background-position: center center;
    }
}
/* =========================================
   PAGE 9: MYSTIC PROCESSION (ZUCCARI)
   ========================================= */
.page-s7-9 {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1a0f0a;
}
.page-s7-9-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('images/section-7-procession.jpg');
    background-size: cover;
    background-position: center;
    z-index: 1;
    transform: scale(1.05);
    transition: transform 2s cubic-bezier(0.25, 1, 0.5, 1);
}
.page-s7-9.in-view .page-s7-9-bg {
    transform: scale(1);
}

/* Mobile Responsiveness for Page 9 */
@media (max-width: 768px) {
    .page-s7-9-bg {
        background-position: center center;
    }
}
/* =========================================
   PAGE 10: SERMONETA ILLUSTRATIONS
   ========================================= */
.page-s7-10 {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1a0f0a;
}
.page-s7-10-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('images/section-7-sermoneta.jpg');
    background-size: cover;
    background-position: center;
    z-index: 1;
    transform: scale(1.05);
    transition: transform 2s cubic-bezier(0.25, 1, 0.5, 1);
}
.page-s7-10.in-view .page-s7-10-bg {
    transform: scale(1);
}

/* Mobile Responsiveness for Page 10 */
@media (max-width: 768px) {
    .page-s7-10-bg {
        background-position: center center;
    }
}
/* =========================================
   PAGE 11: INFERNO VIEW (CAETANI)
   ========================================= */
.page-s7-11 {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1a0f0a;
}
.page-s7-11-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('images/section-7-inferno.jpg');
    background-size: cover;
    background-position: center;
    z-index: 1;
    transform: scale(1.05);
    transition: transform 2s cubic-bezier(0.25, 1, 0.5, 1);
}
.page-s7-11.in-view .page-s7-11-bg {
    transform: scale(1);
}

/* Mobile Responsiveness for Page 11 */
@media (max-width: 768px) {
    .page-s7-11-bg {
        background-position: center center;
    }
}
/* =========================================
   PAGE 12: SALUTATION OF BEATRICE (ROSSETTI)
   ========================================= */
.page-s7-12 {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1a0f0a;
}
.page-s7-12-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('images/section-7-beatrice.jpg');
    background-size: cover;
    background-position: center;
    z-index: 1;
    transform: scale(1.05);
    transition: transform 2s cubic-bezier(0.25, 1, 0.5, 1);
}
.page-s7-12.in-view .page-s7-12-bg {
    transform: scale(1);
}

/* Mobile Responsiveness for Page 12 */
@media (max-width: 768px) {
    .page-s7-12-bg {
        background-position: center center;
    }
}