/* ===============================================================
   courthouse.app — honeyed glitch tribunal
   Palette (named, not numbered):
     #F2E6CA vellum  | #E6D2A6 honeycomb  | #C9A86A brass-warm
     #8E6F3D walnut  | #3B2E1E ink-roast  | #1A1410 chambers-dark
     #D14B2E redline | #5E8A6E olive-record
   =============================================================== */

:root {
    --vellum:        #F2E6CA;
    --honeycomb:     #E6D2A6;
    --brass-warm:    #C9A86A;
    --walnut:        #8E6F3D;
    --ink-roast:     #3B2E1E;
    --chambers-dark: #1A1410;
    --redline:       #D14B2E;
    --olive-record:  #5E8A6E;

    --col: 64ch;
    --baseline: 28px;

    --rec: "Recursive", "Inter", system-ui, sans-serif;
    --cor: "Cormorant Infant", "Lora", Georgia, serif;
    --jbm: "JetBrains Mono", "Space Mono", ui-monospace, monospace;
}

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

html, body {
    background: var(--vellum);
    color: var(--ink-roast);
    font-family: var(--rec);
    font-variation-settings: "MONO" 0, "CASL" 0, "wght" 400, "slnt" 0;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    cursor: none;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
em { font-style: italic; }

/* -------- VELLUM GRAIN OVERLAY -------- */
.vellum-grain {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9000;
    mix-blend-mode: multiply;
    opacity: 1;
}
.filter-defs { position: absolute; width: 0; height: 0; }

/* -------- SCANLINE TEAR -------- */
.scanline-tear {
    position: fixed;
    left: 0;
    top: -10px;
    width: 100vw;
    height: 2px;
    background: linear-gradient(
        to bottom,
        rgba(209,75,46,0.0) 0%,
        rgba(209,75,46,0.55) 50%,
        rgba(94,138,110,0.55) 50%,
        rgba(94,138,110,0.0) 100%
    );
    mix-blend-mode: difference;
    pointer-events: none;
    z-index: 8500;
    will-change: transform;
}

/* -------- CUSTOM CURSOR (gavel-head) -------- */
.cursor-gavel {
    position: fixed;
    width: 6px;
    height: 6px;
    background: var(--brass-warm);
    pointer-events: none;
    z-index: 10000;
    transform: translate(-50%, -50%) rotate(0deg);
    transition: width 220ms cubic-bezier(.16,1,.3,1),
                height 220ms cubic-bezier(.16,1,.3,1),
                background 220ms,
                outline 220ms,
                transform 220ms cubic-bezier(.16,1,.3,1);
    will-change: transform, width, height;
    outline: 0px solid transparent;
    outline-offset: 0;
}
.cursor-gavel.is-over {
    width: 14px;
    height: 14px;
    outline: 1px solid var(--walnut);
    transform: translate(-50%, -50%) rotate(-3deg);
}
@media (pointer: coarse) {
    .cursor-gavel { display: none; }
    html, body { cursor: auto; }
}

/* -------- GAVEL GLYPH (fixed) -------- */
.gavel-glyph {
    position: fixed;
    top: 32px;
    left: 32px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: none;
    z-index: 7000;
}
.gavel-glyph svg { display: block; transform: translate(0, 0) rotate(-4deg); }
.gavel-halo {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(201,168,106, 0);
    pointer-events: none;
}
.gavel-halo.pulse {
    animation: pulseHalo 1400ms cubic-bezier(.4, 0, .2, 1) 1;
}
@keyframes pulseHalo {
    0%   { box-shadow: 0 0 0 0 rgba(201,168,106, 0.0); }
    50%  { box-shadow: 0 0 0 7px rgba(201,168,106, 0.18); }
    100% { box-shadow: 0 0 0 14px rgba(201,168,106, 0.0); }
}

/* -------- MARGINALIA RAIL -------- */
.marginalia {
    position: fixed;
    top: 0;
    right: 0;
    width: 88px;
    height: 100vh;
    pointer-events: none;
    z-index: 6000;
    overflow: hidden;
    background: linear-gradient(
        to left,
        rgba(230,210,166,0.55),
        rgba(230,210,166,0.0)
    );
}
.margin-item {
    position: absolute;
    right: 8px;
    width: 76px;
    font-family: var(--jbm);
    font-size: 11px;
    line-height: 1.4;
    color: var(--walnut);
    font-feature-settings: "tnum" 1;
    letter-spacing: 0.01em;
    will-change: transform;
    text-align: right;
    word-break: break-word;
}
.margin-item.is-glitched { color: var(--ink-roast); letter-spacing: 0.04em; }

/* -------- MAIN HEARING -------- */
.hearing {
    position: relative;
    margin: 0 auto;
    padding: 14vh 88px 18vh 88px;
    max-width: calc(var(--col) + 240px);
    z-index: 100;
}

/* sections (movements) */
.movement {
    position: relative;
    min-height: 100vh;
    padding: 8vh 0 6vh 0;
    margin: 0 auto;
}
/* every fourth section limps left by 7px */
.movement:nth-child(4n) {
    transform: translateX(-7px);
}
.movement:nth-child(4n + 2) {
    transform: translateX(3px);
}

/* prose */
.movement p {
    max-width: var(--col);
    margin: 0 auto 28px auto;
    font-family: var(--rec);
    font-size: 17px;
    line-height: 28px;
    color: var(--ink-roast);
    font-variation-settings: "MONO" 0, "CASL" 0.25, "wght" 420, "slnt" 0;
}
.movement p.prelude {
    font-variation-settings: "MONO" 0, "CASL" 0.45, "wght" 380, "slnt" -2;
    color: var(--ink-roast);
    font-size: 18px;
}

/* display headlines */
.display {
    font-family: var(--rec);
    font-size: clamp(3.2rem, 9vw, 8.4rem);
    line-height: 0.96;
    letter-spacing: -0.04em;
    color: var(--ink-roast);
    font-variation-settings: "MONO" 0, "CASL" 0, "wght" 950, "slnt" -8;
    margin: 0 auto 56px auto;
    max-width: var(--col);
    word-break: break-word;
    overflow-wrap: break-word;
}
.display .glyph-span {
    display: inline-block;
    transition: transform 220ms cubic-bezier(.16,1,.3,1),
                text-shadow 220ms;
    will-change: transform, text-shadow;
}
.display .glyph-span.glitch {
    text-shadow: 1.4px 0 var(--redline), -1.0px 0 var(--olive-record);
    transform: translateX(0.6px);
}
.display .glyph-span.tremor {
    transform: translateX(-0.6px);
    text-shadow: 1.0px 0 var(--redline), -0.8px 0 var(--olive-record);
}
.display .glyph-span.is-space { width: 0.32em; }

/* expressive verbs */
.verb {
    font-family: var(--rec);
    display: inline-block;
    color: var(--ink-roast);
    font-variation-settings: "MONO" 0, "CASL" 0.0, "wght" 720, "slnt" 0;
    transition: font-variation-settings 420ms cubic-bezier(.16,1,.3,1),
                text-shadow 220ms,
                color 220ms;
    cursor: none;
}
.verb:hover {
    font-variation-settings: "MONO" 1, "CASL" 0.6, "wght" 720, "slnt" -4;
    text-shadow: 1.4px 0 var(--redline), -1.0px 0 var(--olive-record);
}
/* TRUTH always RGB-split by 1.6px */
.verb[data-verb="TRUTH"] {
    text-shadow: 1.6px 0 var(--redline), -1.6px 0 var(--olive-record);
    color: var(--ink-roast);
    font-variation-settings: "MONO" 0.2, "CASL" 0.0, "wght" 800, "slnt" -2;
}
.verb[data-verb="TRUTH"]:hover {
    text-shadow: 2.4px 0 var(--redline), -2.4px 0 var(--olive-record);
}

/* inline links: brass underline drawn left-to-right on hover */
.inline-link {
    position: relative;
    color: var(--ink-roast);
    font-variation-settings: "MONO" 0, "CASL" 0.4, "wght" 520, "slnt" 0;
    transition: color 240ms;
    cursor: none;
}
.inline-link::before {
    content: "";
    position: absolute;
    left: 0;
    right: auto;
    bottom: -3px;
    width: 0%;
    height: 1.5px;
    background: var(--brass-warm);
    transition: width 320ms cubic-bezier(.16,1,.3,1);
}
.inline-link:hover {
    color: var(--ink-roast);
    text-shadow: 1.2px 0 var(--redline), -0.8px 0 var(--olive-record);
    animation: rgbWobble 240ms steps(6, end) 1;
}
.inline-link:hover::before { width: 100%; }
.inline-link.unhovered-pulse::after {
    content: "";
    position: absolute;
    inset: -4px -2px;
    border-radius: 2px;
    box-shadow: 0 0 0 0 rgba(94,138,110, 0);
    pointer-events: none;
    animation: oliveLinkPulse 6500ms ease-in-out infinite;
}
@keyframes oliveLinkPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(94,138,110, 0); }
    45%      { box-shadow: 0 0 0 6px rgba(94,138,110, 0.08); }
}

@keyframes rgbWobble {
    0%   { text-shadow: 1.2px 0 var(--redline), -0.8px 0 var(--olive-record); }
    16%  { text-shadow: 0.4px 0 var(--redline), -1.4px 0 var(--olive-record); }
    33%  { text-shadow: 1.6px 0 var(--redline), -0.2px 0 var(--olive-record); }
    50%  { text-shadow: 0.8px 0 var(--redline), -1.0px 0 var(--olive-record); }
    66%  { text-shadow: 1.4px 0 var(--redline), -0.6px 0 var(--olive-record); }
    83%  { text-shadow: 0.6px 0 var(--redline), -1.2px 0 var(--olive-record); }
    100% { text-shadow: 1.2px 0 var(--redline), -0.8px 0 var(--olive-record); }
}

/* evidence (Cormorant Infant) */
.evidence {
    font-family: var(--cor) !important;
    font-size: 18px !important;
    line-height: 1.55 !important;
    font-style: italic;
    color: var(--ink-roast);
    border-left: 1.5px solid var(--walnut);
    padding-left: 22px !important;
    margin: 32px auto !important;
    max-width: calc(var(--col) - 22px) !important;
    font-weight: 420;
}
.evidence.oath { border-left-color: var(--brass-warm); }

/* exhibit list */
.exhibits {
    list-style: none;
    max-width: var(--col);
    margin: 12px auto 36px auto;
    padding: 0;
}
.exhibits li {
    font-family: var(--rec);
    font-size: 16px;
    line-height: 28px;
    color: var(--ink-roast);
    padding: 6px 0;
    border-bottom: 0.5px dashed rgba(142,111,61,0.35);
    display: flex;
    gap: 14px;
}
.exhibits .ex-id {
    font-family: var(--jbm);
    font-size: 13px;
    color: var(--walnut);
    min-width: 36px;
    padding-top: 2px;
}

/* -------- GEOMETRIC SHAPES (architectural) -------- */
.shape {
    position: absolute;
    pointer-events: none;
    filter: drop-shadow(0 24px 48px rgba(26, 20, 16, 0.12));
    transition: transform 1100ms cubic-bezier(.16,1,.3,1);
    will-change: transform;
    z-index: -1;
}
.shape-trapezoid {
    width: 480px;
    height: 260px;
    right: -120px;
    top: 30%;
    transform: rotate(0deg);
}
.shape-trapezoid.entered { transform: rotate(0.6deg); }

.shape-square {
    width: 600px;
    height: 600px;
    left: -180px;
    bottom: -120px;
    opacity: 0.92;
}
.shape-square.entered { transform: rotate(-0.4deg); }

.shape-circle {
    width: 320px;
    height: 320px;
    /* golden ratio horizontal of viewport: roughly 61.8% */
    right: 18%;
    top: 50%;
    opacity: 0.9;
}
.shape-circle.entered { transform: rotate(0.6deg) translateY(-2px); }

.shape-mini-trapezoid {
    width: 240px;
    height: 140px;
    right: 4%;
    top: 16%;
    opacity: 0.85;
}
.shape-mini-trapezoid.entered { transform: rotate(-0.6deg); }

/* -------- COURT-DERIVED GLYPHS -------- */
.glyph {
    position: absolute;
    width: 24px;
    height: 24px;
    opacity: 0.85;
}
.glyph-scale  { left: 10%;  top: 14%;  }
.glyph-palm   { right: 10%; top: 18%;  }
.glyph-ledger { right: 12%; bottom: 22%; }
.glyph-gavel  { left: 12%;  bottom: 18%; transform: rotate(-3deg); }

/* -------- MOVEMENT 6: OBJECTION (full-bleed walnut block) -------- */
.objection-block {
    background: var(--walnut);
    color: var(--vellum);
    padding-top: 14vh;
    padding-bottom: 14vh;
    margin-left: calc(-1 * (50vw - 50%));
    margin-right: calc(-1 * (50vw - 50%));
    width: 100vw;
    transform: none !important;
    position: relative;
    overflow: hidden;
}
.objection-display {
    color: var(--vellum) !important;
    font-variation-settings: "MONO" 0.6, "CASL" 0, "wght" 980, "slnt" -10 !important;
    text-shadow: 2.2px 0 var(--redline), -1.8px 0 var(--olive-record);
    text-align: center;
    margin-left: auto !important;
    margin-right: auto !important;
}
.objection-prose {
    color: var(--vellum) !important;
    font-variation-settings: "MONO" 0.2, "CASL" 0.3, "wght" 460, "slnt" -2 !important;
    margin-left: auto !important;
    margin-right: auto !important;
}
.objection-prose .verb { color: var(--vellum); }
.objection-prose em { color: var(--brass-warm); font-style: italic; }
.objection-prose.objection-shifted {
    transform: translateX(11px);
    font-variation-settings: "MONO" 0.6, "CASL" 0.0, "wght" 420, "slnt" 0 !important;
}
.objection-rule {
    width: 96px;
    height: 1.5px;
    background: var(--brass-warm);
    margin: 56px auto 0 auto;
}

/* -------- MOVEMENT 9: ADJOURNED -------- */
.adjourned {
    text-align: center;
    min-height: 60vh;
    padding-top: 18vh;
    padding-bottom: 18vh;
}
.adjourn-rule {
    width: 96px;
    height: 1.5px;
    background: var(--brass-warm);
    margin: 0 auto 56px auto;
}
.adjourned-display {
    font-size: clamp(3rem, 7vw, 6rem) !important;
    font-variation-settings: "MONO" 0, "CASL" 0.4, "wght" 280, "slnt" -9 !important;
    font-style: italic;
    color: var(--ink-roast);
    text-align: center;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* -------- PULSE-ATTENTION (current section first letter) -------- */
.movement.in-view .display .glyph-span:first-child {
    position: relative;
}
.movement.in-view .display .glyph-span:first-child::after {
    content: "";
    position: absolute;
    inset: -10%;
    border-radius: 8px;
    box-shadow: 0 0 0 0 rgba(201,168,106, 0);
    pointer-events: none;
    animation: firstLetterPulse 4500ms cubic-bezier(.4,0,.2,1) infinite;
}
@keyframes firstLetterPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(201,168,106, 0); }
    50%      { box-shadow: 0 0 0 14px rgba(201,168,106, 0.18); }
}

/* -------- BLOCK-CHAR CORRUPTION CLASS -------- */
.is-corrupt {
    font-family: var(--jbm);
    color: var(--walnut);
    letter-spacing: 0.06em;
}

/* -------- RESPONSIVE -------- */
@media (max-width: 720px) {
    .hearing { padding: 12vh 24px 16vh 24px; }
    .marginalia { display: none; }
    .gavel-glyph { top: 18px; left: 18px; }
    .display { font-size: clamp(2.2rem, 12vw, 4rem); }
    .shape { display: none; }
    .glyph { display: none; }
    .objection-block { padding-left: 24px; padding-right: 24px; }
    .movement:nth-child(4n),
    .movement:nth-child(4n+2) { transform: none; }
}

/* -------- REDUCED MOTION -------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
    .gavel-halo.pulse { animation: none; }
    .display .glyph-span { text-shadow: 1.4px 0 var(--redline), -1.0px 0 var(--olive-record); }
    .verb[data-verb="TRUTH"] { text-shadow: 1.6px 0 var(--redline), -1.6px 0 var(--olive-record); }
    .scanline-tear { display: none; }
    .shape { transform: none !important; }
    .movement.in-view .display .glyph-span:first-child::after {
        box-shadow: 0 0 0 14px rgba(201,168,106, 0.18);
        animation: none;
    }
    .inline-link.unhovered-pulse::after {
        box-shadow: 0 0 0 6px rgba(94,138,110, 0.08);
        animation: none;
    }
}
