/* ========================================
   postp.day — Brutalist Processing Engine
   ======================================== */

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

:root {
    --bg-deep: #0e0b14;
    --bg-panel: #161222;
    --purple-mid: #6b5b8a;
    --purple-light: #a9a0b8;
    --crimson: #c44569;
    --sapphire: #2d6e8e;
    --cream: #e8e0f0;
    --topaz: #8e5b2d;
    --gutter: 8px;
    --shadow-offset: 6px;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background: var(--bg-deep);
    color: var(--cream);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.6;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* --- Bokeh Background Layer --- */
.bokeh-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.5s ease;
    background:
        radial-gradient(circle 180px at 15% 20%, rgba(107, 91, 138, 0.08) 0%, transparent 70%),
        radial-gradient(circle 120px at 75% 35%, rgba(45, 110, 142, 0.06) 0%, transparent 70%),
        radial-gradient(circle 200px at 50% 70%, rgba(196, 69, 105, 0.05) 0%, transparent 70%),
        radial-gradient(circle 80px at 85% 80%, rgba(142, 91, 45, 0.07) 0%, transparent 70%),
        radial-gradient(circle 150px at 25% 85%, rgba(107, 91, 138, 0.06) 0%, transparent 70%),
        radial-gradient(circle 60px at 60% 15%, rgba(45, 110, 142, 0.09) 0%, transparent 70%),
        radial-gradient(circle 100px at 40% 45%, rgba(196, 69, 105, 0.04) 0%, transparent 70%),
        radial-gradient(circle 140px at 90% 50%, rgba(107, 91, 138, 0.07) 0%, transparent 70%);
    animation: bokeh-drift 90s ease-in-out infinite alternate;
}

.bokeh-layer.visible {
    opacity: 1;
}

@keyframes bokeh-drift {
    0% { transform: translate(0, 0); }
    25% { transform: translate(20px, -15px); }
    50% { transform: translate(-10px, 25px); }
    75% { transform: translate(15px, 10px); }
    100% { transform: translate(-20px, -20px); }
}

/* --- Anchor Block (Hero) --- */
.anchor-block {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.anchor-content {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease 0.5s, transform 0.8s ease 0.5s;
}

.anchor-content.visible {
    opacity: 1;
    transform: translateY(0);
}

.process-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: var(--purple-mid);
    letter-spacing: 0.15em;
    margin-bottom: 1.5rem;
}

.blink {
    animation: blink-cursor 1s step-end infinite;
}

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

.anchor-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4.5rem);
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: var(--cream);
    margin-bottom: 0.75rem;
}

.anchor-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem;
    color: var(--purple-light);
    margin-bottom: 2rem;
    letter-spacing: 0.02em;
}

.progress-bar {
    width: 200px;
    height: 3px;
    background: var(--bg-panel);
    border: 1px solid var(--purple-mid);
    margin: 0 auto 1rem;
    overflow: hidden;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: var(--crimson);
    transition: width 2s ease;
}

.progress-fill.complete {
    width: 100%;
}

.process-status {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: var(--crimson);
    letter-spacing: 0.2em;
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.6s ease 2.5s;
}

.scroll-indicator.visible {
    opacity: 1;
}

.scroll-text {
    font-size: 0.65rem;
    color: var(--purple-mid);
    letter-spacing: 0.15em;
}

.scroll-indicator svg {
    animation: bounce-down 2s ease-in-out infinite;
}

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

/* --- Processing Grid --- */
.processing-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gutter);
    padding: var(--gutter);
    max-width: 1200px;
    margin: 0 auto;
}

/* --- Grid Module Base --- */
.grid-module {
    background: var(--bg-panel);
    border: 1px solid rgba(107, 91, 138, 0.2);
    padding: 1.5rem;
    position: relative;
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0 rgba(107, 91, 138, 0.1);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease, border-color 0.3s ease;
}

.grid-module.visible {
    opacity: 1;
    transform: translateY(0);
}

.grid-module:hover {
    border-color: var(--crimson);
}

/* Module size variants */
.module-tall {
    grid-row: span 2;
}

.module-wide {
    grid-column: span 2;
}

.module-square {
    /* default 1x1 */
}

/* --- Module Header --- */
.module-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(107, 91, 138, 0.15);
}

.module-index {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--crimson);
    letter-spacing: -0.02em;
}

.module-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    color: var(--cream);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.module-status {
    margin-left: auto;
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    padding: 0.15rem 0.5rem;
    border: 1px solid;
}

.status-active {
    color: #4ecdc4;
    border-color: #4ecdc4;
}

.status-processing {
    color: var(--crimson);
    border-color: var(--crimson);
    animation: pulse-status 2s ease-in-out infinite;
}

.status-queued {
    color: var(--purple-mid);
    border-color: var(--purple-mid);
}

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

/* --- Module Body --- */
.module-body {
    flex: 1;
}

.module-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    color: var(--purple-light);
    line-height: 1.7;
    margin-top: 1rem;
}

/* --- Module Footer --- */
.module-footer {
    margin-top: 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(107, 91, 138, 0.15);
}

.throughput {
    font-size: 0.7rem;
    color: var(--purple-mid);
    letter-spacing: 0.08em;
}

.throughput-val {
    color: var(--cream);
}

/* --- Waveform Visualization --- */
.waveform {
    height: 80px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(107, 91, 138, 0.15);
    background: rgba(14, 11, 20, 0.5);
}

.waveform-bar {
    position: absolute;
    bottom: 0;
    width: 3px;
    background: var(--sapphire);
    transition: height 0.15s ease;
}

/* --- Noise Visualization --- */
.noise-viz {
    height: 60px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(107, 91, 138, 0.15);
    background: rgba(14, 11, 20, 0.5);
}

.noise-viz canvas {
    width: 100%;
    height: 100%;
}

/* --- Color Swatches --- */
.color-swatches {
    display: flex;
    gap: 4px;
}

.swatch {
    flex: 1;
    height: 40px;
    transition: transform 0.2s ease;
}

.swatch:hover {
    transform: scaleY(1.5);
}

/* --- Timeline --- */
.timeline {
    position: relative;
    height: 40px;
    background: rgba(14, 11, 20, 0.5);
    border: 1px solid rgba(107, 91, 138, 0.15);
    margin-bottom: 0.5rem;
}

.timeline-marker {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: var(--purple-mid);
    opacity: 0.5;
}

.timeline-playhead {
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--crimson);
    transition: left 0.1s linear;
}

/* --- Transform Canvas --- */
.grid-transform canvas {
    width: 100%;
    height: 200px;
    border: 1px solid rgba(107, 91, 138, 0.15);
    background: rgba(14, 11, 20, 0.5);
}

/* --- Render Progress --- */
.render-progress {
    position: relative;
    height: 30px;
    background: rgba(14, 11, 20, 0.5);
    border: 1px solid rgba(107, 91, 138, 0.15);
    overflow: hidden;
}

.render-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--sapphire), var(--crimson));
    transition: width 0.5s ease;
}

.render-percentage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.7rem;
    color: var(--cream);
    letter-spacing: 0.1em;
}

/* --- System Footer --- */
.system-footer {
    position: relative;
    z-index: 1;
    margin-top: 4rem;
    padding: 1.5rem var(--gutter);
    border-top: 2px solid var(--purple-mid);
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.footer-grid {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.footer-label {
    font-size: 0.6rem;
    color: var(--purple-mid);
    letter-spacing: 0.15em;
}

.footer-value {
    font-size: 0.8rem;
    color: var(--cream);
    letter-spacing: 0.05em;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .processing-grid {
        grid-template-columns: 1fr;
    }

    .module-tall {
        grid-row: span 1;
    }

    .module-wide {
        grid-column: span 1;
    }

    .footer-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}
