/* ==========================================================================
   RIA & GOKUL'S WEDDING SITE - STYLESHEET
   Aesthetics: Save The Date Ivory & Gold Keepsake Book on Atmospheric Table
   ========================================================================== */

/* --- RESET & VARIABLES --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --gold-primary: #D4AF37;
    --gold-light: #F3E5AB;
    --gold-dark: #AA820A;
    --burgundy: #6B1D2F;
    --forest-green: #1E3F20;
    --parchment-bg: #FAF6EE;
    --ink-dark: #2A211D;
    --ink-muted: #5C4D44;
    --leather-brown: #241711;

    --font-script: 'Alex Brush', cursive;
    --font-serif: 'Cormorant Garamond', Georgia, serif;
    --font-sans: 'Montserrat', -apple-system, sans-serif;
    
    --transition-smooth: 1.2s cubic-bezier(0.645, 0.045, 0.355, 1);
    --transition-fast: 0.3s ease;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #0d0806;
    font-family: var(--font-serif);
    color: var(--ink-dark);
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   LAYER 0: ATMOSPHERIC BACKGROUND SCENE (KERALA & PALMER HOUSE THEME)
   ========================================================================== */
.scene-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('assets/bg-scene-theme.jpg');
    background-size: cover;
    background-position: center center;
    z-index: 0;
    transition: transform 1.6s cubic-bezier(0.25, 1, 0.5, 1), filter 1.6s ease;
}

.ambient-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(13, 8, 6, 0.1) 0%, rgba(13, 8, 6, 0.65) 100%);
    pointer-events: none;
}

.candle-glow {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 65vw;
    height: 65vh;
    background: radial-gradient(circle, rgba(230, 160, 50, 0.2) 0%, rgba(0,0,0,0) 70%);
    pointer-events: none;
    animation: flicker 4s ease-in-out infinite alternate;
}

@keyframes flicker {
    0% { opacity: 0.8; transform: translate(-50%, -50%) scale(0.98); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.03); }
    100% { opacity: 0.85; transform: translate(-50%, -50%) scale(0.99); }
}

/* Background Shift on Open */
body.book-is-open .scene-background {
    transform: scale(1.05);
    filter: blur(10px) brightness(0.4);
}

/* Floating top buttons are hidden */
.close-book-btn {
    display: none !important;
}

/* SWIPE HINT TOAST FOR MOBILE */
.swipe-hint-toast {
    position: fixed;
    bottom: 75px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(36, 23, 17, 0.92);
    border: 1px solid var(--gold-primary);
    color: var(--gold-light);
    padding: 8px 18px;
    border-radius: 20px;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    z-index: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.swipe-hint-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   LAYER 1: 3D VIEWPORT & BOOK STRUCTURE (EXPANDED DESKTOP SIZE)
   ========================================================================== */
.book-experience-wrapper {
    position: relative;
    z-index: 10;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 2500px;
    -webkit-perspective: 2500px;
}

/* ZERO STATE: Larger 3D closed book laying on table */
.book-structure {
    position: relative;
    width: 46vw;
    max-width: 640px;
    height: 86vh;
    max-height: 900px;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    transition: transform var(--transition-smooth), width var(--transition-smooth), height var(--transition-smooth);
    transform: rotateX(10deg) rotateY(-6deg) translateY(10px);
    -webkit-transform: rotateX(10deg) rotateY(-6deg) translateY(10px);
    cursor: pointer;
}

/* OPENED STATE: Expanded 2-page spread covering 94vw width / 93vh height */
body.book-is-open .book-structure {
    width: 47vw;
    max-width: 720px;
    height: 93vh;
    max-height: 960px;
    transform: rotateX(0deg) rotateY(0deg) translateX(50%) translateY(0);
    -webkit-transform: rotateX(0deg) rotateY(0deg) translateX(50%) translateY(0);
    cursor: default;
}

/* ==========================================================================
   INSIDE PAGES & COVER PANELS
   ========================================================================== */
.page-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    border-radius: 4px 14px 14px 4px;
    box-shadow: 
        inset 10px 0 30px rgba(0,0,0,0.2),
        20px 20px 50px rgba(0,0,0,0.7);
}

/* Inside Right Page */
.page-container.right-page {
    background: radial-gradient(circle at 50% 40%, #FFFDF9 0%, #FAF5EB 70%, #F4EBE0 100%);
    z-index: 1;
    display: flex;
    flex-direction: column;
    padding: 42px 52px 28px 52px;
    position: relative;
    border-left: 2px solid rgba(138, 109, 59, 0.35);
}

/* Inner Spine shadow crease (Desktop 2-Page Book Crease) */
.right-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 35px;
    height: 100%;
    background: linear-gradient(to right, rgba(0,0,0,0.22) 0%, rgba(0,0,0,0) 100%);
    pointer-events: none;
    z-index: 5;
}

/* Viewport for Book Chapters */
.book-content-viewport {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    padding-right: 20px;
    margin-right: -4px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    scroll-behavior: auto;
}

/* Custom Scrollbar for vertical page scrolling */
.book-content-viewport::-webkit-scrollbar {
    width: 6px;
    height: 0;
}
.book-content-viewport::-webkit-scrollbar-track {
    background: rgba(212, 175, 55, 0.08);
    border-radius: 10px;
    margin: 8px 0;
}
.book-content-viewport::-webkit-scrollbar-thumb {
    background: rgba(184, 134, 11, 0.45);
    border-radius: 10px;
}
.book-content-viewport::-webkit-scrollbar-thumb:hover {
    background: var(--gold-dark);
}

/* ==========================================================================
   DIRECTIONAL PAGE TURN ANIMATIONS (FORWARD vs BACKWARD)
   ========================================================================== */
.book-chapter {
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.book-chapter.active {
    display: block;
    opacity: 1;
}

/* FORWARD PAGE TURN: Smooth weighted entry from right */
.page-turn-forward .book-chapter.active {
    animation: pageTurnForward 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

/* BACKWARD PAGE TURN: Smooth weighted entry from left */
.page-turn-backward .book-chapter.active {
    animation: pageTurnBackward 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes pageTurnForward {
    0% {
        opacity: 0;
        transform: translateX(30px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes pageTurnBackward {
    0% {
        opacity: 0;
        transform: translateX(-30px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.chapter-inner {
    padding: 6px 12px 6px 4px;
}

.text-center { text-align: center; }

.sub-heading {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--gold-dark);
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
}

.main-title, .chapter-title {
    font-size: clamp(2.2rem, 3.8vw, 3.2rem);
    font-weight: 700;
    color: var(--burgundy);
    margin-bottom: 6px;
    line-height: 1.1;
}

.gold-divider {
    color: var(--gold-primary);
    font-size: 0.95rem;
    letter-spacing: 8px;
    margin: 10px 0 22px 0;
}

/* ==========================================================================
   CHAPTER CONTENT STYLES
   ========================================================================== */

/* TABLE OF CONTENTS NAVIGATION */
.toc-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 14px 0;
}

.toc-item {
    display: flex;
    align-items: center;
    padding: 16px 22px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(212, 175, 55, 0.45);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.toc-item:hover {
    background: #ffffff;
    border-color: var(--gold-primary);
    transform: translateX(5px);
    box-shadow: 0 6px 16px rgba(107, 29, 47, 0.12);
}

.toc-num {
    font-family: var(--font-serif);
    font-size: 1.45rem;
    font-weight: 600;
    color: var(--gold-dark);
    margin-right: 18px;
    min-width: 30px;
}

.toc-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.toc-name {
    font-size: 1.22rem;
    font-weight: 500;
    color: var(--ink-dark);
}

.toc-desc {
    font-family: var(--font-sans);
    font-size: 0.78rem;
    color: var(--ink-muted);
    margin-top: 2px;
}

.toc-arrow {
    color: var(--gold-primary);
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.toc-item:hover .toc-arrow {
    transform: translateX(5px);
    color: var(--burgundy);
}

/* COMING SOON SECTION STYLING */
.coming-soon-section {
    margin-top: 20px;
}

.coming-soon-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.cs-line {
    flex: 1;
    height: 1px;
    background: rgba(212, 175, 55, 0.35);
}

.cs-badge {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--gold-dark);
    font-weight: 600;
}

.toc-item.disabled-item {
    opacity: 0.65;
    background: rgba(250, 246, 238, 0.4);
    border-style: dashed;
    border-color: rgba(212, 175, 55, 0.35);
    cursor: not-allowed;
    transition: var(--transition-fast);
}

.toc-item.disabled-item:hover {
    transform: none;
    background: rgba(250, 246, 238, 0.6);
    box-shadow: none;
}

.toc-item.disabled-item:hover {
    transform: none;
    background: rgba(250, 246, 238, 0.6);
    box-shadow: none;
}

.coming-soon-tag {
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--burgundy);
    background: rgba(107, 29, 47, 0.08);
    border: 1px solid rgba(107, 29, 47, 0.2);
    padding: 3px 10px;
    border-radius: 12px;
    white-space: nowrap;
}

.ribbon-tab.disabled-ribbon {
    opacity: 0.45;
    background: #6c757d !important;
    cursor: not-allowed;
}

.ribbon-tab.disabled-ribbon:hover {
    transform: none !important;
    background: #6c757d !important;
}

.wedding-date-badge {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    letter-spacing: 2px;
    color: var(--burgundy);
    margin-top: 24px;
    font-weight: 600;
}

/* 02. Journal Entry Story Styling */
.journal-sub-heading {
    font-family: var(--font-sans);
    font-size: 0.78rem;
    letter-spacing: 3.5px;
    text-transform: uppercase;
    color: var(--gold-dark);
    font-weight: 600;
    display: block;
    margin-bottom: 2px;
}

.journal-milestones {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin: 12px 0 22px 0;
    padding: 8px 14px;
    background: rgba(212, 175, 55, 0.08);
    border: 1px dashed rgba(212, 175, 55, 0.4);
    border-radius: 20px;
}

.j-badge {
    font-family: var(--font-sans);
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--burgundy);
    letter-spacing: 0.5px;
}

.j-sep {
    color: var(--gold-dark);
    font-size: 0.7rem;
    opacity: 0.7;
}

.journal-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
    font-family: var(--font-serif);
}

.journal-paragraph {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.8;
    color: #1A110B;
    text-align: left;
    margin: 0;
    letter-spacing: 0.1px;
}

.journal-dropcap {
    float: left;
    font-family: var(--font-script);
    font-size: 4.6rem;
    line-height: 0.72;
    padding-top: 4px;
    padding-right: 12px;
    padding-left: 2px;
    color: var(--burgundy);
    font-weight: normal;
    filter: drop-shadow(0 1px 2px rgba(107, 29, 47, 0.2));
}

.highlight-paragraph {
    background: rgba(255, 255, 255, 0.85);
    padding: 18px 22px;
    border-left: 4px solid var(--gold-primary);
    border-radius: 0 12px 12px 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.journal-final-line {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.35rem;
    font-weight: 700;
    font-style: italic;
    color: var(--burgundy);
    line-height: 1.6;
    margin-top: 8px;
    padding: 16px 20px;
    background: rgba(212, 175, 55, 0.12);
    border: 1.5px dashed rgba(212, 175, 55, 0.55);
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(107, 29, 47, 0.08);
}

/* 04. SEGMENTED PILL TAB CONTROLLER & DEDICATED IN-PLACE VIEWPORT */
.gallery-segmented-control {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    background: #FAF6EE;
    border: 1.5px solid rgba(212, 175, 55, 0.45);
    padding: 5px;
    border-radius: 28px;
    margin-bottom: 18px;
}

.gallery-pill-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    border: none;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    user-select: none;
}

.pill-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.pill-title {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--leather-brown);
}

.gallery-pill-btn:hover {
    background: rgba(212, 175, 55, 0.15);
}

.gallery-pill-btn.active {
    background: var(--burgundy);
    border: 1px solid var(--gold-primary);
}

.gallery-pill-btn.active .pill-title {
    color: var(--gold-light);
    font-weight: 500;
}

.gallery-active-viewport {
    position: relative;
    width: 100%;
    transform: translateZ(0);
    contain: content;
}

.gallery-grid {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 12px;
}

.gallery-grid.active {
    display: grid;
}

/* Ultra-Lightweight 0ms Instant Photo Card Item */
.gallery-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #FAF6EE;
    border: 2px solid transparent;
    box-sizing: border-box;
}

.gallery-item:hover {
    border-color: var(--gold-primary);
    outline: 2px solid var(--burgundy);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-overlay {
    display: none;
}

/* Empty folder notice placeholder */
.empty-folder-notice {
    grid-column: 1 / -1;
    text-align: center;
    padding: 24px 16px;
    background: rgba(250, 246, 238, 0.6);
    border: 1px dashed rgba(212, 175, 55, 0.4);
    border-radius: 10px;
    color: var(--ink-muted);
}

.empty-folder-notice .notice-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 6px;
}

.empty-folder-notice code {
    font-family: monospace;
    color: var(--burgundy);
    background: rgba(107, 29, 47, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
}

.gallery-item:hover img {
    transform: scale(1.08);
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

/* 05. Guest Contact Form */
.rsvp-subtext {
    font-family: var(--font-sans);
    font-size: 0.82rem;
    color: var(--ink-muted);
    margin-bottom: 6px;
}

.rsvp-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink-dark);
}

.form-group-row {
    display: flex;
    gap: 12px;
}

.form-group-row .form-group {
    flex: 1;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group select,
.form-group textarea {
    padding: 10px 14px;
    border: 1px solid rgba(212, 175, 55, 0.5);
    border-radius: 8px;
    background: #ffffff;
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--ink-dark);
    outline: none;
    transition: var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--burgundy);
    box-shadow: 0 0 0 3px rgba(107, 29, 47, 0.12);
}

.submit-rsvp-btn {
    margin-top: 10px;
    background: var(--burgundy);
    color: var(--gold-light);
    border: 1px solid var(--gold-primary);
    padding: 12px 24px;
    border-radius: 28px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
}

.submit-rsvp-btn:hover {
    background: var(--leather-brown);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(107, 29, 47, 0.35);
}

.rsvp-success-card {
    padding: 46px 32px;
    margin: 32px auto;
    max-width: 500px;
    background: linear-gradient(135deg, #FFFDF9 0%, #FAF5EB 100%);
    border: 2px solid var(--gold-primary);
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(107, 29, 47, 0.1), inset 0 0 20px rgba(212, 175, 55, 0.12);
    position: relative;
}

.theme-monogram-crest {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--gold-dark);
    letter-spacing: 3px;
    margin-bottom: 12px;
    display: inline-block;
    padding: 4px 18px;
    border-bottom: 1px solid var(--gold-primary);
}

.success-title {
    font-family: var(--font-serif);
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--burgundy);
    margin-bottom: 8px;
    line-height: 1.2;
}

.success-message {
    font-family: var(--font-serif);
    font-size: 1.22rem;
    font-weight: 500;
    color: var(--ink-dark);
    line-height: 1.7;
    margin: 18px 0;
}

.hidden { display: none !important; }

.edit-rsvp-btn {
    margin-top: 10px;
    background: var(--burgundy);
    border: 1px solid var(--gold-primary);
    color: var(--gold-light);
    padding: 10px 24px;
    border-radius: 22px;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(107, 29, 47, 0.2);
    transition: all 0.2s ease;
}

.edit-rsvp-btn:hover {
    background: var(--leather-brown);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(107, 29, 47, 0.3);
}

/* ==========================================================================
   PAGE FOOTER NAVIGATION CONTROLS (INTEGRATED ON ALL SCREENS)
   ========================================================================== */
.page-footer-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    margin-top: auto;
    border-top: 1px solid rgba(212, 175, 55, 0.3);
}

.page-indicator-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Integrated Navigation Close / Back Button */
.nav-close-btn {
    display: inline-flex;
    background: rgba(107, 29, 47, 0.08);
    border: 1px solid var(--gold-primary);
    color: var(--burgundy);
    padding: 5px 14px;
    border-radius: 16px;
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    align-items: center;
    gap: 4px;
}

.nav-close-btn:hover {
    background: var(--burgundy);
    color: var(--gold-light);
}

.nav-arrow {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--gold-primary);
    color: var(--burgundy);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.nav-arrow:hover {
    background: var(--burgundy);
    color: var(--gold-light);
}

.page-indicator {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    letter-spacing: 1px;
    color: var(--ink-muted);
    font-weight: 600;
}

/* ==========================================================================
   RIBBON BOOKMARK TABS (Right Edge on Desktop)
   ========================================================================== */
.ribbon-bookmarks {
    position: absolute;
    right: -26px;
    top: 50px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease 0.6s;
}

body.book-is-open .ribbon-bookmarks {
    opacity: 1;
    pointer-events: auto;
}

.ribbon-tab {
    background: var(--burgundy);
    color: var(--gold-light);
    border: none;
    padding: 12px 7px;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    box-shadow: 4px 4px 10px rgba(0,0,0,0.35);
    transition: var(--transition-fast);
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.ribbon-text {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.ribbon-tab:nth-child(2) { background: #8B263E; }
.ribbon-tab:nth-child(3) { background: #A03C26; }
.ribbon-tab:nth-child(4) { background: #7B5219; }

.ribbon-tab.active, .ribbon-tab:hover {
    transform: translateX(10px);
    background: var(--gold-dark);
    color: #ffffff;
}

/* ==========================================================================
   FLIPPING COVER FRONT PANEL & WAX SEAL (FLAT 2D SEAMLESS ALIGNMENT)
   ========================================================================== */
.cover-front-panel {
    position: absolute;
    inset: 0;
    z-index: 100;
    transform-origin: left center;
    -webkit-transform-origin: left center;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    transition: transform var(--transition-smooth);
    transform: rotateY(0deg) translateZ(0);
    -webkit-transform: rotateY(0deg) translateZ(0);
    will-change: transform;
    cursor: pointer;
}

body.book-is-open .cover-front-panel {
    transform: rotateY(-180deg) translateZ(0);
    -webkit-transform: rotateY(-180deg) translateZ(0);
    z-index: 10;
}

/* OUTSIDE FRONT COVER (FLAT 2D SAVETHE DATE COVER FACE) */
.cover-outside {
    position: absolute;
    inset: 0;
    background-image: url('assets/book-cover-ivory-gold.jpg');
    background-size: 100% 100%;
    background-position: center center;
    background-repeat: no-repeat;
    background-color: #FAF6EE;
    border-radius: 4px 14px 14px 4px;
    border: 2px solid #D4AF37;
    box-shadow: 
        inset 0 0 25px rgba(0,0,0,0.1),
        0 20px 50px rgba(0,0,0,0.85),
        0 0 30px rgba(212, 175, 55, 0.4);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: rotateY(0deg) translateZ(2px);
    -webkit-transform: rotateY(0deg) translateZ(2px);
    z-index: 2;
}

.cover-gold-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 9.8%;
    background: transparent;
    pointer-events: none;
}

/* Interactive Cover Artwork Lotus Flower Trigger (Horizontal Alignment & Silky Hover Glow) */
.seal-trigger-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    margin-left: 12px;
}

.cover-lotus-trigger-btn {
    position: relative;
    width: 140px;
    height: 90px;
    background: transparent;
    border: none;
    cursor: pointer;
    outline: none;
    border-radius: 45px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lotus-glow-ring {
    position: absolute;
    width: 125px;
    height: 80px;
    border-radius: 50%;
    border: none;
    background: radial-gradient(ellipse at center, rgba(255, 245, 192, 0) 0%, rgba(212, 175, 55, 0) 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease, background 0.4s ease, transform 0.4s ease, box-shadow 0.4s ease;
}

/* Elegant, larger hover glow response */
.cover-lotus-trigger-btn:hover .lotus-glow-ring {
    opacity: 1;
    background: radial-gradient(ellipse at center, rgba(255, 245, 192, 0.6) 0%, rgba(212, 175, 55, 0.35) 55%, rgba(212, 175, 55, 0) 85%);
    box-shadow: 0 0 35px rgba(212, 175, 55, 0.6);
    transform: scale(1.12);
}

.seal-tooltip {
    display: none !important;
}

@keyframes floatTooltip {
    0% { transform: translate(-50%, 0); }
    100% { transform: translate(-50%, -4px); }
}

.brass-lamp-emblem {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #FFF5C0 0%, #D4AF37 55%, #8A6D3B 100%);
    border: 2px solid var(--gold-light);
    box-shadow: 
        0 6px 18px rgba(0, 0, 0, 0.4),
        inset 0 2px 5px rgba(255, 255, 255, 0.8),
        inset 0 -2px 6px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lamp-flame-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.35));
}

.wax-seal-button:hover .brass-lamp-emblem {
    transform: scale(1.12) rotate(6deg);
}

.seal-ring-pulse {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid var(--gold-primary);
    animation: pulseRing 2.2s infinite;
}

@keyframes pulseRing {
    0% { transform: scale(0.9); opacity: 0.9; }
    70% { transform: scale(1.25); opacity: 0; }
    100% { transform: scale(0.9); opacity: 0; }
}

.seal-tooltip {
    position: absolute;
    bottom: -34px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(36, 23, 17, 0.95);
    border: 1px solid var(--gold-primary);
    color: var(--gold-light);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    letter-spacing: 1px;
    white-space: nowrap;
    padding: 6px 14px;
    border-radius: 15px;
    box-shadow: 0 6px 14px rgba(0,0,0,0.5);
    animation: floatTooltip 2s ease-in-out infinite alternate;
}

@keyframes floatTooltip {
    0% { transform: translate(-50%, 0); }
    100% { transform: translate(-50%, -5px); }
}

.wax-seal-button:hover .seal-img {
    transform: scale(1.12) rotate(6deg);
}

/* INSIDE FRONT COVER */
.cover-inside {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 40%, #FFFDF9 0%, #FAF5EB 70%, #F4EBE0 100%);
    border-radius: 14px 4px 4px 14px;
    border-right: 2px solid rgba(138, 109, 59, 0.35);
    box-shadow: 
        inset 10px 0 30px rgba(0,0,0,0.15),
        -15px 15px 40px rgba(0,0,0,0.5);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: rotateY(180deg) translateZ(2px);
    -webkit-transform: rotateY(180deg) translateZ(2px);
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 32px 28px 24px 28px;
}

.inside-cover-content {
    max-width: 98%;
    width: 100%;
}

.welcome-tag {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    letter-spacing: 4.5px;
    text-transform: uppercase;
    color: var(--gold-dark);
    font-weight: 600;
    margin-top: 4px;
    margin-bottom: 8px;
    display: block;
}

.couple-names {
    font-family: var(--font-script);
    font-size: 4.0rem;
    color: var(--burgundy);
    margin: 6px 0 20px 0;
    line-height: 1.05;
}

.inside-portrait-wrapper {
    width: 360px;
    height: 465px;
    max-width: 96%;
    margin: 0 auto 24px auto;
    border-radius: 180px 180px 22px 22px;
    padding: 8px;
    border: 2px solid var(--gold-primary);
    box-shadow: 0 18px 46px rgba(0,0,0,0.3), inset 0 0 20px rgba(212, 175, 55, 0.3);
    background: #FAF6EE;
}

.inside-portrait {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    border-radius: 172px 172px 16px 16px;
}

.welcome-quote {
    font-style: italic;
    font-size: 1.05rem;
    color: var(--ink-dark);
    margin: 26px 0 32px 0;
    line-height: 1.55;
    font-weight: 500;
    padding: 0 10px;
}

.invite-line {
    font-family: var(--font-sans);
    font-size: 0.94rem;
    color: var(--ink-muted);
    line-height: 1.55;
    margin-bottom: 22px;
    padding: 0 10px;
}

.venue-date-callout {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px dashed rgba(212, 175, 55, 0.45);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.venue-title {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--burgundy);
    letter-spacing: 4px;
}

.venue-date {
    font-family: var(--font-sans);
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--gold-dark);
    letter-spacing: 4.5px;
}

/* ==========================================================================
   LIGHTBOX MODAL & CAROUSEL VIEWPORT
   ========================================================================== */
.lightbox-modal {
    position: fixed;
    inset: 0;
    z-index: 2500;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.lightbox-modal.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 6, 4, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.lightbox-wrapper {
    position: relative;
    z-index: 10;
    width: 94vw;
    max-width: 1150px;
    height: 92vh;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
}

.lightbox-header {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0 8px;
}

.lightbox-counter {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gold-light);
    letter-spacing: 2px;
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.35);
    padding: 5px 14px;
    border-radius: 20px;
}

.lightbox-close {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.4);
    color: #FFFFFF;
    font-size: 1.8rem;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
    transition: all 0.25s ease;
}

.lightbox-close:hover {
    background: var(--burgundy);
    border-color: var(--gold-primary);
    transform: scale(1.1);
}

.lightbox-body {
    position: relative;
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    overflow: hidden;
}

.lightbox-img-container {
    position: relative;
    flex: 1;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-img {
    position: absolute;
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 10px;
    border: 2px solid var(--gold-primary);
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.85);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.lightbox-img.active {
    position: relative;
    opacity: 1;
    pointer-events: auto;
}

.lightbox-nav {
    background: rgba(255, 255, 255, 0.15);
    border: 1.5px solid rgba(212, 175, 55, 0.45);
    color: var(--gold-light);
    font-size: 2.2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.25s ease;
    z-index: 20;
    user-select: none;
}

.lightbox-nav:hover {
    background: var(--burgundy);
    border-color: var(--gold-primary);
    color: #FFFFFF;
    transform: scale(1.12);
    box-shadow: 0 6px 20px rgba(107, 29, 47, 0.5);
}

/* ==========================================================================
   STRICT RESPONSIVE DESIGN FOR MOBILE ONLY (< 768px)
   ========================================================================== */
@media (max-width: 768px) {
    .book-experience-wrapper {
        perspective: 1500px;
        -webkit-perspective: 1500px;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    /* NORMAL UN-EXTENDED CLOSED BOOK IN ZERO STATE (3:4 Natural Proportions) */
    .book-structure {
        width: min(84vw, 400px);
        height: calc(min(84vw, 400px) * 1.33);
        max-height: 74vh;
        transform: rotateX(6deg) translateY(5px);
        -webkit-transform: rotateX(6deg) translateY(5px);
        transition: transform 1.2s cubic-bezier(0.645, 0.045, 0.355, 1), width 1.2s cubic-bezier(0.645, 0.045, 0.355, 1), height 1.2s cubic-bezier(0.645, 0.045, 0.355, 1);
        will-change: transform, width, height;
    }

    /* OPENED BOOK: Safari Default (Eliminates bottom dark gap on Mobile Safari) */
    body.book-is-open .book-structure {
        width: 96vw;
        height: calc(100dvh - 54px);
        height: calc(100vh - 75px);
        max-height: 770px;
        transform: rotateX(0deg) rotateY(0deg) translateX(0) translateY(-14px);
        -webkit-transform: rotateX(0deg) rotateY(0deg) translateX(0) translateY(-14px);
    }

    /* OPENED BOOK: Mobile Chrome Targeted (Clears Chrome's bottom toolbar perfectly) */
    body.is-chrome-browser.book-is-open .book-structure {
        height: calc(100dvh - 90px) !important;
        height: calc(100vh - 115px) !important;
        max-height: 710px !important;
        transform: rotateX(0deg) rotateY(0deg) translateX(0) translateY(-38px) !important;
        -webkit-transform: rotateX(0deg) rotateY(0deg) translateX(0) translateY(-38px) !important;
    }

    .cover-front-panel {
        transition: transform 1.2s cubic-bezier(0.645, 0.045, 0.355, 1);
    }



    /* Timed Asymmetric Page Reveal: Zero Flickering on Open & Close */
    .page-container.right-page {
        padding: 28px 16px 20px 16px;
        opacity: 0;
        transition: opacity 0.35s ease 0.65s;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        will-change: opacity;
    }

    body.book-is-open .page-container.right-page {
        opacity: 1;
        transition: opacity 0.4s ease 0.4s;
    }

    .book-content-viewport {
        padding-top: 4px;
        padding-bottom: 12px;
    }

    /* Top Ribbon Bookmark Bar - Active Tabs Only on Mobile Screens */
    .ribbon-bookmarks {
        position: absolute;
        right: 12px;
        left: 12px;
        top: 2px;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        gap: 6px;
        z-index: 20;
    }

    .ribbon-tab {
        writing-mode: horizontal-tb;
        text-orientation: unset;
        padding: 5px 4px;
        border-radius: 4px 4px 0 0;
        font-size: 0.65rem;
        letter-spacing: 0.3px;
        flex: 1;
        text-align: center;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }

    /* Hide Disabled Ribbon Tabs on Mobile Screens Only (Kept on TOC) */
    .ribbon-tab.disabled-ribbon {
        display: none !important;
    }

    .ribbon-tab.active, .ribbon-tab:hover {
        transform: translateY(2px);
    }



    .sub-heading {
        font-size: 0.72rem;
        margin-bottom: 2px;
    }

    .main-title, .chapter-title {
        font-size: 1.65rem;
        margin-bottom: 4px;
    }

    .gold-divider {
        margin: 6px 0 12px 0;
        font-size: 0.85rem;
        letter-spacing: 5px;
    }

    /* Mobile Journal Entry Styling */
    .journal-paragraph {
        font-size: 1.10rem;
        line-height: 1.65;
        text-align: left;
        font-weight: 400;
    }

    .journal-dropcap {
        font-size: 3.8rem;
        padding-right: 8px;
    }

    .journal-final-line {
        font-size: 1.18rem;
        padding: 14px 16px;
    }

    .journal-milestones {
        gap: 4px 8px;
        padding: 6px 10px;
        margin: 8px 0 16px 0;
    }

    .j-badge {
        font-size: 0.70rem;
    }

    /* LARGER ACCESSIBLE TABLE OF CONTENTS SELECTIONS ON MOBILE */
    .toc-list {
        gap: 12px;
        margin: 10px 0;
    }

    .toc-item {
        padding: 14px 16px;
        border-radius: 10px;
        min-height: 52px;
    }

    .toc-num {
        font-size: 1.3rem;
        margin-right: 14px;
        min-width: 28px;
    }

    .toc-name {
        font-size: 1.15rem;
        font-weight: 500;
    }

    .toc-desc {
        font-size: 0.82rem;
    }

    .coming-soon-section {
        margin-top: 14px;
    }

    .wedding-date-badge {
        margin-top: 12px;
        font-size: 0.78rem;
    }

    /* Page Footer Navigation */
    .page-footer-nav {
        padding-top: 8px;
        margin-top: 8px;
    }

    .nav-arrow {
        width: 34px;
        height: 34px;
        font-size: 1.15rem;
    }

    .page-indicator {
        font-size: 0.78rem;
    }

    /* Story Grid Compact Layout */
    .story-timeline {
        gap: 14px;
    }

    .story-card {
        padding: 12px 14px;
    }

    .story-card h3 {
        font-size: 1.2rem;
    }

    .story-card p {
        font-size: 0.95rem;
    }

    /* Inside Cover Mobile Adjustments */
    .cover-inside {
        padding: 24px 18px;
    }

    .couple-names {
        font-size: 2.4rem;
    }

    .inside-portrait-wrapper {
        width: 120px;
        height: 120px;
        margin-bottom: 12px;
    }

    .welcome-quote {
        font-size: 1rem;
    }

    .wax-seal-button {
        width: 75px;
        height: 75px;
    }

    .cover-gold-overlay {
        padding-bottom: 15%;
    }

    /* Mobile Page & Spine Centering Adjustments (Mobile Only Flat Surface & Clean Navigation) */
    .right-page, .page-container.right-page {
        background: #FAF6EE !important;
        border-left: none !important;
        border-right: none !important;
        box-shadow: none !important;
        padding: 22px 14px 4px 14px !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        position: relative !important;
        overflow: hidden !important;
    }

    .right-page::before,
    .right-page::after,
    .page-container::before,
    .page-container::after {
        display: none !important;
        content: none !important;
        background: none !important;
        opacity: 0 !important;
        width: 0 !important;
    }

    /* Flexbox Min-Height 0 Fix: Ensures footer nav bar stays pinned at bottom without being pushed out of view */
    .book-content-viewport {
        flex: 1 1 0% !important;
        min-height: 0 !important;
        max-height: calc(100% - 46px) !important;
        overflow-y: auto !important;
        padding-right: 0 !important;
        margin-right: 0 !important;
        padding-bottom: 8px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .chapter-inner {
        width: 100% !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
    }

    /* Mobile Page Footer Navigation Bar (Visible ONLY when book is OPEN on Mobile) */
    body.book-is-open .page-footer-nav {
        display: flex !important;
        position: relative !important;
        flex-shrink: 0 !important;
        height: 44px !important;
        min-height: 44px !important;
        max-height: 44px !important;
        margin-top: auto !important;
        padding-top: 4px !important;
        padding-bottom: 2px !important;
        border-top: 1px solid rgba(212, 175, 55, 0.4) !important;
        background: #FAF6EE !important;
        z-index: 50 !important;
        box-sizing: border-box !important;
    }

    /* Hide footer navigation completely when book cover is CLOSED on Mobile */
    body:not(.book-is-open) .page-footer-nav {
        display: none !important;
    }

    /* Mobile Segmented Pill Bar Selector (Clean Centered Layout) */
    .gallery-segmented-control {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 16px 0 !important;
        padding: 4px !important;
        gap: 4px !important;
        border-radius: 20px !important;
        box-sizing: border-box !important;
    }

    .gallery-pill-btn {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        padding: 7px 4px !important;
        border-radius: 16px !important;
        gap: 4px !important;
    }

    .pill-icon {
        font-size: 0.95rem !important;
    }

    .pill-title {
        font-size: 0.82rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* Mobile Gallery Grid (2 Columns, Clean Spacing) */
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    /* Full-Screen Mobile Lightbox Expanded View */
    .lightbox-modal .lightbox-wrapper {
        width: 98vw !important;
        max-width: 98vw !important;
        height: 94vh !important;
        max-height: 94vh !important;
        padding: 8px !important;
        border-radius: 12px !important;
    }

    .lightbox-body {
        position: relative !important;
        flex: 1 !important;
        width: 100% !important;
        height: 100% !important;
        gap: 0 !important;
    }

    .lightbox-img-container {
        width: 100% !important;
        height: 100% !important;
    }

    .lightbox-img {
        max-width: 100% !important;
        max-height: 88vh !important;
        border-width: 1px !important;
    }

    /* Hide Arrow Buttons on Mobile to Maximize Photo Space */
    .lightbox-nav {
        display: none !important;
    }

    /* Mobile Auto-Fading Swipe Gesture Hint Pill */
    .lightbox-swipe-hint {
        display: flex !important;
        align-items: center;
        justify-content: center;
        position: absolute;
        bottom: 24px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(15, 10, 8, 0.85);
        border: 1px solid rgba(212, 175, 55, 0.5);
        color: var(--gold-light);
        font-family: var(--font-sans);
        font-size: 0.78rem;
        font-weight: 500;
        letter-spacing: 0.5px;
        padding: 7px 18px;
        border-radius: 20px;
        z-index: 50;
        pointer-events: none;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
        animation: fadeHint 3.2s forwards ease-in-out;
    }

    @keyframes fadeHint {
        0% { opacity: 0; transform: translate(-50%, 8px); }
        15% { opacity: 1; transform: translate(-50%, 0); }
        70% { opacity: 1; transform: translate(-50%, 0); }
        100% { opacity: 0; transform: translate(-50%, -4px); visibility: hidden; }
    }

    .lightbox-close {
        width: 38px !important;
        height: 38px !important;
        font-size: 1.5rem !important;
        background: rgba(0, 0, 0, 0.6) !important;
    }
}