/* ==========================================================================
   reasoner.studio - Styles
   Surreal-rationalism: impossible architecture of thought
   Isometric grid, Ma negative space, staircase descent, dialectical rhythm
   ========================================================================== */

/* -- Custom Properties -- */
:root {
    /* Colors (from DESIGN.md palette) */
    --void-black: #08090E;
    --deep-indigo: #131A3A;
    --sapphire-blue: #2A3B6E;
    --pale-silver: #C8CDD8;
    --insight-teal: #3DD8C5;
    --axiom-gold: #D4A843;
    --contradiction-red: #C43E52;
    --hypothesis-mist: #8B8FAF;
    --dark-surface: #0E0F15;
    --thought-chip-bg: #1A1F3D;

    /* Isometric grid foundation */
    --iso-angle: 30deg;

    /* Typography */
    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Libre Baskerville', serif;
    --font-mono: 'IBM Plex Mono', monospace;

    /* Custom easing: fast start, gentle deceleration -- the rhythm of insight */
    --ease-insight: cubic-bezier(0.16, 1, 0.3, 1);

    /* Ma spacing: generous emptiness between sections */
    --section-gap: clamp(8rem, 15vh, 20rem);
}

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

html {
    scroll-behavior: smooth;
    background-color: var(--void-black);
    color: var(--pale-silver);
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.1vw, 1.2rem);
    font-weight: 400;
    line-height: 1.75;
    letter-spacing: 0.005em;
    overflow-x: hidden;
}

body {
    background-color: var(--void-black);
    min-height: 100vh;
    position: relative;
}

/* -- Lattice Canvas (Fixed Background) -- */
#lattice-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* -- Logical Notation Wallpaper -- */
/* Giant logic symbols barely visible against the void: FOR ALL, THERE EXISTS, AND, OR, NOT, IMPLIES, TURNSTILE, EQUIV */
.logic-symbols {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.logic-symbol {
    position: absolute;
    font-family: var(--font-display);
    font-size: clamp(15rem, 25vw, 30rem);
    color: var(--deep-indigo);
    opacity: 0.35;
    user-select: none;
    line-height: 1;
}

/* Scatter symbols across the viewport -- dark-adapted vision revealing stars */
.symbol-1 { top: -5%; left: 5%; transform: rotate(-8deg); }
.symbol-2 { top: 15%; right: -8%; transform: rotate(5deg); }
.symbol-3 { top: 35%; left: -10%; transform: rotate(12deg); }
.symbol-4 { top: 55%; right: 5%; transform: rotate(-3deg); }
.symbol-5 { top: 75%; left: 10%; transform: rotate(7deg); }
.symbol-6 { top: 90%; right: -5%; transform: rotate(-10deg); }
.symbol-7 { top: 45%; left: 40%; transform: rotate(2deg); }
.symbol-8 { top: 10%; left: 50%; transform: rotate(-5deg); }

/* -- Impossible Geometry (peripheral decorations -- always glimpsed, never center-stage) -- */
.impossible-geom {
    position: absolute;
    z-index: 1;
    pointer-events: none;
    opacity: 0.4;
}

.penrose-bg {
    width: 180px;
    height: 180px;
    top: 8%;
    right: 6%;
}

.necker-bg {
    width: 150px;
    height: 150px;
    bottom: 12%;
    left: 4%;
}

.staircase-decor {
    width: 120px;
    height: 120px;
    bottom: 8%;
    right: 10%;
}

.penrose-triangle {
    width: 160px;
    height: 160px;
    top: 20%;
    right: 5%;
    animation: penrose-rotate 60s linear infinite;
}

@keyframes penrose-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.mobius-decor {
    width: 200px;
    height: 100px;
    bottom: 15%;
    left: 5%;
}

.necker-conclusion {
    width: 100px;
    height: 100px;
    top: 10%;
    right: 8%;
}

/* -- Chamber (Section) Base -- */
/* Each chamber: min-height 100vh, centered content, the descent into reason */
.chamber {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    overflow: hidden;
}

.chamber-content {
    position: relative;
    width: 100%;
    max-width: 1200px;
    padding: 4rem 2rem;
    z-index: 3;
}

/* -- Staircase-descent scroll architecture -- */
/* Each section sits slightly lower and to the right of the previous one,
   creating a diagonal cascade from upper-left to lower-right */
.chamber-ii .chamber-content {
    transform: translateX(2vw);
}
.chamber-iii .chamber-content {
    transform: translateX(4vw);
}
.chamber-iv .chamber-content {
    transform: translateX(3vw);
}
.chamber-v .chamber-content {
    transform: translateX(2vw);
}
.chamber-vi .chamber-content {
    transform: translateX(0);
}

/* -- Staircase horizontal rules between chambers -- */
/* Thin gradient from sapphire-blue to transparent, reinforcing staircase edge */
.chamber + .chamber::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 60%;
    height: 1px;
    background: linear-gradient(to right, var(--sapphire-blue), transparent);
    z-index: 3;
}

/* ==========================================================================
   Chamber I: The Proposition
   No hero section -- begins immediately with a thought, unadorned
   ========================================================================== */
.chamber-i {
    background-color: var(--void-black);
}

.proposition-title {
    font-family: var(--font-display);
    font-size: clamp(3rem, 8vw, 9rem);
    font-weight: 500;
    letter-spacing: 0.15em;
    line-height: 1.1;
    color: var(--pale-silver);
    opacity: 0;
    transition: opacity 1.5s var(--ease-insight);
    text-align: left;
}

.proposition-title.visible {
    opacity: 1;
}

.proposition-subtitle {
    font-family: var(--font-body);
    font-size: clamp(1.1rem, 1.8vw, 1.5rem);
    font-weight: 400;
    line-height: 1.75;
    color: var(--hypothesis-mist);
    max-width: 38ch;
    margin-top: 2rem;
    opacity: 0;
    transition: opacity 1.8s var(--ease-insight) 0.5s;
}

.proposition-subtitle.visible {
    opacity: 1;
}

/* ==========================================================================
   Chamber II: The Axioms
   Three axiom blocks fade-reveal with 200ms stagger, isometric grid placement
   ========================================================================== */
.chamber-ii {
    background-color: var(--void-black);
}

.axioms-grid {
    display: flex;
    flex-direction: column;
    gap: clamp(3rem, 5vh, 6rem);
}

.axiom {
    border: 1px solid var(--sapphire-blue);
    padding: 2rem 3rem;
    max-width: 38ch;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s var(--ease-insight), transform 0.8s var(--ease-insight);
}

.axiom.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Isometric grid placement: left, center-right, far-left (staggered positions) */
.axiom-1 {
    align-self: flex-start;
    margin-left: 2vw;
}
.axiom-2 {
    align-self: flex-end;
    margin-right: 5vw;
}
.axiom-3 {
    align-self: flex-start;
    margin-left: 0;
}

.axiom-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--insight-teal);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.axiom-text {
    font-family: var(--font-mono);
    font-size: 0.9em;
    color: var(--pale-silver);
    line-height: 1.65;
}

/* ==========================================================================
   Chamber III: The Method
   Horizontal rule path-draw animation, body text in Libre Baskerville
   ========================================================================== */
.chamber-iii {
    background-color: var(--void-black);
}

.horizontal-rule-container {
    margin-bottom: 3rem;
    overflow: hidden;
}

.hr-line {
    width: 60%;
    height: 2px;
    opacity: 0;
    transition: opacity 1.5s var(--ease-insight);
}

.hr-line.revealed {
    opacity: 1;
}

.hr-line line {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 1.5s ease-in-out;
}

.hr-line.revealed line {
    stroke-dashoffset: 0;
}

.method-text {
    max-width: 38ch;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s var(--ease-insight), transform 0.8s var(--ease-insight);
}

.method-text.revealed {
    opacity: 1;
    transform: translateY(0);
}

.section-heading {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 3.5vw, 3.5rem);
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 1.1;
    color: var(--pale-silver);
    margin-bottom: 2rem;
}

.body-text {
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.1vw, 1.2rem);
    font-weight: 400;
    line-height: 1.75;
    letter-spacing: 0.005em;
    color: var(--pale-silver);
    margin-bottom: 1.5rem;
}

.body-text:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   Chamber IV: The Lattice (Silent Chamber)
   Pure negative space with lattice visible, pulsing gently.
   Crystal assembles from nothing over 3 seconds, then glows in Insight Teal.
   ========================================================================== */
.chamber-iv {
    background-color: var(--void-black);
}

.lattice-chamber {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

/* Isometric crystalline formation: 3-5 overlapping polygonal shapes */
.crystal-form {
    position: relative;
    width: 240px;
    height: 240px;
    opacity: 0;
    transition: opacity 3s var(--ease-insight);
}

.crystal-form.visible {
    opacity: 1;
}

.crystal-form.glowing {
    filter: drop-shadow(0 0 120px rgba(61, 216, 197, 0.08));
}

.crystal-face {
    position: absolute;
    background: transparent;
    border: 1px solid var(--sapphire-blue);
}

/* Five overlapping faceted shapes with different opacity values creating depth */
.crystal-face-1 {
    width: 80px;
    height: 80px;
    top: 80px;
    left: 80px;
    opacity: 0.8;
    transform: rotate(45deg);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    background: linear-gradient(135deg, rgba(42, 59, 110, 0.4), rgba(19, 26, 58, 0.6));
}

.crystal-face-2 {
    width: 140px;
    height: 140px;
    top: 50px;
    left: 50px;
    opacity: 0.6;
    transform: rotate(30deg);
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
    background: linear-gradient(180deg, rgba(42, 59, 110, 0.3), rgba(19, 26, 58, 0.5));
}

.crystal-face-3 {
    width: 110px;
    height: 110px;
    top: 65px;
    left: 65px;
    opacity: 0.4;
    transform: rotate(-15deg);
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    background: linear-gradient(225deg, rgba(42, 59, 110, 0.35), rgba(19, 26, 58, 0.45));
}

.crystal-face-4 {
    width: 60px;
    height: 60px;
    top: 90px;
    left: 90px;
    opacity: 0.8;
    transform: rotate(60deg);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    background: linear-gradient(90deg, rgba(61, 216, 197, 0.08), rgba(42, 59, 110, 0.4));
}

.crystal-face-5 {
    width: 170px;
    height: 170px;
    top: 35px;
    left: 35px;
    opacity: 0.3;
    transform: rotate(22deg);
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
    background: linear-gradient(315deg, rgba(42, 59, 110, 0.2), rgba(8, 9, 14, 0.3));
}

/* Crystal assembly animation: scale from 0.3 to 1 */
.crystal-form .crystal-face {
    transform-origin: center center;
    transition: transform 3s var(--ease-insight), opacity 3s var(--ease-insight);
}

.crystal-form:not(.visible) .crystal-face {
    transform: scale(0.3) rotate(0deg);
    opacity: 0;
}

.crystal-form.visible .crystal-face-1 { transform: scale(1) rotate(45deg); }
.crystal-form.visible .crystal-face-2 { transform: scale(1) rotate(30deg); }
.crystal-form.visible .crystal-face-3 { transform: scale(1) rotate(-15deg); }
.crystal-form.visible .crystal-face-4 { transform: scale(1) rotate(60deg); }
.crystal-form.visible .crystal-face-5 { transform: scale(1) rotate(22deg); }

/* ==========================================================================
   Chamber V: The Argument
   Thesis-antithesis pattern: left vs right, connected by teal vertical line
   ========================================================================== */
.chamber-v {
    background-color: var(--void-black);
}

.argument-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    align-items: start;
    min-height: 70vh;
}

.thesis,
.antithesis {
    max-width: 38ch;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s var(--ease-insight), transform 0.8s var(--ease-insight);
}

.thesis.revealed,
.antithesis.revealed {
    opacity: 1;
    transform: translateY(0);
}

.thesis {
    justify-self: start;
    padding-left: 2rem;
}

.antithesis {
    justify-self: end;
    padding-right: 2rem;
    text-align: right;
}

.argument-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--insight-teal);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.argument-line-container {
    display: flex;
    justify-content: center;
    align-items: stretch;
    min-height: 100%;
}

.argument-line {
    width: 1px;
    height: 0;
    background-color: var(--insight-teal);
    transition: height 2s var(--ease-insight);
}

.argument-line.extended {
    height: 100%;
}

/* ==========================================================================
   Chamber VI: The Conclusion (Synthesis -- centered)
   Background warms slightly: void-black to dark-surface with amber tint
   Axiom Gold dominates text for the first and only time
   ========================================================================== */
.chamber-vi {
    background-color: var(--dark-surface);
}

.conclusion-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.conclusion-text {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1.2s var(--ease-insight), transform 1.2s var(--ease-insight);
}

.conclusion-text.revealed {
    opacity: 1;
    transform: translateY(0);
}

.conclusion-heading {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 5rem);
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 1.15;
    color: var(--axiom-gold);
    max-width: 20ch;
    margin: 0 auto;
}

.conclusion-lattice-note {
    margin-top: 4rem;
    max-width: 38ch;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.5s var(--ease-insight) 0.5s, transform 1.5s var(--ease-insight) 0.5s;
}

.conclusion-lattice-note.revealed {
    opacity: 1;
    transform: translateY(0);
}

.conclusion-meta {
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1vw, 1.1rem);
    color: var(--hypothesis-mist);
    line-height: 1.75;
    font-style: italic;
}

/* ==========================================================================
   Reveal Animation Base (IntersectionObserver driven)
   ========================================================================== */
.reveal-element {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s var(--ease-insight), transform 0.8s var(--ease-insight);
}

.reveal-element.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .argument-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .argument-line-container {
        display: flex;
        justify-content: center;
        min-height: auto;
        height: 80px;
    }

    .argument-line.extended {
        height: 80px;
    }

    .antithesis {
        text-align: left;
        padding-right: 0;
        padding-left: 2rem;
    }

    .thesis {
        padding-left: 1rem;
    }

    .axiom-1,
    .axiom-2,
    .axiom-3 {
        align-self: stretch;
        margin-left: 0;
        margin-right: 0;
    }

    .chamber-ii .chamber-content,
    .chamber-iii .chamber-content,
    .chamber-iv .chamber-content,
    .chamber-v .chamber-content {
        transform: translateX(0);
    }

    .impossible-geom {
        display: none;
    }

    .logic-symbol {
        font-size: clamp(8rem, 15vw, 18rem);
    }

    .conclusion-heading {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .chamber-content {
        padding: 3rem 1.2rem;
    }

    .axiom {
        padding: 1.5rem 2rem;
    }
}

/* -- Scrollbar -- */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--void-black);
}

::-webkit-scrollbar-thumb {
    background: var(--sapphire-blue);
    border-radius: 2px;
}

/* -- Selection -- */
::selection {
    background: rgba(61, 216, 197, 0.2);
    color: var(--pale-silver);
}
