:root {
    --parchment-cream: #FFF5E6;
    --lilac-mist: #E8D5F0;
    --rose-quartz: #F0D4D8;
    --plum-dusk: #3A2B4A;
    --deep-plum-ink: #2E1F3E;
    --muted-lilac: #9B8AB8;
    --faded-gold: #D4B896;
    --antique-rose: #C8A0A8;
    --spectral-violet: #B8A9C8;
    --peach-haze: #F5E0D0;
    color-scheme: light;
}

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

body {
    background: var(--parchment-cream);
    color: var(--deep-plum-ink);
    font-family: 'Source Serif 4', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw + 0.4rem, 1.25rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
}

/* ====== PERSISTENT GRID LINES ====== */
.grid-lines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background-image:
        repeating-linear-gradient(
            90deg,
            rgba(184, 169, 200, 0.04) 0px,
            rgba(184, 169, 200, 0.04) 0.5px,
            transparent 0.5px,
            transparent calc(100% / 12)
        ),
        repeating-linear-gradient(
            0deg,
            rgba(184, 169, 200, 0.04) 0px,
            rgba(184, 169, 200, 0.04) 0.5px,
            transparent 0.5px,
            transparent 10vh
        );
}

/* ====== SPREADS ====== */
.spread {
    position: relative;
    scroll-snap-align: start;
    overflow: hidden;
}

/* ====== SPREAD 1: THE DOCKET ====== */
.spread-docket {
    min-height: 100vh;
    background: linear-gradient(15deg, var(--parchment-cream) 0%, var(--peach-haze) 45%, var(--lilac-mist) 100%);
    display: flex;
    align-items: flex-start;
    position: relative;
}

.spread-docket::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(
            90deg,
            rgba(184, 169, 200, 0.06) 0px,
            rgba(184, 169, 200, 0.06) 0.5px,
            transparent 0.5px,
            transparent 8vw
        ),
        repeating-linear-gradient(
            0deg,
            rgba(184, 169, 200, 0.06) 0px,
            rgba(184, 169, 200, 0.06) 0.5px,
            transparent 0.5px,
            transparent 8vw
        );
    pointer-events: none;
}

.docket-content {
    padding: 20vh 8vw 0;
    position: relative;
    z-index: 2;
}

.site-title {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(3.5rem, 10vw, 9rem);
    letter-spacing: -0.02em;
    line-height: 1.04;
    color: var(--deep-plum-ink);
}

.site-subtitle {
    font-family: 'Source Serif 4', serif;
    font-weight: 300;
    font-size: clamp(1.1rem, 1.5vw, 1.5rem);
    max-width: 40vw;
    color: var(--plum-dusk);
    line-height: 1.65;
    margin-top: 24px;
}

/* Scales animation */
.scales-animation {
    position: absolute;
    right: 5vw;
    bottom: 10vh;
    width: 40vw;
    max-width: 400px;
    height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    cursor: crosshair;
}

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

.scales-beam {
    transform-origin: 100px 60px;
    animation: scalesOscillate 12s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
}

.scale-left,
.scale-right {
    animation: scalesOscillate 12s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
}

@keyframes scalesOscillate {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(3deg); }
    50% { transform: rotate(0deg); }
    75% { transform: rotate(-3deg); }
}

/* Marginalia */
.marginalia {
    position: absolute;
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 4rem;
    color: var(--muted-lilac);
    opacity: 0.1;
    pointer-events: none;
}

.marginalia-1 {
    bottom: 15vh;
    left: 8vw;
}

.marginalia-gutter {
    position: relative;
    font-size: 3rem;
    margin-top: 40%;
}

/* ====== SPREAD 2: THE TESTIMONY ====== */
.spread-testimony {
    min-height: 120vh;
    padding: 10vh 0;
    background: var(--parchment-cream);
}

.testimony-grid {
    display: grid;
    grid-template-columns: 38% 10% 52%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 4vw;
    min-height: 100vh;
}

.testimony-left {
    display: flex;
    align-items: center;
}

.mixed-media {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 4px;
    overflow: hidden;
}

.media-base {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, var(--plum-dusk) 0%, var(--lilac-mist) 100%);
    mix-blend-mode: multiply;
    opacity: 0.4;
}

.media-overlay,
.media-calligraphy {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.testimony-gutter {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 0;
}

.gutter-rule {
    width: 1px;
    flex: 1;
    background: var(--faded-gold);
}

.testimony-right {
    padding: 40px 0 40px 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 24px;
}

.body-text {
    color: var(--deep-plum-ink);
    max-width: 52ch;
}

.pull-quote {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.4rem, 2.5vw, 2.2rem);
    color: var(--antique-rose);
    border-left: 3px solid var(--faded-gold);
    padding-left: 1.5rem;
    margin: 16px 0;
    line-height: 1.4;
    transition: background 0.4s ease;
}

.pull-quote:hover {
    background: rgba(240, 212, 216, 0.15);
}

/* ====== SPREAD 3: THE DELIBERATION ====== */
.spread-deliberation {
    min-height: 100vh;
    background: var(--parchment-cream);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.deliberation-text {
    position: absolute;
    top: 12vh;
    left: 8vw;
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.7rem, 0.9vw, 0.9rem);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--muted-lilac);
    z-index: 2;
}

.grid-convergence {
    width: 70vw;
    height: 70vh;
    position: relative;
    cursor: crosshair;
}

.grid-line-anim {
    position: absolute;
    width: 100%;
    height: 1px;
    background: var(--spectral-violet);
    opacity: 0.2;
    transform-origin: center;
}

.gl-1 { top: 10%; animation: gridRotate 20s linear infinite; }
.gl-2 { top: 25%; animation: gridRotate 20s linear infinite -2.5s; }
.gl-3 { top: 40%; animation: gridRotate 20s linear infinite -5s; }
.gl-4 { top: 55%; animation: gridRotate 20s linear infinite -7.5s; }
.gl-5 { top: 70%; animation: gridRotate 20s linear infinite -10s; }
.gl-6 { top: 85%; animation: gridRotate 20s linear infinite -12.5s; }
.gl-7 { top: 50%; animation: gridRotateReverse 20s linear infinite; opacity: 0.15; }
.gl-8 { top: 35%; animation: gridRotateReverse 20s linear infinite -5s; opacity: 0.15; }

@keyframes gridRotate {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(8deg); }
    50% { transform: rotate(0deg); }
    75% { transform: rotate(-8deg); }
    100% { transform: rotate(0deg); }
}

@keyframes gridRotateReverse {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    50% { transform: rotate(0deg); }
    75% { transform: rotate(5deg); }
    100% { transform: rotate(0deg); }
}

/* ====== SPREAD 4: THE VERDICT ====== */
.spread-verdict {
    min-height: 100vh;
    padding: 10vh 0;
    background: var(--parchment-cream);
}

.verdict-grid {
    display: grid;
    grid-template-columns: repeat(3, 25%);
    column-gap: 12.5%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 4vw;
    position: relative;
}

/* Grid-line column rules */
.verdict-grid::before,
.verdict-grid::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--faded-gold);
    opacity: 0.3;
}

.verdict-grid::before {
    left: calc(25% + 6.25%);
}

.verdict-grid::after {
    right: calc(25% + 6.25%);
}

.verdict-col {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.vignette {
    width: 120px;
    height: 120px;
    position: relative;
}

.vignette-shape {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--rose-quartz) 0%, var(--lilac-mist) 100%);
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    opacity: 0.4;
}

.vignette-circle {
    clip-path: circle(50% at 50% 50%);
}

.case-number {
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.65rem, 0.8vw, 0.85rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted-lilac);
    font-feature-settings: "tnum";
    margin-top: 24px;
}

/* ====== SPREAD 5: THE RECESS ====== */
.spread-recess {
    min-height: 60vh;
    background: linear-gradient(15deg, var(--lilac-mist) 0%, var(--peach-haze) 55%, var(--parchment-cream) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 40px;
    position: relative;
}

.spread-recess::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(
            90deg,
            rgba(184, 169, 200, 0.09) 0px,
            rgba(184, 169, 200, 0.09) 0.5px,
            transparent 0.5px,
            transparent 8vw
        );
    pointer-events: none;
}

.gavel-animation {
    width: 30vw;
    max-width: 200px;
    height: 30vh;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: crosshair;
}

.gavel-svg {
    width: 100px;
    height: 120px;
    opacity: 0;
    transform: translateY(-30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.gavel-svg.struck {
    opacity: 0.7;
    transform: translateY(0);
}

.gavel-svg.dissolving {
    opacity: 0;
    transform: translateY(10px) scale(0.9);
    transition: opacity 1.5s ease 0.5s, transform 1.5s ease 0.5s;
}

.closing-line {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    color: var(--plum-dusk);
    text-align: center;
    position: relative;
    z-index: 2;
}

/* ====== REVEAL ANIMATIONS ====== */
[data-reveal] {
    opacity: 0;
    transform: translateY(2rem);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

[data-reveal].revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
    .testimony-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .testimony-gutter {
        display: none;
    }

    .testimony-left {
        order: 2;
    }

    .testimony-right {
        order: 1;
    }

    .site-subtitle {
        max-width: 80vw;
    }

    .scales-animation {
        display: none;
    }

    .verdict-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .verdict-grid::before,
    .verdict-grid::after {
        display: none;
    }

    .site-title {
        font-size: clamp(2.5rem, 12vw, 5rem);
    }

    .grid-convergence {
        width: 90vw;
        height: 50vh;
    }
}

/* ====== REDUCED MOTION ====== */
@media (prefers-reduced-motion: reduce) {
    .scales-beam,
    .scale-left,
    .scale-right {
        animation: none;
    }

    .grid-line-anim {
        animation: none;
    }

    [data-reveal] {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .gavel-svg {
        opacity: 0.7;
        transform: none;
        transition: none;
    }

    body {
        scroll-snap-type: none;
        scroll-behavior: auto;
    }
}
