/* =============================================================
   dilemma.dev — Brutalist Anti-Design
   Palette : #0A0A0A void, #F5F5F0 bone, #E63946 arterial,
             #6B6B6B concrete, #39FF14 terminal, #4A154B (emergent)
   Fonts   : Space Grotesk (display), Source Serif 4 (body),
             IBM Plex Mono (machine voice)
   ============================================================= */

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

html {
    scroll-snap-type: y mandatory;
    scroll-behavior: auto; /* gavel-strike, no smooth scroll */
    overflow-x: hidden;
    background: #0A0A0A;
}

body {
    background: #0A0A0A;
    color: #F5F5F0;
    font-family: "Source Serif 4", Georgia, serif;
    font-weight: 400;
    font-size: clamp(16px, 1.1vw, 20px);
    line-height: 1.65;
    overflow-x: hidden;
    overflow-y: auto;
    cursor: default;
    text-rendering: optimizeLegibility;
}

/* Hidden defs SVG */
.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- 2. Typography roles --- */
.serif-voice {
    font-family: "Source Serif 4", Georgia, serif;
}

.mono-voice {
    font-family: "IBM Plex Mono", "Courier New", monospace;
    font-size: clamp(14px, 0.9vw, 17px);
    line-height: 1.5;
}

h1,
h2,
h3,
.headline {
    font-family: "Space Grotesk", "Helvetica Neue", sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
}

em {
    font-style: italic;
    color: #E63946;
}

.serif-voice em {
    font-style: italic;
    color: inherit;
    border-bottom: 1px solid currentColor;
    padding-bottom: 1px;
}

/* --- 3. Navigation: plain underlined links straddling tear-line --- */
#site-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 50;
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 1rem 1.25rem;
    background: transparent;
    pointer-events: auto;
    mix-blend-mode: difference;
}

.nav-link {
    font-family: "Space Grotesk", sans-serif;
    font-weight: 500;
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #F5F5F0;
    text-decoration: none;
    position: relative;
    padding: 0.2rem 0;
    cursor: pointer;
}

.nav-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 1px;
    background: #F5F5F0;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 280ms ease-out, background 200ms ease-out;
}

.nav-link:hover::after {
    transform: scaleX(1);
    background: #E63946;
}

.nav-link:hover {
    color: #E63946;
}

/* --- 4. Section primitives --- */
.section {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

#evidence.section-evidence {
    /* Broken grid is scroll-driven, not snapped */
    min-height: 220vh;
    scroll-snap-align: none;
    scroll-snap-stop: normal;
}

#void.section-void {
    scroll-snap-align: start;
}

/* --- 5. Section 1 — Opening Split-Screen --- */
.section-opening {
    background: #0A0A0A;
}

.split-container {
    position: absolute;
    inset: 0;
    display: flex;
    width: 100%;
    height: 100%;
}

/* Left half encroaches 3% rightward (52/48), creating asymmetric tension */
.split-left {
    position: relative;
    flex: 0 0 52%;
    background: #0A0A0A;
    color: #F5F5F0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 6rem 3rem 4rem 3rem;
    overflow: hidden;
}

.split-right {
    position: relative;
    flex: 0 0 48%;
    background: #F5F5F0;
    color: #0A0A0A;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 6rem 3rem 4rem 3rem;
    overflow: hidden;
}

.split-content {
    max-width: 38ch;
}

.argument {
    font-size: clamp(15px, 1.05vw, 19px);
    line-height: 1.6;
}

.argument-left {
    color: #F5F5F0;
}

.argument-right {
    color: #0A0A0A;
}

/* Chalk-on-concrete textured noise overlays */
.chalk-noise {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.16;
    mix-blend-mode: screen;
    background-image:
        repeating-conic-gradient(from 13deg at 23% 47%,
            rgba(245, 245, 240, 0.00) 0deg,
            rgba(245, 245, 240, 0.00) 1.7deg,
            rgba(245, 245, 240, 0.06) 1.85deg,
            rgba(245, 245, 240, 0.00) 2deg),
        repeating-conic-gradient(from 41deg at 71% 18%,
            rgba(245, 245, 240, 0.00) 0deg,
            rgba(245, 245, 240, 0.04) 0.6deg,
            rgba(245, 245, 240, 0.00) 1.2deg);
    background-size: 6px 6px, 9px 9px;
}

.chalk-noise-light {
    opacity: 0.22;
    mix-blend-mode: multiply;
    background-image:
        repeating-conic-gradient(from 13deg at 23% 47%,
            rgba(10, 10, 10, 0.00) 0deg,
            rgba(10, 10, 10, 0.05) 1.85deg,
            rgba(10, 10, 10, 0.00) 2deg),
        repeating-conic-gradient(from 41deg at 71% 18%,
            rgba(10, 10, 10, 0.00) 0deg,
            rgba(10, 10, 10, 0.04) 0.6deg,
            rgba(10, 10, 10, 0.00) 1.2deg);
    background-size: 6px 6px, 9px 9px;
}

/* Vertical tear-line between halves */
.tear-line.tear-line-vertical {
    position: absolute;
    top: 0;
    left: 52%;
    transform: translateX(-50%);
    width: 60px;
    height: 100%;
    z-index: 6;
    pointer-events: none;
}

.tear-path {
    stroke: #E63946;
    stroke-width: 2;
    fill: none;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 500ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.tear-path.animated {
    stroke-dashoffset: 0;
}

/* Heartbeat red pulse rule */
.red-pulse {
    position: absolute;
    top: 0;
    left: 52%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom,
        rgba(230, 57, 70, 0) 0%,
        rgba(230, 57, 70, 0.15) 8%,
        rgba(230, 57, 70, 0.6) 50%,
        rgba(230, 57, 70, 0.15) 92%,
        rgba(230, 57, 70, 0) 100%);
    box-shadow: 0 0 12px 2px rgba(230, 57, 70, 0.5);
    animation: red-pulse-cycle 1.5s ease-in-out infinite;
    opacity: 0;
    z-index: 5;
    pointer-events: none;
}

.red-pulse.active {
    opacity: 1;
}

@keyframes red-pulse-cycle {
    0%, 100% {
        opacity: 0.3;
        box-shadow: 0 0 6px 1px rgba(230, 57, 70, 0.35);
    }
    50% {
        opacity: 0.85;
        box-shadow: 0 0 18px 4px rgba(230, 57, 70, 0.7);
    }
}

/* Domain title straddling the tear */
.site-title {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
    font-size: clamp(36px, 5vw, 80px);
    letter-spacing: -0.02em;
    color: #F5F5F0;
    mix-blend-mode: difference;
    z-index: 7;
    pointer-events: none;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 700ms ease-out 800ms;
}

.site-title.revealed {
    opacity: 1;
}

/* Particles container along the tear */
.particles-container {
    position: absolute;
    top: 0;
    left: 52%;
    transform: translateX(-50%);
    width: 40px;
    height: 100%;
    z-index: 8;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #E63946;
    box-shadow: 0 0 4px rgba(230, 57, 70, 0.7);
    opacity: 0;
    will-change: transform, opacity;
}

@keyframes particle-drift-left {
    0% {
        transform: translate(0, 0);
        opacity: 0;
    }
    20% {
        opacity: 0.95;
    }
    100% {
        transform: translate(-80px, var(--drift-y, -40px));
        opacity: 0;
    }
}

@keyframes particle-drift-right {
    0% {
        transform: translate(0, 0);
        opacity: 0;
    }
    20% {
        opacity: 0.95;
    }
    100% {
        transform: translate(80px, var(--drift-y, 40px));
        opacity: 0;
    }
}

/* Anti-affordance scroll cue */
.scroll-cue {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.7rem;
    letter-spacing: 0.5em;
    color: #6B6B6B;
    mix-blend-mode: difference;
    z-index: 7;
    opacity: 0;
    transition: opacity 500ms ease-out 1800ms;
}

.scroll-cue.revealed {
    opacity: 1;
    animation: scroll-cue-flicker 3s ease-in-out infinite 2s;
}

@keyframes scroll-cue-flicker {
    0%, 92%, 100% { opacity: 1; }
    94%, 96% { opacity: 0.3; }
    95% { opacity: 0.7; }
}

/* --- Loading state: opening sequence --- */
body.loading .split-right {
    clip-path: polygon(0 0, 0 0, 0 100%, 0 100%);
}

body.loaded .split-right {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    transition: clip-path 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

body.loading .argument {
    opacity: 0;
}

body.loaded .argument {
    opacity: 1;
    transition: opacity 400ms ease-out 1200ms;
}

/* --- 6. Section 2 — Duality (horizontal tear) --- */
.section-duality {
    display: flex;
    flex-direction: column;
    background: #0A0A0A;
}

.duality-top {
    flex: 0 0 51%;
    background: #0A0A0A;
    color: #39FF14;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5rem 3rem 3rem 3rem;
    overflow: auto;
    position: relative;
}

.duality-bottom {
    flex: 0 0 49%;
    background: #F5F5F0;
    color: #0A0A0A;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 3rem 5rem 3rem;
    overflow: auto;
    position: relative;
}

.duality-content {
    max-width: 70ch;
    width: 100%;
}

.code-block {
    font-family: "IBM Plex Mono", monospace;
    font-size: clamp(12px, 0.85vw, 16px);
    line-height: 1.55;
    color: #39FF14;
    background: transparent;
    padding: 1.4rem 1.6rem;
    border-left: 2px solid #39FF14;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    text-shadow: 0 0 6px rgba(57, 255, 20, 0.32);
}

.code-comment { color: #4f8a3d; font-style: italic; }
.code-keyword { color: #E63946; font-weight: 700; }
.code-fn { color: #F5F5F0; }
.code-class { color: #F5F5F0; }
.code-string { color: #b6f7a3; }

.human-prose {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: clamp(16px, 1.15vw, 20px);
    line-height: 1.75;
    color: #0A0A0A;
}

.human-prose em {
    color: #4A154B;
    border-bottom: 1px solid #4A154B;
}

/* Horizontal tear */
.tear-line.tear-line-horizontal {
    position: absolute;
    top: 51%;
    left: 0;
    width: 100%;
    height: 60px;
    transform: translateY(-50%);
    z-index: 6;
    pointer-events: none;
}

.tear-path-h {
    stroke: #E63946;
    stroke-width: 2;
    fill: none;
}

/* --- 7. Section 3 — Evidence Wall (broken grid) --- */
.section-evidence {
    background: #0A0A0A;
    padding: 6rem 0 8rem 0;
    position: relative;
}

.evidence-title {
    position: relative;
    text-align: center;
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
    font-size: clamp(20px, 2.4vw, 36px);
    letter-spacing: 0.16em;
    color: #F5F5F0;
    margin-bottom: 4rem;
    z-index: 4;
}

.evidence-title::before,
.evidence-title::after {
    content: "—";
    color: #E63946;
    margin: 0 0.6em;
}

.evidence-wall {
    position: relative;
    width: 100%;
    height: 200vh;
    overflow: visible;
}

.evidence-block {
    position: absolute;
    width: var(--w, 26%);
    top: var(--top, 10%);
    left: var(--left, auto);
    right: var(--right, auto);
    transform: rotate(var(--rotate, 0deg)) translateX(0);
    background: #0A0A0A;
    color: #F5F5F0;
    border: 1px solid rgba(245, 245, 240, 0.2);
    padding: 1.2rem 1.4rem 2.2rem 1.4rem;
    z-index: 3;
    transition:
        transform 280ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
        border-color 200ms ease-out,
        box-shadow 280ms ease-out,
        opacity 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.evidence-block.block-left {
    opacity: 0;
    transform: rotate(var(--rotate, 0deg)) translateX(-100px);
}

.evidence-block.block-right {
    opacity: 0;
    transform: rotate(var(--rotate, 0deg)) translateX(100px);
}

.evidence-block.block-center {
    opacity: 0;
    transform: rotate(var(--rotate, 0deg)) translateY(40px);
    background: #F5F5F0;
    color: #0A0A0A;
    border: 1px solid #0A0A0A;
    mix-blend-mode: difference;
    z-index: 4;
}

.evidence-block.is-visible {
    opacity: 1;
    transform: rotate(var(--rotate, 0deg)) translateX(0) translateY(0);
}

.evidence-block.is-visible.block-center {
    transform: rotate(var(--rotate, 0deg)) translateY(0);
}

/* Hover: pull block 2px toward the opposing center, red 1px border */
.evidence-block.block-left:hover {
    border-color: #E63946;
    transform: rotate(var(--rotate, 0deg)) translateX(2px);
    box-shadow: 0 0 0 1px #E63946 inset, 0 4px 18px rgba(230, 57, 70, 0.18);
    z-index: 6;
}

.evidence-block.block-right:hover {
    border-color: #E63946;
    transform: rotate(var(--rotate, 0deg)) translateX(-2px);
    box-shadow: 0 0 0 1px #E63946 inset, 0 4px 18px rgba(230, 57, 70, 0.18);
    z-index: 6;
}

.evidence-block.block-center:hover {
    border-color: #E63946;
    box-shadow: 0 0 0 1px #E63946 inset;
    z-index: 7;
}

.evidence-text,
.evidence-code {
    font-size: clamp(13px, 0.9vw, 17px);
    line-height: 1.55;
}

.evidence-code {
    background: transparent;
    color: #39FF14;
    text-shadow: 0 0 4px rgba(57, 255, 20, 0.3);
    white-space: pre-wrap;
}

.evidence-tag {
    position: absolute;
    bottom: 0.55rem;
    right: 0.9rem;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    color: #6B6B6B;
}

.center-collision {
    color: inherit;
}

/* Connecting red lines (overlay) */
.connecting-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.connect-line {
    stroke: #E63946;
    stroke-width: 0.18;
    stroke-dasharray: 1.4 1.2;
    fill: none;
    opacity: 0.55;
    vector-effect: non-scaling-stroke;
}

/* Decision tree placement */
.decision-tree {
    position: absolute;
    bottom: 6%;
    left: 50%;
    transform: translateX(-50%);
    width: clamp(160px, 16vw, 240px);
    height: auto;
    z-index: 4;
    opacity: 0.8;
}

/* Redacted footer */
.redacted-footer {
    position: absolute;
    bottom: 1.5rem;
    left: 0;
    width: 100%;
    text-align: center;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    color: #6B6B6B;
    z-index: 4;
}

/* Redacted text blocks */
.redacted {
    background: #0A0A0A;
    color: #0A0A0A;
    user-select: none;
    padding: 0 0.18em;
    transition: background 200ms ease-out, color 200ms ease-out;
    cursor: help;
    border-radius: 1px;
}

.redacted:hover,
.redacted.revealed {
    background: transparent;
    color: #E63946;
    text-decoration: line-through;
    text-decoration-color: #E63946;
}

.redacted-light {
    background: #0A0A0A;
    color: #0A0A0A;
}

.redacted-light:hover,
.redacted-light.revealed {
    background: transparent;
    color: #E63946;
    text-decoration: line-through;
    text-decoration-color: #E63946;
}

/* --- 8. Section 4 — Final Void --- */
.section-void {
    background: #1a1a1a;
    cursor: default;
}

.void-container {
    position: absolute;
    inset: 0;
    display: flex;
    width: 100%;
    height: 100%;
}

.void-left,
.void-right {
    flex: 1;
    background: #6B6B6B;
    color: rgba(245, 245, 240, 0.55);
    display: flex;
    align-items: center;
    padding: 5rem 3rem;
    transition: background 1.2s ease-out, color 1.2s ease-out;
    position: relative;
}

.void-left {
    justify-content: flex-end;
    background: linear-gradient(to right, #0A0A0A 0%, #6B6B6B 100%);
    color: rgba(245, 245, 240, 0.4);
}

.void-right {
    justify-content: flex-start;
    background: linear-gradient(to left, #F5F5F0 0%, #6B6B6B 100%);
    color: rgba(10, 10, 10, 0.45);
}

.void-content {
    max-width: 30ch;
}

.argument-faded {
    font-size: clamp(14px, 1vw, 18px);
    line-height: 1.65;
    opacity: 0.6;
    transition: opacity 1.2s ease-out;
}

.section-void.is-visible .argument-faded {
    opacity: 1;
}

/* The chasm: widened, jagged, cursor: not-allowed */
.void-chasm {
    flex: 0 0 22%;
    min-width: 180px;
    background: #1a1a1a;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: not-allowed;
    overflow: hidden;
}

.tear-line.tear-line-final {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.tear-path-final {
    stroke: #6B6B6B;
    stroke-width: 3;
    fill: none;
    opacity: 0.7;
}

.void-message {
    position: relative;
    z-index: 2;
    font-family: "Space Grotesk", sans-serif;
    font-weight: 500;
    font-size: clamp(15px, 1.4vw, 22px);
    letter-spacing: 0.04em;
    color: #6B6B6B;
    text-align: center;
    padding: 0 0.6rem;
    line-height: 1.4;
    cursor: not-allowed;
    user-select: none;
}

.section-void.is-visible .void-message {
    color: #F5F5F0;
    transition: color 1.4s ease-out 0.6s;
}

/* --- 9. Reduced motion respect --- */
@media (prefers-reduced-motion: reduce) {
    .red-pulse {
        animation: none;
        opacity: 0.6;
    }
    .scroll-cue.revealed {
        animation: none;
    }
    .evidence-block {
        transition: opacity 200ms ease-out;
    }
}

/* --- 10. Responsive: collapse split-screen on narrow viewports --- */
@media (max-width: 760px) {
    html {
        scroll-snap-type: none;
    }

    #site-nav {
        gap: 0.9rem;
        padding: 0.7rem 1rem;
    }

    .nav-link {
        font-size: 0.65rem;
        letter-spacing: 0.14em;
    }

    .split-container {
        flex-direction: column;
        position: static;
    }

    .split-left,
    .split-right {
        flex: 0 0 auto;
        width: 100%;
        min-height: 50vh;
        padding: 5rem 1.6rem 3rem 1.6rem;
        justify-content: flex-start;
        align-items: flex-start;
    }

    .tear-line.tear-line-vertical,
    .red-pulse,
    .particles-container {
        display: none;
    }

    .site-title {
        position: static;
        transform: none;
        text-align: center;
        margin: 1.6rem auto;
        mix-blend-mode: normal;
        color: #E63946;
        padding: 1rem 0;
    }

    .scroll-cue { display: none; }

    .duality-top,
    .duality-bottom {
        padding: 3rem 1.4rem;
    }

    .evidence-wall {
        height: auto;
    }

    .evidence-block {
        position: relative;
        width: 90%;
        top: auto !important;
        left: 5% !important;
        right: auto !important;
        margin: 0 auto 1.6rem auto;
        transform: rotate(var(--rotate, 0deg)) translateX(0) !important;
    }

    .decision-tree {
        position: relative;
        bottom: auto;
        margin: 2rem auto 0 auto;
    }

    .void-container {
        flex-direction: column;
    }

    .void-left,
    .void-right {
        flex: 0 0 auto;
        min-height: 35vh;
        justify-content: center;
        align-items: center;
        text-align: center;
    }

    .void-chasm {
        flex: 0 0 30vh;
        width: 100%;
        min-width: 0;
    }
}
