/* ======================================
   SocialDebug.Org — Styles
   ====================================== */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #0b1420;
    --bg-elevated: #131e2b;
    --text-primary: #e8ecf0;
    --text-secondary: #7a8a9a;
    --text-tertiary: #4a5a6a;
    --accent-cyan: #00e5ff;
    --accent-amber: #ffb347;
    --accent-magenta: #ff3b7a;
    --divider: #2a3a4a;
    --gutter-bg: #070d14;
    --scanline: #1a2a3a;
    --muted-steel: #5a6a7a;

    --gutter-width: 48px;
    --content-left: 15%;
    --content-max-width: 55%;
    --scroll-progress: 0;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    line-height: 1.8;
    overflow-x: hidden;
}

/* --- Keyframes --- */
@keyframes pulse-debug {
    0% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.4); }
    70% { box-shadow: 0 0 0 16px rgba(0, 229, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0); }
}

@keyframes pulse-magenta {
    0% { box-shadow: 0 0 0 0 rgba(255, 59, 122, 0.4); }
    70% { box-shadow: 0 0 0 12px rgba(255, 59, 122, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 59, 122, 0); }
}

@keyframes blink {
    50% { opacity: 0; }
}

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

@keyframes trace-draw {
    from { stroke-dashoffset: 1000; }
    to { stroke-dashoffset: 0; }
}

/* --- Scan-line Overlay --- */
.scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 3px,
        var(--scanline) 3px,
        var(--scanline) 4px
    );
    opacity: 0.08;
}

/* --- Left-Rail Diagnostic Gutter --- */
.gutter {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--gutter-width);
    height: 100vh;
    background-color: var(--gutter-bg);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-right: 1px solid rgba(42, 58, 74, 0.3);
}

.gutter-site-name {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-tertiary);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 0.05em;
    padding-top: 16px;
    opacity: 0.7;
}

.gutter-progress-track {
    position: absolute;
    left: 4px;
    top: 0;
    width: 2px;
    height: 100%;
    background-color: rgba(42, 58, 74, 0.2);
}

.gutter-progress-bar {
    width: 100%;
    height: calc(var(--scroll-progress) * 100%);
    background-color: var(--accent-cyan);
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.3);
    transition: height 0.1s linear;
}

.gutter-markers {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    padding: 60px 0;
}

.gutter-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    transition: opacity 0.4s ease;
}

.gutter-marker.active {
    opacity: 1;
}

.gutter-marker .breakpoint-icon circle {
    filter: drop-shadow(0 0 4px rgba(255, 59, 122, 0.5));
}

/* --- Content Stream (Main) --- */
.content-stream {
    margin-left: var(--gutter-width);
    position: relative;
}

/* --- Stack Frame Sections --- */
.stack-frame {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 80px 0;
    position: relative;
}

.stack-frame .content-block {
    margin-left: var(--content-left);
    max-width: var(--content-max-width);
    margin-bottom: 2rem;
}

.stack-frame .circuit-trace {
    margin-left: var(--content-left);
    max-width: var(--content-max-width);
    margin-bottom: 2rem;
}

/* Breakpoint shift: right-aligned */
.stack-frame-shifted .content-block {
    margin-left: auto;
    margin-right: var(--content-left);
    text-align: right;
}

/* Breakpoint shift: wide */
.stack-frame-wide .content-block {
    max-width: 80%;
    margin-left: 10%;
}

/* Opening frame */
.frame-opening {
    min-height: 100vh;
    justify-content: center;
}

.opening-provocation {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 480px;
}

/* Terminal/end frame */
.frame-terminal {
    min-height: 50vh;
}

/* --- Frame Counter --- */
.frame-counter {
    position: absolute;
    top: 24px;
    left: var(--content-left);
}

.stack-frame-shifted .frame-counter {
    left: auto;
    right: var(--content-left);
}

/* --- Typography --- */
.headline {
    font-family: 'Albert Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.body-text {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    font-size: 1.125rem;
    line-height: 1.8;
    color: #b0bcc8;
}

.mono-accent {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--muted-steel);
    letter-spacing: 0.05em;
}

.pull-quote {
    font-family: 'Albert Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(1.5rem, 3.5vw, 2.5rem);
    line-height: 1.4;
    color: var(--accent-cyan);
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.15);
}

.dim {
    color: var(--text-tertiary);
}

.end-message {
    font-size: 1rem;
    color: var(--text-tertiary);
    line-height: 2;
}

.closing-text {
    margin-top: 2rem;
}

/* --- Breathing Space --- */
.breathing-space {
    height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.breathing-space-dots {
    background-image: radial-gradient(circle, rgba(42, 58, 74, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
}

.frame-divider {
    border: none;
    height: 1px;
    background-color: var(--divider);
    opacity: 0.3;
    width: 60%;
}

.final-space {
    height: 30vh;
}

/* --- Fade In Animation (initial hidden state) --- */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 800ms cubic-bezier(0.25, 0.1, 0.25, 1),
                transform 800ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Circuit Trace SVGs --- */
.circuit-svg {
    width: 100%;
    max-width: 600px;
    height: auto;
    overflow: visible;
}

.trace-line {
    stroke: var(--accent-cyan);
    stroke-width: 1;
    stroke-opacity: 0.6;
    fill: none;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s ease;
}

.visible .trace-line {
    stroke-dashoffset: 0;
}

.trace-node {
    fill: var(--accent-cyan);
    fill-opacity: 0.7;
    filter: drop-shadow(0 0 3px rgba(0, 229, 255, 0.5));
}

.pulse-node {
    animation: pulse-debug 2s ease-out infinite;
}

/* --- Pulse Breakpoint Element --- */
.pulse-breakpoint {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: var(--content-left);
    margin-top: 2rem;
}

.breakpoint-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--accent-cyan);
    animation: pulse-debug 2s ease-out infinite;
    flex-shrink: 0;
}

/* --- Bokeh Breath --- */
.bokeh-breath {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 229, 255, 0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.bokeh-1 {
    width: 350px;
    height: 350px;
    top: 20%;
    right: 10%;
}

.bokeh-2 {
    width: 280px;
    height: 280px;
    bottom: 15%;
    right: 20%;
}

.bokeh-3 {
    width: 400px;
    height: 400px;
    top: 10%;
    left: 60%;
}

/* --- Terminal Overlay --- */
.terminal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 400ms ease;
}

.terminal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.terminal-panel {
    background: rgba(11, 20, 32, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 229, 255, 0.15);
    border-radius: 4px;
    padding: 0;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 0 40px rgba(0, 229, 255, 0.05);
}

.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(42, 58, 74, 0.3);
}

.terminal-header .mono-accent {
    color: var(--accent-cyan);
}

.terminal-close {
    font-family: 'IBM Plex Mono', monospace;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    transition: color 0.2s ease;
}

.terminal-close:hover {
    color: var(--accent-magenta);
}

.terminal-body {
    padding: 16px;
}

.terminal-body p {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    color: var(--accent-cyan);
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    line-height: 1.6;
}

.terminal-body .dim {
    color: var(--text-tertiary);
}

.terminal-prompt {
    color: var(--accent-amber);
}

.terminal-cursor {
    display: inline-block;
    width: 8px;
    height: 14px;
    background-color: var(--accent-cyan);
    vertical-align: text-bottom;
    animation: blink 1s steps(1) infinite;
}

.terminal-line {
    color: var(--muted-steel);
}

.terminal-trigger {
    height: 1px;
    width: 1px;
    margin-left: var(--content-left);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    :root {
        --gutter-width: 32px;
        --content-left: 8%;
        --content-max-width: 80%;
    }

    .gutter-site-name {
        font-size: 0.65rem;
    }

    .stack-frame-shifted .content-block {
        margin-left: 8%;
        margin-right: 8%;
    }

    .stack-frame-wide .content-block {
        max-width: 85%;
        margin-left: 8%;
    }

    .breathing-space {
        height: 50vh;
    }

    .pull-quote {
        font-size: clamp(1.2rem, 3vw, 2rem);
    }
}

@media (max-width: 480px) {
    :root {
        --content-max-width: 88%;
        --content-left: 5%;
    }

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

    .breathing-space {
        height: 40vh;
    }
}
