/* ==========================================================================
   courthouse.stream — Styles
   Palette: Monochrome + single warm accent (#8b7355)
   Fonts: Caveat (display), Libre Baskerville (body), IBM Plex Mono (labels)
   ========================================================================== */

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

:root {
    --deep-ground: #0e0e12;
    --panel-surface: #1c1c22;
    --border: #3a3a3a;
    --body-text: #c8c8c8;
    --heading-text: #e8e8e8;
    --muted-text: #6b6b6b;
    --leather-accent: #8b7355;
    --hover-state: #f0f0f0;
    --heading-dark: #1a1a1a;
    --ruled-line: #2a2a2a;
    --gap: clamp(2rem, 4vh, 4rem);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --noise-speed: 1;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--deep-ground);
    color: var(--body-text);
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

/* --- Leather Texture Mixin (applied to panels) --- */
.leather-texture {
    background-color: var(--panel-surface);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(139,115,85,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(139,115,85,0.03) 0%, transparent 40%),
        repeating-conic-gradient(rgba(139,115,85,0.02) 0% 25%, transparent 0% 50%);
}

/* --- Navigation --- */
.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 2rem;
    background: rgba(14,14,18,0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    transform: translateY(-100%);
    transition: transform 0.4s var(--ease);
}

.nav-bar.visible {
    transform: translateY(0);
}

.nav-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-text);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    font-family: 'Caveat', cursive;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--body-text);
    transition: color 0.3s var(--ease);
}

.nav-link:hover {
    color: var(--hover-state);
}

/* --- Typography --- */
h1 {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(3rem, 7vw, 6rem);
    color: var(--heading-text);
    line-height: 1.1;
}

h2 {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: var(--heading-text);
    line-height: 1.2;
}

.section-number {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-text);
    display: block;
    margin-bottom: 1rem;
}

.cell-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-text);
    display: block;
    margin-bottom: 0.5rem;
}

/* --- Handwritten Reveal Animation --- */
.handwritten-reveal .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}

.handwritten-reveal .char.revealed {
    opacity: 1;
    transform: translateY(0);
}

.handwritten-reveal .char-space {
    display: inline;
    width: 0.3em;
}

/* --- Bento Sections --- */
.bento-section {
    min-height: 100vh;
    padding: var(--gap);
    position: relative;
}

.bento-grid {
    display: grid;
    gap: var(--gap);
    height: 100%;
    min-height: calc(100vh - var(--gap) * 2);
}

/* --- Bento Cells --- */
.bento-cell {
    background-color: var(--panel-surface);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(139,115,85,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(139,115,85,0.03) 0%, transparent 40%),
        repeating-conic-gradient(rgba(139,115,85,0.02) 0% 25%, transparent 0% 50%);
    border: 1px solid var(--border);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

/* --- Section 1: The Bench (Hero) --- */
.bench-grid {
    grid-template-columns: 8fr 4fr;
    grid-template-rows: 1fr;
}

.bench-curves {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.bench-curves .generative-svg {
    width: 100%;
    height: 100%;
}

.bench-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(2rem, 4vw, 4rem);
}

.bench-text h1 {
    margin-bottom: 1.5rem;
}

.manifesto {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: clamp(1rem, 1.4vw, 1.2rem);
    color: var(--body-text);
    max-width: 42ch;
    line-height: 1.75;
    margin-bottom: 3rem;
}

.scroll-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.scroll-arrow {
    font-size: 1.5rem;
    color: var(--muted-text);
    animation: float-down 2s var(--ease) infinite;
}

@keyframes float-down {
    0%, 100% { transform: translateY(0); opacity: 0.4; }
    50% { transform: translateY(8px); opacity: 1; }
}

/* --- Section 2: The Record --- */
.section-record {
    background-color: var(--deep-ground);
}

.record-grid {
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: 1fr 1fr;
}

.record-cell {
    transition: transform 0.4s var(--ease), border-color 0.4s var(--ease);
    cursor: default;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.record-cell:hover {
    transform: scale(1.02);
    border-color: var(--leather-accent);
    z-index: 2;
}

.record-cell:nth-child(1) { grid-column: 1 / 5; }
.record-cell:nth-child(2) { grid-column: 5 / 9; }
.record-cell:nth-child(3) { grid-column: 9 / 13; }
.record-cell:nth-child(4) { grid-column: 1 / 6; }
.record-cell:nth-child(5) { grid-column: 6 / 9; }
.record-cell:nth-child(6) { grid-column: 9 / 13; }

.cell-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.3;
}

.cell-content {
    position: relative;
    z-index: 1;
    padding: clamp(1rem, 2vw, 2rem);
}

.cell-heading {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    margin-bottom: 0.5rem;
}

.cell-desc {
    font-size: 0.95rem;
    color: var(--body-text);
    max-width: 38ch;
    line-height: 1.65;
}

/* --- Section 3: The Brief --- */
.brief-grid {
    grid-template-columns: 9fr 3fr;
    grid-template-rows: 1fr;
}

.brief-main {
    padding: clamp(2rem, 4vw, 4rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brief-main h2 {
    margin-bottom: 2rem;
}

.brief-text p {
    max-width: 62ch;
    margin-bottom: 1.5rem;
}

.brief-text p.ruled {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--ruled-line);
}

.brief-marginalia {
    padding: 0;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border);
}

.marginalia-scroll {
    overflow-y: auto;
    height: 100%;
    padding: clamp(1.5rem, 3vw, 3rem) clamp(1rem, 2vw, 2rem);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.marginalia-scroll::-webkit-scrollbar {
    width: 3px;
}

.marginalia-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.marginalia-scroll::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.margin-note {
    margin-bottom: 2.5rem;
    padding-left: 1rem;
    border-left: 2px solid var(--leather-accent);
}

.margin-mark {
    font-family: 'Caveat', cursive;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--leather-accent);
    display: block;
    margin-bottom: 0.25rem;
}

.margin-quote {
    font-family: 'Caveat', cursive;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--heading-text);
    line-height: 1.5;
}

/* --- Section 4: The Argument --- */
.argument-grid {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr;
}

.argument-cell {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    transition: transform 0.4s var(--ease), border-color 0.4s var(--ease);
}

.argument-cell:hover {
    transform: scale(1.02);
    border-color: var(--leather-accent);
    z-index: 2;
}

.argument-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.4;
}

.argument-content {
    position: relative;
    z-index: 1;
    padding: clamp(1.5rem, 3vw, 2.5rem);
}

.argument-content h2 {
    font-size: clamp(1.5rem, 2.5vw, 2.5rem);
    margin-bottom: 1rem;
}

.argument-text {
    font-size: 0.95rem;
    color: var(--body-text);
    line-height: 1.75;
    max-width: 42ch;
}

/* --- Section 5: The Verdict --- */
.verdict-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.verdict-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.verdict-cell .generative-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.25;
}

.verdict-content {
    position: relative;
    z-index: 1;
    max-width: 62ch;
    padding: clamp(2rem, 4vw, 4rem);
}

.verdict-content h2 {
    margin-bottom: 2rem;
}

.verdict-statement {
    font-size: clamp(1rem, 1.3vw, 1.15rem);
    line-height: 1.75;
    margin-bottom: 2rem;
    color: var(--body-text);
}

.verdict-contact {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    color: var(--muted-text);
    letter-spacing: 0.02em;
}

.inline-link {
    color: var(--leather-accent);
    border-bottom: 1px solid var(--leather-accent);
    transition: color 0.3s var(--ease);
}

.inline-link:hover {
    color: var(--hover-state);
}

/* --- Gavel Arc (Section Transitions) --- */
.gavel-arc {
    display: block;
    margin: 0 auto;
    width: 200px;
    height: 40px;
}

.gavel-arc path {
    stroke: var(--border);
    stroke-width: 1.5;
    fill: none;
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 1.2s var(--ease);
}

.gavel-arc.drawn path {
    stroke-dashoffset: 0;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .bench-grid {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }

    .record-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }

    .record-cell:nth-child(1) { grid-column: 1 / 2; }
    .record-cell:nth-child(2) { grid-column: 2 / 3; }
    .record-cell:nth-child(3) { grid-column: 1 / 2; }
    .record-cell:nth-child(4) { grid-column: 2 / 3; }
    .record-cell:nth-child(5) { grid-column: 1 / 2; }
    .record-cell:nth-child(6) { grid-column: 2 / 3; }

    .brief-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
    }

    .brief-marginalia {
        border-left: none;
        border-top: 1px solid var(--border);
        max-height: 50vh;
    }

    .argument-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }

    .nav-links {
        gap: 1rem;
    }
}

@media (max-width: 600px) {
    .record-grid {
        grid-template-columns: 1fr;
    }

    .record-cell:nth-child(n) { grid-column: 1 / -1; }

    .nav-links {
        display: none;
    }
}
