/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: #1a1128;
    color: #e8ddd0;
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.72;
    overflow-x: hidden;
}

/* ===== FIXED STARS BACKGROUND ===== */
#stars-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.star {
    position: absolute;
    width: var(--size);
    height: var(--size);
    background: var(--color);
    clip-path: polygon(50% 0%, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0% 50%, 40% 40%);
    opacity: var(--opacity);
    animation: twinkle var(--duration) ease-in-out var(--delay) infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: var(--opacity); }
    50% { opacity: 0.7; }
}

/* ===== SCROLL PROGRESS STAR ===== */
#scroll-star {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    color: #a8a2b0;
    transition: color 0.3s ease;
}

/* ===== PANELS (PARALLAX SECTIONS) ===== */
.panel {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    overflow: hidden;
    transform: translateY(60px);
    opacity: 0;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.8s ease;
}

.panel.revealed {
    transform: translateY(0);
    opacity: 1;
}

.panel-overture {
    transform: translateY(0);
    opacity: 1;
}

/* Shadow on overlapping panels */
.panel:not(.panel-overture)::before {
    content: '';
    position: absolute;
    top: -30px;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to bottom, transparent, rgba(26, 17, 40, 0.6));
    z-index: 2;
}

/* ===== SECTION BACKGROUNDS ===== */
.panel-overture {
    background: radial-gradient(ellipse at 50% 50%, rgba(201, 160, 160, 0.15) 0%, transparent 60%),
                #2a1b3d;
}

.panel-left:nth-of-type(odd) {
    background: #2a1b3d;
}

.panel-left:nth-of-type(even) {
    background: #3d2b4a;
}

.panel-immersive {
    background: #3d2b4a;
}

.panel-denouement {
    background: radial-gradient(ellipse at 50% 50%, rgba(212, 175, 55, 0.08) 0%, transparent 60%),
                #1a1128;
}

/* ===== LABEL (CHAPTER NUMBERS) ===== */
.label {
    display: block;
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.7rem, 1vw, 0.85rem);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #c9a0a0;
    margin-bottom: 1rem;
}

/* ===== HERO SECTION ===== */
.panel-overture .panel-content {
    text-align: center;
    padding: 2rem;
    position: relative;
    z-index: 2;
}

.hero-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: clamp(3.5rem, 10vw, 8rem);
    letter-spacing: 0.03em;
    line-height: 1.1;
    background: linear-gradient(135deg, #d4af37 0%, #e8ddd0 25%, #d4af37 50%, #a8a2b0 75%, #d4af37 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: chromeShimmer 8s ease-in-out infinite;
    margin-bottom: 1.5rem;
    cursor: default;
    transition: text-shadow 0.3s ease;
}

.hero-title:hover {
    animation-duration: 2s;
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}

@keyframes chromeShimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.hero-tagline {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: #c9a0a0;
    max-width: 38em;
    margin: 0 auto 3rem;
}

.scroll-hint {
    animation: pulseDown 2s ease-in-out infinite;
}

@keyframes pulseDown {
    0%, 100% { transform: translateY(0); opacity: 0.6; }
    50% { transform: translateY(8px); opacity: 1; }
}

/* ===== SECTION HEADINGS ===== */
.section-heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(2rem, 5vw, 3.5rem);
    letter-spacing: 0.01em;
    line-height: 1.2;
    color: #e8ddd0;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #d4af37 0%, #e8ddd0 25%, #d4af37 50%, #a8a2b0 75%, #d4af37 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: chromeShimmer 8s ease-in-out infinite;
    transition: text-shadow 0.3s ease;
}

.section-heading:hover {
    animation-duration: 2s;
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}

/* ===== LEFT-ANCHORED PANELS ===== */
.panel-inner {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    padding: 4rem 2rem;
    gap: 3rem;
    position: relative;
    z-index: 2;
}

.panel-text {
    flex: 0 0 55%;
}

.panel-text p {
    max-width: 38em;
    margin-bottom: 1.2rem;
    color: #e8ddd0;
}

.panel-text p em {
    color: #d4856a;
    font-style: italic;
}

/* ===== COLLAGE ZONES ===== */
.collage-zone {
    flex: 1;
    position: relative;
    min-height: 350px;
}

.collage-frame {
    position: absolute;
    border: 1px solid #a8a2b0;
    background: transparent;
}

.cf-1 {
    width: 140px;
    height: 180px;
    top: 10%;
    left: 15%;
    transform: rotate(-6deg);
    opacity: 0.5;
}

.cf-2 {
    width: 100px;
    height: 130px;
    top: 35%;
    left: 50%;
    transform: rotate(8deg);
    opacity: 0.35;
}

.cf-3 {
    width: 120px;
    height: 90px;
    top: 65%;
    left: 25%;
    transform: rotate(-3deg);
    opacity: 0.4;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.05), rgba(201, 160, 160, 0.08));
}

.cf-4 {
    width: 110px;
    height: 140px;
    top: 50%;
    left: 55%;
    transform: rotate(5deg);
    opacity: 0.4;
}

.collage-text {
    position: absolute;
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: #c9a0a0;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.6;
}

.ct-1 { top: 25%; left: 60%; transform: rotate(-2deg); }
.ct-2 { top: 80%; left: 10%; transform: rotate(3deg); }
.ct-3 { top: 20%; left: 10%; transform: rotate(-4deg); }
.ct-4 { top: 75%; left: 55%; transform: rotate(2deg); }

/* ===== ARC VISUALIZATION ===== */
.arc-visualization {
    position: absolute;
    top: 10%;
    left: 5%;
    width: 80%;
}

.story-arc-svg {
    width: 100%;
    height: auto;
    opacity: 0.8;
}

/* ===== IMMERSIVE PANELS ===== */
.gradient-mesh {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.gm-1 {
    background:
        radial-gradient(ellipse at 30% 40%, rgba(61, 43, 74, 0.8) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 70%, rgba(201, 160, 160, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 20%, rgba(212, 175, 55, 0.15) 0%, transparent 70%);
}

.gm-2 {
    background:
        radial-gradient(ellipse at 70% 30%, rgba(212, 133, 106, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 20% 60%, rgba(61, 43, 74, 0.8) 0%, transparent 60%),
        radial-gradient(ellipse at 60% 80%, rgba(201, 160, 160, 0.3) 0%, transparent 55%);
}

.frosted-container {
    position: relative;
    z-index: 2;
    background: rgba(42, 27, 61, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: clamp(2rem, 5vw, 4rem);
    max-width: 700px;
    border: 1px solid rgba(168, 162, 176, 0.15);
    border-radius: 2px;
}

.frosted-container p {
    max-width: 38em;
    margin-bottom: 1.2rem;
    color: #e8ddd0;
}

.frosted-container p em {
    color: #d4856a;
    font-style: italic;
}

/* ===== DENOUEMENT ===== */
.denouement-content {
    text-align: center;
    padding: 2rem;
    position: relative;
    z-index: 2;
}

.closing-star {
    margin-bottom: 2rem;
    opacity: 0.9;
}

.closing-tagline {
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.75rem, 1.2vw, 0.9rem);
    color: #a8a2b0;
    letter-spacing: 0.1em;
    margin-top: 1.5rem;
}

/* ===== BUTTERFLIES ===== */
.butterfly {
    position: absolute;
    z-index: 3;
    opacity: 0.6;
    transition: transform 0.3s ease;
}

.bf-1 { top: 15%; right: 12%; transform: rotate(15deg); }
.bf-2 { bottom: 20%; left: 8%; transform: rotate(-30deg); }
.bf-3 { top: 20%; right: 5%; transform: rotate(45deg); }
.bf-4 { bottom: 25%; right: 40%; transform: rotate(-12deg); }
.bf-5 { top: 10%; left: 5%; transform: rotate(20deg); }
.bf-6 { bottom: 12%; right: 8%; transform: rotate(-25deg); }
.bf-7 { bottom: 20%; right: 10%; transform: rotate(30deg); }
.bf-8 { top: 8%; right: 10%; transform: rotate(-15deg); }
.bf-9 { bottom: 15%; left: 10%; transform: rotate(35deg); }
.bf-10 { margin-top: 2rem; position: relative; transform: rotate(10deg); opacity: 0.5; }

/* ===== STAGGERED TEXT REVEAL ===== */
.panel .label,
.panel .section-heading,
.panel p,
.panel .frosted-container .label,
.panel .frosted-container .section-heading,
.panel .frosted-container p {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.panel.revealed .label,
.panel.revealed .frosted-container .label { transition-delay: 0s; opacity: 1; transform: translateY(0); }
.panel.revealed .section-heading,
.panel.revealed .frosted-container .section-heading { transition-delay: 0.1s; opacity: 1; transform: translateY(0); }
.panel.revealed p:nth-of-type(1),
.panel.revealed .frosted-container p:nth-of-type(1) { transition-delay: 0.2s; opacity: 1; transform: translateY(0); }
.panel.revealed p:nth-of-type(2),
.panel.revealed .frosted-container p:nth-of-type(2) { transition-delay: 0.3s; opacity: 1; transform: translateY(0); }
.panel.revealed p:nth-of-type(3) { transition-delay: 0.4s; opacity: 1; transform: translateY(0); }

/* Hero always visible */
.panel-overture .label,
.panel-overture .hero-title,
.panel-overture .hero-tagline {
    opacity: 1;
    transform: translateY(0);
}

.panel-overture .hero-title {
    transition: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .panel-inner {
        flex-direction: column;
        padding: 3rem 1.5rem;
    }

    .panel-text {
        flex: none;
        width: 100%;
    }

    .collage-zone {
        min-height: 200px;
        width: 100%;
    }

    .frosted-container {
        margin: 0 1rem;
    }
}
