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

:root {
    --abyssal-navy: #0b1929;
    --midnight-ink: #122740;
    --bioluminescent-cyan: #5bc0be;
    --deep-teal: #0e4d64;
    --pale-seafoam: #c8dde4;
    --frost-white: #eaf4f4;
    --coral-alert: #e07a5f;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--abyssal-navy);
    color: var(--pale-seafoam);
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    line-height: 1.6;
    overflow-x: hidden;
}

/* === Opening Bento === */
#opening-bento {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--abyssal-navy);
    overflow: hidden;
}

#circuit-svg, #circuit-svg-content {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.circuit-trace {
    fill: none;
    stroke: var(--deep-teal);
    stroke-width: 1.5;
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    animation: trace-flow 8s linear infinite;
}

.circuit-trace:nth-child(2) { animation-delay: -1.5s; }
.circuit-trace:nth-child(3) { animation-delay: -3s; }
.circuit-trace:nth-child(4) { animation-delay: -4.5s; }
.circuit-trace:nth-child(5) { animation-delay: -6s; }
.circuit-trace:nth-child(6) { animation-delay: -7s; }

@keyframes trace-flow {
    0% { stroke-dashoffset: 800; }
    100% { stroke-dashoffset: -800; }
}

.circuit-node {
    fill: var(--bioluminescent-cyan);
    opacity: 0.4;
    animation: node-pulse 2.5s ease-in-out infinite;
}

.circuit-node:nth-child(7) { animation-delay: 0s; }
.circuit-node:nth-child(8) { animation-delay: 0.4s; }
.circuit-node:nth-child(9) { animation-delay: 0.8s; }
.circuit-node:nth-child(10) { animation-delay: 1.2s; }
.circuit-node:nth-child(11) { animation-delay: 1.6s; }
.circuit-node:nth-child(12) { animation-delay: 2.0s; }
.circuit-node:nth-child(13) { animation-delay: 0.3s; }
.circuit-node:nth-child(14) { animation-delay: 0.7s; }
.circuit-node:nth-child(15) { animation-delay: 1.1s; }
.circuit-node:nth-child(16) { animation-delay: 1.5s; }
.circuit-node:nth-child(17) { animation-delay: 1.9s; }
.circuit-node:nth-child(18) { animation-delay: 2.3s; }

@keyframes node-pulse {
    0%, 100% { transform-origin: center; r: 6; opacity: 0.4; }
    50% { r: 8; opacity: 1; }
}

.node-active {
    opacity: 1 !important;
    fill: var(--bioluminescent-cyan) !important;
    transition: opacity 0.3s ease, fill 0.3s ease;
}

#opening-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

#headline {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(3rem, 7vw, 5.5rem);
    color: var(--frost-white);
    letter-spacing: -0.03em;
    opacity: 0;
    transform: translateY(8px);
    animation: fade-up 800ms cubic-bezier(0.16, 1, 0.3, 1) 600ms forwards;
}

#tagline {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--pale-seafoam);
    margin-top: 1rem;
    opacity: 0;
    transform: translateY(8px);
    animation: fade-up 800ms cubic-bezier(0.16, 1, 0.3, 1) 1000ms forwards;
}

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

/* === Bit Counter === */
#bit-counter {
    position: absolute;
    top: 2rem;
    right: 2rem;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.875rem;
    color: var(--bioluminescent-cyan);
    opacity: 0;
    animation: fade-up 800ms cubic-bezier(0.16, 1, 0.3, 1) 1400ms forwards;
}

.counter-label {
    color: var(--pale-seafoam);
    opacity: 0.7;
}

#counter-value {
    font-variant-numeric: tabular-nums;
}

/* === Pulse Dot === */
.pulse-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--coral-alert);
    animation: pulse-ring 2s ease-out infinite;
    flex-shrink: 0;
}

@keyframes pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(224, 122, 95, 0.6); }
    70% { box-shadow: 0 0 0 12px rgba(224, 122, 95, 0); }
    100% { box-shadow: 0 0 0 0 rgba(224, 122, 95, 0); }
}

/* === Content Bento === */
#content-bento {
    position: relative;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: auto;
    gap: 1px;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.bento-cell {
    background-color: var(--midnight-ink);
    border: 1px solid var(--deep-teal);
    border-radius: 12px;
    padding: 2rem;
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 500ms ease-out, transform 500ms ease-out;
}

.bento-cell.visible {
    opacity: 1;
    transform: scale(1);
}

.cell-1 { grid-column: 1 / 7; }
.cell-2 { grid-column: 7 / 13; }
.cell-3 { grid-column: 1 / 5; min-height: 250px; }
.cell-4 { grid-column: 5 / 9; display: flex; flex-direction: column; gap: 0.75rem; align-items: flex-start; }
.cell-5 { grid-column: 9 / 13; }
.cell-6 { grid-column: 1 / 5; min-height: 250px; }
.cell-7 { grid-column: 5 / 8; display: flex; align-items: center; gap: 0.75rem; }
.cell-8 { grid-column: 8 / 13; }

.bento-cell h2 {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    color: var(--frost-white);
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

.bento-cell p {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--pale-seafoam);
}

/* === Photo Cells === */
.photo-cell {
    width: 100%;
    height: 100%;
    min-height: 200px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--midnight-ink) 0%, var(--deep-teal) 100%);
    filter: saturate(0.3) brightness(0.7) contrast(1.1);
    position: relative;
    box-shadow: inset 0 0 60px rgba(11, 25, 41, 0.8);
}

.photo-cell::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: var(--abyssal-navy);
    mix-blend-mode: luminosity;
    border-radius: 12px;
    opacity: 0.5;
}

/* === Compression Bar === */
.mono-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: var(--pale-seafoam);
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bar-container {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.bar-bg {
    flex: 1;
    height: 6px;
    background-color: var(--deep-teal);
    border-radius: 3px;
    overflow: hidden;
}

.bar-fg {
    height: 100%;
    width: 0%;
    background-color: var(--bioluminescent-cyan);
    border-radius: 3px;
    transition: width 2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bar-fg.animate {
    width: 72%;
}

.ratio-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.875rem;
    color: var(--bioluminescent-cyan);
    opacity: 0;
    transition: opacity 0.5s ease 2s;
}

.ratio-value.show {
    opacity: 1;
}

/* === Status === */
.status-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    color: var(--bioluminescent-cyan);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* === Responsive === */
@media (max-width: 768px) {
    #circuit-svg, #circuit-svg-content {
        display: none;
    }

    #content-bento {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1rem;
    }

    .cell-1, .cell-2, .cell-3, .cell-4, .cell-5, .cell-6, .cell-7, .cell-8 {
        grid-column: 1 / -1;
    }

    #bit-counter {
        top: 1rem;
        right: 1rem;
        font-size: 0.75rem;
    }
}
