/* LegalDebug.com
   Retro-futuristic: vintage law library meets diagnostic console.
   Palette: navy / silver / gold / parchment / terminal cyan.
   Design tokens retained for compliance: IBM Plex Mono pulses with `@keyframes pulse { 0% IBM Plex Mono" (Google Fonts Interaction Interaction: Interaction* Interaction:* Interaction::* Interaction:** While other designs rely on parallax (87% frequency Interactive flip cards translating legal jargon into plain language Interactive Hover | Warm amber glow | `#d4a843` | IntersectionObserver` with `threshold: 0.15` — elements translate 20px upward and fade from 0 to 1 over 0.8s Interspersed between text sections are card-flip interactive elements. Each "debug card" presents a legal concept on the front (styled as a parchment-colored card with serif text Space Grotesk at `0.7rem`. Card dimensions: `min-height: 280px Space Grotesk" (Google Fonts
*/

:root {
    --bg-navy:        #0b1628;
    --bg-silver:      #c8d6e5;
    --bg-midnight:    #06101c;
    --text-silver:    #d4dce6;
    --text-charcoal:  #1a2740;
    --accent-gold:    #b8a04c;
    --accent-cyan:    #7ec8e3;
    --accent-amber:   #d4a843;
    --parchment:      #f0ead6;
    --alert-red:      #c44536;

    --font-display: "Cormorant Garamond", "Times New Roman", serif;
    --font-body:    "EB Garamond", "Georgia", serif;
    --font-mono:    "IBM Plex Mono", "Menlo", monospace;
    --font-ui:      "Space Grotesk", "Helvetica Neue", sans-serif;
}

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

html, body {
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    background: var(--bg-navy);
}

body {
    font-family: var(--font-body);
    font-size: 1.125rem;
    line-height: 1.85;
    color: var(--text-silver);
    background: var(--bg-navy);
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
    overflow-x: hidden;
    position: relative;
}

/* ------------------------------------------------------------------ */
/* Legal pad grid overlay: slow upward scroll, parallax-fixed.        */
/* ------------------------------------------------------------------ */
.legal-pad-grid {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        repeating-linear-gradient(
            0deg,
            rgba(180, 190, 200, 0.08) 0,
            rgba(180, 190, 200, 0.08) 1px,
            transparent 1px,
            transparent 24px
        );
    background-attachment: fixed;
    animation: gridDrift 120s linear infinite;
}

@keyframes gridDrift {
    from { background-position: 0 0; }
    to   { background-position: 0 -2400px; }
}

/* ------------------------------------------------------------------ */
/* Menu: section glyph in top-right, full-screen overlay.             */
/* ------------------------------------------------------------------ */
.menu-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.75rem;
    z-index: 50;
    background: transparent;
    border: 1px solid rgba(184, 160, 76, 0.45);
    color: var(--accent-gold);
    font-family: var(--font-display);
    font-size: 1.6rem;
    width: 2.6rem;
    height: 2.6rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.4s ease, border-color 0.4s ease, background 0.4s ease, transform 0.4s ease;
}

.menu-toggle:hover {
    color: var(--accent-amber);
    border-color: var(--accent-amber);
    background: rgba(212, 168, 67, 0.08);
    transform: rotate(15deg);
}

.menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(6, 16, 28, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.menu-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.menu-close {
    position: absolute;
    top: 1.5rem;
    right: 1.75rem;
    background: transparent;
    border: 1px solid rgba(184, 160, 76, 0.45);
    color: var(--accent-gold);
    font-family: var(--font-display);
    font-size: 1.6rem;
    width: 2.6rem;
    height: 2.6rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.menu-close:hover {
    color: var(--accent-amber);
    border-color: var(--accent-amber);
}

.menu-inner {
    max-width: 42rem;
    width: 90%;
    text-align: center;
    color: var(--text-silver);
}

.menu-label {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent-gold);
    display: block;
    margin-bottom: 2rem;
}

.menu-list {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem 0;
}

.menu-list li {
    margin: 0.6rem 0;
}

.menu-list a {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3.2vw, 2.4rem);
    font-weight: 500;
    color: var(--text-silver);
    text-decoration: none;
    letter-spacing: 0.04em;
    transition: color 0.35s ease, letter-spacing 0.35s ease;
    display: inline-block;
}

.menu-list a:hover {
    color: var(--accent-amber);
    letter-spacing: 0.09em;
}

.menu-footer {
    font-family: var(--font-body);
    font-style: italic;
    color: rgba(212, 220, 230, 0.7);
    font-size: 0.95rem;
    margin: 1.5rem 0 0 0;
}

/* ------------------------------------------------------------------ */
/* Metallic rule (gold sheen).                                        */
/* ------------------------------------------------------------------ */
.metallic-rule {
    border: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(184, 160, 76, 0.15) 20%, var(--accent-gold) 50%, rgba(184, 160, 76, 0.15) 80%, transparent 100%);
    margin: 1.5rem auto;
    width: 60%;
    max-width: 48rem;
}

.hero-rule {
    width: 40%;
    margin: 1.5rem auto;
}

.section-rule {
    width: 42%;
    margin: 1.25rem 0 2rem 0;
    background: linear-gradient(90deg, var(--accent-gold) 0%, rgba(184, 160, 76, 0.35) 60%, transparent 100%);
}

/* ------------------------------------------------------------------ */
/* Stage: perspective container for layered-depth section stack.      */
/* ------------------------------------------------------------------ */
.stage {
    position: relative;
    z-index: 1;
    perspective: 1600px;
    perspective-origin: 50% 40%;
}

/* ------------------------------------------------------------------ */
/* Generic section band (full-bleed stacked-paper).                   */
/* ------------------------------------------------------------------ */
.section {
    position: relative;
    width: 100%;
    padding: 8vh 0;
}

.band + .band {
    margin-top: -3vh;
}

.band-dark {
    background: linear-gradient(180deg, var(--bg-navy) 0%, var(--bg-midnight) 100%);
    color: var(--text-silver);
    box-shadow:
        -4px 8px 28px rgba(11, 22, 40, 0.35),
        -1px 2px 10px rgba(11, 22, 40, 0.20),
        0 -8px 32px rgba(11, 22, 40, 0.30);
    transform: translateZ(0);
    z-index: 2;
}

.band-light {
    background: var(--bg-silver);
    color: var(--text-charcoal);
    box-shadow:
        -4px 8px 28px rgba(11, 22, 40, 0.35),
        -1px 2px 10px rgba(11, 22, 40, 0.20);
    transform: translateZ(10px);
    z-index: 3;
}

.band-light::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: repeating-linear-gradient(
        0deg,
        rgba(26, 39, 64, 0.06) 0,
        rgba(26, 39, 64, 0.06) 1px,
        transparent 1px,
        transparent 24px
    );
}

.band-footer {
    background: var(--bg-midnight);
    color: var(--text-silver);
    box-shadow:
        -4px 8px 28px rgba(11, 22, 40, 0.45),
        0 -10px 40px rgba(11, 22, 40, 0.35);
    z-index: 4;
    padding: 10vh 0;
}

.band-inner {
    position: relative;
    max-width: 52ch;
    margin: 0 auto;
    padding: 6vh 2rem;
    z-index: 2;
}

.band-inner-wide {
    max-width: 78ch;
}

/* Floating section-number watermark */
.section-num {
    position: absolute;
    top: 4vh;
    left: 6vw;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(6rem, 14vw, 12rem);
    line-height: 1;
    letter-spacing: 0.04em;
    opacity: 0.04;
    pointer-events: none;
    user-select: none;
    z-index: 1;
}

.band-light .section-num {
    color: var(--text-charcoal);
    opacity: 0.05;
}

.band-dark .section-num,
.band-footer .section-num {
    color: var(--text-silver);
    opacity: 0.045;
}

/* ------------------------------------------------------------------ */
/* Hero                                                                */
/* ------------------------------------------------------------------ */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: linear-gradient(180deg, var(--bg-navy) 0%, #091322 100%);
    overflow: hidden;
    padding: 0;
    z-index: 1;
    box-shadow: 0 12px 40px rgba(11, 22, 40, 0.5);
}

.hero-frame {
    position: relative;
    text-align: center;
    padding: 0 2rem;
    max-width: 68rem;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.8rem, 7vw, 6rem);
    letter-spacing: 0.04em;
    color: var(--text-silver);
    margin: 0;
    line-height: 1.05;
    text-shadow: 0 2px 28px rgba(184, 160, 76, 0.08);
}

.hero-subtitle {
    font-family: var(--font-body);
    font-style: italic;
    font-size: clamp(1.05rem, 1.7vw, 1.35rem);
    color: rgba(212, 220, 230, 0.82);
    margin: 0.25rem 0 1.75rem;
    letter-spacing: 0.02em;
    opacity: 0;
    animation: fadeIn 1.2s ease both;
    animation-delay: 2s;
}

.hero-meta {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin: 0;
    opacity: 0;
    animation: fadeIn 1.2s ease both;
    animation-delay: 2.8s;
}

.tag {
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent-gold);
}

.bracket-ornament {
    position: absolute;
    font-family: var(--font-mono);
    font-size: clamp(6rem, 18vw, 14rem);
    color: rgba(126, 200, 227, 0.09);
    line-height: 1;
    user-select: none;
    pointer-events: none;
    top: 50%;
    transform: translateY(-50%);
}

.bracket-open  { left: -6vw; }
.bracket-close { right: -6vw; }

.hero-cursor {
    position: absolute;
    bottom: 4vh;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 2rem;
    color: var(--accent-cyan);
    animation: pulse 2.5s ease-in-out infinite;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50%      { opacity: 0.9; }
}

/* ------------------------------------------------------------------ */
/* Section headings & typography                                       */
/* ------------------------------------------------------------------ */
.eyebrow {
    display: block;
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent-gold);
    margin: 0 0 1rem 0;
}

.eyebrow.dark {
    color: #8a7332;
}

.section-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.9rem, 3.8vw, 2.6rem);
    letter-spacing: 0.04em;
    margin: 0;
    line-height: 1.15;
    color: var(--text-silver);
}

.section-title.dark {
    color: var(--text-charcoal);
}

.footer-title {
    font-size: clamp(1.9rem, 3.2vw, 2.4rem);
}

.lede {
    font-family: var(--font-body);
    font-size: 1.2rem;
    line-height: 1.75;
    margin: 0 0 1.25rem 0;
}

.lede.dark { color: var(--text-charcoal); }
.band-light p { color: var(--text-charcoal); }
.band-light em { color: #32486b; font-style: italic; }

.pullquote {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 500;
    font-size: 1.35rem;
    line-height: 1.55;
    color: var(--accent-gold);
    border-left: 2px solid var(--accent-gold);
    padding: 0.25rem 0 0.25rem 1.25rem;
    margin: 2rem 0;
    letter-spacing: 0.01em;
}

.footnote {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 0.98rem;
    color: rgba(212, 220, 230, 0.65);
    margin-top: 1.5rem;
}

.inline-bracket {
    font-family: var(--font-mono);
    color: var(--accent-cyan);
    font-size: 0.95em;
    padding: 0 0.15em;
}

.band-light .inline-bracket { color: #2a5572; }

/* ------------------------------------------------------------------ */
/* Terminal strip (in dark section)                                   */
/* ------------------------------------------------------------------ */
.terminal-strip {
    margin-top: 2rem;
    padding: 0.85rem 1.1rem;
    border: 1px solid rgba(126, 200, 227, 0.22);
    background: rgba(6, 16, 28, 0.6);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--accent-cyan);
    letter-spacing: 0.02em;
    display: flex;
    gap: 0.6rem;
    align-items: center;
    border-radius: 2px;
}

.term-prompt { color: var(--accent-gold); }
.term-cmd    { color: var(--accent-cyan); }
.term-cursor {
    margin-left: auto;
    color: var(--accent-cyan);
    animation: blink 1s steps(1, end) infinite;
}

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

/* ------------------------------------------------------------------ */
/* Debug cards (flip)                                                  */
/* ------------------------------------------------------------------ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2rem;
    margin: 2.5rem 0 1rem 0;
    perspective: 1200px;
}

.debug-card {
    position: relative;
    min-height: 280px;
    width: 100%;
    background: transparent;
    cursor: pointer;
    outline: none;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 280px;
    transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.debug-card:hover .card-inner,
.debug-card.is-flipped .card-inner {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    padding: 1.75rem 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    border-radius: 2px;
    overflow: hidden;
}

.card-front {
    background: var(--parchment);
    color: var(--text-charcoal);
    border: 1px solid rgba(26, 39, 64, 0.14);
    box-shadow:
        -4px 8px 22px rgba(11, 22, 40, 0.22),
        -1px 2px 6px rgba(11, 22, 40, 0.12);
    background-image:
        repeating-linear-gradient(
            0deg,
            rgba(26, 39, 64, 0.045) 0,
            rgba(26, 39, 64, 0.045) 1px,
            transparent 1px,
            transparent 22px
        );
}

.card-back {
    background: var(--bg-navy);
    color: var(--accent-cyan);
    transform: rotateY(180deg);
    border: 1px solid rgba(126, 200, 227, 0.22);
    box-shadow:
        -4px 8px 22px rgba(6, 16, 28, 0.55),
        inset 0 0 40px rgba(126, 200, 227, 0.04);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
}

.card-icon {
    width: 44px;
    height: 44px;
    margin-bottom: 0.6rem;
    opacity: 0.88;
}

.card-tag {
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #6f5a25;
    margin-bottom: 0.4rem;
}

.card-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.6rem;
    letter-spacing: 0.03em;
    margin: 0 0 0.35rem 0;
    color: var(--text-charcoal);
}

.card-body {
    font-family: var(--font-body);
    font-size: 1.02rem;
    line-height: 1.6;
    margin: 0;
    color: var(--text-charcoal);
}

.card-hint {
    margin-top: auto;
    font-family: var(--font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #8a7332;
    padding-top: 0.9rem;
}

.card-hint.mono {
    font-family: var(--font-mono);
    color: var(--accent-cyan);
    letter-spacing: 0.12em;
}

.term-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-gold);
    opacity: 0.8;
    margin-bottom: 0.4rem;
}

.term-block {
    margin: 0 0 0.6rem 0;
    padding: 0;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--accent-cyan);
    white-space: pre-wrap;
    word-break: normal;
}

.term-key   { color: #c9a14c; }
.term-fn    { color: #e9d08a; }
.term-false { color: var(--alert-red); }

.card-back-note {
    margin: 0.4rem 0 0 0;
    font-family: var(--font-body);
    font-style: italic;
    font-size: 0.95rem;
    line-height: 1.55;
    color: rgba(212, 220, 230, 0.82);
}

.card-back-note em { color: var(--accent-amber); font-style: italic; }

.blink {
    display: inline-block;
    color: var(--accent-cyan);
    margin-left: 2px;
    animation: blink 1s steps(1, end) infinite;
}

/* ------------------------------------------------------------------ */
/* Stack trace list                                                    */
/* ------------------------------------------------------------------ */
.trace-list {
    list-style: none;
    padding: 0;
    margin: 2rem 0 1rem 0;
    border-left: 1px solid rgba(184, 160, 76, 0.3);
}

.trace-frame {
    display: grid;
    grid-template-columns: 2.25rem 1fr;
    gap: 0.5rem 0.9rem;
    padding: 0.55rem 0 0.55rem 1.1rem;
    font-family: var(--font-mono);
    font-size: 0.92rem;
    color: var(--accent-cyan);
    position: relative;
    align-items: baseline;
}

.trace-frame + .trace-frame {
    border-top: 1px dashed rgba(126, 200, 227, 0.12);
}

.frame-index {
    color: var(--accent-gold);
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: lowercase;
}

.frame-path {
    color: var(--text-silver);
    font-weight: 500;
}

.frame-arg {
    color: var(--accent-cyan);
    font-style: italic;
}

.frame-loc {
    grid-column: 2;
    font-size: 0.78rem;
    color: rgba(126, 200, 227, 0.55);
    letter-spacing: 0.02em;
}

/* ------------------------------------------------------------------ */
/* Diff / patch block                                                  */
/* ------------------------------------------------------------------ */
.diff-block {
    margin: 2rem 0;
    border: 1px solid rgba(26, 39, 64, 0.2);
    background: #eae3c9;
    box-shadow:
        -4px 8px 20px rgba(26, 39, 64, 0.12),
        -1px 2px 6px rgba(26, 39, 64, 0.08);
    border-radius: 2px;
    overflow: hidden;
}

.diff-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 1rem;
    background: var(--text-charcoal);
    color: var(--parchment);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

.diff-file { color: var(--accent-gold); }
.diff-meta { color: var(--accent-cyan); }

.diff-body {
    margin: 0;
    padding: 1rem 1.2rem;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    line-height: 1.65;
    color: var(--text-charcoal);
    white-space: pre-wrap;
    word-break: normal;
}

.diff-context { color: #4a5a78; display: block; }
.diff-minus {
    display: block;
    color: #7a2a20;
    background: rgba(196, 69, 54, 0.08);
    margin: 0 -1.2rem;
    padding: 0 1.2rem;
}
.diff-plus {
    display: block;
    color: #1f4a30;
    background: rgba(60, 120, 80, 0.10);
    margin: 0 -1.2rem;
    padding: 0 1.2rem;
}

.patch-notes {
    list-style: none;
    padding: 0;
    margin: 1.75rem 0 0 0;
}

.patch-notes li {
    font-family: var(--font-body);
    font-size: 1.02rem;
    line-height: 1.65;
    color: var(--text-charcoal);
    padding: 0.35rem 0;
    display: grid;
    grid-template-columns: 7rem 1fr;
    gap: 0.75rem;
    align-items: baseline;
}

.note-tag {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: #6f5a25;
    letter-spacing: 0.05em;
}

/* ------------------------------------------------------------------ */
/* Footer                                                              */
/* ------------------------------------------------------------------ */
.footer-inner {
    text-align: center;
    max-width: 56ch;
}

.footer-body {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 1.1rem;
    line-height: 1.8;
    margin: 0 auto 1.5rem;
    color: rgba(212, 220, 230, 0.82);
}

.footer-meta {
    display: flex;
    justify-content: center;
    gap: 1.4rem;
    flex-wrap: wrap;
    margin: 1.2rem 0;
}

.footer-sig {
    font-family: var(--font-display);
    font-weight: 500;
    letter-spacing: 0.4em;
    font-size: 1.2rem;
    color: var(--accent-gold);
    margin: 2rem 0 0;
}

/* ------------------------------------------------------------------ */
/* Scroll-reveal                                                       */
/* ------------------------------------------------------------------ */
[data-reveal] .band-inner {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

[data-reveal].is-visible .band-inner {
    opacity: 1;
    transform: translateY(0);
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */
@media (max-width: 720px) {
    body { font-size: 1.05rem; }
    .card-grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .bracket-ornament { display: none; }
    .section-num { font-size: 5.5rem; left: 4vw; top: 3vh; }
    .band-inner { padding: 5vh 1.4rem; }
    .patch-notes li { grid-template-columns: 1fr; gap: 0.1rem; }
    .trace-frame { grid-template-columns: 1.8rem 1fr; }
    .hero-meta { gap: 0.9rem; }
}

@media (hover: none) {
    /* Touch: flip via .is-flipped class only, not hover */
    .debug-card:hover .card-inner { transform: none; }
    .debug-card.is-flipped .card-inner { transform: rotateY(180deg); }
}
