/* ===== CAUSALITY.CLUB STYLES ===== */
/* Cool Grays with Candle Warmth */

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
    --slate-void: #1a1d23;
    --graphite: #272b33;
    --pewter: #3d4350;
    --silver-fog: #c8cdd3;
    --ash: #8a909b;
    --candle-amber: #e8a44a;
    --flame-core: #d4842a;
    --specimen-green: #7a9e8c;

    --font-headline: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    --ease-entrance: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-exit: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
    background-color: var(--slate-void);
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    background-color: var(--slate-void);
    color: var(--silver-fog);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== SCROLL PROGRESS ===== */
#scroll-progress {
    position: fixed;
    top: 0;
    right: 20px;
    width: 2px;
    height: 0%;
    background-color: var(--silver-fog);
    z-index: 1000;
    transition: height 0.1s linear;
}

/* ===== GRID LINES ===== */
#grid-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.8s ease;
}

#grid-lines.visible {
    opacity: 1;
}

.grid-line {
    border-left: 1px solid rgba(140, 148, 160, 0.06);
    height: 100%;
}

/* ===== CANDLE GLOW EFFECTS ===== */
.candle-glow {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
    animation: flicker 3s cubic-bezier(0.4, 0.0, 0.6, 1) infinite;
}

#candle-glow-1 {
    width: 400px;
    height: 400px;
    left: 35%;
    top: 40%;
    background: radial-gradient(ellipse at 50% 80%, rgba(232, 164, 74, 0.08) 0%, rgba(232, 164, 74, 0.02) 40%, transparent 70%);
}

#candle-glow-2 {
    width: 300px;
    height: 300px;
    left: 20%;
    top: 160vh;
    background: radial-gradient(ellipse at 50% 80%, rgba(232, 164, 74, 0.06) 0%, rgba(232, 164, 74, 0.015) 40%, transparent 70%);
    animation-delay: 1s;
}

#candle-glow-3 {
    width: 350px;
    height: 350px;
    right: 15%;
    top: 320vh;
    background: radial-gradient(ellipse at 50% 80%, rgba(232, 164, 74, 0.07) 0%, rgba(232, 164, 74, 0.018) 40%, transparent 70%);
    animation-delay: 2s;
}

@keyframes flicker {
    0% { transform: scale(1); opacity: 0.6; }
    25% { transform: scale(1.04); opacity: 0.72; }
    50% { transform: scale(1.08); opacity: 0.8; }
    75% { transform: scale(0.98); opacity: 0.65; }
    100% { transform: scale(0.96); opacity: 0.55; }
}

/* ===== CHAMBERS (SECTIONS) ===== */
.chamber {
    position: relative;
    width: 100%;
}

/* ===== CHAMBER 1: VESTIBULE ===== */
#vestibule {
    height: 120vh;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    position: relative;
    overflow: hidden;
}

.chamber-title-block {
    position: absolute;
    left: 8vw;
    top: 20vh;
    z-index: 10;
}

#causality-title {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(3rem, 10vw, 8rem);
    letter-spacing: -0.03em;
    text-transform: uppercase;
    color: var(--silver-fog);
    font-feature-settings: 'ss01';
    line-height: 1;
}

#causality-title .letter {
    display: inline-block;
    opacity: 0;
    animation: letterFadeIn 0.6s var(--ease-entrance) forwards;
}

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

.domain-suffix {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: clamp(1.2rem, 3vw, 2.5rem);
    letter-spacing: 0.3em;
    color: var(--ash);
    margin-top: 0.5rem;
}

.vestibule-candle-glow {
    position: absolute;
    left: 30%;
    top: 35%;
    width: 500px;
    height: 500px;
    background: radial-gradient(ellipse at 50% 80%, rgba(232, 164, 74, 0.12) 0%, rgba(232, 164, 74, 0.03) 40%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 3;
    animation: flicker 3s cubic-bezier(0.4, 0.0, 0.6, 1) infinite;
}

/* Seed Pod SVG */
#seed-pod-svg {
    position: absolute;
    right: 5vw;
    bottom: 10vh;
    width: 45vw;
    max-width: 500px;
    height: auto;
    z-index: 5;
}

.seed-path {
    fill: none;
    stroke: var(--specimen-green);
    stroke-width: 0.8;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawPath 4s var(--ease-entrance) forwards;
}

@keyframes drawPath {
    to { stroke-dashoffset: 0; }
}

/* ===== CHAMBER 2: SPECIMEN WALL ===== */
#specimen-wall {
    min-height: 170vh;
    padding: 10vh 5vw;
    position: relative;
    background: linear-gradient(180deg, var(--slate-void) 0%, var(--graphite) 50%, var(--slate-void) 100%);
}

.specimen-grid {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    grid-template-rows: auto;
    gap: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.specimen-frame {
    border: 1px solid var(--pewter);
    clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
    background: var(--graphite);
    padding: 1.5rem;
    opacity: 0;
    transition: border-color 600ms cubic-bezier(0.16, 1, 0.3, 1), transform 200ms ease-out;
    position: relative;
    background: linear-gradient(135deg, rgba(122, 158, 140, 0.05) 0%, transparent 60%), var(--graphite);
}

.specimen-frame:hover {
    border-color: var(--candle-amber);
}

.specimen-frame.visible {
    opacity: 1;
}

.frame-1 {
    grid-column: 1 / 7;
    grid-row: 1;
    min-height: 320px;
}

.frame-2 {
    grid-column: 8 / 15;
    grid-row: 1;
    min-height: 380px;
    margin-top: 4rem;
}

.frame-3 {
    grid-column: 3 / 10;
    grid-row: 2;
    min-height: 340px;
    margin-top: -2rem;
}

.frame-4 {
    grid-column: 10 / 17;
    grid-row: 2;
    min-height: 300px;
    margin-top: 3rem;
}

.frame-5 {
    grid-column: 1 / 8;
    grid-row: 3;
    min-height: 350px;
    margin-top: -3rem;
}

.frame-6 {
    grid-column: 7 / 14;
    grid-row: 3;
    min-height: 310px;
    margin-top: 2rem;
}

.frame-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.specimen-illustration {
    flex: 1;
    width: 100%;
    height: auto;
}

.botanical-line {
    fill: none;
    stroke: var(--specimen-green);
    stroke-width: 0.8;
}

.causal-arrow {
    fill: none;
    stroke: var(--pewter);
    stroke-width: 1.2;
}

.causal-node {
    fill: var(--pewter);
    stroke: none;
}

.specimen-label {
    display: block;
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ash);
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--pewter);
}

/* ===== CHAMBER 3: READING ROOM ===== */
#reading-room {
    min-height: 180vh;
    padding: 15vh 5vw;
    position: relative;
    background: linear-gradient(180deg, var(--slate-void) 0%, var(--graphite) 50%, var(--slate-void) 100%);
}

.reading-columns {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    gap: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}

.narrow-column {
    grid-column: 1 / 5;
}

.wide-column {
    grid-column: 7 / 14;
}

.candle-divider {
    position: absolute;
    left: calc(4 * 6.25% + 1.5rem);
    top: 10%;
    width: 4px;
    height: 80%;
    background: linear-gradient(180deg, transparent 0%, rgba(232, 164, 74, 0.2) 30%, rgba(232, 164, 74, 0.35) 50%, rgba(232, 164, 74, 0.2) 70%, transparent 100%);
    z-index: 5;
    filter: blur(2px);
    pointer-events: none;
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.3vw, 1.15rem);
    line-height: 1.75;
    color: var(--silver-fog);
    margin-bottom: 1.5rem;
    hyphens: auto;
    text-align: justify;
}

.pull-quote {
    margin: 3rem 0;
    padding: 0;
    border: none;
}

.pull-quote p {
    font-family: var(--font-headline);
    font-weight: 300;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.02em;
    color: var(--silver-fog);
    line-height: 1.3;
}

.blur-reveal {
    filter: blur(3px);
    opacity: 0.4;
    transition: filter 600ms var(--ease-entrance), opacity 600ms var(--ease-entrance);
}

.blur-reveal.focused {
    filter: blur(0);
    opacity: 1;
}

.reading-illustration {
    width: 100%;
    height: auto;
    margin: 2rem 0;
}

/* ===== CHAMBER 4: OBSERVATORY ===== */
#observatory {
    min-height: 120vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 5vh 0;
}

.observatory-candle-glow {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(ellipse at 50% 50%, rgba(232, 164, 74, 0.06) 0%, rgba(232, 164, 74, 0.015) 40%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
    transition: opacity 0.5s ease;
}

.observatory-candle-glow.intensified {
    background: radial-gradient(ellipse at 50% 50%, rgba(232, 164, 74, 0.15) 0%, rgba(232, 164, 74, 0.04) 40%, transparent 70%);
}

#causal-tree-svg {
    width: 80vmin;
    height: 80vmin;
    max-width: 800px;
    max-height: 800px;
    z-index: 5;
}

.observatory-circle {
    fill: none;
    stroke: var(--pewter);
    stroke-width: 0.5;
    opacity: 0.3;
}

.tree-botanical {
    fill: none;
    stroke: var(--specimen-green);
    stroke-width: 0.8;
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 0.05s linear;
}

.tree-causal {
    fill: none;
    stroke: var(--candle-amber);
    stroke-width: 1.2;
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 0.05s linear;
}

/* ===== CHAMBER 5: THRESHOLD ===== */
#threshold {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.threshold-content {
    max-width: calc(3 * 6.25vw * 16);
    width: 280px;
    text-align: center;
    z-index: 10;
}

.threshold-statement {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    letter-spacing: -0.03em;
    text-transform: uppercase;
    color: var(--silver-fog);
    line-height: 1.3;
    margin-bottom: 3rem;
    font-feature-settings: 'ss01';
}

.threshold-domain {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    letter-spacing: 0.12em;
    color: var(--candle-amber);
}

.flicker-letter {
    display: inline-block;
    animation: letterFlicker 3s cubic-bezier(0.4, 0.0, 0.6, 1) infinite;
}

@keyframes letterFlicker {
    0% { opacity: 0.7; }
    20% { opacity: 1; }
    40% { opacity: 0.75; }
    60% { opacity: 0.95; }
    80% { opacity: 0.65; }
    100% { opacity: 0.7; }
}

.threshold-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40vh;
    background: linear-gradient(180deg, transparent 0%, var(--slate-void) 100%);
    pointer-events: none;
    z-index: 5;
}

/* ===== LIGHT POOLING ===== */
.chamber::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 100px;
    background: radial-gradient(ellipse at 50% 100%, rgba(232, 164, 74, 0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}

/* ===== GLOW HALOS ===== */
.glow-halo {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    box-shadow: 0 0 60px 30px rgba(232, 164, 74, 0.08), 0 0 120px 60px rgba(232, 164, 74, 0.04);
    pointer-events: none;
    z-index: 2;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .specimen-grid {
        grid-template-columns: 1fr;
    }

    .frame-1, .frame-2, .frame-3, .frame-4, .frame-5, .frame-6 {
        grid-column: 1;
        grid-row: auto;
        margin-top: 1.5rem;
        min-height: 280px;
    }

    .reading-columns {
        grid-template-columns: 1fr;
    }

    .narrow-column {
        grid-column: 1;
    }

    .wide-column {
        grid-column: 1;
    }

    .candle-divider {
        display: none;
    }

    #seed-pod-svg {
        right: 2vw;
        bottom: 5vh;
        width: 60vw;
    }

    .chamber-title-block {
        left: 5vw;
        top: 15vh;
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }

    #causality-title .letter,
    .specimen-frame,
    .blur-reveal {
        opacity: 1 !important;
        filter: none !important;
        transform: none !important;
    }

    .seed-path,
    .tree-botanical,
    .tree-causal {
        stroke-dashoffset: 0 !important;
    }
}
