/* ppuzzle.dev — Dreaming Dashboard */

:root {
    --cyan: #00f0ff;
    --magenta: #ff2d6b;
    --lavender: #6b5b95;
    --light-slate: #e0e8f0;
    --dark-panel: #1a1d2e;
    --darker-bg: #12141f;
    --deep-blue: #1e3a5f;
    --abyss: #0a0b12;
    --mid-dark: #0f1018;
    --muted-slate: #b8c4d0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Source Sans 3', sans-serif;
    background: var(--abyss);
    color: var(--light-slate);
    overflow-x: hidden;
    line-height: 1.6;
}

.mono-accent {
    font-family: 'IBM Plex Mono', monospace;
    color: var(--cyan);
    font-size: 0.85em;
}

.highlight {
    color: var(--cyan);
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
}

/* Scanline overlay */
.scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
}

/* Dashboard layout */
.dashboard {
    width: 100%;
    min-height: 100vh;
}

.panel-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.panel-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2px;
    max-width: 1200px;
    width: 100%;
}

/* Panel base */
.panel {
    position: relative;
    background: var(--dark-panel);
    border-radius: 4px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.panel.visible {
    opacity: 1;
    transform: translateY(0);
}

.panel-border {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.panel-border svg {
    width: 100%;
    height: 100%;
}

.organic-border {
    fill: none;
    stroke: var(--deep-blue);
    stroke-width: 1.5;
    transition: stroke 0.3s ease;
}

.panel:hover .organic-border {
    stroke: var(--cyan);
    filter: drop-shadow(0 0 4px rgba(0, 240, 255, 0.3));
}

.panel-content {
    position: relative;
    padding: 24px;
    z-index: 1;
}

.panel-title {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 2.5vw, 2.2rem);
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    color: var(--light-slate);
}

.panel-subtitle {
    font-family: 'Libre Franklin', sans-serif;
    font-style: italic;
    font-weight: 300;
    font-size: 1rem;
    margin-bottom: 20px;
    color: var(--lavender);
}

/* Grid spans */
.panel-hero { grid-column: span 7; min-height: 300px; }
.panel-status { grid-column: span 5; min-height: 300px; }
.panel-wave { grid-column: span 12; min-height: 260px; }
.panel-wide { grid-column: span 8; min-height: 280px; }
.panel-blob { grid-column: span 4; min-height: 280px; }
.panel-terminal { grid-column: span 6; min-height: 380px; }
.panel-grid-viz { grid-column: span 6; min-height: 380px; }
.panel-full { grid-column: span 12; min-height: 340px; }

/* Glitch text effect */
.glitch-text {
    position: relative;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

.glitch-text::before {
    color: var(--cyan);
    animation: glitch-1 3s infinite;
}

.glitch-text::after {
    color: var(--magenta);
    animation: glitch-2 3s infinite;
}

@keyframes glitch-1 {
    0%, 90%, 100% { opacity: 0; transform: translate(0); }
    91% { opacity: 0.8; transform: translate(-2px, 1px); clip-path: inset(20% 0 30% 0); }
    93% { opacity: 0; }
    95% { opacity: 0.6; transform: translate(1px, -1px); clip-path: inset(50% 0 10% 0); }
    97% { opacity: 0; }
}

@keyframes glitch-2 {
    0%, 90%, 100% { opacity: 0; transform: translate(0); }
    92% { opacity: 0.8; transform: translate(2px, -1px); clip-path: inset(40% 0 20% 0); }
    94% { opacity: 0; }
    96% { opacity: 0.6; transform: translate(-1px, 1px); clip-path: inset(10% 0 60% 0); }
    98% { opacity: 0; }
}

/* Hero */
h1.glitch-text {
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}

/* KPIs */
.kpi-row, .final-kpis {
    display: flex;
    gap: 32px;
    margin-top: 20px;
}

.kpi {
    display: flex;
    flex-direction: column;
}

.kpi-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 2rem;
    color: var(--cyan);
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

.kpi-label {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--lavender);
}

/* Status list */
.status-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.active {
    background: var(--cyan);
    box-shadow: 0 0 8px var(--cyan);
    animation: pulse-dot 2s infinite;
}

.status-dot.warning {
    background: #ffaa00;
    box-shadow: 0 0 8px #ffaa00;
    animation: pulse-dot 1.5s infinite;
}

.status-dot.inactive {
    background: var(--magenta);
    opacity: 0.5;
}

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

/* Wave canvas */
#wave-canvas {
    width: 100%;
    height: 200px;
    display: block;
}

/* Metric bars */
.metric-bars {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.metric-bar {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bar-track {
    width: 100%;
    height: 6px;
    background: var(--abyss);
    border-radius: 3px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--deep-blue), var(--cyan));
    border-radius: 3px;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
}

/* Blobs */
.blob-container {
    position: relative;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(1px);
    animation: blob-morph 8s infinite ease-in-out;
}

.blob-1 {
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, var(--cyan), transparent 70%);
    opacity: 0.6;
    animation-delay: 0s;
}

.blob-2 {
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, var(--magenta), transparent 70%);
    opacity: 0.5;
    animation-delay: -3s;
}

.blob-3 {
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, var(--lavender), transparent 70%);
    opacity: 0.4;
    animation-delay: -5s;
}

@keyframes blob-morph {
    0%, 100% { transform: translate(0, 0) scale(1); border-radius: 50%; }
    25% { transform: translate(20px, -15px) scale(1.1); border-radius: 40% 60% 50% 50%; }
    50% { transform: translate(-10px, 10px) scale(0.9); border-radius: 60% 40% 60% 40%; }
    75% { transform: translate(15px, 5px) scale(1.05); border-radius: 50% 50% 40% 60%; }
}

/* Terminal */
.terminal-output {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    line-height: 1.8;
    color: var(--cyan);
    height: 260px;
    overflow: hidden;
    opacity: 0.9;
}

.terminal-line {
    opacity: 0;
    animation: fade-in 0.3s forwards;
}

@keyframes fade-in {
    to { opacity: 1; }
}

/* Pixel grid */
.pixel-grid {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    gap: 2px;
    height: 260px;
}

.pixel-cell {
    background: var(--deep-blue);
    border-radius: 1px;
    transition: background 0.4s ease, box-shadow 0.4s ease;
}

.pixel-cell.active {
    background: var(--cyan);
    box-shadow: 0 0 4px var(--cyan);
}

.pixel-cell.magenta {
    background: var(--magenta);
    box-shadow: 0 0 4px var(--magenta);
}

/* Synthesis */
.synthesis-text {
    font-family: 'Libre Franklin', sans-serif;
    font-style: italic;
    font-weight: 300;
    font-size: 1.2rem;
    line-height: 1.8;
    max-width: 700px;
    color: var(--light-slate);
    margin-bottom: 24px;
}

/* Responsive */
@media (max-width: 768px) {
    .panel-hero, .panel-status, .panel-wave,
    .panel-wide, .panel-blob, .panel-terminal,
    .panel-grid-viz, .panel-full {
        grid-column: span 12;
    }

    .kpi-row, .final-kpis {
        gap: 16px;
        flex-wrap: wrap;
    }
}
