/* ============================================
   LegalDebug.com - Styles
   Geological descent / Debug the legal system
   ============================================ */

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

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

body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.1rem;
    line-height: 1.78;
    color: #f0ebe3;
    background: linear-gradient(180deg, #d4c5a9 0%, #6b5e4c 15%, #3a3228 40%, #1e1e1e 65%, #1a1a1a 80%, #2e4a2e 100%);
    background-attachment: fixed;
    overflow-x: hidden;
}

/* ---- Grain Overlay ---- */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.06;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.5'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ---- Debug Indicator (Fixed Nav Dot) ---- */
#debug-indicator {
    position: fixed;
    top: 28px;
    left: 28px;
    z-index: 9998;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#debug-dot {
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #7cb342;
    box-shadow: 0 0 8px rgba(124, 179, 66, 0.5), 0 0 20px rgba(124, 179, 66, 0.2);
    transition: background-color 0.6s ease, box-shadow 0.6s ease;
}

#debug-dot.amber {
    background-color: #e6a23c;
    box-shadow: 0 0 8px rgba(230, 162, 60, 0.5), 0 0 20px rgba(230, 162, 60, 0.2);
}

#debug-dot.red {
    background-color: #c62828;
    box-shadow: 0 0 8px rgba(198, 40, 40, 0.5), 0 0 20px rgba(198, 40, 40, 0.2);
}

/* ---- Navigation Overlay ---- */
#nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9997;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(30, 30, 30, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

#nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

#nav-panel {
    max-width: 560px;
    width: 90%;
}

.nav-close {
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    color: #e6a23c;
    cursor: pointer;
    margin-bottom: 2rem;
    letter-spacing: 0.04em;
    transition: color 0.3s ease;
}

.nav-close:hover {
    color: #f0ebe3;
}

.nav-command {
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    color: #7cb342;
    letter-spacing: 0.04em;
    padding: 0.8rem 0;
    cursor: pointer;
    border-bottom: 1px solid rgba(124, 179, 66, 0.15);
    transition: color 0.3s ease, padding-left 0.3s ease;
}

.nav-command:hover {
    color: #e6a23c;
    padding-left: 12px;
}

/* ---- Sections ---- */
.section {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.section-inner {
    max-width: 860px;
    margin: 0 auto;
    padding: 6rem 2rem;
    position: relative;
    z-index: 2;
}

/* ---- Section Dividers ---- */
.section-divider {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
    z-index: 3;
    display: block;
}

/* ---- Hero Section ---- */
.section--hero {
    background-color: #d4c5a9;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding-bottom: 80px;
}

.section--hero .section-inner {
    text-align: center;
    padding: 4rem 2rem;
}

.hero-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(3.5rem, 8vw, 9rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #2d2a24;
    line-height: 1;
    margin-bottom: 1.5rem;
    min-height: 1.2em;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    overflow: hidden;
}

.hero-title .char {
    display: inline-block;
    transform: translateY(120%);
    opacity: 0;
    transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-title .char.visible {
    transform: translateY(0);
    opacity: 1;
}

.hero-subtitle {
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    letter-spacing: 0.04em;
    color: #3a3228;
    margin-bottom: 2rem;
}

.hero-cursor {
    display: inline-block;
    color: #7cb342;
    animation: cursor-blink 1s step-end infinite;
    opacity: 0;
}

.hero-cursor.visible {
    opacity: 1;
}

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

.hero-tagline {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.15rem;
    line-height: 1.78;
    color: #6b5e4c;
    max-width: 540px;
    margin: 0 auto;
}

/* ---- Botanical SVGs ---- */
.botanical {
    position: absolute;
    z-index: 1;
    pointer-events: none;
    color: #8a7a5a; /* sepia botanical tone */
}

.botanical--fern {
    top: 5%;
    right: -20px;
    width: 140px;
    height: auto;
    opacity: 0.7;
}

.botanical--oak {
    bottom: 120px;
    left: -30px;
    width: 160px;
    height: auto;
    opacity: 0.7;
}

.botanical--moss {
    top: 60px;
    right: -40px;
    width: 200px;
    height: auto;
    opacity: 0.7;
}

/* ---- Constitutional Foundations ---- */
.section--constitutional {
    background-color: #6b5e4c;
    padding-bottom: 80px;
}

/* ---- Statutory Entanglement ---- */
.section--statutory {
    background: linear-gradient(170deg, #3a3228 0%, #2e4a2e 50%, #3a3228 100%);
    padding-bottom: 80px;
}

/* ---- Precedent Archaeology ---- */
.section--precedent {
    background-color: #1e1e1e;
    padding-bottom: 80px;
}

/* ---- Deep Bugs ---- */
.section--deep-bugs {
    background-color: #1a1a1a;
    padding-bottom: 80px;
}

/* ---- Organic Renewal ---- */
.section--renewal {
    background: linear-gradient(170deg, #2e4a2e 0%, #2e4a2e 60%, #1e1e1e 100%);
    min-height: 100vh;
}

/* ---- Mycelium Networks ---- */
.mycelium-network {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 860px;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.mycelium-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s ease-out;
}

.mycelium-path.visible {
    stroke-dashoffset: 0;
}

.mycelium-node {
    animation: none;
}

.mycelium-node.visible {
    animation: pulse-node 3s ease-in-out infinite;
}

@keyframes pulse-node {
    0%, 100% { r: 3; opacity: 0.5; }
    50% { r: 5; opacity: 0.8; }
}

/* ---- Leaf Venation ---- */
.leaf-venation {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ---- Section Headings ---- */
.section-heading {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(2rem, 4vw, 4rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #f0ebe3;
    margin-bottom: 2rem;
    line-height: 1.1;
}

.section--hero .section-heading {
    color: #2d2a24;
}

/* ---- Section Content ---- */
.section-content {
    margin-bottom: 2.5rem;
}

.section-content p {
    margin-bottom: 1.5rem;
    color: #f0ebe3;
}

.section--hero .section-content p {
    color: #2d2a24;
}

/* ---- Debug Annotations ---- */
.debug-annotation {
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    padding: 0.6rem 1rem;
    margin-bottom: 0.6rem;
    border-left: 3px solid;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 4px 4px 0;
}

.debug-annotation--trace {
    color: #7cb342;
    border-left-color: #7cb342;
}

.debug-annotation--warn {
    color: #e6a23c;
    border-left-color: #e6a23c;
}

.debug-annotation--err {
    color: #c62828;
    border-left-color: #c62828;
}

.debug-annotation span:first-child {
    font-weight: 700;
}

/* ---- Breakpoint Dividers ---- */
.breakpoint-divider {
    height: 80px;
    overflow: hidden;
    display: flex;
    align-items: center;
    position: relative;
}

.breakpoint-divider span {
    font-family: 'Space Mono', monospace;
    font-size: 7px;
    letter-spacing: 0.02em;
    color: #f0ebe3;
    opacity: 0.15;
    white-space: nowrap;
    display: block;
    animation: scroll-citations 60s linear infinite;
    padding-left: 100%;
}

@keyframes scroll-citations {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* ---- Renewal Terminal ---- */
.renewal-terminal {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(124, 179, 66, 0.3);
    border-radius: 6px;
    padding: 1.5rem;
    margin-top: 2rem;
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

.terminal-line {
    color: #f0ebe3;
    padding: 0.2rem 0;
    opacity: 0.9;
}

.terminal-cursor {
    animation: cursor-blink 1s step-end infinite;
    color: #7cb342;
}

/* ---- Utility Classes ---- */
.mono-text {
    font-family: 'Space Mono', monospace;
    letter-spacing: 0.04em;
}

.green {
    color: #7cb342;
}

.amber {
    color: #e6a23c;
}

.red {
    color: #c62828;
}

/* ---- Stagger Animation ---- */
.stagger-item {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.stagger-item.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Preserve the slight rotation on section-content when visible */
.section-content.stagger-item.visible {
    transform: translateY(0);
}

/* ---- Footer ---- */
.site-footer {
    background-color: #1e1e1e;
    padding: 2rem;
    text-align: center;
    border-top: 1px solid rgba(124, 179, 66, 0.15);
}

.footer-inner {
    max-width: 860px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-inner .mono-text {
    font-size: 0.8rem;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .section-inner {
        padding: 4rem 1.5rem;
    }

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

    .section-heading {
        font-size: clamp(1.8rem, 5vw, 3rem);
    }

    .debug-annotation {
        font-size: 0.7rem;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .botanical--fern {
        width: 100px;
        right: -10px;
    }

    .botanical--oak {
        width: 120px;
        left: -20px;
    }

    .botanical--moss {
        width: 150px;
        right: -20px;
    }

    .nav-command {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .hero-subtitle {
        font-size: 0.8rem;
    }

    .hero-tagline {
        font-size: 1rem;
    }

    .renewal-terminal {
        font-size: 0.7rem;
        padding: 1rem;
    }
}
