/* --- Magical Disney CSS Variables --- */
:root {
    --bg-color: #1a0e2a;
    /* Deep magical purple */
    --text-main: #fcfcfc;
    --text-muted: rgba(255, 230, 240, 0.7);
    --accent-gold: #f4d068;
    /* Golden magical dust */
    --accent-rose: #ff7eb3;
    /* Soft fairy pink */
    --accent-royal: #6b21a8;
    /* Royal purple */
    --frame-border: #d4af37;
    /* Metallic gold */
    --frame-bg: rgba(25, 10, 30, 0.6);

    --font-heading: 'Cinzel', serif;
    --font-script: 'Great Vibes', cursive;
    --font-body: 'Inter', sans-serif;
}

/* --- Base Reset & Setup --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html.lenis {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto;
}

.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

.lenis.lenis-stopped {
    overflow: hidden;
}

body.disney-theme {
    background: linear-gradient(135deg, #0d0614, #1a0e2a, #261642);
    color: var(--text-main);
    font-family: var(--font-body);
    overflow-x: hidden;
    cursor: none;
    /* Custom magic cursor */
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* --- Magical Cursors --- */
.cursor-glow {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(244, 208, 104, 0.15) 0%, transparent 60%);
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 9998;
    transform: translate(-150px, -150px);
    transition: width 0.3s, height 0.3s;
}

.cursor-sparkle {
    width: 6px;
    height: 6px;
    background: #fff;
    box-shadow: 0 0 10px 2px var(--accent-gold);
    border-radius: 50%;
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 10000;
    transform: translate(-3px, -3px);
}

.cursor-sparkle.hovering {
    transform: translate(-3px, -3px) scale(3);
    background: var(--accent-rose);
    box-shadow: 0 0 15px 5px var(--accent-rose);
}

/* --- Typography --- */
h1,
h2,
h3 {
    font-family: var(--font-heading);
    font-weight: 600;
}

.magic-script {
    font-family: var(--font-script);
    font-weight: 400;
    color: var(--accent-gold);
    text-shadow: 0 0 20px rgba(244, 208, 104, 0.4);
    letter-spacing: 2px;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 5rem);
    line-height: 1.2;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.hero-title .magic-script {
    font-size: clamp(4rem, 12vw, 9rem);
    margin-top: -1rem;
}

.line-wrap {
    overflow: hidden;
    display: inline-block;
}

.line {
    display: inline-block;
    transform: translateY(100%);
    opacity: 0;
}

.hero-subtitle {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 5px;
    color: var(--accent-rose);
    margin-bottom: 2rem;
    opacity: 0;
    text-align: center;
}

/* --- Layout Sections --- */
main {
    width: 100%;
}

.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0 5vw;
    background: radial-gradient(circle at center, rgba(107, 33, 168, 0.4) 0%, transparent 60%);
}

.hero-content {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#pixie-dust-hero {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.vignette-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 40%, #0d0614 120%);
    z-index: 2;
    pointer-events: none;
}

/* Scroll indicator */
.scroll-indicator {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    z-index: 10;
}

.scroll-indicator p {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent-gold);
    margin-bottom: 15px;
}

.mouse {
    width: 26px;
    height: 40px;
    border: 2px solid var(--accent-gold);
    border-radius: 20px;
    position: relative;
}

.wheel {
    width: 4px;
    height: 8px;
    background: var(--text-main);
    border-radius: 2px;
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    animation: scroll 2s infinite cubic-bezier(0.15, 0.41, 0.69, 0.94);
}

@keyframes scroll {
    0% {
        transform: translate(-50%, 0);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, 15px);
        opacity: 0;
    }
}

/* --- Story Sections --- */
.story-section {
    min-height: 100vh;
    padding: 10rem 5vw;
    display: flex;
    align-items: center;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.story-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6rem;
    align-items: center;
}

.story-container.reversed {
    grid-template-columns: 1fr 1fr;
}

.story-text {
    position: relative;
    z-index: 2;
}

.chapter-heading {
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 6px;
    color: var(--accent-rose);
    margin-bottom: 1rem;
}

.chapter-title {
    font-size: clamp(2.5rem, 4vw, 3.5rem);
    line-height: 1.2;
    margin-bottom: 2rem;
}

.highlight-text {
    background: linear-gradient(120deg, var(--accent-gold), #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.body-text {
    font-size: clamp(1.1rem, 2vw, 1.3rem);
    color: var(--text-muted);
    max-width: 450px;
    line-height: 1.8;
}

/* --- Ornate Frames for Images --- */
.ornate-frame {
    position: relative;
    border-radius: 20px 20px 150px 150px;
    /* Arch shape */
    padding: 15px;
    background: linear-gradient(135deg, var(--frame-border), #8a6a23);
    box-shadow:
        0 30px 60px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(244, 208, 104, 0.2);
    overflow: hidden;
    transform: perspective(1000px) rotateY(0deg);
    transition: transform 0.5s ease;
}

.ornate-frame:hover {
    transform: perspective(1000px) rotateY(-5deg) translateY(-10px);
}

.ornate-frame::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px 15px 145px 145px;
    z-index: 2;
    pointer-events: none;
}

.portrait-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 10px 10px 140px 140px;
    transform: scale(1.02);
    transition: transform 0.8s ease;
}

.ornate-frame:hover .portrait-img {
    transform: scale(1.08);
}

.sparkle-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="10" cy="10" r="1" fill="white" opacity="0.5"/><circle cx="50" cy="80" r="1.5" fill="%23f4d068" opacity="0.7"/><circle cx="80" cy="30" r="1" fill="white" opacity="0.6"/></svg>');
    background-size: 50px 50px;
    z-index: 3;
    pointer-events: none;
    opacity: 0.5;
    mix-blend-mode: screen;
    animation: floating-sparkles 10s linear infinite;
}

@keyframes floating-sparkles {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 50px 50px;
    }
}

/* --- Ticker Tape / Marquee --- */
.ticker-section {
    padding: 6rem 0;
    overflow: hidden;
    background: linear-gradient(90deg, var(--accent-royal), #b83280, var(--accent-royal));
    color: #fff;
    transform: rotate(2deg) scale(1.1);
    box-shadow: 0 0 50px rgba(255, 126, 179, 0.4);
}

.ticker-wrapper {
    display: flex;
    white-space: nowrap;
}

.ticker-content {
    font-size: 5rem;
    padding: 0 2rem;
    text-shadow: none;
    color: #fff;
    animation: ticker 25s linear infinite;
}

@keyframes ticker {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* --- Finale Section --- */
.finale {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at bottom, rgba(255, 126, 179, 0.2) 0%, transparent 70%);
}

.finale-content {
    text-align: center;
    z-index: 10;
}

.finale-heading {
    font-size: clamp(5rem, 15vw, 12rem);
    margin-bottom: 2rem;
    line-height: 1;
}

.glow-on-hover {
    padding: 1.2rem 4rem;
    border: none;
    outline: none;
    color: #1a0e2a;
    background: var(--accent-gold);
    cursor: none;
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 4px;
    text-transform: uppercase;
    border-radius: 50px;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(244, 208, 104, 0.5);
    position: relative;
}

.glow-on-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px rgba(244, 208, 104, 0.8), 0 0 20px rgba(255, 255, 255, 0.5);
}

#lantern-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {

    .story-container,
    .story-container.reversed {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 4rem;
    }

    .story-container.reversed .ornate-frame {
        grid-column: 1;
        grid-row: 2;
    }

    .story-container.reversed .story-text {
        grid-column: 1;
        grid-row: 1;
    }

    .body-text {
        margin: 0 auto;
    }

    .cursor-glow,
    .cursor-sparkle {
        display: none;
    }

    body.disney-theme {
        cursor: auto;
    }

    .glow-on-hover {
        cursor: pointer;
    }
}

/* --- Running Sprite Animation --- */
.sprite-container {
    position: fixed;
    bottom: 30px;
    left: -400px;
    width: 382.5px;
    height: 256px;
    transform: scale(0.6);
    transform-origin: bottom left;
    z-index: 9999;
    pointer-events: none;
}

.running-sprite {
    width: 100%;
    height: 100%;
    background-image: url('assets/image_copy_6_cleaned.png');
    background-size: 200% 400%;
    /* 2 columns = 200%, 4 rows = 400% */
    background-position: 0% 0%;
}

/* Maps out the X and Y coordinates of the 8 frames in the 2x4 grid */
@keyframes run-cycle {
    0% {
        background-position: 0% 0%;
    }

    12.5% {
        background-position: 100% 0%;
    }

    25% {
        background-position: 0% 33.33%;
    }

    37.5% {
        background-position: 100% 33.33%;
    }

    50% {
        background-position: 0% 66.66%;
    }

    62.5% {
        background-position: 100% 66.66%;
    }

    75% {
        background-position: 0% 100%;
    }

    87.5% {
        background-position: 100% 100%;
    }

    100% {
        background-position: 0% 0%;
    }
}