/* =============================================
   SocialDebug.Org — Neubrutalist Investigation Board
   ============================================= */

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

:root {
    --void-ink: #070B1A;
    --midnight-core: #0B0B2B;
    --deep-indigo: #121236;
    --border-black: #0B0B2B;
    --shadow-abyss: #05051A;
    --aged-parchment: #E8DCC8;
    --leather-tan: #B8A892;
    --steel-blue: #4A6FA5;
    --amber-signal: #D4773B;
    --debug-red: #C23B22;
    --leather-base: #1A120B;
    --leather-grain: #2A1D14;
    --leather-crease: #0F0A06;
    --nav-border: #2D2D6B;
}

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

body {
    background: var(--void-ink);
    color: var(--leather-tan);
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.65;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Leather Texture Parallax Background --- */
#leather-bg {
    position: fixed;
    top: -20%;
    left: -5%;
    width: 110%;
    height: 140%;
    z-index: 0;
    opacity: 0;
    transition: opacity 800ms ease;
    background:
        /* Vignette */
        radial-gradient(ellipse at center, transparent 30%, var(--void-ink) 90%),
        /* Grain highlights */
        radial-gradient(circle at 20% 30%, var(--leather-grain) 0.5px, transparent 1px),
        radial-gradient(circle at 60% 70%, var(--leather-grain) 0.3px, transparent 0.8px),
        radial-gradient(circle at 80% 20%, var(--leather-grain) 0.4px, transparent 1px),
        radial-gradient(circle at 40% 80%, var(--leather-grain) 0.5px, transparent 1.2px),
        /* Crease shadows */
        radial-gradient(circle at 30% 50%, var(--leather-crease) 0.3px, transparent 0.6px),
        radial-gradient(circle at 70% 40%, var(--leather-crease) 0.4px, transparent 0.8px),
        /* Subtle noise layer */
        repeating-conic-gradient(var(--leather-base) 0% 25%, var(--leather-grain) 0% 50%) 0 0 / 3px 3px,
        /* Base */
        linear-gradient(180deg, var(--leather-base) 0%, #15100A 50%, var(--leather-base) 100%);
    background-size:
        100% 100%,
        200px 200px,
        180px 180px,
        160px 160px,
        220px 220px,
        190px 190px,
        170px 170px,
        3px 3px,
        100% 100%;
    will-change: transform;
}

#leather-bg.visible {
    opacity: 0.6;
}

/* --- Foreground Retro-Pattern Overlay --- */
#foreground-overlay {
    position: fixed;
    top: -10%;
    left: 0;
    width: 100%;
    height: 120%;
    z-index: 10;
    pointer-events: none;
    will-change: transform;
}

.halftone-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, var(--steel-blue) 1px, transparent 1px);
    background-size: 8px 8px;
    opacity: 0.12;
}

.crosshatch-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 6px,
            var(--nav-border) 6px,
            var(--nav-border) 7px
        ),
        repeating-linear-gradient(
            135deg,
            transparent,
            transparent 6px,
            var(--nav-border) 6px,
            var(--nav-border) 7px
        );
    opacity: 0.08;
}

/* --- Fixed Left-Edge Navigation --- */
#nav-strip {
    position: fixed;
    left: 0;
    top: 0;
    width: 48px;
    height: 100vh;
    background: var(--midnight-core);
    border-right: 3px solid var(--nav-border);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.nav-dot {
    width: 14px;
    height: 14px;
    border: 2px solid var(--steel-blue);
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    background: transparent;
}

.nav-dot.active {
    background: var(--steel-blue);
}

.nav-dot:hover {
    border-color: var(--amber-signal);
    box-shadow: 0 0 0 2px var(--amber-signal);
}

.nav-dot:hover.active {
    background: var(--amber-signal);
    border-color: var(--amber-signal);
}

.nav-tooltip {
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--midnight-core);
    border: 2px solid var(--steel-blue);
    color: var(--steel-blue);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: 4px 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
}

.nav-dot:hover .nav-tooltip {
    opacity: 1;
}

/* --- Debug Sections --- */
.debug-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 80px 60px 108px;
    z-index: 5;
}

/* --- Section Watermark Numbers --- */
.section-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Archivo Black', sans-serif;
    font-size: clamp(15rem, 30vw, 40rem);
    color: #0E0E30;
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
    line-height: 1;
    user-select: none;
}

/* --- Zigzag Tape Divider --- */
.zigzag-divider {
    position: absolute;
    top: 0;
    left: 48px;
    right: 0;
    height: 16px;
    z-index: 6;
    background:
        linear-gradient(135deg, var(--amber-signal) 33.33%, transparent 33.33%) 0 0,
        linear-gradient(225deg, var(--amber-signal) 33.33%, transparent 33.33%) 0 0;
    background-size: 16px 16px;
    background-repeat: repeat-x;
    opacity: 0.6;
}

/* --- Neubrutalist Debug Frame --- */
.debug-frame {
    position: relative;
    background: var(--deep-indigo);
    border: 5px solid var(--border-black);
    box-shadow: 8px 8px 0 var(--shadow-abyss);
    padding: 48px 56px;
    max-width: 780px;
    width: 100%;
    z-index: 2;
    /* Zoom-focus initial state */
    transform: scale(0.88);
    filter: blur(4px);
    opacity: 0.3;
    transition: transform 500ms cubic-bezier(0.34, 1.56, 0.64, 1),
                filter 500ms ease,
                opacity 500ms ease;
}

.debug-frame.in-view {
    transform: scale(1);
    filter: blur(0);
    opacity: 1;
}

.debug-frame:hover {
    box-shadow: 16px 16px 0 var(--shadow-abyss);
    border-color: var(--amber-signal);
}

/* --- Frame Content --- */
.frame-content {
    position: relative;
    z-index: 1;
}

.section-label {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--steel-blue);
    margin-bottom: 16px;
}

h1, h2 {
    font-family: 'Archivo Black', sans-serif;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 0.95;
    color: var(--aged-parchment);
    margin-bottom: 28px;
}

h1 {
    font-size: clamp(2.5rem, 6vw, 5.5rem);
}

h2 {
    font-size: clamp(2rem, 5vw, 4rem);
}

.body-text {
    color: var(--leather-tan);
    margin-bottom: 20px;
    max-width: 620px;
}

.body-text:last-of-type {
    margin-bottom: 32px;
}

/* --- Stamp Motif --- */
.stamp {
    display: inline-block;
    font-family: 'Archivo Black', sans-serif;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--amber-signal);
    padding: 8px 18px;
    border: 2px solid var(--amber-signal);
    outline: 4px solid var(--border-black);
    outline-offset: 4px;
    cursor: default;
    user-select: none;
}

.stamp-rotate-neg {
    transform: rotate(-2deg);
}

.stamp-rotate-pos {
    transform: rotate(2deg);
}

.stamp-red {
    color: var(--debug-red);
    border-color: var(--debug-red);
}

.stamp:hover {
    animation: stamp-wiggle 100ms ease-in-out 6 alternate;
}

@keyframes stamp-wiggle {
    0% { transform: rotate(-2deg); }
    100% { transform: rotate(2deg); }
}

/* --- Debug Annotations (Marginalia) --- */
.annotation {
    position: absolute;
    display: flex;
    align-items: center;
    z-index: 3;
}

.annotation-line {
    display: inline-block;
    width: 40px;
    height: 0;
    border-top: 1px dashed var(--steel-blue);
    margin-right: 8px;
}

.annotation-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--steel-blue);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    white-space: nowrap;
}

/* --- Typing Animation for Hero Heading --- */
#hero-heading {
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid var(--aged-parchment);
    width: 0;
    animation: typing-reveal 1.2s steps(12, end) 1.1s forwards,
               blink-caret 600ms step-end 6;
}

@keyframes typing-reveal {
    from { width: 0; }
    to { width: 100%; white-space: normal; border-right-color: transparent; }
}

@keyframes blink-caret {
    50% { border-right-color: transparent; }
}

/* --- Staggered Children Animation --- */
.debug-frame.in-view .section-label {
    animation: fade-up 400ms ease forwards;
    animation-delay: 0ms;
}

.debug-frame.in-view h1,
.debug-frame.in-view h2 {
    animation: fade-up 400ms ease forwards;
    animation-delay: 120ms;
}

.debug-frame.in-view .body-text:nth-of-type(1) {
    animation: fade-up 400ms ease forwards;
    animation-delay: 240ms;
}

.debug-frame.in-view .body-text:nth-of-type(2) {
    animation: fade-up 400ms ease forwards;
    animation-delay: 360ms;
}

.debug-frame.in-view .stamp {
    animation: fade-up 400ms ease forwards;
    animation-delay: 480ms;
}

.frame-content > * {
    opacity: 0;
    transform: translateY(12px);
}

.debug-frame.in-view .frame-content > * {
    opacity: 1;
    transform: translateY(0);
}

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

/* --- Hero Section Special Treatment --- */
#section-0 .debug-frame {
    transform: scale(0.85);
    filter: blur(3px);
    opacity: 0;
}

#section-0 .debug-frame.in-view {
    transform: scale(1);
    filter: blur(0);
    opacity: 1;
    transition: transform 600ms cubic-bezier(0.34, 1.56, 0.64, 1),
                filter 600ms ease,
                opacity 600ms ease;
}

/* Override typing heading to allow animation */
#section-0 .debug-frame.in-view #hero-heading {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .debug-section {
        padding: 40px 20px 40px 68px;
    }

    .debug-frame {
        padding: 28px 24px;
    }

    .annotation {
        display: none;
    }

    .section-watermark {
        font-size: clamp(8rem, 20vw, 15rem);
    }

    #nav-strip {
        width: 36px;
    }

    .nav-dot {
        width: 10px;
        height: 10px;
    }

    .zigzag-divider {
        left: 36px;
    }
}

@media (max-width: 480px) {
    .debug-section {
        padding: 30px 14px 30px 52px;
    }

    .debug-frame {
        padding: 20px 16px;
        border-width: 3px;
        box-shadow: 5px 5px 0 var(--shadow-abyss);
    }

    h1 {
        font-size: clamp(2rem, 8vw, 3rem);
    }

    h2 {
        font-size: clamp(1.5rem, 6vw, 2.5rem);
    }
}
