/* ============================================
   pontius.quest — Styles
   A brooding meditation on the nature of judgment
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    /* Palette — The Sepia-Nostalgic Tribunal */
    --bg-primary: #1C1814;        /* Darkened Marble */
    --bg-secondary: #2A2420;      /* Worn Limestone */
    --bg-tertiary: #E8E0D4;       /* Dusty Stucco */
    --text-primary: #3A2E24;      /* Burnt Umber */
    --text-secondary: #5C4A3A;    /* Weathered Bronze */
    --text-tertiary: #6B5D50;     /* Faded Parchment Ink */
    --accent-primary: #8B4513;    /* Iron Gall Rust */
    --accent-secondary: #4A5568;  /* Predawn Mediterranean */
    --border-color: rgba(58, 46, 36, 0.4); /* Judgment Line */
    --limestone: #8C7B6B;         /* Limestone */

    /* Layout ratios — updated by JS per act */
    --left-ratio: 70fr;
    --right-ratio: 30fr;

    /* Basin opacity — updated by JS per act */
    --basin-opacity: 0.08;

    /* Scroll progress for Act V verdict scaling */
    --scroll-progress: 0;

    /* Act IV flash */
    --act-bg: var(--bg-primary);
}

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

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

body {
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    font-family: 'Crimson Text', serif;
    font-size: 18px;
    line-height: 1.65;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Background Basin --- */
.basin-bg {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50vw;
    height: 50vh;
    z-index: 0;
    pointer-events: none;
    opacity: var(--basin-opacity);
    transition: opacity 600ms ease;
}

.basin-svg {
    width: 100%;
    height: 100%;
}

.ripple {
    opacity: 0;
    transition: opacity 600ms ease;
}

/* --- Palimpsest Layer --- */
.palimpsest-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.palimpsest-fragment {
    position: absolute;
}

.frag-1 {
    top: 12%;
    left: 8%;
    width: 120px;
    transform: rotate(-3deg);
}

.frag-2 {
    top: 35%;
    right: 12%;
    width: 160px;
    transform: rotate(1.5deg);
}

.frag-3 {
    top: 58%;
    left: 15%;
    width: 100px;
    transform: rotate(-1deg);
}

.frag-4 {
    top: 75%;
    right: 20%;
    width: 200px;
    transform: rotate(2deg);
}

.frag-5 {
    top: 22%;
    right: 5%;
    width: 80px;
    transform: rotate(-2.5deg);
}

.frag-6 {
    bottom: 8%;
    left: 30%;
    width: 140px;
    transform: rotate(0.5deg);
}

/* --- Judgment Line (Central Divider) --- */
.judgment-line {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: var(--border-color);
    z-index: 10;
    pointer-events: none;
    transition: left 800ms ease-in-out, opacity 800ms ease-in-out;
    left: 70%;
    opacity: 1;
}

.judgment-line.hidden {
    opacity: 0;
}

/* --- Tribunal Container (Main Grid) --- */
.tribunal {
    position: relative;
    z-index: 1;
}

/* --- Act Base Styles --- */
.act {
    display: grid;
    grid-template-columns: var(--left-ratio) var(--right-ratio);
    min-height: 100vh;
    transition: grid-template-columns 800ms ease-in-out, background-color 600ms ease;
    background-color: var(--act-bg);
    position: relative;
}

/* --- Panel Styles --- */
.panel {
    padding: 80px 48px;
    position: relative;
    overflow: hidden;
}

.panel-inner {
    max-width: 640px;
    margin: 0 auto;
}

.panel-left {
    background-color: transparent;
}

.panel-right {
    background-color: rgba(42, 36, 32, 0.3);
}

/* --- Act Number --- */
.act-number {
    font-family: 'IM Fell English', serif;
    font-size: 13px;
    color: var(--limestone);
    letter-spacing: 0.3em;
    display: block;
    margin-bottom: 32px;
    text-transform: uppercase;
}

/* --- Column Fragment SVGs --- */
.column-fragment {
    display: block;
    width: 120px;
    height: 36px;
    margin-bottom: 40px;
}

/* --- Act Titles --- */
.act-title {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 48px;
    color: var(--text-secondary);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    line-height: 1.15;
    margin-bottom: 48px;
}

.deliberation-title {
    font-size: 36px;
    color: var(--text-tertiary);
    letter-spacing: 0.2em;
    margin-bottom: 40px;
}

/* ============================================
   ACT I: The Accusation (70/30)
   ============================================ */
.act-i {
    --left-ratio: 70fr;
    --right-ratio: 30fr;
}

.accusation-text .charge {
    font-family: 'Crimson Text', serif;
    font-size: 20px;
    font-weight: 400;
    line-height: 1.65;
    color: var(--text-secondary);
    margin-bottom: 28px;
}

.question-whisper {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: 28px;
    color: var(--text-tertiary);
    line-height: 1.5;
    margin-top: 40vh;
    opacity: 0.7;
}

.deliberation-note {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: 17px;
    color: var(--text-tertiary);
    line-height: 1.75;
    margin-top: 24px;
    opacity: 0.6;
}

/* ============================================
   ACT II: The Evidence (50/50)
   ============================================ */
.act-ii {
    --left-ratio: 50fr;
    --right-ratio: 50fr;
    background-color: var(--bg-primary);
}

/* Timeline blocks */
.timeline {
    position: relative;
    padding-left: 24px;
    border-left: 1px solid var(--border-color);
}

.timeline-block {
    margin-bottom: 48px;
    position: relative;
}

.timeline-block::before {
    content: '';
    position: absolute;
    left: -29px;
    top: 6px;
    width: 8px;
    height: 8px;
    border: 1px solid var(--accent-primary);
    background: var(--bg-primary);
    transform: rotate(45deg);
}

.timeline-year {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--accent-primary);
    letter-spacing: 0.2em;
    display: block;
    margin-bottom: 12px;
}

.timeline-text {
    font-family: 'Crimson Text', serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.65;
    color: var(--text-secondary);
}

/* Manuscript column (right panel Act II) */
.manuscript-column {
    padding-left: 16px;
    border-left: 1px solid rgba(107, 93, 80, 0.25);
}

.manuscript-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: 18px;
    line-height: 1.75;
    color: var(--text-tertiary);
    margin-bottom: 24px;
}

.manuscript-text em {
    font-style: normal;
    color: var(--accent-primary);
}

/* ============================================
   ACT III: The Crowd (80/20)
   ============================================ */
.act-iii {
    --left-ratio: 80fr;
    --right-ratio: 20fr;
    background-color: #1A1612;
}

/* Crowd voices — multi-column chaos */
.crowd-voices {
    column-width: 12ch;
    column-gap: 8px;
    column-rule: 1px solid rgba(58, 46, 36, 0.15);
}

.voice {
    display: block;
    font-family: 'Crimson Text', serif;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-secondary);
    margin-bottom: 6px;
    break-inside: avoid;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Deterministic variations via nth-child */
.voice:nth-child(6n+1) { opacity: 0.9; transform: rotate(-1deg); }
.voice:nth-child(6n+2) { opacity: 0.5; transform: rotate(1.5deg); }
.voice:nth-child(6n+3) { opacity: 0.75; transform: rotate(-0.5deg); }
.voice:nth-child(6n+4) { opacity: 0.4; transform: rotate(2deg); }
.voice:nth-child(6n+5) { opacity: 0.85; transform: rotate(-1.5deg); }
.voice:nth-child(6n+6) { opacity: 0.3; transform: rotate(0.8deg); }

.voice:nth-child(3n+1) { font-size: 18px; }
.voice:nth-child(5n+2) { font-size: 14px; }
.voice:nth-child(7n+3) { font-size: 20px; color: var(--accent-primary); }
.voice:nth-child(4n) { font-size: 15px; }

/* Monologue (right panel Act III) */
.panel-inner-monologue {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 80vh;
    max-width: 200px;
    margin: 0 auto;
}

.monologue-line {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: 15px;
    line-height: 2.2;
    color: var(--text-tertiary);
    opacity: 0.7;
}

.monologue-line:nth-child(n+4) {
    opacity: 0.55;
}

.monologue-line:nth-child(n+8) {
    opacity: 0.4;
}

.monologue-line:nth-child(n+12) {
    opacity: 0.3;
}

/* ============================================
   ACT IV: The Washing (Full-width)
   ============================================ */
.act-iv {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: var(--bg-primary);
    transition: background-color 1200ms ease;
    position: relative;
}

.act-iv-content {
    text-align: center;
    max-width: 600px;
    padding: 80px 40px;
    position: relative;
    z-index: 2;
}

.act-number-iv {
    color: var(--accent-secondary);
}

.act-title-iv {
    font-size: 56px;
    color: var(--accent-secondary);
    margin-bottom: 64px;
}

/* Basin center icon */
.basin-center {
    margin: 48px auto;
    width: 300px;
    height: 230px;
}

.basin-icon {
    width: 100%;
    height: 100%;
}

/* Ripple animation — the ONLY animation on the site */
.ripple-iv {
    opacity: 0;
    animation: ripple-expand 8s ease-in-out infinite;
    animation-play-state: paused;
}

.ripple-iv-1 { animation-delay: 0s; }
.ripple-iv-2 { animation-delay: 2.667s; }
.ripple-iv-3 { animation-delay: 5.333s; }

@keyframes ripple-expand {
    0% {
        opacity: 0;
        transform: scale(1);
    }
    20% {
        opacity: 0.6;
    }
    100% {
        opacity: 0;
        transform: scale(1.15);
    }
}

/* Ripples active when Act IV is in view */
.act-iv.active .ripple-iv {
    animation-play-state: running;
}

/* Act IV flash animation */
@keyframes act-iv-flash {
    0% { background-color: #1C1814; }
    30% { background-color: #E8E0D4; }
    50% { background-color: #E8E0D4; }
    100% { background-color: #2A2420; }
}

.act-iv.flashing {
    animation: act-iv-flash 4000ms ease forwards;
}

.act-iv.flashing .act-title-iv,
.act-iv.flashing .act-number-iv {
    color: var(--text-primary);
    transition: color 1200ms ease;
}

.act-iv.flashing .washing-text,
.act-iv.flashing .washing-subtext {
    color: var(--text-primary);
    transition: color 1200ms ease;
}

.act-iv.flashing .basin-icon ellipse,
.act-iv.flashing .basin-icon line {
    stroke: var(--text-primary);
    transition: stroke 1200ms ease;
}

/* Hand imprint — negative space */
.hand-imprint {
    width: 80px;
    height: 100px;
    margin: 24px auto;
    opacity: 0.08;
    background: radial-gradient(ellipse, var(--bg-tertiary) 0%, transparent 70%);
    border-radius: 40% 40% 30% 30%;
}

.washing-text {
    font-family: 'Crimson Text', serif;
    font-size: 20px;
    font-style: italic;
    line-height: 1.65;
    color: var(--text-secondary);
    margin-top: 40px;
    margin-bottom: 20px;
}

.washing-text em {
    font-style: normal;
    font-family: 'Cinzel', serif;
    font-size: 16px;
    letter-spacing: 0.15em;
    display: block;
    margin-top: 12px;
    color: var(--limestone);
}

.washing-subtext {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: 17px;
    line-height: 1.75;
    color: var(--text-tertiary);
    opacity: 0.7;
}

/* ============================================
   ACT V: The Verdict (30/70, inverted)
   ============================================ */
.act-v {
    --left-ratio: 30fr;
    --right-ratio: 70fr;
    background-color: #1A1612;
    min-height: 120vh;
}

.public-record {
    margin-top: 40px;
}

.record-text {
    font-family: 'Crimson Text', serif;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.65;
    color: var(--text-secondary);
    margin-bottom: 20px;
    opacity: 0.8;
}

.record-text em {
    font-style: normal;
    font-family: 'Cinzel', serif;
    font-size: 14px;
    letter-spacing: 0.15em;
    color: var(--limestone);
}

/* Verdict container */
.panel-inner-verdict {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 80vh;
}

.verdict-container {
    margin: 48px 0;
    text-align: center;
}

.verdict-text {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: calc(24px + var(--scroll-progress) * 136px);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--text-secondary);
    line-height: 1.1;
    word-break: break-word;
    transition: font-size 100ms linear;
}

/* Reflection text */
.verdict-reflection {
    margin-top: 64px;
}

.reflection-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: 18px;
    line-height: 1.75;
    color: var(--text-tertiary);
    margin-bottom: 24px;
}

.reflection-final {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 28px;
    letter-spacing: 0.2em;
    color: var(--accent-primary);
    margin-top: 48px;
    margin-bottom: 12px;
    text-align: center;
}

.reflection-final em {
    font-style: normal;
}

.reflection-translation {
    font-family: 'IM Fell English', serif;
    font-size: 14px;
    color: var(--limestone);
    text-align: center;
    letter-spacing: 0.1em;
    opacity: 0.7;
    margin-bottom: 80px;
}

/* ============================================
   RESPONSIVE: Mobile (< 768px)
   Single column, alternating tones
   ============================================ */
@media (max-width: 768px) {
    .act {
        display: flex;
        flex-direction: column;
        grid-template-columns: unset;
    }

    .judgment-line {
        display: none;
    }

    .panel {
        padding: 48px 24px;
    }

    .panel-left {
        background-color: rgba(28, 24, 20, 0.5);
    }

    .panel-right {
        background-color: rgba(42, 36, 32, 0.6);
    }

    .act-title {
        font-size: 32px;
        letter-spacing: 0.15em;
    }

    .deliberation-title {
        font-size: 24px;
    }

    .question-whisper {
        margin-top: 20px;
        font-size: 22px;
    }

    .act-title-iv {
        font-size: 36px;
    }

    .basin-center {
        width: 200px;
        height: 160px;
    }

    .panel-inner-monologue {
        min-height: 40vh;
        max-width: 100%;
    }

    .crowd-voices {
        column-width: 10ch;
    }

    .verdict-text {
        font-size: calc(20px + var(--scroll-progress) * 80px);
    }

    .reflection-final {
        font-size: 22px;
    }

    .panel-inner {
        max-width: 100%;
    }

    .act-iv-content {
        padding: 48px 24px;
    }

    .act-v {
        min-height: 100vh;
    }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

/* ============================================
   SELECTION STYLING
   ============================================ */
::selection {
    background: rgba(139, 69, 19, 0.3);
    color: var(--bg-tertiary);
}
