/* ============================================
   LegalDebug.com - Styles
   Watercolor meets Legal Precision
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --espresso-ink: #2B1810;
    --burnt-sienna: #D4763A;
    --raw-amber: #E8A862;
    --legal-parchment: #F4E8D1;
    --brief-white: #FFF8F0;
    --oxblood-clause: #8B3A2A;
    --margin-red: #C75B39;
    --sidebar-sage: #7A8B6F;
    --sienna-accent: #A0522D;
    --body-light: #3D2B1F;
    --body-dark: #E8D5C0;

    --font-display: 'Fraunces', serif;
    --font-body: 'Source Serif 4', serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

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

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 18px;
    line-height: 1.75;
    color: var(--body-light);
    background-color: var(--legal-parchment);
    overflow-x: hidden;
}

/* --- SVG Filter Container (hidden) --- */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Scroll Progress Indicator --- */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 2px;
    height: 0%;
    background: var(--burnt-sienna);
    z-index: 1000;
    transition: height 0.05s linear;
    /* Wet paint drip effect */
    background-image: linear-gradient(
        to bottom,
        var(--burnt-sienna) 0%,
        var(--burnt-sienna) 85%,
        var(--raw-amber) 95%,
        transparent 100%
    );
}

/* --- Spread (Section) Base --- */
.spread {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 80px 0;
}

/* --- Noise Overlays --- */
.noise-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.noise-overlay.visible {
    opacity: 1;
}

.noise-warm {
    background-color: var(--legal-parchment);
    filter: url(#noise);
    opacity: 0.05;
    mix-blend-mode: multiply;
}

.noise-warm::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--burnt-sienna);
    opacity: 0.03;
    mix-blend-mode: multiply;
}

.noise-dark {
    background-color: var(--legal-parchment);
    filter: url(#noise-dark);
    opacity: 0.02;
    mix-blend-mode: screen;
}

/* --- Watercolor Wash Elements --- */
.watercolor-wash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.8s ease, transform 1.5s ease-out;
}

.watercolor-wash.visible {
    opacity: 1;
}

.wash-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    transition: transform 2s ease-out;
}

/* Spread 1 washes - Burnt sienna bloom from top-left */
.wash-blob-1 {
    top: -10%;
    left: -5%;
    width: 60vw;
    height: 60vh;
    background: radial-gradient(ellipse at 30% 30%,
        rgba(212, 118, 58, 0.35) 0%,
        rgba(232, 168, 98, 0.2) 40%,
        rgba(199, 91, 57, 0.1) 70%,
        transparent 100%
    );
}

.wash-blob-2 {
    top: 20%;
    left: 15%;
    width: 45vw;
    height: 45vh;
    background: radial-gradient(ellipse at 50% 50%,
        rgba(232, 168, 98, 0.25) 0%,
        rgba(212, 118, 58, 0.15) 50%,
        transparent 100%
    );
}

.wash-blob-3 {
    bottom: 10%;
    right: 10%;
    width: 35vw;
    height: 35vh;
    background: radial-gradient(ellipse at 60% 60%,
        rgba(244, 232, 209, 0.3) 0%,
        rgba(232, 168, 98, 0.1) 60%,
        transparent 100%
    );
}

/* Spread 2 washes */
.wash-blob-4 {
    top: 5%;
    left: -5%;
    width: 45vw;
    height: 80vh;
    background: radial-gradient(ellipse at 40% 50%,
        rgba(212, 118, 58, 0.25) 0%,
        rgba(199, 91, 57, 0.15) 50%,
        transparent 100%
    );
}

.wash-blob-5 {
    bottom: 0;
    left: 10%;
    width: 35vw;
    height: 50vh;
    background: radial-gradient(ellipse at 50% 70%,
        rgba(232, 168, 98, 0.2) 0%,
        rgba(212, 118, 58, 0.1) 60%,
        transparent 100%
    );
}

/* Spread 3 washes (dark background - lighter washes) */
.wash-blob-6 {
    top: 10%;
    right: 5%;
    width: 50vw;
    height: 50vh;
    background: radial-gradient(ellipse at 60% 40%,
        rgba(139, 58, 42, 0.3) 0%,
        rgba(199, 91, 57, 0.15) 50%,
        transparent 100%
    );
}

.wash-blob-7 {
    bottom: 5%;
    left: 10%;
    width: 40vw;
    height: 45vh;
    background: radial-gradient(ellipse at 40% 60%,
        rgba(160, 82, 45, 0.2) 0%,
        rgba(139, 58, 42, 0.1) 60%,
        transparent 100%
    );
}

/* Spread 4 washes - Radiate from center behind quote */
.wash-blob-8 {
    top: 15%;
    left: 20%;
    width: 60vw;
    height: 60vh;
    background: radial-gradient(ellipse at 50% 50%,
        rgba(232, 168, 98, 0.3) 0%,
        rgba(212, 118, 58, 0.2) 40%,
        transparent 80%
    );
}

.wash-blob-9 {
    top: 25%;
    left: 30%;
    width: 40vw;
    height: 40vh;
    background: radial-gradient(ellipse at 50% 50%,
        rgba(212, 118, 58, 0.25) 0%,
        rgba(199, 91, 57, 0.1) 60%,
        transparent 100%
    );
}

.wash-blob-10 {
    bottom: 20%;
    right: 15%;
    width: 35vw;
    height: 35vh;
    background: radial-gradient(ellipse at 50% 50%,
        rgba(232, 168, 98, 0.2) 0%,
        transparent 70%
    );
}

/* Spread 5 washes - Fading, running out of pigment */
.wash-blob-11 {
    top: 10%;
    left: 5%;
    width: 40vw;
    height: 50vh;
    background: radial-gradient(ellipse at 30% 40%,
        rgba(212, 118, 58, 0.15) 0%,
        rgba(232, 168, 98, 0.08) 50%,
        transparent 100%
    );
}

.wash-blob-12 {
    top: 40%;
    right: 5%;
    width: 35vw;
    height: 40vh;
    background: radial-gradient(ellipse at 70% 50%,
        rgba(199, 91, 57, 0.1) 0%,
        transparent 70%
    );
}

/* --- Ink Splatters --- */
.ink-splatters {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.ink-spot {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, var(--espresso-ink) 40%, transparent 100%);
    display: block;
}

/* --- Spread Content Layout --- */
.spread-content {
    position: relative;
    z-index: 5;
    padding: 40px;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.spread-content-left {
    padding-right: 35%;
}

.spread-content-right {
    padding-left: 35%;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.spread-content-center {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px 15%;
}

.spread-content-narrow {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 30%;
    text-align: left;
}

/* --- Typography --- */
.hero-title {
    font-family: var(--font-display);
    font-size: clamp(80px, 12vw, 200px);
    line-height: 0.95;
    color: var(--espresso-ink);
    letter-spacing: -0.02em;
    margin-bottom: 40px;
    font-variation-settings: 'WONK' 0, 'SOFT' 50;
    opacity: 0;
}

.hero-title.typed {
    opacity: 1;
}

.hero-title .letter {
    display: inline-block;
    opacity: 0;
    transition: font-variation-settings 0.4s ease-out;
}

.hero-title .letter.visible {
    opacity: 1;
}

.section-heading {
    font-family: var(--font-display);
    font-size: clamp(36px, 6vw, 72px);
    color: var(--espresso-ink);
    line-height: 1.1;
    margin-bottom: 30px;
    font-variation-settings: 'wght' 500, 'WONK' 0;
    transition: font-variation-settings 0.3s ease-out;
}

.section-heading:hover {
    font-variation-settings: 'wght' 700, 'WONK' 1;
}

.heading-light {
    color: var(--legal-parchment);
}

.subtitle {
    font-family: var(--font-body);
    font-size: clamp(20px, 2.5vw, 28px);
    color: var(--body-light);
    line-height: 1.6;
    max-width: 50ch;
    margin-bottom: 20px;
}

.filing-meta {
    font-size: 14px;
    color: var(--sienna-accent);
    letter-spacing: 0.05em;
}

.mono-accent {
    font-family: var(--font-mono);
    font-size: 14px;
    letter-spacing: 0.05em;
    color: var(--sienna-accent);
}

/* --- Spread 1 Specifics --- */
.spread-1 {
    background: linear-gradient(135deg, var(--legal-parchment) 0%, var(--brief-white) 100%);
}

.title-block {
    position: relative;
}

.subtitle-block {
    margin-top: 20px;
}

/* --- Connector Lines --- */
.connector-line {
    position: absolute;
    pointer-events: none;
    z-index: 4;
}

.connector-line svg {
    width: 100%;
    height: 100%;
}

.angular-line {
    transition: stroke-dasharray 0.4s ease;
}

.angular-line:hover {
    stroke-dasharray: 12 0;
}

.connector-1 {
    position: absolute;
    bottom: -60px;
    right: -100px;
    width: 400px;
    height: 300px;
    opacity: 0;
}

.connector-1.drawn {
    opacity: 1;
}

.connector-2 {
    left: 38%;
    top: 10%;
    width: 200px;
    height: 500px;
    z-index: 4;
}

.connector-4 {
    top: 15%;
    left: 10%;
    width: 600px;
    height: 200px;
    z-index: 4;
    opacity: 0.6;
}

.connector-5 {
    top: 0;
    left: 50%;
    width: 300px;
    height: 400px;
    z-index: 4;
    opacity: 0.3;
    transform: translateX(-50%);
}

/* Connector line stroke animation */
.angular-line {
    stroke-dashoffset: 1000;
    animation: none;
}

.angular-line.animate-draw {
    animation: drawLine 1.2s ease-out forwards;
}

@keyframes drawLine {
    from { stroke-dashoffset: 1000; }
    to { stroke-dashoffset: 0; }
}

/* --- Spread 2 Specifics --- */
.spread-2 {
    background: var(--brief-white);
}

.evidence-tag {
    position: relative;
    width: fit-content;
}

.evidence-tag-inner {
    background: var(--legal-parchment);
    border: 1px solid var(--burnt-sienna);
    padding: 20px 30px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* torn edge effect */
    clip-path: polygon(
        0% 2%, 8% 0%, 15% 3%, 25% 1%, 35% 4%, 45% 0%, 55% 2%, 65% 0%, 75% 3%, 85% 1%, 92% 3%, 100% 0%,
        100% 98%, 92% 100%, 85% 97%, 75% 100%, 65% 96%, 55% 100%, 45% 98%, 35% 100%, 25% 97%, 15% 100%, 8% 98%, 0% 100%
    );
    box-shadow: 0 2px 8px rgba(43, 24, 16, 0.12);
}

.evidence-number {
    font-size: 18px;
    color: var(--oxblood-clause);
    font-weight: 500;
}

.evidence-case {
    font-size: 12px;
    color: var(--sienna-accent);
}

.case-content {
    max-width: 65ch;
}

.legal-paragraphs {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.legal-paragraph {
    display: flex;
    gap: 16px;
    text-align: justify;
}

.paragraph-number {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--burnt-sienna);
    min-width: 36px;
    padding-top: 4px;
    /* Watercolor wash treatment via background */
    background: linear-gradient(135deg,
        rgba(212, 118, 58, 0.15) 0%,
        rgba(232, 168, 98, 0.1) 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    font-weight: 500;
}

.legal-paragraph p {
    flex: 1;
    color: var(--body-light);
}

.legal-highlight {
    cursor: pointer;
    position: relative;
    transition: color 0.3s ease;
}

.legal-highlight::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -4px;
    right: -4px;
    bottom: -2px;
    background: radial-gradient(ellipse at 50% 50%,
        rgba(232, 168, 98, 0.0) 0%,
        transparent 100%
    );
    z-index: -1;
    transform: scale(0);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.5s ease;
    border-radius: 4px;
}

.legal-highlight.highlighted::before {
    transform: scale(1);
    background: radial-gradient(ellipse at 50% 50%,
        rgba(232, 168, 98, 0.3) 0%,
        rgba(232, 168, 98, 0.1) 70%,
        transparent 100%
    );
}

/* --- Spread 3 Specifics --- */
.spread-3 {
    background: var(--espresso-ink);
    color: var(--legal-parchment);
}

.annotation-body {
    display: flex;
    gap: 40px;
    position: relative;
}

.annotation-text {
    flex: 1;
    max-width: 60ch;
}

.annotation-text p {
    color: var(--body-dark);
    margin-bottom: 24px;
    text-align: justify;
}

.annotated-phrase {
    color: var(--legal-parchment);
    border-bottom: 1px dashed var(--margin-red);
    cursor: help;
    position: relative;
    transition: color 0.3s ease;
}

.annotated-phrase:hover {
    color: var(--raw-amber);
}

.margin-annotations {
    position: absolute;
    right: -250px;
    top: 0;
    width: 200px;
    height: 100%;
}

.margin-note {
    position: absolute;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--margin-red);
    line-height: 1.4;
    padding-left: 16px;
    border-left: 1px solid var(--margin-red);
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.margin-note:hover {
    opacity: 1;
}

.note-marker {
    font-size: 14px;
    font-weight: 500;
    display: block;
    margin-bottom: 4px;
    color: var(--raw-amber);
}

.note-text {
    display: block;
}

.connector-lines-spread3 {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

.annotation-connectors {
    width: 100%;
    height: 100%;
}

/* --- Spread 4 Specifics --- */
.spread-4 {
    background: linear-gradient(180deg, var(--brief-white) 0%, var(--legal-parchment) 100%);
}

.verdict-block {
    max-width: 800px;
}

.verdict-label .mono-accent {
    font-size: 12px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--sienna-accent);
    display: block;
    margin-bottom: 12px;
}

.verdict-quote {
    font-family: var(--font-display);
    font-size: clamp(24px, 3.5vw, 42px);
    line-height: 1.5;
    color: var(--espresso-ink);
    font-variation-settings: 'wght' 400, 'WONK' 1;
    transition: font-variation-settings 0.1s linear;
    margin-bottom: 30px;
}

.verdict-attribution {
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--sienna-accent);
    font-style: italic;
}

/* --- Spread 5 Specifics --- */
.spread-5 {
    background: linear-gradient(180deg, var(--legal-parchment) 0%, var(--brief-white) 50%, rgba(255, 248, 240, 0.5) 100%);
}

.spread-content-narrow {
    padding: 40px 20px;
    max-width: 650px;
    width: 40%;
    min-width: 320px;
}

.closing-text p {
    color: var(--body-light);
    margin-bottom: 24px;
    text-align: justify;
}

.closing-citation {
    text-align: center;
    margin-top: 40px;
}

.closing-citation .mono-accent {
    font-size: 12px;
    letter-spacing: 0.1em;
    color: var(--sienna-accent);
    opacity: 0.7;
}

/* --- Bug Report Cards --- */
.bug-report {
    position: absolute;
    z-index: 6;
}

.bug-card {
    background: var(--legal-parchment);
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 16px 20px;
    border-radius: 2px;
    box-shadow: 0 2px 8px rgba(43, 24, 16, 0.12);
    color: var(--body-light);
    max-width: 280px;
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
    cursor: default;
}

.bug-card:hover {
    transform: translateY(-4px) rotate(1deg);
    box-shadow: 0 6px 16px rgba(43, 24, 16, 0.18);
}

.bug-card-dark {
    background: var(--espresso-ink);
    border: 1px solid rgba(244, 232, 209, 0.1);
    color: var(--body-dark);
}

.bug-card-dark .bug-label {
    color: var(--raw-amber);
}

.bug-card-dark .bug-status {
    color: var(--margin-red);
}

.bug-label {
    display: block;
    font-weight: 500;
    color: var(--oxblood-clause);
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

.bug-card p {
    line-height: 1.5;
    margin-bottom: 8px;
}

.bug-status {
    display: block;
    font-size: 10px;
    letter-spacing: 0.08em;
    color: var(--margin-red);
    text-transform: uppercase;
}

/* Bug card positions and rotations */
.bug-report-1 {
    top: 15%;
    right: 8%;
    transform: rotate(-2deg);
}

.bug-report-2 {
    bottom: 18%;
    left: 6%;
    transform: rotate(1.5deg);
}

.bug-report-3 {
    top: 12%;
    right: 6%;
    transform: rotate(-1deg);
}

.bug-report-4 {
    bottom: 15%;
    right: 8%;
    transform: rotate(2.5deg);
}

.bug-report-5 {
    bottom: 20%;
    left: 8%;
    transform: rotate(-1.5deg);
}

/* --- Torn Edge Dividers --- */
.torn-edge {
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 40px;
    z-index: 8;
}

.torn-edge-bottom {
    clip-path: polygon(
        0% 40%, 3% 55%, 7% 35%, 11% 50%, 15% 30%, 19% 48%, 23% 38%,
        27% 55%, 31% 32%, 35% 52%, 39% 35%, 43% 50%, 47% 28%, 51% 45%,
        55% 35%, 59% 55%, 63% 30%, 67% 48%, 71% 38%, 75% 52%, 79% 32%,
        83% 50%, 87% 35%, 91% 55%, 95% 38%, 100% 45%,
        100% 100%, 0% 100%
    );
    background: var(--brief-white);
    transition: clip-path 0.6s ease;
}

.spread-1 .torn-edge-bottom {
    background: var(--brief-white);
}

.spread-2 .torn-edge-bottom {
    background: var(--espresso-ink);
}

.torn-edge-dark {
    background: var(--brief-white) !important;
}

.spread-4 .torn-edge-bottom {
    background: var(--legal-parchment);
}

/* --- Brush Stroke Underlines --- */
.brush-underline {
    position: relative;
}

.brush-underline::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: -5%;
    width: 110%;
    height: 4px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--burnt-sienna) 10%,
        var(--raw-amber) 50%,
        var(--burnt-sienna) 90%,
        transparent 100%
    );
    opacity: 0.6;
    border-radius: 2px;
    filter: blur(0.5px);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .spread-content-left {
        padding-right: 20%;
    }

    .spread-content-right {
        padding-left: 20%;
    }

    .spread-content-narrow {
        width: 60%;
    }

    .spread-content-center {
        padding: 40px 10%;
    }

    .margin-annotations {
        display: none;
    }

    .bug-report {
        display: none;
    }

    .connector-line {
        opacity: 0.3;
    }
}

@media (max-width: 768px) {
    .spread-content-left,
    .spread-content-right {
        padding-left: 20px;
        padding-right: 20px;
    }

    .spread-content-narrow {
        width: 90%;
        padding: 20px;
    }

    .spread-content-center {
        padding: 20px;
    }

    .hero-title {
        font-size: clamp(48px, 15vw, 100px);
    }

    .section-heading {
        font-size: clamp(28px, 8vw, 48px);
    }

    .verdict-quote {
        font-size: clamp(20px, 5vw, 32px);
    }

    .connector-line {
        display: none;
    }

    .connector-lines-spread3 {
        display: none;
    }

    .evidence-tag {
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 16px;
    }

    .spread {
        padding: 40px 0;
    }

    .legal-paragraph {
        flex-direction: column;
        gap: 4px;
    }

    .paragraph-number {
        min-width: auto;
    }
}
