/* --- VARIABLES --- */
:root {
    --bg-dark: #02000a;
    --purple-main: #8a00e6;
    --magenta-glow: #e600ff;
    --cyan-accent: #00eaff;
    --deep-indigo: #240046;
    --text-white: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --font-heading: 'Cinzel', serif;
    --font-body: 'Lato', sans-serif;
}

/* --- RESET --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Global transition as requested */
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Exclude time-sensitive elements from global transitions */
.scroll-sequence-section,
.scroll-sequence-sticky,
.sequence-canvas,
.feature-art-container,
.feature-art-container img,
canvas,
img {
    transition: none !important;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-white);
    font-family: var(--font-body);
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- BACKGROUND ANIMATION --- */
.portal-background {
    display: none;
    /* Hidden now that we have the image sequence */
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 10s infinite ease-in-out alternate;
    mix-blend-mode: screen;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: var(--purple-main);
    top: -150px;
    left: -150px;
    animation-duration: 12s;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: var(--magenta-glow);
    bottom: -100px;
    right: -100px;
    animation-duration: 9s;
    animation-delay: 1s;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: var(--cyan-accent);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.3;
    animation: pulse 8s infinite ease-in-out;
}

.orb-4 {
    width: 300px;
    height: 300px;
    background: var(--deep-indigo);
    top: 20%;
    right: 20%;
    filter: blur(60px);
    animation: float 15s infinite ease-in-out reverse;
    opacity: 0.8;
}

.orb-5 {
    width: 200px;
    height: 200px;
    background: var(--magenta-glow);
    bottom: 20%;
    left: 10%;
    filter: blur(50px);
    animation: float 7s infinite ease-in-out;
    opacity: 0.5;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(40px, -40px) scale(1.1);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.3;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0.5;
    }
}

/* --- LAYOUT UTILS --- */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
}

/* --- HERO SECTION --- */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 180px;
    /* Increased to account for negative section margin */
    padding-bottom: 80px;
    position: relative;
}

.hero-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 60px;
    max-width: 1300px;
}

.hero-text {
    flex: 1.2;
    z-index: 10;
}

.hero-image {
    flex: 0.8;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 10;
}

.glass-card {
    position: relative;
    width: 100%;
    max-width: 100%;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 20px;
    padding: 3.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    /* Performance hint for blur sampling */
    will-change: backdrop-filter;
}

.hero-text .main-title {
    /* Font size now handled by .main-title and its media queries to prevent mobile overflow */
    margin-bottom: 10px;
}

.hero-text .synopsis-preview {
    margin-bottom: 30px;
}

/* --- TYPOGRAPHY --- */
.subtitle {
    text-transform: uppercase;
    letter-spacing: 4px;
    color: var(--cyan-accent);
    font-size: 1rem;
    font-weight: 700;
    display: block;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(0, 234, 255, 0.5);
}

.main-title {
    font-family: var(--font-heading);
    font-size: 5.5rem;
    background: linear-gradient(to right, #fff, var(--cyan-accent));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0 0 15px 0;
    line-height: 1;
    filter: drop-shadow(0 0 20px rgba(138, 0, 230, 0.6));
}

.author-name {
    font-size: 1.8rem;
    margin-bottom: 25px;
    font-weight: 300;
    color: var(--magenta-glow);
}

.synopsis-preview {
    font-size: 1.2rem;
    line-height: 1.7;
    color: #e0e0e0;
    margin-bottom: 40px;
    max-width: 90%;
}

/* --- BUTTONS --- */
.cta-group {
    display: flex;
    gap: 20px;
}

.btn {
    padding: 15px 40px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-size: 1rem;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(45deg, var(--purple-main), var(--magenta-glow));
    color: white;
    box-shadow: 0 0 25px rgba(230, 0, 255, 0.5);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 0 40px rgba(230, 0, 255, 0.8);
}

.btn-secondary {
    background: rgba(0, 234, 255, 0.1);
    border: 2px solid var(--cyan-accent);
    color: var(--cyan-accent);
}

.btn-secondary:hover {
    background: var(--cyan-accent);
    color: var(--bg-dark);
    box-shadow: 0 0 25px rgba(0, 234, 255, 0.5);
}

/* --- BOOK COVER CARD --- */
.book-card-3d {
    position: relative;
    width: 550px;
    max-width: 100%;
    border-radius: 15px;
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    perspective: 1000px;
}

.book-card-3d img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8);
    display: block;
    position: relative;
    z-index: 2;
}

.glow-effect {
    position: absolute;
    inset: 0px;
    box-shadow: 0 0 50px 15px var(--magenta-glow), 0 0 90px 30px var(--purple-main);
    z-index: 1;
    opacity: 0.6;
    border-radius: 30px;
    /* Animation removed for static look */
}

.glow-effect-secondary {
    position: absolute;
    top: 10%;
    left: 10%;
    width: 80%;
    height: 80%;
    background: var(--cyan-accent);
    z-index: 0;
    filter: blur(60px);
    opacity: 0.4;
    animation: glowPulse 6s infinite alternate-reverse;
}

@keyframes glowPulse {
    0% {
        opacity: 0.5;
        transform: scale(0.99);
    }

    100% {
        opacity: 0.8;
        transform: scale(1.01);
    }
}

.book-card-3d:hover {
    transform: scale(1.03) translateY(-10px) rotateY(-5deg);
}

/* --- SCROLL-SCRUBBING IMAGE SEQUENCE SECTION --- */
#main-nav-placeholder {
    position: relative;
    z-index: 1000;
    /* Ensure site header is on top of sequence */
}

.scroll-sequence-section {
    position: relative;
    height: 750vh;
    /* Deep scroll for cinematic feel */
    width: 100%;
    margin-top: -180px;
    /* Force UP to ensure it renders under the absolute top of the header */
}

.scroll-sequence-sticky {
    position: sticky;
    top: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    z-index: 2;
    /* Still below absolute header if fixed, but above local bg */
}

/* Content layer that scrolls over the sticky background */
.content-overlay {
    position: relative;
    z-index: 10;
    width: 100%;
    /* Start content slightly after the very top if desired, or at 0 */
    margin-top: -100vh;
}

/* Header text overlaid on the sequence - now used in the spacer */
.scroll-sequence-header {
    text-align: center;
    pointer-events: none;
    transition: opacity 0.8s ease;
}

.scroll-sequence-header h2 {
    font-family: var(--font-heading);
    font-size: 4rem;
    color: var(--text-white);
    text-shadow: 0 0 15px var(--purple-main);
}

.scroll-spacer {
    height: 200vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Static fallback image container */
.scroll-sequence-sticky .feature-art-container {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: opacity 1.5s ease-in-out;
}

.scroll-sequence-sticky .feature-art-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Hide fallback when canvas is active */
.scroll-sequence-sticky.canvas-ready .feature-art-container {
    opacity: 0;
    pointer-events: none;
}

/* Canvas — starts invisible, fades in when loaded */
.sequence-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
}

.scroll-sequence-sticky.canvas-ready .sequence-canvas {
    opacity: 1;
}

/* Subtle vignette overlay */
.scroll-sequence-sticky::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 6;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 30%, var(--bg-dark) 100%);
    opacity: 0.6;
}

/* --- DETAILS / ABOUT SECTION --- */
.details-section {
    padding: 60px 0;
}

.details-section .glass-card {
    margin-bottom: 40px;
}

.glass-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.3);
}

.glass-card h2 {
    font-family: var(--font-heading);
    color: var(--magenta-glow);
    margin-bottom: 20px;
    font-size: 2.5rem;
    text-shadow: 0 0 10px rgba(230, 0, 255, 0.3);
}

.glass-card p {
    line-height: 1.9;
    font-size: 1.1rem;
    color: #e0e0e0;
}

/* --- FOOTER --- */
footer {
    text-align: center;
    padding: 50px 0;
    border-top: 1px solid var(--glass-border);
    margin-top: 80px;
    color: #888;
    background: rgba(0, 0, 0, 0.5);
}

.socials {
    margin-top: 20px;
}

.socials a {
    color: var(--text-white);
    font-size: 1.8rem;
    margin: 0 15px;
    transition: color 0.3s, transform 0.3s;
    display: inline-block;
}

.socials a:hover {
    color: var(--cyan-accent);
    transform: scale(1.2);
    text-shadow: 0 0 15px var(--cyan-accent);
}

/* --- ANIMATIONS & RESPONSIVE --- */
.fade-in-left {
    animation: fadeLeft 1s ease forwards;
    opacity: 0;
}

.fade-in-right {
    animation: fadeRight 1s ease forwards;
    opacity: 0;
}

.fade-in-up {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s ease-out;
}

.fade-in-up.visible {
    opacity: 1;
    transform: none;
}

.delay-100 {
    transition-delay: 0.2s;
}

@keyframes fadeLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes fadeRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* RESPONSIVE */
@media (max-width: 1100px) {
    .book-card-3d {
        width: 400px;
    }

    .main-title {
        font-size: 4rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 20px;
    }

    .hero-section {
        padding-top: 240px;
        padding-bottom: 40px;
    }

    .hero-layout {
        flex-direction: column;
        text-align: center;
        gap: 40px;
    }

    .hero-text {
        margin-top: 0;
    }

    .hero-image {
        margin-top: 10px;
    }

    .glass-card {
        padding: 2rem;
    }

    .book-card-3d {
        width: 320px;
        max-width: 90vw;
        margin: 0 auto;
    }

    .main-title {
        font-size: 3rem;
    }

    .cta-group {
        justify-content: center;
        flex-direction: column;
        gap: 15px;
    }

    /* SLIM MOBILE (iPhone SE, etc) */
    @media (max-width: 480px) {
        .container {
            padding: 0 10px;
        }

        .main-title {
            font-size: 2.22rem;
        }

        .glass-card {
            padding: 1.5rem;
        }

        .author-name {
            font-size: 1.4rem;
        }

        .btn {
            padding: 12px 25px;
            font-size: 0.9rem;
        }

        .book-card-3d {
            width: 260px;
        }
    }

    .orb {
        opacity: 0.5;
    }

    /* Reduce scroll height on mobile for a tighter experience */
    .scroll-sequence-section {
        height: 250vh;
    }

    .scroll-sequence-header h2 {
        font-size: 2rem;
    }

    /* FIX: Constrain Orbs on Mobile */
    .orb-1 {
        width: 300px;
        height: 300px;
        top: -50px;
        left: -50px;
    }

    .orb-2 {
        width: 250px;
        height: 250px;
        bottom: -50px;
        right: -50px;
    }

    .orb-3 {
        width: 200px;
        height: 200px;
    }

    .orb-4 {
        width: 150px;
        height: 150px;
    }

    .orb-5 {
        width: 100px;
        height: 100px;
    }
}