/* Global Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #020c1b;
    color: #e6f1ff;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

#app {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Screens Structure */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1),
        transform 1.2s cubic-bezier(0.25, 1, 0.5, 1);
    transform: scale(1.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #020c1b;
    z-index: 1;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
    z-index: 10;
}

/* Background Gradients */
.glow-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(0, 114, 255, 0.15) 0%, rgba(2, 12, 27, 1) 75%);
    z-index: -1;
}

.glow-bg-animated {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(0, 240, 255, 0.18) 0%, rgba(2, 12, 27, 1) 70%);
    z-index: -1;
    animation: pulseGlow 4s infinite alternate ease-in-out;
}

.glow-bg-title {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(0, 240, 255, 0.25) 0%, rgba(0, 114, 255, 0.05) 50%, rgba(2, 12, 27, 1) 85%);
    z-index: -1;
    animation: titleGlow 8s infinite alternate ease-in-out;
}

@keyframes pulseGlow {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.15);
        opacity: 1;
    }
}

@keyframes titleGlow {
    0% {
        transform: scale(1) rotate(0deg);
    }

    50% {
        transform: scale(1.1) rotate(5deg);
    }

    100% {
        transform: scale(1) rotate(-5deg);
    }
}

/* SCREEN 1: START SCREEN & GLOW BUTTON */
.content-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 2;
}

.start-hint {
    font-size: 1.1rem;
    color: rgba(230, 241, 255, 0.6);
    margin-bottom: 2.5rem;
    letter-spacing: 0.1em;
    text-indent: 0.1em;
    font-weight: 300;
    text-transform: uppercase;
    animation: pulseText 2s infinite ease-in-out;
}

@keyframes pulseText {

    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 0.9;
    }
}

.glow-button {
    position: relative;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 2px solid rgba(0, 240, 255, 0.4);
    background: rgba(10, 25, 47, 0.6);
    cursor: pointer;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: 0 0 30px rgba(0, 114, 255, 0.2),
        inset 0 0 20px rgba(0, 240, 255, 0.1);
    backdrop-filter: blur(10px);
}

.glow-button::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border-radius: 50%;
    border: 1px dashed rgba(0, 240, 255, 0.3);
    animation: rotateDashed 20s linear infinite;
    pointer-events: none;
}

.btn-glow-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 240, 255, 0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.btn-text {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    color: #e6f1ff;
    letter-spacing: 0.15em;
    text-indent: 0.15em;
    text-shadow: 0 0 10px rgba(230, 241, 255, 0.5);
    z-index: 2;
    transition: all 0.3s ease;
}

/* Button Hover & Active States */
.glow-button:hover {
    transform: scale(1.08);
    border-color: rgba(0, 240, 255, 0.8);
    box-shadow: 0 0 50px rgba(0, 240, 255, 0.4),
        0 0 100px rgba(0, 114, 255, 0.2),
        inset 0 0 30px rgba(0, 240, 255, 0.3);
}

.glow-button:hover .btn-glow-layer {
    opacity: 1;
}

.glow-button:hover .btn-text {
    color: #00f0ff;
    text-shadow: 0 0 20px rgba(0, 240, 255, 0.8);
    transform: scale(1.05);
}

.glow-button:active {
    transform: scale(0.95);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.3),
        inset 0 0 40px rgba(0, 240, 255, 0.5);
    transition: all 0.1s ease;
}

@keyframes rotateDashed {
    100% {
        transform: rotate(360deg);
    }
}

/* SCREEN 2: COUNTDOWN */
.countdown-wrap {
    perspective: 1000px;
    z-index: 2;
}

#countdown-number {
    font-size: 32vh;
    font-weight: 800;
    color: #00f0ff;
    text-shadow: 0 0 40px rgba(0, 240, 255, 0.6),
        0 0 80px rgba(0, 114, 255, 0.3);
    line-height: 1;
    transform-style: preserve-3d;
}

/* JavaScript triggers this class for each countdown value */
.scale-fade {
    animation: scaleFadeAnim 1s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes scaleFadeAnim {
    0% {
        opacity: 0;
        transform: scale(0.4) translateZ(-100px);
    }

    15% {
        opacity: 1;
        transform: scale(1) translateZ(0);
    }

    85% {
        opacity: 1;
        transform: scale(1.05) translateZ(20px);
    }

    100% {
        opacity: 0;
        transform: scale(1.4) translateZ(100px);
    }
}

/* SCREEN 3: TITLE REVEAL */
.title-container {
    text-align: center;
    z-index: 3;
    padding: 0 20px;
}

.subtitle-reveal {
    font-size: 1.5rem;
    font-weight: 600;
    color: rgba(0, 240, 255, 0.8);
    letter-spacing: 0.4em;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(30px);
    animation: slideUpFade 1s 0.3s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.main-title-reveal {
    font-family: 'Cinzel', serif;
    font-size: 6.5vw;
    font-weight: 900;
    color: #e6f1ff;
    line-height: 1.15;
    letter-spacing: 0.05em;
    opacity: 0;
    transform: translateY(50px);
    animation: slideUpFade 1.5s 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.accent-title {
    display: block;
    font-family: 'Outfit', sans-serif;
    font-size: 5vw;
    font-weight: 800;
    background: linear-gradient(135deg, #00f0ff 0%, #0072ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-top: 10px;
    text-shadow: 0 0 50px rgba(0, 240, 255, 0.3);
    letter-spacing: 0.02em;
}

@keyframes slideUpFade {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Sparkles/Particles effect background */
.sparkles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.sparkle {
    position: absolute;
    background: radial-gradient(circle, #fff 0%, rgba(0, 240, 255, 0.4) 60%, transparent 100%);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    animation: floatSparkle var(--duration) ease-in-out infinite;
}

@keyframes floatSparkle {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }

    50% {
        opacity: var(--opacity);
    }

    100% {
        transform: translateY(-20vh) scale(var(--scale));
        opacity: 0;
    }
}

/* SCREEN 4: PEMBINA SCREEN */
.pembina-content {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 3;
    padding: 20px;
}

.pembina-section-title {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #e6f1ff;
    margin-bottom: 3.5rem;
    text-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
    position: relative;
}

.pembina-section-title::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: #00f0ff;
    box-shadow: 0 0 10px #00f0ff;
    border-radius: 2px;
}

.pembina-cards-container {
    display: flex;
    justify-content: center;
    gap: 80px;
    width: 100%;
    flex-wrap: wrap;
}

.pembina-card {
    background: rgba(10, 25, 47, 0.4);
    border: 1px solid rgba(0, 240, 255, 0.15);
    border-radius: 16px;
    padding: 25px;
    width: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    backdrop-filter: blur(12px);
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: 0 15px 35px rgba(2, 12, 27, 0.6),
        inset 0 0 15px rgba(0, 240, 255, 0.05);
}

.pembina-card:hover {
    transform: translateY(-12px);
    border-color: rgba(0, 240, 255, 0.5);
    box-shadow: 0 25px 50px rgba(0, 114, 255, 0.2),
        0 0 30px rgba(0, 240, 255, 0.2),
        inset 0 0 20px rgba(0, 240, 255, 0.1);
}

.pembina-img-frame {
    width: 100%;
    aspect-ratio: 3/4;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    background: rgba(2, 12, 27, 0.8);
    border: 1px solid rgba(230, 241, 255, 0.05);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pembina-img-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.img-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(230, 241, 255, 0.4);
    gap: 15px;
    font-size: 0.95rem;
    font-weight: 300;
    letter-spacing: 0.05em;
}

.placeholder-icon {
    width: 50px;
    height: 50px;
    opacity: 0.5;
    color: #00f0ff;
    filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.4));
}

.pembina-info {
    text-align: center;
    width: 100%;
}

.pembina-info h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #e6f1ff;
    letter-spacing: 0.05em;
    margin-bottom: 5px;
    transition: color 0.3s ease;
}

.pembina-card:hover .pembina-info h3 {
    color: #00f0ff;
}

/* SCREEN 5: DIGITAL FLIPBOOK MAGAZINE */
.book-layout {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3;
    padding: 30px;
}

.book-viewport {
    width: min(90vw, 125vh);
    height: calc(min(90vw, 125vh) / 1.414);
    aspect-ratio: 1.414;
    /* 42 x 29.7 cm (A3 size) spread */
    max-width: 1000px;
    max-height: 707px;
    perspective: 2000px;
    margin-bottom: 25px;
    filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.8));
}

.book-3d {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 1.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.book-3d.align-right-page {
    transform: translateX(-25%);
}

.book-3d.align-center {
    transform: translateX(0%);
}

.book-3d.align-left-page {
    transform: translateX(25%);
}

/* Pages Styling for StPageFlip */
.page {
    background-color: #0b192e;
    overflow: hidden;
}

.page-content {
    width: 100%;
    height: 100%;
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.4);
}

.page-content canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Spine shading effect drawn behind elements */
.page-content::before {
    content: '';
    position: absolute;
    top: 0;
    width: 35px;
    height: 100%;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0) 100%);
    pointer-events: none;
    z-index: 5;
}

/* Hard covers (Page 1 and Page 76) styling */
.page[data-density="hard"] {
    background-color: #020c1b;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.5);
}

.flip-status {
    font-size: 1rem;
    color: rgba(230, 241, 255, 0.5);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 300;
    animation: pulseText 1.5s infinite ease-in-out;
}

/* SCREEN 6: BLACKOUT STATE */
#screen-blackout {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 2.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
}

#screen-blackout.active {
    opacity: 1;
    pointer-events: auto;
}

/* Helper styles for blank placeholder pages */
.placeholder-page {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0b192e 0%, #030c1b 100%);
    border: 1px solid rgba(0, 240, 255, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(230, 241, 255, 0.6);
    padding: 40px;
    text-align: center;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.5);
}

.placeholder-page h4 {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: #e6f1ff;
    letter-spacing: 0.05em;
    text-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

.placeholder-page p {
    font-size: 0.9rem;
    color: rgba(230, 241, 255, 0.4);
    letter-spacing: 0.05em;
}

.placeholder-page .badge {
    margin-top: 30px;
    padding: 6px 15px;
    border-radius: 20px;
    border: 1px solid rgba(0, 240, 255, 0.3);
    font-size: 0.8rem;
    color: #00f0ff;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}





/* Magazine Title Card Screen */
.magazine-title-card {
    font-family: 'Cinzel', serif;
    font-size: 5.5rem;
    font-weight: 900;
    color: #e6f1ff;
    letter-spacing: 0.15em;
    text-indent: 0.15em;
    text-shadow: 0 0 45px rgba(0, 240, 255, 0.45);
    opacity: 0;
    transform: scale(0.95);
    animation: scaleFadeInIntro 1.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.line-accent {
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #00f0ff, transparent);
    box-shadow: 0 0 10px #00f0ff;
    margin: 24px auto 0;
    animation: expandLineIntro 1.6s 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes scaleFadeInIntro {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes expandLineIntro {
    to {
        width: 320px;
    }
}

/* Progress Bar styling */
.render-progress-container {
    width: 320px;
    margin: 40px auto 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease, transform 0.8s ease;
    transform: translateY(15px);
}

.render-progress-container.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.progress-label {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    color: rgba(230, 241, 255, 0.7);
    margin-bottom: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

#render-progress-text {
    color: #00f0ff;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.progress-bar-outer {
    width: 100%;
    height: 6px;
    background: rgba(10, 25, 47, 0.6);
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.progress-bar-inner {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #0a192f, #00f0ff, #e6f1ff);
    box-shadow: 0 0 12px #00f0ff;
    border-radius: 4px;
    transition: width 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}
