/* ============================================
   LegalDebug.com - Styles
   Law as codebase. Bugs as injustice.
   ============================================ */

/* --- Custom Gavel Cursor --- */
:root {
    --marble: #f5f0e8;
    --void: #0d0f12;
    --error-red: #c0392b;
    --warn-amber: #d4a017;
    --patch-green: #27ae60;
    --statute-black: #1a1a1a;
    --brief-gray: #6b7280;
    --parchment: #e8dcc8;
    --link-blue: #2563eb;
    --border-gray: #d1d5db;
}

/* --- GAVEL CURSOR SVG (data URI) --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cg fill='%231a1a1a' stroke='%231a1a1a' stroke-width='0.5'%3E%3Crect x='5' y='1' width='10' height='5' rx='1'/%3E%3Crect x='9' y='6' width='2' height='8'/%3E%3Crect x='6' y='14' width='8' height='2' rx='0.5'/%3E%3C/g%3E%3C/svg%3E") 10 10, auto;
}

body {
    font-family: 'Source Serif 4', Georgia, serif;
    color: var(--statute-black);
    background: var(--marble);
    line-height: 1.75;
    overflow-x: hidden;
}

/* --- Interactive cursor override --- */
a, button, .stack-frame, .severity-badge, .redacted, .graph-node, [data-interactive] {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cg fill='%231a1a1a' stroke='%231a1a1a' stroke-width='0.5' transform='rotate(-15 10 10)'%3E%3Crect x='5' y='1' width='10' height='5' rx='1'/%3E%3Crect x='9' y='6' width='2' height='8'/%3E%3Crect x='6' y='14' width='8' height='2' rx='0.5'/%3E%3C/g%3E%3C/svg%3E") 10 10, pointer;
}

/* ============================================
   SECTIONS - GENERAL
   ============================================ */
.section {
    min-height: 100vh;
    position: relative;
    scroll-snap-align: start;
    overflow: hidden;
}

.section--dark {
    background: var(--void);
    color: var(--parchment);
}

.section--light {
    background: var(--marble);
    color: var(--statute-black);
}

/* ============================================
   SECTION DIVIDERS
   ============================================ */
.section-divider {
    background: var(--marble);
    text-align: center;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-gray);
    border-bottom: 1px solid var(--border-gray);
}

.section-divider--dark {
    background: var(--void);
    border-top-color: #2a2a2a;
    border-bottom-color: #2a2a2a;
}

.section-divider span {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--brief-gray);
    letter-spacing: 0.05em;
}

.section-divider--dark span {
    color: #555;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
.section-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 2rem;
    color: var(--statute-black);
}

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

.code-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
}

.comment-annotation {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    color: var(--warn-amber);
    display: block;
    text-align: right;
    margin: 0.5rem 0;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.comment-annotation.visible {
    opacity: 1;
    transform: translateX(0);
}

.comment-annotation--inline {
    display: inline;
    transform: none;
    opacity: 1;
}

/* ============================================
   TAGS (OK, WARN, ERR)
   ============================================ */
.tag {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.85em;
    display: inline-block;
    transition: transform 0.15s ease, filter 0.15s ease;
}

.tag:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.tag--ok {
    color: var(--patch-green);
}

.tag--warn {
    color: var(--warn-amber);
}

.tag--err {
    color: var(--error-red);
}

.tag--timeout {
    color: var(--brief-gray);
}

/* ============================================
   SEVERITY BADGES
   ============================================ */
.severity-badge {
    display: inline-block;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    line-height: 1.5;
}

.severity--critical {
    background: var(--error-red);
    color: #fff;
}

.severity--high {
    background: var(--warn-amber);
    color: var(--statute-black);
}

.severity--medium {
    background: var(--patch-green);
    color: #fff;
}

.severity--low {
    background: var(--brief-gray);
    color: #fff;
}

.severity-text--critical {
    color: var(--error-red);
    font-weight: 700;
}

.status-unresolved {
    color: var(--error-red);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
}

/* ============================================
   SECTION 1: BOOT SEQUENCE
   ============================================ */
#boot-sequence {
    display: flex;
    align-items: center;
    justify-content: center;
}

.boot-container {
    width: 100%;
    max-width: 900px;
    padding: 2rem;
    position: relative;
}

.boot-lines {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.75rem, 1.2vw, 0.95rem);
    line-height: 1.9;
}

.boot-line {
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.boot-line.visible {
    opacity: 1;
    transform: translateY(0);
}

.timeout-text {
    color: var(--error-red);
    font-weight: 700;
    animation: pulse-red 1.5s ease-in-out infinite;
}

@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.boot-title {
    opacity: 0;
    transition: opacity 0.4s ease;
    margin-top: 3rem;
    text-align: center;
}

.boot-title.visible {
    opacity: 1;
}

.title-main {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(4rem, 14vw, 10rem);
    letter-spacing: -0.03em;
    color: var(--parchment);
    line-height: 1;
}

.title-subtitle {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--brief-gray);
    margin-top: 1rem;
}

.cursor-blink {
    animation: blink 1s step-end infinite;
    color: var(--parchment);
}

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

/* ============================================
   SECTION 2: BUG REPORT (HERO)
   ============================================ */
#bug-report {
    display: flex;
    align-items: center;
    padding: 6rem 2rem;
}

.bug-report-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 4rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    align-items: start;
}

.bug-report-card {
    background: #fff;
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    overflow: hidden;
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.bug-report-card.visible {
    opacity: 1;
    transform: translateX(0);
}

.bug-report-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-gray);
    background: #fafaf7;
}

.bug-report-id {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--brief-gray);
}

.bug-report-fields {
    padding: 1.5rem;
}

.field-row {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0ece4;
    align-items: baseline;
}

.field-row--description {
    flex-direction: column;
    gap: 0.5rem;
}

.field-row--description .field-value {
    line-height: 1.65;
}

.field-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--brief-gray);
    min-width: 100px;
    flex-shrink: 0;
}

.field-value {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 0.95rem;
    color: var(--statute-black);
}

.field-value code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    background: #f0ece4;
    padding: 0.1em 0.35em;
    border-radius: 3px;
}

.bug-report-meta {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-gray);
    background: #fafaf7;
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--brief-gray);
}

.bug-report-editorial {
    position: relative;
    padding-left: 3.5rem;
    margin-top: 4rem;
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.6s ease-out 0.2s, transform 0.6s ease-out 0.2s;
}

.bug-report-editorial.visible {
    opacity: 1;
    transform: translateX(0);
}

.editorial-text p {
    margin-bottom: 1.25rem;
    font-size: clamp(1rem, 1.4vw, 1.2rem);
    color: #2c2c2c;
}

/* Line Numbers (decorative) */
.line-numbers {
    position: absolute;
    left: 0;
    top: 0;
    width: 2.5rem;
    height: 100%;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--border-gray);
    line-height: 1.75;
    counter-reset: line-counter;
    overflow: hidden;
}

.line-numbers::before {
    content: "001\A002\A003\A004\A005\A006\A007\A008\A009\A010\A011\A012\A013\A014\A015\A016\A017\A018\A019\A020\A021\A022\A023\A024\A025";
    white-space: pre;
    display: block;
    padding-top: 0;
}

/* ============================================
   REDACTED TEXT
   ============================================ */
.redacted {
    position: relative;
    display: inline;
    background: var(--statute-black);
    color: transparent;
    padding: 0.05em 0.15em;
    border-radius: 2px;
    transition: background 0.3s ease-out, color 0.3s ease-out;
    user-select: none;
}

.redacted::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        90deg,
        var(--statute-black) 0px,
        var(--statute-black) 2px,
        #222 2px,
        #222 3px
    );
    border-radius: 2px;
    transition: opacity 0.3s ease-out;
}

.redacted:hover {
    background: transparent;
    color: var(--error-red);
}

.redacted:hover::before {
    opacity: 0;
}

.redacted.shake {
    animation: shake-error 0.2s ease;
}

@keyframes shake-error {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

/* ============================================
   SECTION 3: STACK TRACE
   ============================================ */
#stack-trace {
    padding: 6rem 2rem;
    display: flex;
    align-items: center;
}

.stack-trace-container {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.stack-trace-intro {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    color: var(--error-red);
    margin-bottom: 2rem;
}

.stack-frames {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.stack-frame {
    border-left: 3px solid #333;
    padding: 1rem 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.8rem, 1.1vw, 0.95rem);
    line-height: 1.7;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease, border-color 0.3s ease, background 0.3s ease;
    position: relative;
}

.stack-frame.visible {
    opacity: 1;
    transform: translateY(0);
}

.stack-frame:hover {
    border-left-color: var(--link-blue);
    background: rgba(37, 99, 235, 0.05);
}

.frame-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.frame-file {
    color: var(--brief-gray);
}

.frame-year {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--parchment);
    letter-spacing: 0.05em;
}

.frame-code {
    color: var(--parchment);
    margin: 0.25rem 0;
}

.fn-name {
    color: var(--warn-amber);
}

.frame-detail {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease, opacity 0.3s ease;
    opacity: 0;
    padding: 0 0;
}

.stack-frame:hover .frame-detail {
    max-height: 200px;
    opacity: 1;
    padding: 0.75rem 0 0.25rem;
}

.frame-detail p {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 0.9rem;
    color: #d4cfc4;
    line-height: 1.65;
    margin-bottom: 0.5rem;
}

.stack-trace-error {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.8rem, 1.1vw, 0.95rem);
    color: var(--error-red);
    margin-top: 2rem;
    padding: 1rem;
    border: 1px solid var(--error-red);
    border-radius: 4px;
    background: rgba(192, 57, 43, 0.08);
    line-height: 1.7;
}

/* ============================================
   SECTION 4: DIFF VIEW
   ============================================ */
#diff-view {
    padding: 6rem 2rem;
}

.diff-container {
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

.diff-intro {
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    color: #2c2c2c;
    margin-bottom: 3rem;
}

.diff-block {
    margin-bottom: 3rem;
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.diff-header {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 1rem;
    background: #fafaf7;
    border-bottom: 1px solid var(--border-gray);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    gap: 0.15rem;
}

.diff-file-old {
    color: var(--error-red);
}

.diff-file-new {
    color: var(--patch-green);
}

.diff-hunk {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.75rem, 1vw, 0.85rem);
    line-height: 1.7;
}

.diff-hunk-header {
    padding: 0.35rem 1rem;
    background: #f0ece4;
    color: var(--brief-gray);
    font-size: 0.75rem;
}

.diff-line {
    display: flex;
    padding: 0.1rem 1rem;
    border-left: 3px solid transparent;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.diff-line.visible {
    opacity: 1;
}

.diff-line--context {
    background: #fff;
    border-left-color: transparent;
}

.diff-line--deletion {
    background: rgba(192, 57, 43, 0.08);
    border-left-color: var(--error-red);
    color: var(--error-red);
}

.diff-line--deletion.visible {
    animation: slide-in-left 0.3s ease-out;
}

.diff-line--addition {
    background: rgba(39, 174, 96, 0.08);
    border-left-color: var(--patch-green);
    color: var(--patch-green);
}

.diff-line--addition.visible {
    animation: slide-in-right 0.3s ease-out;
}

@keyframes slide-in-left {
    from { transform: translateX(-10px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slide-in-right {
    from { transform: translateX(10px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.diff-line-num {
    display: inline-block;
    width: 3rem;
    text-align: right;
    color: var(--border-gray);
    user-select: none;
    flex-shrink: 0;
    padding-right: 0.5rem;
}

/* ============================================
   SECTION 5: DEPENDENCY GRAPH
   ============================================ */
#dependency-graph {
    padding: 6rem 2rem;
}

.graph-container {
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

.graph-intro {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    color: #d4cfc4;
    margin-bottom: 2rem;
}

.graph-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 5/3;
    background: rgba(255,255,255,0.03);
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    overflow: hidden;
}

#dependency-svg {
    width: 100%;
    height: 100%;
}

/* Graph node styles (applied via JS) */
.graph-node-circle {
    fill: var(--void);
    stroke: var(--parchment);
    stroke-width: 2;
    transition: stroke 0.4s ease, stroke-width 0.3s ease;
}

.graph-node-circle:hover {
    stroke: var(--link-blue);
    stroke-width: 3;
}

.graph-node-text {
    fill: var(--parchment);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-anchor: middle;
    pointer-events: none;
}

.graph-connection {
    stroke: var(--parchment);
    stroke-width: 1.5;
    fill: none;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s ease;
}

.graph-connection.drawn {
    stroke-dashoffset: 0;
}

.graph-connection--broken {
    stroke: var(--error-red);
    stroke-dasharray: 8 4;
}

.graph-connection--broken.drawn {
    stroke-dashoffset: 0;
}

.graph-tooltip {
    position: absolute;
    background: var(--statute-black);
    color: var(--parchment);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    border: 1px solid var(--brief-gray);
    max-width: 280px;
    line-height: 1.5;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.graph-tooltip.visible {
    opacity: 1;
}

/* ============================================
   SECTION 6: CONSOLE
   ============================================ */
#console {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}

.console-container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

.console-window {
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    background: #0a0c0f;
}

.console-titlebar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    background: #1c1e22;
    border-bottom: 1px solid #333;
}

.console-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.console-dot--red { background: var(--error-red); }
.console-dot--amber { background: var(--warn-amber); }
.console-dot--green { background: var(--patch-green); }

.console-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--brief-gray);
    margin-left: 0.5rem;
}

.console-body {
    padding: 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.8rem, 1.1vw, 0.95rem);
    line-height: 1.8;
}

.console-line {
    margin-bottom: 0.25rem;
}

.console-prompt {
    color: var(--patch-green);
    font-weight: 700;
}

.console-output {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
    color: var(--parchment);
}

.console-output--final {
    color: var(--brief-gray);
}

.console-line--active {
    margin-top: 1rem;
}

.console-typing {
    color: var(--parchment);
}

/* Console footer */
.console-footer {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 3rem;
    justify-content: center;
}

.sigil {
    color: var(--parchment);
    flex-shrink: 0;
}

.sigil-svg {
    display: block;
}

.footer-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.75rem;
    color: var(--brief-gray);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.footer-separator {
    color: #444;
    margin: 0 0.25rem;
}

/* ============================================
   CLICK PULSE EFFECT
   ============================================ */
.click-pulse {
    position: fixed;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, var(--warn-amber) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0;
    z-index: 9999;
    transform: translate(-50%, -50%);
}

.click-pulse.active {
    animation: pulse-click 0.35s ease-out forwards;
}

@keyframes pulse-click {
    0% { width: 0; height: 0; opacity: 0.7; }
    100% { width: 50px; height: 50px; opacity: 0; }
}

/* ============================================
   SCROLL-TRIGGERED VISIBILITY
   ============================================ */
.scroll-triggered {
    /* Sections use specific child animations */
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .bug-report-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .bug-report-editorial {
        margin-top: 2rem;
        padding-left: 2.5rem;
    }

    .frame-header {
        flex-direction: column;
        gap: 0.25rem;
    }

    .diff-header {
        font-size: 0.7rem;
    }

    .console-footer {
        flex-direction: column;
        gap: 1rem;
    }

    .title-main {
        font-size: clamp(2.5rem, 12vw, 5rem);
    }

    .graph-viewport {
        aspect-ratio: 4/5;
    }
}
