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

:root {
    --deep-night: #1a1018;
    --burnt-amber: #c4652a;
    --rhinestone-pink: #d4789c;
    --parchment: #f0e6d6;
    --gold: #b89a5a;
    --sage: #7a9478;
    --shadow-plum: #2d1f2e;
    --flare-white: #fff4e8;
    --sage-mid: #5a7a5c;
    --sage-dark: #3a5a3c;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--deep-night);
    color: var(--parchment);
    font-family: 'Hanken Grotesk', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.015em;
    overflow-x: hidden;
}

/* === HERO SECTION === */
#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: var(--deep-night);
}

#starfield {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.star {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, var(--flare-white) 0%, var(--rhinestone-pink) 40%, transparent 70%);
    animation: starPulse var(--dur) ease-in-out var(--delay) infinite alternate;
}

.star.bright {
    clip-path: polygon(50% 0%, 60% 35%, 100% 50%, 60% 65%, 50% 100%, 40% 65%, 0% 50%, 40% 35%);
    border-radius: 0;
    background: var(--flare-white);
}

@keyframes starPulse {
    0% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* === LENS FLARE === */
#lens-flare {
    position: absolute;
    top: 20%;
    right: 25%;
    z-index: 2;
    will-change: transform, opacity;
    pointer-events: none;
}

.flare-core {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--flare-white), transparent);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.flare-bloom {
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(196, 101, 42, 0.2), transparent);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.flare-haze {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 120, 156, 0.08), transparent);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.flare-ghost {
    position: absolute;
    width: calc(20px + var(--i) * 5px);
    height: calc(20px + var(--i) * 5px);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: rgba(196, 101, 42, calc(0.05 + var(--i) * 0.02));
    top: calc(50% + var(--i) * 40px - 100px);
    left: calc(50% - var(--i) * 50px + 100px);
}

/* === CONSTELLATIONS SVG === */
#constellations {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

#constellations line {
    stroke: var(--gold);
    stroke-width: 1;
    opacity: 0.4;
}

#constellations circle {
    fill: var(--gold);
    opacity: 0.6;
}

/* === HERO TITLE === */
#hero-title {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.title-multi {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(4rem, 10vw, 9rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--parchment);
    display: block;
    transform: rotate(-2deg) translateX(-40px);
    text-shadow: 0 0 60px rgba(196, 101, 42, 0.3);
}

.title-pledger {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(4rem, 10vw, 9rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--burnt-amber);
    display: block;
    transform: rotate(1.5deg) translateX(40px);
    margin-top: -20px;
    text-shadow: 0 0 60px rgba(196, 101, 42, 0.2);
}

/* === SCROLL INDICATOR === */
#scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    animation: scrollBounce 2s ease-in-out infinite;
}

.rhinestone-dot {
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, var(--parchment), var(--gold));
    border: 1px solid var(--rhinestone-pink);
    transform: rotate(45deg);
    animation: rhinestoneGlint 8s ease-in-out infinite;
}

.rhinestone-dot:nth-child(2) { animation-delay: 1.5s; }
.rhinestone-dot:nth-child(3) { animation-delay: 3s; }
.rhinestone-dot:nth-child(4) { animation-delay: 4.5s; }
.rhinestone-dot:nth-child(5) { animation-delay: 6s; }

@keyframes scrollBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(10px); }
}

@keyframes rhinestoneGlint {
    0%, 85%, 100% { background: linear-gradient(135deg, var(--parchment), var(--gold)); }
    90% { background: var(--flare-white); box-shadow: 0 0 8px var(--flare-white); }
}

/* === LEDGER PANELS === */
#ledger-panels {
    position: relative;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0;
    padding: 120px 40px 80px;
    min-height: 100vh;
}

.ledger-panel {
    position: relative;
    background: rgba(240, 230, 214, 0.92);
    color: var(--deep-night);
    padding: 50px 40px;
    box-shadow: 8px 12px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(184, 154, 90, 0.2);
}

.panel-1 {
    grid-column: 1 / 7;
    transform: rotate(-1deg);
    z-index: 20;
    margin-top: 0;
}

.panel-2 {
    grid-column: 5 / 12;
    transform: rotate(1.5deg);
    z-index: 30;
    margin-top: -60px;
}

.panel-3 {
    grid-column: 2 / 8;
    transform: rotate(0.5deg);
    z-index: 25;
    margin-top: -60px;
}

.panel-4 {
    grid-column: 6 / 13;
    transform: rotate(-1.5deg);
    z-index: 35;
    margin-top: -60px;
}

.panel-inner h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    letter-spacing: 0.04em;
    color: var(--deep-night);
    margin-bottom: 12px;
}

.panel-inner p {
    max-width: 38em;
    color: var(--shadow-plum);
    margin-bottom: 20px;
}

.ledger-rule {
    width: 100%;
    height: 6px;
    position: relative;
    margin-bottom: 20px;
}

.ledger-rule::before,
.ledger-rule::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(184, 154, 90, 0.3);
}

.ledger-rule::before { top: 0; }
.ledger-rule::after { top: 4px; }

.ledger-figures {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(184, 154, 90, 0.2);
    padding-top: 16px;
    margin-top: 12px;
}

.figure-label {
    font-family: 'Hanken Grotesk', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
    color: var(--burnt-amber);
}

.figure-value {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 300;
    color: var(--sage-dark);
    font-size: 0.95rem;
}

/* Rhinestone corners */
.rhinestone-corner {
    position: absolute;
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, var(--parchment), var(--gold));
    border: 1px solid var(--rhinestone-pink);
    transform: rotate(45deg);
    animation: rhinestoneGlint 10s ease-in-out infinite;
}

.rhinestone-corner.top-right { top: 16px; right: 16px; }
.rhinestone-corner.top-left { top: 16px; left: 16px; }
.rhinestone-corner.bottom-right { bottom: 16px; right: 16px; }
.rhinestone-corner.bottom-left { bottom: 16px; left: 16px; }

/* === STAR MAP INTERLUDE === */
#star-interlude {
    position: relative;
    width: 100%;
    height: 80vh;
    background: var(--deep-night);
    overflow: hidden;
}

#interlude-starfield {
    position: absolute;
    inset: 0;
    z-index: 1;
}

#interlude-constellations {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

#interlude-constellations line {
    stroke: var(--gold);
    stroke-width: 1;
    opacity: 0.4;
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 2s ease;
}

#interlude-constellations.visible line {
    stroke-dashoffset: 0;
}

#interlude-constellations circle {
    fill: var(--flare-white);
    opacity: 0.8;
}

#interlude-constellations text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: 14px;
    fill: var(--gold);
    opacity: 0.7;
    text-anchor: middle;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.interlude-quote {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    text-align: center;
    max-width: 600px;
}

.interlude-quote p {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.4rem, 2.5vw, 2.2rem);
    color: var(--parchment);
    line-height: 1.6;
}

/* === PASTORAL FOOTER === */
#pastoral-footer {
    position: relative;
    width: 100%;
    height: 60vh;
    overflow: hidden;
    background: var(--deep-night);
}

.horizon-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        var(--deep-night) 0%,
        var(--shadow-plum) 30%,
        rgba(196, 101, 42, 0.4) 60%,
        rgba(196, 101, 42, 0.6) 80%,
        rgba(240, 230, 214, 0.3) 100%
    );
    z-index: 1;
}

.hill {
    position: absolute;
    border-radius: 50% 50% 0 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.hill-back {
    width: 160vw;
    height: 35%;
    background: var(--sage-dark);
    z-index: 2;
    bottom: -5%;
}

.hill-mid {
    width: 140vw;
    height: 30%;
    background: var(--sage-mid);
    z-index: 3;
    bottom: -8%;
}

.hill-front {
    width: 120vw;
    height: 28%;
    background: var(--sage);
    z-index: 4;
    bottom: -10%;
}

#fireflies {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
}

.firefly {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 8px var(--gold);
    animation: fireflyFloat var(--dur) ease-in-out infinite alternate;
}

@keyframes fireflyFloat {
    0% { transform: translate(0, 0); opacity: 0.4; }
    25% { transform: translate(var(--dx1), var(--dy1)); opacity: 1; }
    50% { transform: translate(var(--dx2), var(--dy2)); opacity: 0.6; }
    75% { transform: translate(var(--dx3), var(--dy3)); opacity: 0.9; }
    100% { transform: translate(var(--dx4), var(--dy4)); opacity: 0.3; }
}

#footer-title {
    position: absolute;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: 0.08em;
    text-transform: lowercase;
    color: var(--parchment);
    text-shadow: 0 0 80px rgba(196, 101, 42, 0.4);
    white-space: nowrap;
}

/* === GRASS BLADES === */
.grass-blade {
    position: absolute;
    width: 2px;
    background: var(--sage);
    bottom: 100%;
    opacity: var(--opacity);
    transform-origin: bottom center;
    animation: grassSway 3s ease-in-out infinite alternate;
    animation-delay: var(--delay);
}

@keyframes grassSway {
    0% { transform: rotate(-3deg); }
    100% { transform: rotate(3deg); }
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .title-multi,
    .title-pledger {
        font-size: clamp(2.5rem, 8vw, 4rem);
        transform: rotate(0) translateX(0);
    }

    .title-pledger {
        margin-top: -10px;
    }

    #ledger-panels {
        display: flex;
        flex-direction: column;
        gap: 20px;
        padding: 60px 20px;
    }

    .ledger-panel {
        transform: rotate(0) !important;
        margin-top: 0 !important;
    }

    #interlude-constellations text {
        display: none;
    }

    #footer-title {
        font-size: clamp(2rem, 6vw, 4rem);
    }
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    .star, .rhinestone-dot, .rhinestone-corner, .firefly, .grass-blade {
        animation: none !important;
    }
    #scroll-indicator {
        animation: none !important;
    }
    .star { opacity: 0.6; }
    .firefly { opacity: 0.6; }
}
