/* =============================================
   oning.stream - Reasoning Stream Styles
   Pixel-art aesthetic, burgundy-cream palette
   ============================================= */

/* --- CSS Custom Properties --- */
:root {
    --reasoning-burgundy: #4A1828;
    --cream-thought: #F0E8D0;
    --flare-gold: #D8A830;
    --pixel-teal: #38A8A0;
    --warm-rose: #C87068;
    --deep-wine: #2A0818;
    --soft-ivory: #F8F0E0;

    --font-primary: 'Libre Baskerville', Georgia, serif;
    --column-width: 680px;
    --grid-size: 8px;
}

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

html {
    scroll-behavior: auto; /* No smooth scroll - we do pixel-snap in JS */
    font-size: 16px;
}

body {
    font-family: var(--font-primary);
    background-color: var(--soft-ivory);
    color: var(--deep-wine);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Pixel Grid Overlay (fixed, full page) --- */
#pixel-grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 200ms ease;
    background-image:
        repeating-linear-gradient(
            to right,
            rgba(74, 24, 40, 0.03) 0px,
            rgba(74, 24, 40, 0.03) 1px,
            transparent 1px,
            transparent 8px
        ),
        repeating-linear-gradient(
            to bottom,
            rgba(74, 24, 40, 0.03) 0px,
            rgba(74, 24, 40, 0.03) 1px,
            transparent 1px,
            transparent 8px
        );
}

#pixel-grid-overlay.visible {
    opacity: 1;
}

/* --- Circuit Traces SVG (global) --- */
#circuit-traces {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    opacity: 0.03;
    transition: opacity 300ms ease;
}

/* =============================================
   IGNITION SCREEN
   ============================================= */
#ignition-screen {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, var(--cream-thought) 0%, var(--reasoning-burgundy) 100%);
    overflow: hidden;
    z-index: 10;
}

.ignition-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

/* --- Lens Flare (Ignition) --- */
#ignition-flare {
    width: 300px;
    height: 300px;
    transform: scale(0);
    transition: transform 800ms cubic-bezier(0.16, 1, 0.3, 1);
}

#ignition-flare.active {
    transform: scale(1);
}

.lens-flare-svg {
    width: 100%;
    height: 100%;
}

.flare-ring {
    transform-origin: center;
}

.flare-ring-outer {
    animation: flare-pulse-outer 4s ease-in-out infinite;
}

.flare-ring-mid {
    animation: flare-pulse-mid 3s ease-in-out infinite 0.5s;
}

.flare-ring-inner {
    animation: flare-pulse-inner 2.5s ease-in-out infinite 1s;
}

@keyframes flare-pulse-outer {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.7; }
}

@keyframes flare-pulse-mid {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

@keyframes flare-pulse-inner {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.9; }
}

/* --- Ignition Title --- */
.domain-title {
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: clamp(28px, 3.5vw, 52px);
    letter-spacing: 0.01em;
    color: var(--deep-wine);
    margin-top: 24px;
    min-height: 1.2em;
    text-align: center;
}

.domain-title .cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: var(--flare-gold);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: cursor-blink 600ms step-end infinite;
}

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

.ignition-subtitle {
    font-family: var(--font-primary);
    font-weight: 400;
    font-style: italic;
    font-size: 12px;
    color: var(--warm-rose);
    margin-top: 12px;
    opacity: 0;
    transition: opacity 600ms ease 1.5s;
}

.ignition-subtitle.visible {
    opacity: 1;
}

/* --- Ignition Circuit Traces --- */
#ignition-circuits {
    width: 800px;
    max-width: 100vw;
    height: 200px;
    margin-top: 32px;
    overflow: visible;
}

.circuit-trace {
    fill: none;
    stroke: var(--pixel-teal);
    stroke-width: 1;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    opacity: 0.4;
    transition: stroke-dashoffset 2s ease 1s;
}

.circuit-trace.drawn {
    stroke-dashoffset: 0;
}

/* --- Scroll Indicator --- */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
    animation: fade-in-indicator 600ms ease 3s forwards;
}

.scroll-indicator-text {
    font-family: var(--font-primary);
    font-weight: 400;
    font-style: italic;
    font-size: 12px;
    color: var(--warm-rose);
    letter-spacing: 0.05em;
}

.scroll-indicator-arrow {
    animation: bounce-arrow 1.5s ease-in-out infinite;
}

@keyframes fade-in-indicator {
    from { opacity: 0; }
    to { opacity: 0.7; }
}

@keyframes bounce-arrow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* =============================================
   REASONING TIMELINE
   ============================================= */
#reasoning-timeline {
    position: relative;
    padding: 80px 24px 120px;
    background-color: var(--soft-ivory);
    z-index: 5;
}

.timeline-column {
    max-width: var(--column-width);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 64px;
}

/* --- Reasoning Block (Pixel-Art Terminal) --- */
.reasoning-block {
    position: relative;
    border: 2px solid var(--reasoning-burgundy);
    border-radius: 0; /* pixel-perfect corners */
    background: var(--cream-thought);
    opacity: 0;
    transform: translateY(64px);
    transition: box-shadow 300ms ease;
}

.reasoning-block.visible {
    opacity: 1;
    transform: translateY(0);
}

.reasoning-block:hover {
    box-shadow: 0 0 0 2px var(--flare-gold), 0 0 16px rgba(216, 168, 48, 0.3);
}

/* --- Block Header (Title Bar) --- */
.block-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--reasoning-burgundy);
    border-bottom: 2px solid var(--deep-wine);
}

.block-label {
    font-family: var(--font-primary);
    font-weight: 400;
    font-style: italic;
    font-size: 12px;
    color: var(--cream-thought);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    flex: 1;
}

.block-step-badge {
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: 12px;
    color: var(--flare-gold);
}

/* --- Pixel Icons (8x8) --- */
.pixel-icon {
    width: 8px;
    height: 8px;
    image-rendering: pixelated;
}

.pixel-icon-observe {
    background: linear-gradient(135deg, var(--flare-gold) 25%, transparent 25%),
                linear-gradient(225deg, var(--flare-gold) 25%, transparent 25%),
                linear-gradient(315deg, var(--flare-gold) 25%, transparent 25%),
                linear-gradient(45deg, var(--flare-gold) 25%, transparent 25%);
    background-size: 4px 4px;
    background-position: 0 0, 4px 0, 4px 4px, 0 4px;
}

.pixel-icon-analyze {
    background:
        linear-gradient(to right, var(--pixel-teal) 2px, transparent 2px) 0 0 / 4px 4px,
        linear-gradient(to bottom, var(--pixel-teal) 2px, transparent 2px) 0 0 / 4px 4px;
}

.pixel-icon-connect {
    background: var(--warm-rose);
    box-shadow: inset 0 0 0 2px var(--cream-thought);
}

.pixel-icon-test {
    background:
        linear-gradient(45deg, var(--flare-gold) 50%, transparent 50%),
        linear-gradient(-45deg, var(--pixel-teal) 50%, transparent 50%);
}

.pixel-icon-conclude {
    background: var(--flare-gold);
}

/* --- Block Content --- */
.block-content {
    padding: 32px 24px;
    position: relative;
}

/* --- Step Counter --- */
.step-counter {
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: clamp(32px, 3vw, 56px);
    color: var(--deep-wine);
    text-shadow: 2px 2px 0 rgba(42, 8, 24, 0.15);
    margin-bottom: 16px;
    transition: transform 200ms ease;
    line-height: 1;
}

.reasoning-block:hover .step-counter {
    transform: scale(1.1);
}

/* --- Block Title --- */
.block-title {
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: clamp(20px, 2.5vw, 28px);
    letter-spacing: 0.01em;
    color: var(--deep-wine);
    margin-bottom: 16px;
}

/* --- Block Text --- */
.block-text {
    font-family: var(--font-primary);
    font-weight: 400;
    font-size: clamp(15px, 1vw, 17px);
    line-height: 1.85;
    color: var(--reasoning-burgundy);
}

/* --- Lens Flare Divider --- */
.lens-flare-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 80px;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 400ms ease, transform 400ms ease;
}

.lens-flare-divider.visible {
    opacity: 1;
    transform: scale(1);
}

.divider-flare-svg {
    width: 80px;
    height: 80px;
    animation: divider-pulse 3s ease-in-out infinite;
}

@keyframes divider-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* =============================================
   FUTURISTIC HORIZON (Footer)
   ============================================= */
#futuristic-horizon {
    position: relative;
    width: 100%;
    background: linear-gradient(to bottom, var(--soft-ivory) 0%, var(--reasoning-burgundy) 30%, var(--deep-wine) 100%);
    padding-top: 80px;
    overflow: hidden;
    z-index: 5;
}

.horizon-content {
    position: relative;
    width: 100%;
}

#cityscape-svg {
    display: block;
    width: 100%;
    height: auto;
    min-height: 160px;
}

.horizon-flare {
    animation: horizon-flare-blink 3s ease-in-out infinite;
}

.horizon-flare:nth-child(odd) {
    animation-delay: 0.5s;
}

@keyframes horizon-flare-blink {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.horizon-text {
    position: absolute;
    bottom: 24px;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    z-index: 10;
}

.horizon-label {
    font-family: var(--font-primary);
    font-weight: 400;
    font-style: italic;
    font-size: 12px;
    color: var(--warm-rose);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.horizon-domain {
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: 18px;
    color: var(--cream-thought);
    letter-spacing: 0.01em;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
    #ignition-flare {
        width: 200px;
        height: 200px;
    }

    #ignition-circuits {
        width: 100%;
        height: 120px;
    }

    .block-content {
        padding: 24px 16px;
    }

    .timeline-column {
        gap: 48px;
    }

    .scroll-indicator {
        bottom: 24px;
    }
}

@media (max-width: 480px) {
    #ignition-flare {
        width: 160px;
        height: 160px;
    }

    .step-counter {
        font-size: clamp(28px, 8vw, 40px);
    }
}
