/* ============================================================
   cbdc.studio - Deep Burgundy Suite
   Horizontal-scroll narrative experience
   ============================================================ */

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

html {
    overflow-x: hidden;
    scroll-behavior: auto;
}

body {
    background: #0D0305;
    color: #D4BFA6;
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.9;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* --- Horizontal Scroll Engine --- */
.scroll-outer {
    height: 500vh;
    position: relative;
}

.scroll-inner {
    position: sticky;
    top: 0;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.panel-strip {
    display: flex;
    flex-direction: row;
    width: 500vw;
    height: 100vh;
    will-change: transform;
}

.panel {
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

/* --- Candle Glow Overlay (shared) --- */
.candle-glow-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    background: radial-gradient(ellipse at 48% 100%, rgba(212, 160, 84, 0.12) 0%, transparent 60%);
    pointer-events: none;
    z-index: 1;
}

/* ============================================================
   PANEL 1 -- The Study Door
   ============================================================ */
.panel-1 {
    background: linear-gradient(to top, #3B0A1E 0%, #0D0305 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-1-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
}

.site-mark {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: 10rem;
    color: #F2E6D9;
    letter-spacing: -0.03em;
    line-height: 1;
    text-align: center;
    margin-bottom: 2rem;
}

.invitation-line {
    width: 0;
    height: 1px;
    background: #A6896E;
    position: absolute;
    right: -50vw;
    top: 50%;
    opacity: 0.5;
    transition: width 2s ease-out 0.5s;
}

.invitation-line.visible {
    width: 45vw;
}

/* --- Candle Flame (shared component) --- */
.candle-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.candle-panel1 {
    margin-top: 3rem;
}

.candle-panel4 {
    position: absolute;
    bottom: 8%;
    left: 48%;
    z-index: 3;
}

.candle-wick {
    width: 2px;
    height: 14px;
    background: #6B2D4A;
    border-radius: 1px;
}

.candle-flame {
    position: relative;
    width: 20px;
    height: 48px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.flame-outer {
    position: absolute;
    bottom: 0;
    width: 20px;
    height: 48px;
    background: radial-gradient(ellipse at center bottom, #D4A054, transparent);
    filter: blur(6px);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: flicker-outer 3s ease-in-out infinite;
}

.flame-mid {
    position: absolute;
    bottom: 2px;
    width: 10px;
    height: 32px;
    background: #C2703A;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: flicker-mid 2.5s ease-in-out infinite;
}

.flame-core {
    position: absolute;
    bottom: 4px;
    width: 5px;
    height: 18px;
    background: #F2E6D9;
    border-radius: 50%;
    animation: flicker-core 2s ease-in-out infinite;
}

@keyframes flicker-outer {
    0%, 100% { transform: scaleY(1) translateX(0); opacity: 0.8; }
    25% { transform: scaleY(1.08) translateX(-1px); opacity: 0.9; }
    50% { transform: scaleY(0.92) translateX(1px); opacity: 1; }
    75% { transform: scaleY(1.05) translateX(-0.5px); opacity: 0.85; }
}

@keyframes flicker-mid {
    0%, 100% { transform: scaleY(1) translateX(0); opacity: 0.9; }
    30% { transform: scaleY(1.1) translateX(1px); opacity: 1; }
    60% { transform: scaleY(0.9) translateX(-1px); opacity: 0.85; }
    80% { transform: scaleY(1.04) translateX(0.5px); opacity: 0.95; }
}

@keyframes flicker-core {
    0%, 100% { transform: scaleY(1) translateX(0); opacity: 0.9; }
    20% { transform: scaleY(0.9) translateX(0.5px); opacity: 1; }
    40% { transform: scaleY(1.1) translateX(-1px); opacity: 0.8; }
    70% { transform: scaleY(0.95) translateX(0.5px); opacity: 1; }
}

/* ============================================================
   PANEL 2 -- The Ledger
   ============================================================ */
.panel-2 {
    background: linear-gradient(to top, #3B0A1E 0%, #0D0305 100%);
    display: flex;
    flex-direction: row;
    align-items: center;
    position: relative;
}

.panel-2-left {
    width: 40%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem;
}

.botanical-svg.pecunia {
    width: 100%;
    max-width: 320px;
    height: auto;
    opacity: 0.85;
}

.panel-2-right {
    width: 60%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 4rem 6rem 4rem 2rem;
}

.ledger-text {
    max-width: 540px;
    text-align: justify;
    font-size: 1.125rem;
    line-height: 1.9;
    color: #D4BFA6;
}

.reveal-line {
    display: block;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal-line.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Wax Drip Dividers */
.wax-drip-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 1.5rem 0;
    position: relative;
}

.wax-drip-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 1px;
    background: #6B2D4A;
    opacity: 0.4;
}

.wax-dot {
    display: block;
    width: 6px;
    height: 6px;
    background: #6B2D4A;
    border-radius: 50% 50% 45% 55% / 55% 45% 50% 50%;
    margin: 0 6px;
    position: relative;
    z-index: 1;
}

.wax-dot:nth-child(2) {
    width: 8px;
    height: 7px;
    border-radius: 45% 55% 50% 50% / 50% 50% 45% 55%;
}

.wax-dot:nth-child(4) {
    width: 7px;
    height: 8px;
    border-radius: 55% 45% 48% 52% / 52% 48% 55% 45%;
}

.wax-drip-light .wax-dot {
    background: #A6896E;
}

.wax-drip-light::before {
    background: #A6896E;
    opacity: 0.3;
}

/* ============================================================
   PANEL 3 -- The Herbarium
   ============================================================ */
.panel-3 {
    background: linear-gradient(to top, #3B0A1E 0%, #0D0305 100%);
    position: relative;
}

.herbarium-scatter {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
    perspective: 800px;
}

.specimen-card {
    position: absolute;
    left: var(--card-x);
    top: var(--card-y);
    transform: rotate(var(--card-rotate, 0deg));
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: default;
    transition: transform 0.15s ease-out, box-shadow 0.3s ease;
    transform-style: preserve-3d;
    filter: drop-shadow(0 2px 8px rgba(13, 3, 5, 0.4));
}

.specimen-card:hover {
    filter: drop-shadow(0 8px 24px rgba(13, 3, 5, 0.6));
    z-index: 10;
}

.specimen-svg {
    width: 160px;
    height: 220px;
}

.specimen-label {
    font-family: 'IM Fell English', serif;
    font-size: 0.85rem;
    color: #A6896E;
    margin-top: 0.5rem;
    letter-spacing: 0.02em;
}

.specimen-label em {
    font-style: italic;
}

/* ============================================================
   PANEL 4 -- The Candlelit Table
   ============================================================ */
.panel-4 {
    background: #0D0305;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.panel-4-atmosphere {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, #3B0A1E 0%, #0D0305 60%);
    z-index: 0;
}

.panel-4-atmosphere::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30%;
    background: radial-gradient(ellipse at 52% 100%, rgba(212, 160, 84, 0.18) 0%, transparent 55%);
    pointer-events: none;
}

.panel-4-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 700px;
    padding: 2rem;
}

.manifesto-text {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: 2.8rem;
    line-height: 1.4;
    color: #F2E6D9;
    letter-spacing: -0.02em;
}

.manifesto-glow {
    text-shadow: 0 0 40px rgba(212, 160, 84, 0.3), 0 0 80px rgba(212, 160, 84, 0.1);
    animation: candle-text-glow 4s ease-in-out infinite;
}

.manifesto-small {
    font-size: 1.8rem;
    margin-top: 0;
}

@keyframes candle-text-glow {
    0%, 100% {
        text-shadow: 0 0 40px rgba(212, 160, 84, 0.25), 0 0 80px rgba(212, 160, 84, 0.08);
    }
    50% {
        text-shadow: 0 0 50px rgba(212, 160, 84, 0.4), 0 0 100px rgba(212, 160, 84, 0.15);
    }
}

/* ============================================================
   PANEL 5 -- The Archive Exit
   ============================================================ */
.panel-5 {
    background: linear-gradient(to top, #3B0A1E 0%, #0D0305 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.panel-5-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2rem;
    position: relative;
    z-index: 2;
}

.exit-line {
    width: 0;
    height: 1px;
    background: #A6896E;
    opacity: 0.5;
    position: absolute;
    left: -40vw;
    top: 50%;
    transition: width 2s ease-out 0.3s;
}

.exit-line.visible {
    width: 38vw;
}

.exit-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 3rem;
}

.botanical-svg.seed-pod {
    width: 120px;
    height: auto;
    opacity: 0.75;
}

.exit-text {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.exit-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: 2.4rem;
    color: #F2E6D9;
    letter-spacing: -0.02em;
}

.exit-contact {
    font-family: 'IM Fell English', serif;
    font-size: 1.1rem;
    color: #C2703A;
    font-style: italic;
}

.exit-note {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.95rem;
    color: #A6896E;
    line-height: 1.6;
}

/* ============================================================
   Progress Bar
   ============================================================ */
.progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background: #D4A054;
    z-index: 100;
    transition: width 0.1s linear;
}

/* ============================================================
   Panel Indicator (Wick Dots)
   ============================================================ */
.panel-indicator {
    position: fixed;
    bottom: 20px;
    right: 24px;
    display: flex;
    flex-direction: row;
    gap: 10px;
    z-index: 100;
    align-items: flex-end;
}

.wick-dot {
    display: block;
    width: 3px;
    height: 12px;
    background: #6B2D4A;
    border-radius: 1px;
    position: relative;
    transition: background 0.3s ease;
}

.wick-dot::after {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: transparent;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.wick-dot.active {
    background: #A6896E;
}

.wick-dot.active::after {
    background: #D4A054;
    box-shadow: 0 0 6px 2px rgba(212, 160, 84, 0.5);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
    .site-mark {
        font-size: 5rem;
    }

    .panel-2 {
        flex-direction: column;
    }

    .panel-2-left {
        width: 100%;
        height: 40%;
        padding: 2rem;
    }

    .panel-2-right {
        width: 100%;
        height: 60%;
        padding: 1.5rem 2rem;
    }

    .ledger-text {
        font-size: 1rem;
        text-align: left;
    }

    .specimen-svg {
        width: 120px;
        height: 165px;
    }

    .specimen-label {
        font-size: 0.75rem;
    }

    .manifesto-text {
        font-size: 1.8rem;
    }

    .manifesto-small {
        font-size: 1.2rem;
    }

    .exit-heading {
        font-size: 1.8rem;
    }

    .exit-info {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }

    .panel-5-content {
        flex-direction: column;
    }
}

@media (max-width: 600px) {
    .site-mark {
        font-size: 3.2rem;
    }

    .specimen-card {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
    }

    .herbarium-scatter {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1.5rem;
        padding: 2rem;
        align-items: center;
        align-content: center;
    }

    .manifesto-text {
        font-size: 1.4rem;
    }

    .manifesto-small {
        font-size: 1rem;
    }
}
