/* ============================================
   judge.club - styles.css
   Anti-design / Immersive-scroll / Retro-futuristic
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --xerox-cream: #F0E8D8;
    --carbon-black: #1A1A1A;
    --verdict-vermillion: #D94032;
    --signal-cyan: #00B4D8;
    --phosphor-green: #39FF14;
    --legal-yellow: #F5E6A3;
    --graphite-wash: #706858;
    --blackout: #0D0D0D;

    --font-primary: 'Space Mono', monospace;
    --font-stamp: 'VT323', monospace;
    --font-annotation: 'Caveat', cursive;

    --grid-standard: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 19px,
        rgba(112, 104, 88, 0.15) 19px,
        rgba(112, 104, 88, 0.15) 20px
    ),
    repeating-linear-gradient(
        90deg,
        transparent,
        transparent 19px,
        rgba(112, 104, 88, 0.15) 19px,
        rgba(112, 104, 88, 0.15) 20px
    );

    --grid-dense: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 7px,
        rgba(112, 104, 88, 0.08) 7px,
        rgba(112, 104, 88, 0.08) 8px
    ),
    repeating-linear-gradient(
        90deg,
        transparent,
        transparent 7px,
        rgba(112, 104, 88, 0.08) 7px,
        rgba(112, 104, 88, 0.08) 8px
    );

    --grid-diagonal: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 19px,
        rgba(112, 104, 88, 0.15) 19px,
        rgba(112, 104, 88, 0.15) 20px
    ),
    repeating-linear-gradient(
        135deg,
        transparent,
        transparent 19px,
        rgba(112, 104, 88, 0.15) 19px,
        rgba(112, 104, 88, 0.15) 20px
    );

    --torn-edge: polygon(
        0 4%, 3% 0, 7% 3%, 12% 1%, 18% 4%, 23% 0, 29% 2%, 35% 0,
        42% 3%, 48% 1%, 55% 0, 61% 4%, 68% 1%, 74% 0, 80% 3%,
        87% 1%, 93% 0, 97% 3%, 100% 1%, 100% 96%, 97% 100%, 93% 97%,
        87% 100%, 80% 98%, 74% 100%, 68% 97%, 61% 100%, 55% 98%,
        48% 100%, 42% 97%, 35% 100%, 29% 98%, 23% 100%, 18% 97%,
        12% 100%, 7% 98%, 3% 100%, 0 97%
    );

    --vignette: radial-gradient(ellipse at center, transparent 60%, rgba(112, 104, 88, 0.15) 100%);
}

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

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

body {
    font-family: var(--font-primary);
    font-weight: 400;
    font-size: clamp(0.9rem, 1.4vw, 1.1rem);
    line-height: 1.75;
    letter-spacing: 0.02em;
    color: var(--carbon-black);
    background-color: var(--xerox-cream);
    background-image: var(--vignette);
    overflow-x: hidden;
    position: relative;
}

/* CRT Scanline Overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
    pointer-events: none;
    z-index: 9999;
}

/* Paper texture overlay (inline SVG noise) */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Ccircle cx='23' cy='15' r='1' fill='%23706858' opacity='0.04'/%3E%3Ccircle cx='78' cy='42' r='1.5' fill='%23706858' opacity='0.03'/%3E%3Ccircle cx='156' cy='27' r='1' fill='%23706858' opacity='0.05'/%3E%3Ccircle cx='45' cy='89' r='1.2' fill='%23706858' opacity='0.04'/%3E%3Ccircle cx='112' cy='67' r='1' fill='%23706858' opacity='0.03'/%3E%3Ccircle cx='189' cy='95' r='1.5' fill='%23706858' opacity='0.04'/%3E%3Ccircle cx='34' cy='134' r='1' fill='%23706858' opacity='0.05'/%3E%3Ccircle cx='167' cy='152' r='1.2' fill='%23706858' opacity='0.03'/%3E%3Ccircle cx='89' cy='178' r='1' fill='%23706858' opacity='0.04'/%3E%3Ccircle cx='145' cy='112' r='1.5' fill='%23706858' opacity='0.05'/%3E%3Ccircle cx='67' cy='56' r='1' fill='%23706858' opacity='0.03'/%3E%3Ccircle cx='198' cy='189' r='1.2' fill='%23706858' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 9998;
}


/* --- Fixed Margin Markers --- */
.margin-markers {
    position: fixed;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.margin-stamp {
    font-family: var(--font-stamp);
    font-size: clamp(0.6rem, 1vw, 0.8rem);
    color: var(--verdict-vermillion);
    text-transform: uppercase;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    opacity: 0.5;
    letter-spacing: 0.15em;
    transform: rotate(-8deg);
    transition: opacity 0.3s, color 0.3s;
    cursor: default;
}

.margin-stamp.active {
    opacity: 1;
    color: var(--signal-cyan);
}


/* ============================================
   ZONE 1: The Docket
   ============================================ */
.zone-docket {
    position: relative;
    width: 100%;
    height: 100vh;
    background-color: var(--xerox-cream);
    background-image: var(--grid-dense);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transform-origin: center bottom;
    will-change: transform;
}

.docket-content {
    position: relative;
    text-align: center;
    width: 100%;
    padding: 0 2rem;
}

/* Hero Title */
.hero-title {
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: clamp(3rem, 10vw, 8rem);
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--carbon-black);
    position: relative;
    display: inline-block;
}

.hero-title .char {
    display: inline-block;
    opacity: 0;
    clip-path: inset(100% 0 0 0);
    transition: none;
}

.hero-title .char.revealed {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    text-shadow: 0 2px 0 var(--xerox-cream);
}

.hero-title .char[data-char="j"] {
    position: relative;
    top: var(--char-offset, 0);
}

.hero-title .char-period {
    font-size: 300%;
    line-height: 0.3;
    vertical-align: baseline;
    position: relative;
    top: -0.1em;
}

/* Hero Subtitle */
.hero-subtitle {
    font-family: var(--font-stamp);
    font-size: clamp(0.9rem, 1.8vw, 1.2rem);
    color: var(--signal-cyan);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 2rem;
    opacity: 0;
    animation: subtitlePulse 3s ease-in-out infinite;
    animation-play-state: paused;
}

.hero-subtitle.visible {
    animation-play-state: running;
}

@keyframes subtitlePulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Rubber Stamps */
.stamp {
    position: absolute;
    font-family: var(--font-stamp);
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
    text-transform: uppercase;
    color: var(--verdict-vermillion);
    opacity: 0;
    border: 2px solid var(--verdict-vermillion);
    outline: 2px solid var(--verdict-vermillion);
    outline-offset: 2px;
    border-radius: 4px;
    padding: 4px 12px;
    pointer-events: none;
    transform: scale(1.3);
    filter: blur(0.3px);
}

.stamp.slammed {
    opacity: 0.7;
    transform: scale(1) rotate(var(--stamp-rotate, -5deg));
    transition: transform 150ms cubic-bezier(0.34, 1.56, 0.64, 1), opacity 100ms ease;
}

.stamp-est {
    --stamp-rotate: -8deg;
    top: 15%;
    right: 15%;
}

.stamp-members {
    --stamp-rotate: -3deg;
    bottom: 25%;
    left: 12%;
}

.stamp-rise {
    --stamp-rotate: -6deg;
    top: 22%;
    left: 20%;
}


/* ============================================
   ZONE 2: The Evidence Room
   ============================================ */
.zone-evidence {
    position: relative;
    min-height: 300vh;
    padding: 10vh 0 20vh;
    background-color: var(--xerox-cream);
}

/* Document Blocks */
.document {
    position: sticky;
    width: var(--doc-width, 75vw);
    margin: 0 auto 60vh;
    padding: 4rem 3rem 3rem;
    top: var(--doc-top, 2rem);
    transform: rotate(calc(var(--doc-rotation, 0) * 1deg));
    clip-path: var(--torn-edge);
    box-shadow: 0 8px 24px rgba(26, 26, 26, 0.12);
    animation: morphEdges 20s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
    z-index: 1;
    transition: transform 0.1s ease-out;
}

.document h2 {
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: clamp(1.3rem, 2.5vw, 2rem);
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
    color: var(--carbon-black);
}

.document p {
    margin-bottom: 1.5rem;
    max-width: 65ch;
}

/* Document background variants */
.doc-1 {
    background-color: #fff;
    background-image: var(--grid-standard);
    z-index: 2;
}

.doc-2 {
    background-color: var(--legal-yellow);
    z-index: 3;
}

.doc-3 {
    background-color: var(--xerox-cream);
    background-image: var(--grid-diagonal);
    z-index: 4;
}

.doc-4 {
    background-color: #fff;
    background-image: var(--grid-standard);
    z-index: 5;
}

.doc-5 {
    background-color: var(--legal-yellow);
    z-index: 6;
}

/* Torn-edge morph animation */
@keyframes morphEdges {
    0% {
        clip-path: polygon(
            0 4%, 3% 0, 7% 3%, 12% 1%, 18% 4%, 23% 0, 29% 2%, 35% 0,
            42% 3%, 48% 1%, 55% 0, 61% 4%, 68% 1%, 74% 0, 80% 3%,
            87% 1%, 93% 0, 97% 3%, 100% 1%, 100% 96%, 97% 100%, 93% 97%,
            87% 100%, 80% 98%, 74% 100%, 68% 97%, 61% 100%, 55% 98%,
            48% 100%, 42% 97%, 35% 100%, 29% 98%, 23% 100%, 18% 97%,
            12% 100%, 7% 98%, 3% 100%, 0 97%
        );
    }
    33% {
        clip-path: polygon(
            0 3%, 3% 1%, 7% 4%, 12% 0, 18% 3%, 23% 1%, 29% 0, 35% 2%,
            42% 1%, 48% 3%, 55% 1%, 61% 0, 68% 3%, 74% 1%, 80% 0,
            87% 3%, 93% 1%, 97% 0, 100% 3%, 100% 97%, 97% 98%, 93% 100%,
            87% 97%, 80% 100%, 74% 98%, 68% 100%, 61% 97%, 55% 100%,
            48% 98%, 42% 100%, 35% 97%, 29% 100%, 23% 97%, 18% 100%,
            12% 98%, 7% 100%, 3% 97%, 0 100%
        );
    }
    66% {
        clip-path: polygon(
            0 2%, 3% 3%, 7% 0, 12% 4%, 18% 1%, 23% 3%, 29% 1%, 35% 3%,
            42% 0, 48% 4%, 55% 2%, 61% 1%, 68% 0, 74% 3%, 80% 1%,
            87% 4%, 93% 2%, 97% 1%, 100% 0, 100% 98%, 97% 97%, 93% 100%,
            87% 98%, 80% 97%, 74% 100%, 68% 98%, 61% 97%, 55% 100%,
            48% 97%, 42% 100%, 35% 98%, 29% 97%, 23% 100%, 18% 98%,
            12% 97%, 7% 100%, 3% 98%, 0 100%
        );
    }
    100% {
        clip-path: polygon(
            0 4%, 3% 0, 7% 3%, 12% 1%, 18% 4%, 23% 0, 29% 2%, 35% 0,
            42% 3%, 48% 1%, 55% 0, 61% 4%, 68% 1%, 74% 0, 80% 3%,
            87% 1%, 93% 0, 97% 3%, 100% 1%, 100% 96%, 97% 100%, 93% 97%,
            87% 100%, 80% 98%, 74% 100%, 68% 97%, 61% 100%, 55% 98%,
            48% 100%, 42% 97%, 35% 100%, 29% 98%, 23% 100%, 18% 97%,
            12% 100%, 7% 98%, 3% 100%, 0 97%
        );
    }
}

/* Stamp Overlays on Documents */
.stamp-overlay {
    position: absolute;
    top: 1rem;
    right: 2rem;
    font-family: var(--font-stamp);
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
    text-transform: uppercase;
    padding: 3px 10px;
    border: 2px solid;
    outline: 2px solid;
    outline-offset: 2px;
    border-radius: 4px;
    transform: rotate(-6deg);
    filter: blur(0.3px);
    pointer-events: none;
}

.stamp-overlay-red {
    color: var(--verdict-vermillion);
    border-color: var(--verdict-vermillion);
    outline-color: var(--verdict-vermillion);
    opacity: 0.7;
}

.stamp-overlay-cyan {
    color: var(--signal-cyan);
    border-color: var(--signal-cyan);
    outline-color: var(--signal-cyan);
    opacity: 0.7;
}

/* Annotations (Caveat handwriting) */
.annotation-caveat {
    position: absolute;
    font-family: var(--font-annotation);
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    color: var(--graphite-wash);
    opacity: 0.6;
    transform: rotate(var(--ann-rotate, -3deg));
    left: var(--ann-x, -50px);
    top: var(--ann-y, 30px);
    white-space: nowrap;
    pointer-events: none;
}

/* Fold marks on documents */
.document::after {
    content: '';
    position: absolute;
    top: 45%;
    left: 5%;
    right: 5%;
    height: 1px;
    background-color: var(--graphite-wash);
    opacity: 0.15;
    pointer-events: none;
}


/* ============================================
   ZONE 3: The Deliberation
   ============================================ */
.zone-deliberation {
    position: relative;
    min-height: 200vh;
    padding: 15vh 2rem;
    background-color: var(--xerox-cream);
    background-image: var(--grid-standard);
    transition: background-image 0.5s;
}

.zone-deliberation.diagonal-grid {
    background-image: var(--grid-diagonal);
}

.deliberation-column {
    max-width: 38ch;
    margin: 0 auto;
    position: relative;
}

.deliberation-text {
    font-family: var(--font-primary);
    font-weight: 400;
    font-size: clamp(0.9rem, 1.4vw, 1.1rem);
    line-height: 1.75;
    letter-spacing: 0.02em;
    margin-bottom: 6rem;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.deliberation-text.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Margin notes in deliberation */
.margin-note {
    position: absolute;
    font-family: var(--font-annotation);
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    color: var(--graphite-wash);
    opacity: 0.6;
    transform: rotate(var(--note-offset, -3deg));
    white-space: nowrap;
    pointer-events: none;
}

.margin-note[style*="left"] {
    left: -120px;
}

.margin-note[style*="right"] {
    right: -140px;
    left: auto;
}


/* ============================================
   ZONE 4: The Verdict
   ============================================ */
.zone-verdict {
    position: relative;
    width: 100%;
    height: 100vh;
    background-color: var(--blackout);
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 19px,
            rgba(240, 232, 216, 0.06) 19px,
            rgba(240, 232, 216, 0.06) 20px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 19px,
            rgba(240, 232, 216, 0.06) 19px,
            rgba(240, 232, 216, 0.06) 20px
        );
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.verdict-content {
    text-align: center;
    position: relative;
}

.verdict-text {
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: clamp(5rem, 15vw, 12rem);
    color: var(--xerox-cream);
    letter-spacing: -0.03em;
    line-height: 1.1;
    animation: verdictWeight 4s ease-in-out infinite;
    display: inline;
}

@keyframes verdictWeight {
    0%, 100% {
        letter-spacing: 0.02em;
    }
    50% {
        letter-spacing: 0.08em;
    }
}

/* Blinking cursor */
.verdict-cursor {
    display: inline-block;
    width: 0.5em;
    height: 1.1em;
    background-color: var(--phosphor-green);
    vertical-align: text-bottom;
    margin-left: 0.1em;
    animation: cursorBlink 1060ms step-end infinite;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Scanline sweep */
.scanline-sweep {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--phosphor-green);
    opacity: 0.1;
    animation: scanSweep 8s linear infinite;
    pointer-events: none;
}

@keyframes scanSweep {
    0% { top: 0; }
    100% { top: 100%; }
}


/* ============================================
   Responsive adjustments
   ============================================ */
@media (max-width: 768px) {
    .margin-markers {
        display: none;
    }

    .annotation-caveat {
        display: none;
    }

    .margin-note {
        position: relative;
        left: 0 !important;
        right: 0 !important;
        display: block;
        margin-bottom: 3rem;
        text-align: center;
    }

    .document {
        width: 92vw !important;
        padding: 3rem 1.5rem 2rem;
    }

    .stamp-est,
    .stamp-members,
    .stamp-rise {
        display: none;
    }

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

@media (max-width: 480px) {
    .hero-title {
        font-size: clamp(2rem, 12vw, 4rem);
    }

    .deliberation-column {
        max-width: 100%;
    }
}
