/* ============================================================
   lunar.bar — Styles
   A dimly-lit scholars' lounge on a lunar colony
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    /* Palette: Dopamine-Neon Against Void */
    --void: #050508;
    --deep-chamber: #0A0A1A;
    --regolith: #0D0D14;
    --neon-pink: #FF2D6A;
    --neon-cyan: #00D4FF;
    --neon-green: #39FF8C;
    --parchment: #D4CFC6;
    --lavender-gray: #8B8B9E;
    --amber: #FFB347;

    /* Typography */
    --font-heading: 'Caveat', cursive;
    --font-body: 'Spectral', serif;
    --font-mono: 'IBM Plex Mono', monospace;
    --font-quote: 'Cormorant Garamond', serif;

    /* Blur-Focus System */
    --blur-amount: 6px;
    --focus-opacity: 0.3;
}

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

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

body {
    background: var(--void);
    color: var(--parchment);
    font-family: var(--font-body);
    font-size: 18px;
    font-weight: 350;
    line-height: 1.72;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Navigation Filament --- */
.nav-filament {
    position: fixed;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 60vh;
}

.filament-track {
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, var(--neon-pink), #4400aa, #000066);
    border-radius: 1px;
    position: relative;
    opacity: 0.4;
}

.filament-indicator {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--neon-pink);
    box-shadow: 0 0 12px var(--neon-pink), 0 0 30px rgba(255, 45, 106, 0.4);
    transition: top 0.3s ease-out;
}

.filament-labels {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.filament-label {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--lavender-gray);
    opacity: 0.3;
    transition: opacity 0.5s ease, color 0.5s ease;
    writing-mode: horizontal-tb;
    cursor: default;
    user-select: none;
}

.filament-label.active {
    opacity: 1;
    color: var(--neon-pink);
}

/* --- Chamber Base Styles --- */
.chamber {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.chamber-noise {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    filter: url(#grain);
    opacity: 0.06;
    pointer-events: none;
    z-index: 1;
}

/* Grain Band Dividers */
.grain-band {
    position: absolute;
    left: 0;
    width: 100%;
    height: 40px;
    filter: url(#grain);
    opacity: 0.15;
    pointer-events: none;
    z-index: 2;
}

.grain-band-bottom {
    bottom: 0;
}

/* Blur-Focus Depth System */
.chamber .chamber-content-wrapper,
.threshold-content,
.alcove-content,
.library-content,
.laboratory-content,
.vault-content {
    transition: filter 0.8s ease-out, opacity 0.8s ease-out;
}

.chamber.blurred .threshold-content,
.chamber.blurred .alcove-content,
.chamber.blurred .library-content,
.chamber.blurred .laboratory-content,
.chamber.blurred .vault-content {
    filter: blur(var(--blur-amount));
    opacity: var(--focus-opacity);
}

.chamber.focused .threshold-content,
.chamber.focused .alcove-content,
.chamber.focused .library-content,
.chamber.focused .laboratory-content,
.chamber.focused .vault-content {
    filter: blur(0px);
    opacity: 1;
}

/* ============================================================
   Chamber 1: The Threshold
   ============================================================ */
.chamber-threshold {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--void);
}

.threshold-content {
    text-align: center;
    position: relative;
    z-index: 3;
}

.threshold-title {
    font-family: var(--font-heading);
    font-size: clamp(72px, 12vw, 120px);
    color: var(--neon-pink);
    text-shadow: 0 0 40px rgba(255, 45, 106, 0.4);
    letter-spacing: -0.01em;
    line-height: 1;
    margin-bottom: 30px;
}

.threshold-title .letter {
    display: inline-block;
    opacity: 0;
    animation: letterReveal 0.6s ease-out forwards;
    animation-delay: calc(var(--delay) * 0.25s + 0.5s);
}

@keyframes letterReveal {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.threshold-line {
    width: 0;
    height: 2px;
    background: var(--neon-pink);
    box-shadow: 0 0 10px rgba(255, 45, 106, 0.5);
    margin: 0 auto;
    animation: lineExtend 3s ease-out 2.5s forwards;
}

@keyframes lineExtend {
    0% { width: 0; }
    100% { width: min(80vw, 600px); }
}

/* Regolith gradient transition from Chamber 1 to Chamber 2 */
.chamber-threshold::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    background: linear-gradient(to bottom, var(--void), var(--regolith));
    pointer-events: none;
    z-index: 2;
}

/* ============================================================
   Chamber 2: The Alcove
   ============================================================ */
.chamber-alcove {
    min-height: 150vh;
    background: var(--void);
    padding: 10vh 6vw 10vh 6vw;
}

.alcove-content {
    display: flex;
    gap: 6vw;
    max-width: 1400px;
    position: relative;
    z-index: 3;
}

.alcove-left {
    flex: 0 0 58%;
    transform: rotate(-0.8deg);
}

.pull-quote-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 50px;
}

.flame-beside-quote {
    flex-shrink: 0;
    margin-top: 8px;
    filter: drop-shadow(0 0 12px rgba(255, 179, 71, 0.3));
}

.pull-quote {
    font-family: var(--font-quote);
    font-size: clamp(28px, 4vw, 48px);
    font-weight: 300;
    font-style: italic;
    color: var(--neon-cyan);
    line-height: 1.35;
    border: none;
    padding: 0;
}

.alcove-body {
    font-family: var(--font-body);
    font-size: 18px;
    font-weight: 350;
    color: var(--parchment);
    line-height: 1.72;
    margin-bottom: 28px;
    max-width: 680px;
}

.alcove-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding-top: 60px;
}

.alcove-aside {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aside-label {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--lavender-gray);
    letter-spacing: 0.05em;
}

.alcove-annotation {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--lavender-gray);
    line-height: 1.65;
}

/* ============================================================
   Chamber 3: The Library
   ============================================================ */
.chamber-library {
    min-height: 200vh;
    background: var(--void);
    padding: 10vh 5vw;
}

.library-content {
    display: flex;
    gap: 3vw;
    max-width: 1500px;
    position: relative;
    z-index: 3;
}

.library-col {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.library-col-1 {
    flex: 0 0 40%;
}

.library-col-2 {
    flex: 0 0 25%;
    padding-top: 80px;
}

.library-col-3 {
    flex: 0 0 35%;
    padding-top: 40px;
}

.library-card {
    background: rgba(255, 255, 255, 0.02);
    padding: 30px;
    position: relative;
    transition: transform 0.4s ease, filter 0.4s ease;
}

.library-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    filter: url(#grain);
    opacity: 0.08;
    pointer-events: none;
}

.library-card-depth-1 {
    transform: translateZ(0);
}

.library-card-depth-2 {
    filter: blur(0.3px);
    opacity: 0.92;
}

.library-card-depth-3 {
    filter: blur(0.6px);
    opacity: 0.85;
}

.library-title {
    font-family: var(--font-heading);
    font-size: clamp(36px, 4.5vw, 56px);
    color: var(--neon-pink);
    text-shadow: 0 0 40px rgba(255, 45, 106, 0.4);
    letter-spacing: -0.01em;
    margin-bottom: 18px;
    line-height: 1.1;
}

.library-text {
    font-family: var(--font-body);
    font-size: 17px;
    font-weight: 350;
    color: var(--parchment);
    line-height: 1.72;
}

.library-annotation {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--lavender-gray);
    display: block;
    margin-bottom: 14px;
}

.library-quote {
    font-family: var(--font-quote);
    font-size: 24px;
    font-weight: 300;
    font-style: italic;
    color: var(--neon-cyan);
    line-height: 1.45;
}

/* Flame bullet list */
.flame-list {
    list-style: none;
    padding: 0;
}

.flame-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    font-family: var(--font-body);
    font-size: 17px;
    color: var(--parchment);
    line-height: 1.72;
}

.flame-bullet {
    flex-shrink: 0;
    margin-top: 4px;
    filter: drop-shadow(0 0 6px rgba(255, 179, 71, 0.3));
}

/* Wax-drip borders */
.card-wax-border {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background: rgba(255, 179, 71, 0.2);
    clip-path: polygon(
        0% 0%, 3% 100%, 6% 20%, 10% 80%, 14% 10%, 18% 90%,
        22% 30%, 26% 70%, 30% 0%, 34% 100%, 38% 25%, 42% 85%,
        46% 15%, 50% 75%, 54% 5%, 58% 95%, 62% 35%, 66% 65%,
        70% 10%, 74% 90%, 78% 20%, 82% 80%, 86% 0%, 90% 100%,
        94% 30%, 98% 70%, 100% 0%
    );
}

/* ============================================================
   Chamber 4: The Laboratory
   ============================================================ */
.chamber-laboratory {
    min-height: 150vh;
    background: var(--void);
    padding: 10vh 0;
}

.laboratory-content {
    display: flex;
    position: relative;
    z-index: 3;
    max-width: 1500px;
}

.laboratory-main {
    flex: 0 0 70%;
    padding-left: 6vw;
    padding-right: 4vw;
    margin-right: auto;
}

.laboratory-title {
    font-family: var(--font-heading);
    font-size: clamp(56px, 8vw, 96px);
    color: var(--neon-pink);
    text-shadow: 0 0 50px rgba(255, 45, 106, 0.5), 0 0 100px rgba(255, 45, 106, 0.2);
    letter-spacing: -0.01em;
    margin-bottom: 30px;
    line-height: 1;
}

.laboratory-text {
    font-family: var(--font-body);
    font-size: 19px;
    font-weight: 400;
    color: var(--parchment);
    line-height: 1.72;
    margin-bottom: 40px;
    max-width: 720px;
}

.laboratory-divider {
    width: 120px;
    height: 2px;
    background: var(--neon-cyan);
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
    margin-bottom: 40px;
}

.laboratory-subtitle {
    font-family: var(--font-heading);
    font-size: clamp(32px, 4vw, 48px);
    color: var(--neon-pink);
    text-shadow: 0 0 30px rgba(255, 45, 106, 0.35);
    letter-spacing: -0.01em;
    margin-bottom: 36px;
}

.experiment-entry {
    display: flex;
    gap: 24px;
    margin-bottom: 40px;
    align-items: flex-start;
}

.experiment-number {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--neon-green);
    flex-shrink: 0;
    padding-top: 3px;
    letter-spacing: 0.05em;
}

.experiment-details {
    flex: 1;
}

.experiment-name {
    font-family: var(--font-heading);
    font-size: 28px;
    color: var(--neon-cyan);
    display: block;
    margin-bottom: 10px;
}

.experiment-desc {
    font-family: var(--font-body);
    font-size: 17px;
    font-weight: 350;
    color: var(--parchment);
    line-height: 1.72;
    max-width: 600px;
}

/* Candle in Chamber 4 right margin */
.laboratory-candle {
    position: sticky;
    top: 35vh;
    flex: 0 0 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 200px;
    margin-right: 8vw;
    margin-left: auto;
}

.candle-glow-halo {
    position: absolute;
    top: -40px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 179, 71, 0.15) 0%, transparent 60%);
    pointer-events: none;
}

.flame-large {
    position: relative;
    z-index: 2;
}

.candle-base {
    width: 24px;
    height: 60px;
    background: linear-gradient(to bottom, #2a2018, #1a1410);
    border-radius: 2px 2px 4px 4px;
    margin-top: -5px;
    position: relative;
    z-index: 2;
}

/* ============================================================
   Chamber 5: The Vault
   ============================================================ */
.chamber-vault {
    height: 100vh;
    background: var(--deep-chamber);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.crater-field {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.crater {
    position: absolute;
    width: var(--size);
    height: var(--size);
    top: var(--top);
    left: var(--left);
    border-radius: 50%;
    background: rgba(10, 10, 26, 0.5);
    box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.6);
    opacity: var(--opacity);
}

.decorative-crater {
    cursor: default;
}

.vault-content {
    text-align: center;
    position: relative;
    z-index: 3;
    max-width: 600px;
    padding: 0 20px;
}

.vault-text {
    font-family: var(--font-quote);
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 300;
    font-style: italic;
    color: var(--parchment);
    line-height: 1.4;
    margin-bottom: 40px;
}

.vault-attribution {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--lavender-gray);
    letter-spacing: 0.08em;
    margin-bottom: 40px;
}

.vault-flame-row {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.vault-flame-row .flame-tiny {
    filter: drop-shadow(0 0 8px rgba(255, 179, 71, 0.3));
}

/* ============================================================
   Shake-Error Micro-Interaction (Scholarly Rebuke)
   ============================================================ */
@keyframes scholarly-rebuke {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-3px); }
    40% { transform: translateX(3px); }
    60% { transform: translateX(-2px); }
    80% { transform: translateX(2px); }
}

.scholarly-rebuke {
    animation: scholarly-rebuke 0.3s ease-in-out;
}

.scholarly-rebuke-glow {
    box-shadow: 0 0 20px rgba(255, 45, 106, 0.6) !important;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
    .alcove-content {
        flex-direction: column;
        gap: 40px;
    }

    .alcove-left {
        flex: 1;
        transform: rotate(-0.4deg);
    }

    .alcove-right {
        padding-top: 0;
    }

    .library-content {
        flex-direction: column;
        gap: 20px;
    }

    .library-col-1,
    .library-col-2,
    .library-col-3 {
        flex: 1;
        padding-top: 0;
    }

    .laboratory-content {
        flex-direction: column;
    }

    .laboratory-main {
        flex: 1;
        padding-right: 6vw;
    }

    .laboratory-candle {
        position: relative;
        top: auto;
        margin: 40px auto;
        flex: none;
    }
}

@media (max-width: 768px) {
    .nav-filament {
        display: none;
    }

    .threshold-title {
        font-size: clamp(48px, 15vw, 80px);
    }

    .pull-quote {
        font-size: clamp(22px, 5vw, 36px);
    }

    .alcove-left {
        transform: none;
    }

    .library-card {
        padding: 20px;
    }

    .laboratory-title {
        font-size: clamp(40px, 10vw, 72px);
    }

    body {
        font-size: 16px;
    }
}
