*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body, html {
    width: 100%;
    background: #000;
    background-image: radial-gradient(rgba(255,255,255,0.09) 1.5px, transparent 1.5px);
    background-size: 22px 22px;
    font-family: 'Poppins', sans-serif;
    overflow-x: hidden;
    color: #fff;
}

/* ─── LAYERS ──────────────────────────────── */
#glitter {
    position: fixed; inset: 0;
    width: 100vw; height: 100vh;
    pointer-events: none;
    z-index: 900;
    opacity: 1;
}

#fade-white {
    position: fixed; inset: 0;
    background: #fff;
    opacity: 0;
    pointer-events: none;
    z-index: 800;
}

/* ─── MAGIC WORDS ─────────────────────────── */
#magic-words {
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 700;
    overflow: hidden; /* CRITICAL: clips anything that bleeds outside */
}
.magic-word {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    font-family: 'Spicy Rice', cursive;
    font-size: clamp(1.2rem, 4vw, 2rem); /* Responsive, won't overflow */
    text-transform: uppercase;
    letter-spacing: 2px;
    background: linear-gradient(90deg, #ff7eb3, #a8edea, #4facfe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0;
    filter: blur(8px);
    will-change: transform, opacity, filter;
    max-width: 80vw; /* Hard cap so it never overflows */
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── NEON GLOW BURST ─────────────────────── */
#neon-burst {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 0; height: 0;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(255,150,220,1) 0%,
        rgba(100,200,255,0.8) 30%,
        rgba(100,255,180,0.4) 55%,
        transparent 72%
    );
    filter: blur(20px);
    opacity: 0;
    pointer-events: none;
    z-index: 600;
    will-change: transform, opacity, width, height;
}

/* ─── INTRO SCENE ─────────────────────────── */
#intro-scene {
    position: fixed; inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 500;
    pointer-events: none;
}

/* 
  Perspective container.
  rotateX tilts the whole book away = "lying flat on a table" viewpoint.
  We use a high rotateX so we see it almost horizontally, like the photo.
*/
#book-perspective {
    perspective: 900px;
    perspective-origin: 50% -20%;  /* camera slightly above */
}

#book-closed {
    display: flex;
    align-items: stretch;
    transform-style: preserve-3d;
    /* Tilt the whole book to look like it's lying on a surface */
    transform: rotateX(62deg) rotateZ(0deg);
    will-change: transform;
    position: relative;
}

/* ─── BOOK HALVES ─────────────────────────── */
:root {
    --hw: 140px;
    --bh: 200px;
}
@media (min-width: 400px) { :root { --hw: 170px; --bh: 240px; } }
@media (min-width: 600px) { :root { --hw: 210px; --bh: 295px; } }

/* No preserve-3d on children — avoids ALL glitch artifacts */
#book-left, #book-right {
    width: var(--hw);
    height: var(--bh);
    position: relative;
    will-change: transform;
    border-radius: 4px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}

#book-left  { transform-origin: right center; }
#book-right { transform-origin: left center; }

.left-cover {
    width: 100%; height: 100%;
    background: linear-gradient(150deg, #ff758c 0%, #ff9eb5 40%, #c471ed 75%, #4facfe 100%);
    border-radius: 4px 0 0 4px;
}
.right-cover {
    width: 100%; height: 100%;
    background: linear-gradient(150deg, #4facfe 0%, #c471ed 40%, #ff9eb5 75%, #ff758c 100%);
    border-radius: 0 4px 4px 0;
}

/* Spine — just a colored strip between the two halves */
#book-spine {
    width: 8px;
    height: var(--bh);
    background: linear-gradient(180deg, #ff7eb3, #c471ed, #4facfe);
    flex-shrink: 0;
    align-self: center;
    box-shadow: 0 0 12px rgba(200,100,255,0.5);
}

/* ─── PRESENTATION ────────────────────────── */
.presentation-wrapper {
    width: 100vw; height: 100vh; height: 100dvh;
    position: relative;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
}

.panel {
    position: absolute; inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
    visibility: hidden;
}
#panel-1 { visibility: visible; }
.panel img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-width: 560px;
}

/* Gradient masks — hide the PDF cut on top and bottom */
.panel::before,
.panel::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 80px;         /* Height of the fade zone */
    pointer-events: none;
    z-index: 5;
}
.panel::before {
    top: 0;
    background: linear-gradient(to bottom, #000 0%, transparent 100%);
}
.panel::after {
    bottom: 0;
    background: linear-gradient(to top, #000 0%, transparent 100%);
}

/* Floating scroll button */
.float-scroll-btn {
    position: absolute;
    bottom: 28px; left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    width: 50px; height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.92);
    color: #000;
    font-size: 1.5rem;
    line-height: 50px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 4px 24px rgba(0,0,0,0.35);
    opacity: 0;
    animation: fBtn 2s ease-in-out infinite;
    user-select: none;
}
@keyframes fBtn {
    0%,100% { transform: translateX(-50%) translateY(0); }
    50%      { transform: translateX(-50%) translateY(8px); }
}

/* CTA Button (last slide) */
.v3-cta-button {
    position: absolute;
    bottom: 3%; left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(90deg, #ff7eb3, #4facfe);
    color: #fff;
    padding: 15px 32px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1rem;
    white-space: nowrap;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transition: transform .2s, filter .2s;
    z-index: 100;
    letter-spacing: 1px;
}
.v3-cta-button:hover {
    transform: translateX(-50%) scale(1.06);
    filter: brightness(1.15);
}

/* ─── NEON BARS (top + bottom of presentation) ── */
.neon-bar {
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 20;
    pointer-events: none;
    background: linear-gradient(90deg,
        #ff7eb3 0%,
        #4facfe 40%,
        #78ffd6 70%,
        #ff7eb3 100%
    );
    background-size: 200% 100%;
    animation: neonShift 4s linear infinite;
}
.neon-bar--top    { top: 0; }
.neon-bar--bottom { bottom: 0; }

/* Glow layered via box-shadow */
.neon-bar--top {
    box-shadow:
        0  0  6px 1px rgba(255, 126, 179, 0.8),
        0  0 18px 3px rgba(79, 172, 254, 0.6),
        0  0 30px 5px rgba(120, 255, 214, 0.3);
}
.neon-bar--bottom {
    box-shadow:
        0  0  6px 1px rgba(255, 126, 179, 0.8),
        0  0 18px 3px rgba(79, 172, 254, 0.6),
        0  0 30px 5px rgba(120, 255, 214, 0.3);
}

@keyframes neonShift {
    0%   { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}
