/* Turn.js Flipbook Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Las Vegas sample turn.js enhancements */
.turn-magazine {
    overflow: visible; /* Allow page peel/fold overlay to render outside container */
    will-change: transform;
}

.flipbook-viewport {
    overflow: hidden; /* Ensure viewport also hides overflow */
}

.turn-magazine .gradient {
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 100%;
    pointer-events: none; /* Don't block corner hover/peel */
}

.turn-magazine.double .even .gradient {
    background: -webkit-gradient(linear, left top, right top, color-stop(0, rgba(0,0,0,0)), color-stop(1, rgba(0,0,0,0.2)));
    background-image: -webkit-linear-gradient(left, rgba(0,0,0,0) 0%, rgba(0,0,0,0.2) 100%);
    background-image: -moz-linear-gradient(left, rgba(0,0,0,0) 0%, rgba(0,0,0,0.2) 100%);
    background-image: -ms-linear-gradient(left, rgba(0,0,0,0) 0%, rgba(0,0,0,0.2) 100%);
    background-image: -o-linear-gradient(left, rgba(0,0,0,0) 0%, rgba(0,0,0,0.2) 100%);
    background-image: linear-gradient(left, rgba(0,0,0,0) 0%, rgba(0,0,0,0.2) 100%);
}

.turn-magazine.double .odd .gradient,
.turn-magazine.single .even .gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 100%;
    border-left: 1px solid rgba(0,0,0,0.30);
    background: -webkit-gradient(linear, right top, left top, color-stop(0, rgba(0,0,0,0)), color-stop(1, rgba(0,0,0,0.2)));
    background-image: -webkit-linear-gradient(right, rgba(0,0,0,0) 0%, rgba(0,0,0,0.2) 100%);
    background-image: -moz-linear-gradient(right, rgba(0,0,0,0) 0%, rgba(0,0,0,0.2) 100%);
    background-image: -ms-linear-gradient(right, rgba(0,0,0,0) 0%, rgba(0,0,0,0.2) 100%);
    background-image: -o-linear-gradient(right, rgba(0,0,0,0) 0%, rgba(0,0,0,0.2) 100%);
    background-image: linear-gradient(right, rgba(0,0,0,0) 0%, rgba(0,0,0,0.2) 100%);
}

body {
    font-family: 'Georgia', serif;
    background: #b8aee6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    overflow-x: hidden;
    padding: 0; /* remove extra body padding to prevent vertical scroll */
    position: relative;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(184, 174, 230, 0.92);
    backdrop-filter: blur(2px);
    z-index: 9999;
}

.loading-spinner {
    width: 56px;
    height: 56px;
    border: 6px solid rgba(255,255,255,0.6);
    border-top-color: rgba(34,34,34,0.8);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin-bottom: 14px;
}

.loading-text {
    color: #222;
    font-weight: 700;
    letter-spacing: .3px;
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(255,255,255,0.6);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 14px;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.flipbook-viewport {
    overflow: hidden;
    width: 100%;
    height: 100vh; /* keep full viewport height; banner overlays without shifting */
    display: flex;
    justify-content: center;
    align-items: center; /* vertically centered */
    padding: 0 20px; /* horizontal padding only to avoid vertical overflow */
}

.flipbook-viewport .container {
    position: relative;
    margin: auto;
}

/* Flipbook container (turn.js will set the exact size via JS) */
.flipbook {
    margin: 0 auto;
    background: transparent;
    overflow: visible; /* Allow peel overlay */
    opacity: 0; /* Fade in after init to avoid flicker */
    transition: opacity .25s ease;
}

/* Force white only on the temporary single-page slot so peel/back appears white */
/* White page peels in single view (mobile) */
.single-peel-white .p-temporal { 
  background: #fff !important; 
  background-color: #fff !important;
}

/* Ensure page wrappers don't show overflow */
.flipbook .page-wrapper {
    overflow: hidden;
    position: absolute;
    background: transparent;
}

/* Hide any page content that might peek through */
.flipbook .page-content {
    overflow: hidden;
    position: relative;
}

/* Ensure wrappers don't paint over page 23 background layers */
.flipbook .page-wrapper:has(.page-content:has(.gazebo-overlay)) { background: transparent !important; }
.flipbook .page:has(.gazebo-overlay) { background: transparent !important; }
/* Don't override p-temporal for page 23 - let single-peel-white handle it */

/* Target page 23 explicitly as well */
.page-wrapper[page="23"] { background: transparent !important; }
.page-wrapper[page="23"] .page { background: transparent !important; }
.page-wrapper[page="23"] .page-content { background-color: transparent !important; }

/* Each page content wrapper */
.page-content {
    width: 100%;
    height: 100%;
    position: relative;
    background: #111; /* subtle bg behind images to avoid white gaps */
}

/* Explicit override for page 23 so overlay transparency reveals base art */
.page-content.p23 { background: transparent !important; background-color: transparent !important; }
.page-wrapper[page="23"] { background: transparent !important; }

/* Transparent page variant (for page 23 overlay) */
.page-content.transparent-page { background: transparent; }
.page-content.transparent-page img { background: transparent !important; }

.page-content[data-blank="1"] {
    background: #fff; /* clean blank page for cover/back padding */
}

.page-content img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* keep original aspect ratio, no stretch */
    display: block;
    background: #111;
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Clickable areas */
.clickable-area {
    position: absolute;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 5;
}

.gazebo-hotspot {
    border-radius: 0;
    background: transparent;
    border: none;
}

.gazebo-hotspot::after {
    content: '';
}

.gazebo-hotspot:hover {
    box-shadow: 0 0 0 3px rgba(255,255,255,0.75), 0 0 26px rgba(255,255,255,0.65);
}

/* RSVP overlay image that sits atop page 23 */
.gazebo-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none; /* click passes to hotspot */
    z-index: 2;
}

/* Clickable mask matching the overlay alpha, so only gazebo is clickable */
.gazebo-mask {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.001); /* gives element a hit area */
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
    cursor: default; /* JS will set pointer when opaque */
    z-index: 3;

}
.gazebo-mask:hover { 
    box-shadow: 0 0 0 4px rgba(255,255,255,0.9), 0 0 35px rgba(255,255,255,0.8); 
    transform: scale(1.02);
    transition: all 0.2s ease;
}

/* Mobile indicator: enhanced pulsing ring for better visibility */
@media (pointer: coarse), (max-width: 768px) {
    .gazebo-mask { 
        animation: gazebo-pulse 2s ease-in-out infinite !important;
        border-radius: 8px; /* Add subtle border radius for better pulse effect */
        /* Do not force pointer-events; JS controls interactivity based on alpha detection */
        /* Enhanced mobile shine effect - always visible */
        box-shadow: 0 0 0 3px rgba(255,255,255,0.9), 0 0 0 8px rgba(255,255,255,0.6), 0 0 0 15px rgba(255,255,255,0.3) !important;
        /* Additional mobile glow for better visibility */
        filter: drop-shadow(0 0 8px rgba(255,255,255,0.4));
        /* Ensure it sits above Turn.js layers on mobile */
        z-index: 5;
    }
    @keyframes gazebo-pulse {
        0%, 100% { 
            box-shadow: 0 0 0 3px rgba(255,255,255,0.9), 0 0 0 8px rgba(255,255,255,0.6), 0 0 0 15px rgba(255,255,255,0.3);
        }
        50% { 
            box-shadow: 0 0 0 3px rgba(255,255,255,0.95), 0 0 0 25px rgba(255,255,255,0.8), 0 0 0 40px rgba(255,255,255,0.4);
        }
    }
}

/* Navigation and UI Elements */
.nav-buttons { display:none; }

.container {
    display: grid;
    grid-template-columns: auto minmax(280px, 1fr) auto;
    align-items: center;
    gap: 16px;
}

.nav-arrow {
    background: rgba(255,255,255,0.35);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.35);
    color: #222;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.nav-arrow:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0,0,0,.12); background: rgba(255,255,255,0.55); }
.nav-arrow:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; transform: none; }

.nav-arrow-left { justify-self: end; }
.nav-arrow-right { justify-self: start; }

.page-counter { display: none; }
/* Bottom page progress bar (non-interactive) */
.page-progress {
    position: fixed;
    height: 6px;
    background: rgba(255,255,255,0.25);
    z-index: 10000;
    pointer-events: none; /* non-interactive */
}
.page-progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6 0%, #a855f7 100%);
    transition: width .2s ease;
}

/* Cursor status bar lives above the counter */
#cursorStatusBar { z-index: 10002; }

/* Dev tools panel (sits below cursor status) */
#devToolsPanel {
	position: fixed;
	top: 34px;
	left: 6px;
	z-index: 10002;
	font-family: monospace;
	font-size: 12px;
	padding: 4px 6px;
	background: rgba(0,0,0,0.55);
	color: #fff;
	border-radius: 6px;
	border: 1px solid rgba(255,255,255,0.25);
}
#devToolsPanel button{
	margin: 2px 4px 2px 0;
	padding: 4px 8px;
	font-size: 12px;
	border-radius: 4px;
	border: 1px solid rgba(255,255,255,0.35);
	background: rgba(255,255,255,0.85);
	color: #222;
	cursor: pointer;
}
#devToolsPanel.hidden { display: none; }

button {
    padding: 10px 20px;
    font-size: 16px;
    font-family: 'Georgia', serif;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.25s ease;
    color: #333;
    font-weight: 600;
}

button:hover { box-shadow: 0 5px 15px rgba(0,0,0,0.15); transform: translateY(-1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; transform: none; }

/* Mobile responsiveness */
@media (max-width: 768px) {
    .flipbook-viewport { min-height: 100svh; padding: 0 10px; }
    button { padding: 8px 14px; font-size: 14px; }
    .page-counter { font-size: 14px; padding: 6px 12px; }
    /* Center the flipbook when arrows are hidden */
    .container { grid-template-columns: 1fr; justify-items: center; }
}

/* Phone landscape: force centering with flex to avoid any grid offset */
@media (pointer: coarse) and (orientation: landscape) {
    .flipbook-viewport .container {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 0;
        width: 100%;
    }
}

/* Tablet desktop alignment helpers */
@media (min-width: 768px) {
    .flipbook-viewport .container { margin: 0 auto; }
}

/* Hide arrows on phones / coarse pointer devices */
@media (pointer: coarse), (max-width: 768px) {
    .nav-arrow { display: none !important; }
}

/* Invitation page styles (for invitation.html) */
body.invitation-page { background: #b8aee6; }

/* Hard-center the flipbook element in any layout */
.flipbook { margin-left: auto !important; margin-right: auto !important; }
.invitation-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; }
.invitation-container img { max-width: 100%; max-height: 90vh; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.back-button { position: fixed; top: 20px; left: 20px; padding: 10px 20px; background: rgba(255,255,255,.95); border: 2px solid rgba(255,255,255,.3); border-radius: 24px; color: #333; font-weight: 700; text-decoration: none; transition: all .25s; }
.back-button:hover { box-shadow: 0 5px 15px rgba(0,0,0,.15); transform: translateY(-1px); } 

/* Entry overlay for mobile fullscreen consent */
.entry-overlay { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,0.8); z-index: 10050; }
.entry-overlay .entry-button { padding: 14px 22px; font-size: 16px; border-radius: 999px; border: 2px solid rgba(255,255,255,0.7); background: rgba(0,0,0,0.6); color: #fff; cursor: pointer; }
.entry-overlay .entry-button:hover { box-shadow: 0 8px 20px rgba(0,0,0,0.35); }

/* Glow overlay state used by page 23 RSVP hover */
.glow-overlay { opacity: 0; transition: opacity .15s ease-out; }
.glow-overlay.active { opacity: 1; }

/* RSVP Box */
.rsvp-box {
    position: fixed; /* overlay; do not shift layout */
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);

    overflow: hidden;
    z-index: 15000; /* stays above site UI but below invitation overlay (which is 20000) */
    border: 3px solid rgba(255, 255, 255, 0.5);
    /* Responsive sizing and positioning */
    width: min(90vw, 1100px);
    max-width: 1100px;
    min-width: 280px;
    /* Smooth transitions for show/hide */
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Initial hidden state */
    opacity: 0;
}

/* Responsive positioning based on available space */
.rsvp-box.compact { top: 16px; width: min(94vw, 960px); }
.rsvp-box.normal { top: 18px; width: min(92vw, 1000px); }
.rsvp-box.spacious { top: 20px; width: min(90vw, 1050px); }
.rsvp-box.very-spacious { top: 22px; width: min(88vw, 1100px); }

.rsvp-box-content {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    gap: 16px;
    position: relative;
}

/* Responsive content sizing */
.rsvp-box.compact .rsvp-box-content {
    padding: 10px 14px;
    gap: 12px;
}

.rsvp-box.normal .rsvp-box-content {
    padding: 12px 18px;
    gap: 16px;
}

.rsvp-box.spacious .rsvp-box-content {
    padding: 16px 22px;
    gap: 20px;
}

.rsvp-box.very-spacious .rsvp-box-content {
    padding: 20px 26px;
    gap: 24px;
}

.rsvp-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.rsvp-message {
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

.rsvp-subtext {
    font-size: 12px;
    font-weight: 400;
    text-align: center;
    opacity: 0.9;
    font-style: italic;
}

/* Responsive text sizing */
.rsvp-box.compact .rsvp-message {
    font-size: 13px;
}

.rsvp-box.compact .rsvp-subtext {
    font-size: 10px;
}

.rsvp-box.normal .rsvp-message { font-size: 16px; }
.rsvp-box.normal .rsvp-subtext { font-size: 12px; }
.rsvp-box.spacious .rsvp-message { font-size: 18px; }
.rsvp-box.spacious .rsvp-subtext { font-size: 12.5px; }
.rsvp-box.very-spacious .rsvp-message { font-size: 20px; }
.rsvp-box.very-spacious .rsvp-subtext { font-size: 13px; }

.rsvp-button {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 18px;
    border-radius: 22px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    white-space: nowrap;
}

/* Responsive button sizing */
.rsvp-box.compact .rsvp-button {
    padding: 6px 14px;
    font-size: 11px;
    border-radius: 18px;
}

.rsvp-box.normal .rsvp-button {
    padding: 8px 18px;
    font-size: 13px;
    border-radius: 22px;
}

.rsvp-box.spacious .rsvp-button { padding: 10px 22px; font-size: 14px; border-radius: 24px; }
.rsvp-box.very-spacious .rsvp-button { padding: 12px 24px; font-size: 16px; border-radius: 26px; }

.rsvp-button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2);
}

.rsvp-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

/* Responsive close button sizing */
.rsvp-box.compact .rsvp-close {
    font-size: 20px;
    width: 26px;
    height: 26px;
}

.rsvp-box.normal .rsvp-close {
    font-size: 24px;
    width: 30px;
    height: 30px;
}

.rsvp-box.spacious .rsvp-close {
    font-size: 28px;
    width: 34px;
    height: 34px;
}

.rsvp-box.very-spacious .rsvp-close {
    font-size: 32px;
    width: 38px;
    height: 38px;
}

.rsvp-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Responsive design for mobile */
@media (max-width: 768px) {
    .rsvp-box { top: 50px !important; width: 92vw !important; min-width: 260px; }
    
    .rsvp-box-content {
        flex-direction: column;
        gap: 12px;
        padding: 14px 16px;
    }
    
    .rsvp-text {
        order: 1;
    }
    
    .rsvp-button {
        order: 2;
        width: 100%;
        max-width: 180px;
    }
    
    .rsvp-close {
        position: absolute;
        top: 10px;
        right: 15px;
        order: 3;
    }
}

/* Rectangular hotspot overlay for page 9 */
.hotspot-container { position: absolute; pointer-events: auto; }
.hotspot-container .rect-hotspot {
    position: absolute;
    pointer-events: auto; /* only anchors receive pointer */
    display: block;
    transition: all 0.3s ease;
}

/* Mobile-specific tap indicators */
@media (pointer: coarse), (max-width: 768px) {
    .hotspot-container .rect-hotspot {
        /* Subtle pulse animation to indicate tappability */
        animation: map-pulse 2s ease-in-out infinite;
    }
    
    .hotspot-container .rect-hotspot:hover,
    .hotspot-container .rect-hotspot:active {
        animation: none;
        transform: scale(1.02);
    }
}

@keyframes map-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.8);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.4);
    }
}

/* Desktop hover effects */
@media (pointer: fine) and (min-width: 769px) {
    .hotspot-container .rect-hotspot:hover {
        box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8), 0 0 12px rgba(255, 255, 255, 0.6);
    }
}

/* Mobile UX indicators for gazebo */
@media (pointer: coarse), (max-width: 768px) {
    /* Option 1: Floating tap indicator */
    .page-content.p23::after {
        content: "TAP";
        position: absolute;
        top: 54%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: rgba(0, 0, 0, 0.65);
        color: #ffffff;
        padding: 12px 22px;
        border-radius: 999px;
        font-size: 18px;
        font-weight: 800;
        letter-spacing: 1px;
        border: 6px solid rgba(255, 255, 255, 0.5);
        z-index: 4;
        animation: tap-bounce 2s ease-in-out infinite;
        pointer-events: none;
    }
    
    /* Option 2: Shimmer overlay on gazebo area */
    .gazebo-mask {
        position: relative;
        pointer-events: auto !important;
    }
    
    .gazebo-mask::before {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(45deg, 
            transparent 30%, 
            rgba(255,255,255,0.3) 50%, 
            transparent 70%);
        animation: shimmer 3s ease-in-out infinite;
        pointer-events: none;
        z-index: 6;
    }
    
    @keyframes tap-bounce {
        0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.8; }
        50% { transform: translateX(-50%) translateY(-5px); opacity: 1; }
    }
    
    @keyframes shimmer {
        0% { transform: translateX(-100%) rotate(45deg); }
        100% { transform: translateX(100%) rotate(45deg); }
    }
}