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

:root {
    --abyss: #1a0e0a;
    --ember: #e8652a;
    --smolder: #c44b1a;
    --vapor-pink: #ff6b9d;
    --neon-orchid: #c850c0;
    --bone-ash: #f0e2d6;
    --warm-fog: #b8a090;
    --deep-rust: #3d1a08;
    --terminal-green: #4ade80;
    --gap: 4px;
}

html { scroll-behavior: smooth; }

body {
    background: var(--abyss);
    color: var(--bone-ash);
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* === AMBIENT BUBBLES === */
#ambient-bubbles {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 107, 157, 0.15), rgba(200, 80, 192, 0.06), transparent 70%);
    border: 1px solid rgba(232, 101, 42, 0.12);
    animation: rise linear infinite;
    will-change: transform;
}

@keyframes rise {
    from { transform: translateY(100vh) scale(0.8); opacity: 0; }
    15% { opacity: 0.7; }
    85% { opacity: 0.5; }
    to { transform: translateY(-120vh) scale(1.1); opacity: 0; }
}

/* === BENTO GRID === */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--gap);
    padding: var(--gap);
    min-height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
}

/* === CELL BASE === */
.bento-cell {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
    transition: opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    contain: layout style paint;
    overflow: hidden;
    position: relative;
}

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

/* === MONUMENT CELL === */
.monument-cell {
    grid-column: span 8;
    grid-row: span 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 400px;
}

.monument-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #e8652a, #c850c0, #ff6b9d, #e8652a);
    background-size: 300% 300%;
    animation: gradient-drift 20s ease infinite;
    opacity: 0.25;
}

@keyframes gradient-drift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.monument-bubbles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.wordmark {
    font-family: 'Bebas Neue', Impact, sans-serif;
    font-size: clamp(5rem, 14vw, 12rem);
    font-weight: 400;
    letter-spacing: 0.05em;
    color: var(--bone-ash);
    position: relative;
    z-index: 1;
    line-height: 1;
    text-align: center;
}

.wordmark-dot { color: var(--ember); }

.monument-sub {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--warm-fog);
    position: relative;
    z-index: 1;
    margin-top: 1rem;
}

/* === DATA CELL === */
.data-cell {
    grid-column: span 2;
    grid-row: span 1;
    background: var(--ember);
    color: var(--abyss);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    cursor: default;
    min-height: 120px;
}

.data-cell--accent {
    background: var(--deep-rust);
    color: var(--ember);
}

.data-cell--accent .data-numeral { color: var(--ember); }
.data-cell--accent .data-label { color: var(--warm-fog); }

.data-numeral {
    font-family: 'Bebas Neue', Impact, sans-serif;
    font-size: clamp(2.5rem, 5vw, 4rem);
    line-height: 1;
    color: var(--abyss);
}

.data-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    margin-top: 0.4rem;
    color: var(--deep-rust);
}

.data-cell:hover {
    animation: glitch 0.3s linear;
    background: var(--vapor-pink);
}

.data-cell--accent:hover {
    background: var(--smolder);
}

@keyframes glitch {
    0%, 100% { clip-path: inset(0 0 0 0); }
    20% { clip-path: inset(20% 0 60% 0); transform: translateX(-3px); }
    40% { clip-path: inset(50% 0 10% 0); transform: translateX(3px); }
    60% { clip-path: inset(10% 0 40% 0); transform: translateX(-2px); }
}

/* === AQUARIUM CELL === */
.aquarium-cell {
    grid-column: span 4;
    grid-row: span 2;
    background: radial-gradient(ellipse at 50% 80%, #2a1810, var(--abyss));
    position: relative;
    overflow: hidden;
    min-height: 200px;
}

.aquarium-cell--secondary {
    grid-column: span 3;
    grid-row: span 2;
}

/* === CIRCUIT CELL === */
.circuit-cell {
    grid-column: span 2;
    grid-row: span 1;
    background: var(--abyss);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    min-height: 80px;
}

.circuit-cell--tall {
    grid-row: span 2;
}

.circuit-cell svg {
    width: 100%;
    height: 100%;
}

.circuit-trace {
    stroke: var(--ember);
    stroke-width: 1.5;
    fill: none;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.5s ease;
}

.circuit-cell.visible .circuit-trace {
    stroke-dashoffset: 0;
}

.circuit-node {
    fill: var(--ember);
    opacity: 0.3;
    animation: node-pulse 3s ease-in-out infinite;
}

@keyframes node-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.circuit-cell:hover .circuit-trace {
    stroke: var(--vapor-pink);
}

/* === THESIS CELL === */
.thesis-cell {
    grid-column: span 5;
    grid-row: span 2;
    background: radial-gradient(ellipse at center, #2a1810, var(--abyss));
    padding: clamp(1.5rem, 3vw, 2.5rem);
    display: flex;
    align-items: center;
    border: 1px solid rgba(232, 101, 42, 0.08);
}

.thesis-cell--wide {
    grid-column: span 7;
}

.thesis-cell p {
    font-size: clamp(1.05rem, 1.6vw, 1.25rem);
    line-height: 1.7;
    color: var(--bone-ash);
}

.thesis-cell em {
    color: var(--vapor-pink);
    font-style: italic;
}

.thesis-cell:hover {
    border-image: linear-gradient(135deg, #ff6b9d, #c850c0, #e8652a) 1;
}

/* === QUOTE CELL === */
.quote-cell {
    grid-column: span 5;
    grid-row: span 1;
    padding: clamp(1.2rem, 2.5vw, 2rem);
    display: flex;
    align-items: center;
    border: 1px solid transparent;
    border-image: linear-gradient(135deg, #ff6b9d, #c850c0, #e8652a) 1;
    background: var(--abyss);
    min-height: 100px;
}

.quote-cell--final {
    grid-column: span 6;
}

.quote-cell blockquote {
    font-family: 'Crimson Pro', Georgia, serif;
    font-style: italic;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    line-height: 1.7;
    color: var(--warm-fog);
}

/* === TERMINAL CELL === */
.terminal-cell {
    grid-column: span 4;
    grid-row: span 2;
    background: #0d0705;
    border: 1px solid rgba(232, 101, 42, 0.15);
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.terminal-bar {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(61, 26, 8, 0.5);
}

.terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.terminal-code {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--ember);
    padding: 1rem;
    overflow: auto;
    flex: 1;
}

.t-keyword { color: var(--neon-orchid); }
.t-fn { color: var(--vapor-pink); }
.t-comment { color: var(--warm-fog); opacity: 0.6; }
.t-num { color: var(--terminal-green); }

.terminal-cell:hover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 50%, rgba(232, 101, 42, 0.03) 50%);
    background-size: 100% 4px;
    pointer-events: none;
    animation: scanline 4s linear infinite;
}

@keyframes scanline {
    from { transform: translateY(-100%); }
    to { transform: translateY(100%); }
}

/* === COLUMN CELL (Roman fragment) === */
.column-cell {
    grid-column: span 2;
    grid-row: span 2;
    background: var(--deep-rust);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
}

.column-fragment {
    width: 80px;
    height: 180%;
    background: repeating-linear-gradient(
        90deg,
        var(--warm-fog) 0px,
        var(--warm-fog) 6px,
        rgba(184, 160, 144, 0.3) 6px,
        rgba(184, 160, 144, 0.3) 8px,
        var(--bone-ash) 8px,
        var(--bone-ash) 14px,
        rgba(184, 160, 144, 0.3) 14px,
        rgba(184, 160, 144, 0.3) 16px
    );
    border-radius: 40px 40px 0 0;
    opacity: 0.3;
    transform: translateY(30%);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .monument-cell { grid-column: span 4; grid-row: span 2; min-height: 280px; }
    .thesis-cell, .thesis-cell--wide { grid-column: span 4; }
    .quote-cell, .quote-cell--final { grid-column: span 4; }
    .terminal-cell { grid-column: span 4; }
    .aquarium-cell, .aquarium-cell--secondary { grid-column: span 4; grid-row: span 1; min-height: 150px; }
    .data-cell { grid-column: span 2; }
    .circuit-cell, .circuit-cell--tall { grid-column: span 2; grid-row: span 1; }
    .column-cell { grid-column: span 2; }
}
