:root {
    --ink-abyss: #0B1026;
    --frosted-vellum: rgba(240, 244, 248, 0.88);
    --verdict-rose: #E85D75;
    --dissent-violet: #7B4FAF;
    --acquittal-cerulean: #3DA5D9;
    --bleed-indigo: #2E3A6E;
    --storm-lavender: #9B8EC4;
    --ice-glass: rgba(168, 216, 234, 0.12);
    --frost-white: #E8EDF2;
    --deep-ink: #0B1026;
    --fog-gray: #8A9BB0;
    color-scheme: dark;
}

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

body {
    background: var(--ink-abyss);
    color: var(--frost-white);
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.2vw, 1.05rem);
    line-height: 1.65;
}

/* ====== WATERCOLOR VOID ====== */
.watercolor-void {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(46, 58, 110, 0.3) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 60%, rgba(26, 29, 46, 0.5) 0%, transparent 50%),
        linear-gradient(180deg, #0B1026 0%, #12162E 50%, #0B1026 100%);
}

.paper-grain {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

/* Atmosphere blobs */
.atmosphere-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    pointer-events: none;
    will-change: transform;
}

.blob-1 {
    width: 400px; height: 350px;
    top: 10%; left: 5%;
    background: radial-gradient(ellipse, rgba(123, 79, 175, 0.18) 0%, transparent 70%);
    animation: blobDrift1 32s ease-in-out infinite;
}

.blob-2 {
    width: 350px; height: 400px;
    top: 50%; right: 10%;
    background: radial-gradient(ellipse, rgba(61, 165, 217, 0.15) 0%, transparent 70%);
    animation: blobDrift2 38s ease-in-out infinite;
}

.blob-3 {
    width: 500px; height: 300px;
    bottom: 15%; left: 30%;
    background: radial-gradient(ellipse, rgba(155, 142, 196, 0.12) 0%, transparent 70%);
    animation: blobDrift3 28s ease-in-out infinite;
}

.blob-4 {
    width: 300px; height: 300px;
    top: 30%; left: 55%;
    background: radial-gradient(ellipse, rgba(46, 58, 110, 0.2) 0%, transparent 70%);
    animation: blobDrift4 35s ease-in-out infinite;
}

.blob-5 {
    width: 250px; height: 350px;
    top: 70%; left: 10%;
    background: radial-gradient(ellipse, rgba(232, 93, 117, 0.1) 0%, transparent 70%);
    animation: blobDrift1 40s ease-in-out infinite -10s;
}

.blob-6 {
    width: 400px; height: 250px;
    top: 5%; right: 25%;
    background: radial-gradient(ellipse, rgba(46, 58, 110, 0.15) 0%, transparent 70%);
    animation: blobDrift2 30s ease-in-out infinite -8s;
}

@keyframes blobDrift1 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(30px, -20px); }
    50% { transform: translate(-15px, 25px); }
    75% { transform: translate(20px, 10px); }
}

@keyframes blobDrift2 {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(-25px, 15px); }
    66% { transform: translate(20px, -30px); }
}

@keyframes blobDrift3 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(20px, 15px); }
    50% { transform: translate(-30px, -10px); }
    75% { transform: translate(10px, -20px); }
}

@keyframes blobDrift4 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-20px, 25px); }
}

/* Watermark title */
.watermark-title {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-8deg);
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(12rem, 20vw, 28rem);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: rgba(168, 216, 234, 0.06);
    mix-blend-mode: overlay;
    pointer-events: none;
    white-space: nowrap;
    z-index: 0;
}

/* ====== NAVIGATION ====== */
.navigation-ref {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 50;
    display: flex;
    gap: 6px;
    align-items: center;
}

.ref-link {
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.15em;
    color: var(--frost-white);
    opacity: 0.4;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: opacity 0.2s ease;
}

.ref-link:hover {
    opacity: 0.7;
}

.ref-sep {
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    color: var(--frost-white);
    opacity: 0.2;
}

/* ====== JUDGMENT GRID ====== */
.judgment-grid {
    position: relative;
    z-index: 10;
    display: grid;
    grid-template-columns: 1.1fr 0.8fr 1.1fr;
    gap: clamp(24px, 3vw, 48px);
    padding: clamp(60px, 8vw, 120px) clamp(24px, 4vw, 60px);
    max-width: 1200px;
    margin: 0 auto;
}

/* Card wrappers with vertical displacement */
.card-wrapper {
    overflow: visible;
}

.card-wrapper:nth-child(7n+1) { transform: translateY(-8px); }
.card-wrapper:nth-child(7n+2) { transform: translateY(14px); }
.card-wrapper:nth-child(7n+3) { transform: translateY(-3px); }
.card-wrapper:nth-child(7n+4) { transform: translateY(18px); }
.card-wrapper:nth-child(7n+5) { transform: translateY(-12px); }
.card-wrapper:nth-child(7n+6) { transform: translateY(6px); }
.card-wrapper:nth-child(7n+7) { transform: translateY(-1px); }

/* ====== JUDGMENT CARDS ====== */
.judgment-card {
    background: var(--frosted-vellum);
    backdrop-filter: blur(8px) saturate(1.2);
    -webkit-backdrop-filter: blur(8px) saturate(1.2);
    box-shadow:
        0 4px 24px rgba(11, 16, 38, 0.25),
        0 1px 4px rgba(11, 16, 38, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    padding: clamp(20px, 3vw, 32px);
    position: relative;
    transition: opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Clip paths for torn edges */
.judgment-card:nth-child(3n+1) {
    clip-path: polygon(2% 0%, 98% 1%, 100% 3%, 99% 97%, 97% 100%, 3% 99%, 0% 96%, 1% 4%);
}

.card-wrapper:nth-child(3n+1) .judgment-card {
    clip-path: polygon(2% 0%, 98% 1%, 100% 3%, 99% 97%, 97% 100%, 3% 99%, 0% 96%, 1% 4%);
}

.card-wrapper:nth-child(3n+2) .judgment-card {
    clip-path: polygon(0% 2%, 4% 0%, 96% 1%, 100% 0%, 99% 5%, 100% 95%, 97% 100%, 2% 98%, 0% 97%);
}

.card-wrapper:nth-child(3n+3) .judgment-card {
    clip-path: polygon(1% 1%, 99% 0%, 100% 2%, 98% 98%, 100% 100%, 0% 99%, 2% 96%, 0% 3%);
}

/* Card accent blobs */
.card-wrapper:nth-child(odd) .judgment-card::before {
    content: '';
    position: absolute;
    width: 70px;
    height: 50px;
    top: -15px;
    right: -10px;
    background: radial-gradient(ellipse at 40% 50%, rgba(232, 93, 117, 0.25) 0%, transparent 70%);
    border-radius: 50% 40% 60% 30% / 40% 50% 30% 60%;
    filter: blur(6px);
    pointer-events: none;
}

.card-wrapper:nth-child(even) .judgment-card::before {
    content: '';
    position: absolute;
    width: 90px;
    height: 60px;
    bottom: -20px;
    left: -15px;
    background: radial-gradient(ellipse at 60% 50%, rgba(46, 58, 110, 0.3) 0%, transparent 70%);
    border-radius: 40% 60% 30% 50% / 50% 30% 60% 40%;
    filter: blur(6px);
    pointer-events: none;
}

/* Verdict stamp blob on every 5th card */
.card-wrapper:nth-child(5n) .judgment-card::after {
    content: '';
    position: absolute;
    width: 150px;
    height: 150px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(232, 93, 117, 0.12) 0%, transparent 60%);
    border-radius: 50%;
    filter: blur(20px);
    pointer-events: none;
    z-index: 0;
}

/* Hidden state for stagger animation */
.judgment-card.hidden {
    opacity: 0;
    transform: scale(0.92) translateY(20px);
}

/* Card content */
.case-number {
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.25em;
    color: var(--fog-gray);
    opacity: 0.7;
    margin-bottom: 12px;
}

.card-title {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    letter-spacing: 0.18em;
    word-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--deep-ink);
    margin-bottom: 12px;
    line-height: 1.3;
}

.card-divider {
    width: 40%;
    height: 1px;
    background: var(--acquittal-cerulean);
    opacity: 0.3;
    margin-bottom: 16px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.judgment-card:not(.hidden) .card-divider {
    transform: scaleX(1);
}

.card-body {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.88rem, 1.1vw, 1rem);
    line-height: 1.65;
    color: rgba(11, 16, 38, 0.85);
    text-align: justify;
    hyphens: auto;
    margin-bottom: 16px;
    max-width: 52ch;
}

.dissent-note {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: var(--verdict-rose);
    text-align: right;
    text-shadow: 1px 1px 3px rgba(232, 93, 117, 0.3);
    position: relative;
    z-index: 2;
}

.card-wrapper:nth-of-type(3n+1) .dissent-note { transform: rotate(-2deg); }
.card-wrapper:nth-of-type(3n+2) .dissent-note { transform: rotate(1.5deg); }
.card-wrapper:nth-of-type(3n+3) .dissent-note { transform: rotate(3deg); }

/* Ink drip details */
.card-wrapper:nth-child(4n+1) .judgment-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    width: 1.5px;
    height: 40px;
    background: var(--dissent-violet);
    opacity: 0.15;
    border-radius: 0 0 50% 50%;
    transform-origin: top;
    transform: scaleY(0);
    transition: transform 0.8s ease 0.2s;
}

.card-wrapper:nth-child(4n+1) .judgment-card:not(.hidden)::after {
    transform: scaleY(1);
}

/* ====== VOID TERMINUS ====== */
.void-terminus {
    position: relative;
    z-index: 20;
    height: 30vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, transparent 0%, var(--ink-abyss) 60%);
}

.final-dissent {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(1.1rem, 2.5vw, 1.6rem);
    color: var(--verdict-rose);
    opacity: 0.4;
    letter-spacing: 0.05em;
}

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

@media (max-width: 600px) {
    .judgment-grid {
        grid-template-columns: 1fr;
        padding: 80px 16px;
    }

    .watermark-title {
        font-size: 6rem;
    }

    .navigation-ref {
        top: 10px;
        left: 10px;
    }

    .card-wrapper {
        transform: none !important;
    }
}

/* ====== REDUCED MOTION ====== */
@media (prefers-reduced-motion: reduce) {
    .atmosphere-blob {
        animation: none;
    }

    .judgment-card {
        transition: none;
    }

    .judgment-card.hidden {
        opacity: 1;
        transform: none;
    }

    .card-divider {
        transform: scaleX(1);
        transition: none;
    }

    .card-wrapper:nth-child(4n+1) .judgment-card::after {
        transform: scaleY(1);
        transition: none;
    }
}
