/* ============================================
   rational.quest — Pop-Art Tribunal
   CSS Custom Properties & Base
   ============================================ */

:root {
    --bg-dark: #0d0a1a;
    --bg-light: #f5f0e0;
    --accent-vermillion: #e63946;
    --accent-gold: #d4a017;
    --accent-ultraviolet: #4a0e8f;
    --text-light: #f0ead6;
    --text-dark: #1a0a2e;
    --halftone-rose: #c4607a;
    --line-gold: #b8941f;
    --dot-size-coarse: 6px;
    --dot-spacing-coarse: 12px;
    --dot-size-fine: 3px;
    --dot-spacing-fine: 8px;
    --blur-initial: 12px;
    --blur-duration: 800ms;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.7;
    letter-spacing: 0.005em;
    color: var(--text-dark);
    background: var(--bg-dark);
    overflow-x: hidden;
}

/* ============================================
   Chamber Base
   ============================================ */

.chamber {
    min-height: 100vh;
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chamber-dark {
    background-color: var(--bg-dark);
    color: var(--text-light);
}

.chamber-light {
    background-color: var(--bg-light);
    color: var(--text-dark);
}

/* ============================================
   Chamber Numerals (Watermark)
   ============================================ */

.chamber-numeral {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(15rem, 25vw, 30rem);
    line-height: 1;
    opacity: 0.06;
    color: var(--text-light);
    pointer-events: none;
    z-index: 0;
    user-select: none;
}

.numeral-light {
    opacity: 0.04;
    color: var(--text-dark);
}

/* ============================================
   Typography
   ============================================ */

.headline-grand {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(3.2rem, 7vw, 6rem);
    letter-spacing: -0.02em;
    line-height: 1.0;
    color: var(--accent-vermillion);
    text-shadow: 3px 3px 0 var(--text-dark);
}

.section-headline {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(2rem, 4.5vw, 3.5rem);
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--accent-gold);
    margin-bottom: 1.5rem;
}

.chamber-dark .section-headline {
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

.conclusion-headline {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(2.4rem, 5vw, 4.5rem);
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--accent-vermillion);
    text-align: center;
    max-width: 14ch;
}

.callout-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-style: italic;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    letter-spacing: 0.01em;
    line-height: 1.4;
    color: var(--accent-gold);
}

.chamber-label {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.domain-label {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    display: block;
    margin-top: 2rem;
    text-align: center;
    color: var(--text-dark);
    opacity: 0.6;
}

.body-text {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.7;
    letter-spacing: 0.005em;
    margin-bottom: 1.2rem;
    max-width: 50ch;
}

.text-light {
    color: var(--text-light);
}

/* ============================================
   Chamber Grid System
   ============================================ */

.chamber-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 2fr 1fr 1.5fr 1fr;
    gap: 2rem;
    width: 90%;
    max-width: 1400px;
    position: relative;
    z-index: 2;
    padding: 4rem 0;
}

/* Chamber I: headline in columns 2-4 */
#chamber-1 .chamber-grid {
    align-items: center;
    min-height: 70vh;
}

.col-2-4 {
    grid-column: 2 / 5;
}

/* Chamber II: text col 1-2, illustration col 4-6 */
.col-1-2 {
    grid-column: 1 / 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.col-4-6 {
    grid-column: 4 / 7;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chamber III: dialectic 3-column */
.dialectic-grid {
    grid-template-columns: 1fr 1.2fr 1fr;
}

.col-thesis {
    grid-column: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.col-center-diagram {
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.col-antithesis {
    grid-column: 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Chamber IV: text left, figure right */
.col-paradox-text {
    grid-column: 1 / 4;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.col-paradox-figure {
    grid-column: 4 / 7;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chamber V: synthesis 3x2 grid */
.synthesis-grid {
    grid-template-columns: 1fr 2fr 1fr;
    grid-template-rows: auto auto;
    align-items: center;
}

.col-synth-1 {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    justify-content: center;
}

.col-synth-2 {
    grid-column: 2;
    grid-row: 1;
}

.col-synth-3 {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    justify-content: center;
}

.col-synth-4 {
    grid-column: 1 / 2;
    grid-row: 2;
}

.col-synth-5 {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    justify-content: center;
}

.col-synth-6 {
    grid-column: 3;
    grid-row: 2;
}

/* Chamber VI: centered */
.chamber-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    padding: 2rem;
}

/* ============================================
   Ben-Day Dots
   ============================================ */

.ben-day-dots {
    position: absolute;
    z-index: 1;
    pointer-events: none;
}

.dots-upper-right {
    top: 0;
    right: 0;
    width: 50%;
    height: 50%;
    background-image: radial-gradient(circle, var(--halftone-rose) var(--dot-size-coarse), transparent var(--dot-size-coarse));
    background-size: var(--dot-spacing-coarse) var(--dot-spacing-coarse);
    opacity: 0.25;
    mask-image: radial-gradient(ellipse at 100% 0%, black 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at 100% 0%, black 30%, transparent 70%);
}

.dots-ultraviolet {
    bottom: 0;
    left: 0;
    width: 45%;
    height: 60%;
    background-image: radial-gradient(circle, var(--accent-ultraviolet) var(--dot-size-fine), transparent var(--dot-size-fine));
    background-size: var(--dot-spacing-fine) var(--dot-spacing-fine);
    opacity: 0.2;
    mask-image: radial-gradient(ellipse at 0% 100%, black 25%, transparent 65%);
    -webkit-mask-image: radial-gradient(ellipse at 0% 100%, black 25%, transparent 65%);
}

/* ============================================
   Halftone Curtains
   ============================================ */

.halftone-curtain {
    width: 100%;
    height: 40px;
    position: relative;
    z-index: 5;
}

.curtain-1,
.curtain-3,
.curtain-5 {
    background-image: radial-gradient(circle, var(--halftone-rose) 2px, transparent 2px);
    background-size: 8px 8px;
    background-color: var(--bg-light);
}

.curtain-2,
.curtain-4 {
    background-image: radial-gradient(circle, var(--halftone-rose) 2px, transparent 2px);
    background-size: 8px 8px;
    background-color: var(--bg-dark);
}

/* ============================================
   Speech Bubbles
   ============================================ */

.speech-bubble {
    position: relative;
    max-width: 420px;
    margin-top: 2rem;
}

.bubble-svg {
    width: 100%;
    height: auto;
    display: block;
}

.bubble-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    width: 80%;
    text-align: center;
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(0.9rem, 1.8vw, 1.3rem);
    line-height: 1.4;
    color: var(--accent-gold);
}

.bubble-left,
.bubble-right {
    max-width: 320px;
    margin-bottom: 1.5rem;
}

.bubble-left .bubble-text,
.bubble-right .bubble-text {
    font-size: clamp(0.8rem, 1.4vw, 1rem);
}

/* ============================================
   SVG Illustrations
   ============================================ */

.svg-illustration {
    width: 100%;
    max-width: 400px;
}

.svg-illustration svg {
    width: 100%;
    height: auto;
}

.vignette {
    max-width: 160px;
}

.penrose {
    max-width: 350px;
}

/* ============================================
   Decorative Borders
   ============================================ */

/* Greek Key Pattern (Chamber I) */
.border-greek-key {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 28px;
    z-index: 3;
    background:
        linear-gradient(90deg, var(--accent-gold) 12px, transparent 12px) 0 0 / 24px 28px,
        linear-gradient(0deg, var(--accent-gold) 6px, transparent 6px) 0 0 / 24px 28px,
        linear-gradient(90deg, transparent 12px, var(--accent-gold) 12px) 0 14px / 24px 14px,
        linear-gradient(0deg, transparent 8px, var(--accent-gold) 8px, var(--accent-gold) 14px, transparent 14px) 0 0 / 24px 28px;
    opacity: 0.35;
}

/* Islamic Geometric Tessellation (Chamber III) */
.border-islamic {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 32px;
    z-index: 3;
    background:
        linear-gradient(45deg, var(--accent-gold) 25%, transparent 25%) 0 0 / 16px 16px,
        linear-gradient(-45deg, var(--accent-gold) 25%, transparent 25%) 0 0 / 16px 16px,
        linear-gradient(45deg, transparent 75%, var(--accent-gold) 75%) 0 0 / 16px 16px,
        linear-gradient(-45deg, transparent 75%, var(--accent-gold) 75%) 0 0 / 16px 16px;
    opacity: 0.3;
}

/* East Asian Cloud Scroll (Chamber V) - using SVG-like CSS waves */
.border-cloud-scroll {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30px;
    z-index: 3;
    background:
        radial-gradient(circle at 50% 100%, transparent 14px, var(--accent-gold) 14px, var(--accent-gold) 16px, transparent 16px) 0 0 / 32px 30px;
    opacity: 0.3;
}

/* Composite Border (Chamber VI) */
.border-composite {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    border: 3px solid transparent;
    border-image: repeating-linear-gradient(
        90deg,
        var(--accent-gold) 0px,
        var(--accent-gold) 12px,
        var(--accent-vermillion) 12px,
        var(--accent-vermillion) 24px,
        var(--accent-ultraviolet) 24px,
        var(--accent-ultraviolet) 36px
    ) 3;
    opacity: 0.4;
}

/* ============================================
   Blur-Focus Animation System
   ============================================ */

.chamber-element {
    filter: blur(var(--blur-initial));
    opacity: 0.4;
    transform: scale(0.97);
    transition:
        filter var(--blur-duration) ease-out,
        opacity var(--blur-duration) ease-out,
        transform var(--blur-duration) ease-out;
}

.chamber-element[data-revealed="true"] {
    filter: blur(0);
    opacity: 1;
    transform: scale(1);
}

/* Speech bubble pop-in override */
.speech-bubble {
    transition:
        filter var(--blur-duration) ease-out,
        opacity var(--blur-duration) ease-out,
        transform 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
    transition-delay: 200ms;
}

.speech-bubble[data-revealed="true"] {
    filter: blur(0);
    opacity: 1;
    transform: scale(1);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 900px) {
    .chamber-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 3rem 1.5rem;
    }

    .col-2-4,
    .col-1-2,
    .col-4-6,
    .col-thesis,
    .col-center-diagram,
    .col-antithesis,
    .col-paradox-text,
    .col-paradox-figure {
        grid-column: 1;
    }

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

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

    .col-synth-1,
    .col-synth-2,
    .col-synth-3,
    .col-synth-4,
    .col-synth-5,
    .col-synth-6 {
        grid-column: 1;
        grid-row: auto;
    }

    .headline-grand {
        font-size: clamp(2.5rem, 10vw, 4rem);
    }

    .chamber-numeral {
        font-size: clamp(8rem, 40vw, 15rem);
    }

    .chamber {
        min-height: auto;
        padding: 4rem 0;
    }

    html {
        scroll-snap-type: none;
    }

    .speech-bubble {
        max-width: 100%;
    }

    .bubble-left,
    .bubble-right {
        max-width: 100%;
    }

    .svg-illustration {
        max-width: 280px;
        margin: 0 auto;
    }

    .border-greek-key,
    .border-islamic,
    .border-cloud-scroll {
        height: 20px;
    }
}

@media (max-width: 600px) {
    .chamber-grid {
        padding: 2rem 1rem;
    }

    .headline-grand {
        font-size: clamp(2rem, 8vw, 3rem);
    }

    .section-headline {
        font-size: clamp(1.6rem, 6vw, 2.2rem);
    }

    .conclusion-headline {
        font-size: clamp(1.8rem, 7vw, 3rem);
    }
}
