/* ============================================================
   completengine.net — Street-Style Computational
   Muted Vintage Palette | Bento-Box Grid | Water Bubbles
   ============================================================ */

:root {
    --bg-void: #121214;
    --bg-cell: #1a1a1e;
    --bg-elevated: #242428;
    --border-grid: #6b6b52;
    --text-body: #d1cbb8;
    --text-heading: #e8e0cc;
    --accent-gold: #c4a83a;
    --accent-teal: #5a8a7a;
    --accent-terra: #8b4a3a;
    --accent-bubble: #3a5a6b;
    --bg-warm: #1e1a18;
    --grid-gap: 6px;
    --cell-radius: 3px;
    --cell-padding: clamp(1.2rem, 3vw, 2.4rem);
    --ease-confident: cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

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

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

body {
    background-color: var(--bg-void);
    color: var(--text-body);
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.6vw, 1.1rem);
    line-height: 1.65;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    position: relative;
}

/* ---- NOISE TEXTURE OVERLAY ---- */
#noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 4 4' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='4' height='4' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 128px 128px;
}

/* ---- VERTICAL NAV STRIP ---- */
#nav-strip {
    position: fixed;
    left: 0;
    top: 0;
    width: 40px;
    height: 100vh;
    background: #1e1e22;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
}

.nav-label {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-teal);
    text-decoration: none;
    transition: color 0.3s var(--ease-confident);
    cursor: pointer;
}

.nav-label:hover {
    color: var(--accent-gold);
}

/* ---- TYPOGRAPHY ---- */
h1, h2, h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    color: var(--text-heading);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    line-height: 1.0;
}

h3 {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    margin-bottom: 0.5rem;
}

.callout {
    font-family: 'Permanent Marker', cursive;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    color: var(--accent-gold);
    display: block;
    transform: rotate(-2deg);
    margin-bottom: 0.5rem;
}

.code-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-teal);
    display: block;
    margin-bottom: 0.8rem;
}

/* ---- TITLE CARD ---- */
#title-card {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: var(--bg-cell);
    overflow: hidden;
    margin-left: 40px;
    width: calc(100% - 40px);
}

#title-text {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 2rem;
}

#main-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(3rem, 10vw, 8rem);
    letter-spacing: 0.15em;
    line-height: 1.0;
    text-transform: uppercase;
    background: linear-gradient(
        135deg,
        var(--accent-bubble) 0%,
        var(--accent-teal) 30%,
        var(--accent-gold) 60%,
        var(--accent-bubble) 100%
    );
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: causticShift 12s ease-in-out infinite;
}

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

#title-bubbles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
}

/* ---- TRANSITION ZONES ---- */
.transition-zone {
    width: calc(100% - 40px);
    margin-left: 40px;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-void);
    position: relative;
}

.chapter-title {
    font-family: 'Permanent Marker', cursive;
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: var(--accent-gold);
    animation: floatTitle 4s ease-in-out infinite;
    opacity: 0;
    transition: opacity 0.8s var(--ease-confident);
}

.chapter-title.visible {
    opacity: 1;
}

@keyframes floatTitle {
    0%, 100% { transform: translateY(-5px); }
    50% { transform: translateY(5px); }
}

/* ---- CHAMBERS ---- */
.chamber {
    width: calc(100% - 40px);
    margin-left: 40px;
    padding: 2rem clamp(1rem, 3vw, 3rem);
    position: relative;
}

/* ---- BENTO GRID BASE ---- */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--grid-gap);
    position: relative;
}

/* ---- BENTO CELL BASE ---- */
.bento-cell {
    background: var(--bg-cell);
    border: 2px solid var(--border-grid);
    border-radius: var(--cell-radius);
    padding: var(--cell-padding);
    position: relative;
    overflow: hidden;
    transition: background-color 0.3s var(--ease-confident);
}

.bento-cell:hover {
    background: var(--bg-elevated);
}

.cell-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.cell-content {
    position: relative;
    z-index: 1;
}

.cell-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* ---- REGISTRATION MARKS ---- */
.reg-mark {
    position: absolute;
    font-family: 'Space Mono', monospace;
    font-size: 0.6rem;
    color: var(--accent-teal);
    opacity: 0.6;
    pointer-events: none;
    z-index: 3;
}

.reg-mark.top-left { top: 4px; left: 6px; }
.reg-mark.top-right { top: 4px; right: 6px; }
.reg-mark.bottom-left { bottom: 4px; left: 6px; }
.reg-mark.bottom-right { bottom: 4px; right: 6px; }
.reg-mark.depth-reg-1 { top: 10%; left: 5%; }
.reg-mark.depth-reg-2 { top: 50%; right: 8%; }
.reg-mark.depth-reg-3 { bottom: 15%; left: 40%; }

/* ---- DRIP ELEMENTS ---- */
.drip {
    position: absolute;
    bottom: -20px;
    width: 2px;
    height: 30px;
    background: linear-gradient(to bottom, var(--accent-gold), transparent);
    z-index: 4;
    pointer-events: none;
}

.drip-1 { left: 30%; height: 25px; }
.drip-2 { right: 20%; height: 35px; }
.drip-3 { left: 60%; height: 20px; }
.drip-4 { right: 40%; height: 30px; }

/* ---- STENCIL LINES ---- */
.stencil-line {
    position: absolute;
    background: var(--border-grid);
    pointer-events: none;
}

.stencil-h-1 {
    top: 25%;
    left: -10px;
    width: calc(100% + 20px);
    height: 1px;
    opacity: 0.4;
}

.stencil-h-2 {
    top: 75%;
    left: -10px;
    width: calc(100% + 20px);
    height: 1px;
    opacity: 0.3;
}

.stencil-v-1 {
    left: 60%;
    top: -10px;
    width: 1px;
    height: calc(100% + 20px);
    opacity: 0.3;
}

/* ---- BUBBLE STYLING ---- */
.bubble {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(58, 90, 107, 0.4);
    background: radial-gradient(
        ellipse at 30% 20%,
        rgba(58, 90, 107, 0.15) 0%,
        rgba(58, 90, 107, 0.05) 50%,
        transparent 100%
    );
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    pointer-events: none;
    z-index: 2;
}

/* ---- RIPPLE EFFECT ---- */
.ripple {
    position: absolute;
    border-radius: 50%;
    border: 2px solid var(--accent-gold);
    pointer-events: none;
    z-index: 10;
    animation: rippleExpand 600ms var(--ease-confident) forwards;
}

@keyframes rippleExpand {
    0% {
        width: 0;
        height: 0;
        opacity: 0.4;
    }
    100% {
        width: 400px;
        height: 400px;
        opacity: 0;
    }
}

/* ============================================================
   CHAMBER 1: THE MANIFESTO — 2x3 Bento Grid
   ============================================================ */
.manifesto-grid {
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: auto auto;
}

.cell-manifesto-1 {
    grid-column: 1 / 8;
    grid-row: 1;
    min-height: 200px;
}

.cell-manifesto-2 {
    grid-column: 8 / 13;
    grid-row: 1 / 3;
    min-height: 200px;
}

.cell-manifesto-3 {
    grid-column: 1 / 4;
    grid-row: 2;
    min-height: 180px;
}

.cell-manifesto-4 {
    grid-column: 4 / 8;
    grid-row: 2;
    min-height: 180px;
}

.cell-manifesto-5 {
    grid-column: 1 / 7;
    grid-row: 3;
    min-height: 180px;
}

.cell-manifesto-6 {
    grid-column: 7 / 13;
    grid-row: 3;
    min-height: 180px;
}

/* ============================================================
   CHAMBER 2: THE MECHANISM — 3x2 Bento Grid
   ============================================================ */
.mechanism-grid {
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: auto auto auto;
}

.cell-mechanism-main {
    grid-column: 1 / 8;
    grid-row: 1 / 3;
    min-height: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cell-mechanism-main .cell-content {
    width: 100%;
    display: flex;
    justify-content: center;
}

#engine-schematic {
    width: 100%;
    max-width: 500px;
    height: auto;
}

.schema-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 8s var(--ease-confident);
}

.schema-line.animate {
    stroke-dashoffset: 0;
}

.cell-mechanism-desc-1 {
    grid-column: 8 / 13;
    grid-row: 1;
    min-height: 180px;
}

.cell-mechanism-desc-2 {
    grid-column: 8 / 13;
    grid-row: 2;
    min-height: 180px;
}

.cell-mechanism-desc-3 {
    grid-column: 1 / 7;
    grid-row: 3;
    min-height: 160px;
}

.cell-mechanism-desc-4 {
    grid-column: 7 / 13;
    grid-row: 3;
    min-height: 160px;
}

/* ============================================================
   CHAMBER 3: THE FLOW — 4x3 Mosaic Grid
   ============================================================ */
.flow-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

.flow-cell {
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.flow-cell[data-shade="1"] { background: #1a1a1e; }
.flow-cell[data-shade="2"] { background: #1e1e22; }
.flow-cell[data-shade="3"] { background: #202024; }
.flow-cell[data-shade="4"] { background: #242428; }

.flow-word {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--text-heading);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    line-height: 1;
}

/* ============================================================
   CHAMBER 4: THE DEPTH — Full-Width Layered
   ============================================================ */
.depth-grid {
    grid-template-columns: 1fr;
}

.cell-depth-full {
    grid-column: 1 / -1;
    min-height: 80vh;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.depth-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.depth-layer-1 { z-index: 0; }
.depth-layer-2 { z-index: 1; }
.depth-layer-3 {
    z-index: 2;
    padding: var(--cell-padding);
    padding-left: clamp(2rem, 8vw, 8rem);
    padding-right: clamp(2rem, 8vw, 8rem);
    flex-direction: column;
    gap: 1.5rem;
}
.depth-layer-4 { z-index: 3; pointer-events: none; }
.depth-layer-5 { z-index: 4; pointer-events: none; }

.caustic-pattern {
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(58, 90, 107, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 60%, rgba(58, 90, 107, 0.04) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 80%, rgba(58, 90, 107, 0.05) 0%, transparent 45%);
    animation: causticDrift 15s linear infinite;
}

.caustic-pattern-2 {
    animation: causticDrift2 20s linear infinite;
    opacity: 0.7;
}

@keyframes causticDrift {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-5%, -3%) rotate(5deg); }
}

@keyframes causticDrift2 {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(3%, -5%) rotate(-3deg); }
}

.depth-large-text {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(6rem, 18vw, 16rem);
    color: var(--text-heading);
    opacity: 0.08;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    pointer-events: none;
    user-select: none;
}

.depth-layer-3 p {
    max-width: 700px;
    text-align: center;
    color: var(--text-body);
}

/* ============================================================
   CHAMBER 5: THE NETWORK — Grid with SVG Connections
   ============================================================ */
.network-grid {
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: auto auto auto;
    position: relative;
}

.network-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
}

.network-svg line {
    stroke: var(--accent-teal);
    stroke-width: 1;
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    opacity: 0.5;
}

.network-svg line.animate {
    transition: stroke-dashoffset 1s var(--ease-confident);
    stroke-dashoffset: 0;
}

.cell-network-1 {
    grid-column: 1 / 5;
    grid-row: 1;
    min-height: 180px;
}

.cell-network-2 {
    grid-column: 5 / 9;
    grid-row: 1;
    min-height: 180px;
}

.cell-network-3 {
    grid-column: 9 / 13;
    grid-row: 1;
    min-height: 180px;
}

.cell-network-4 {
    grid-column: 1 / 5;
    grid-row: 2;
    min-height: 180px;
}

.cell-network-5 {
    grid-column: 5 / 9;
    grid-row: 2;
    min-height: 180px;
}

.cell-network-6 {
    grid-column: 9 / 13;
    grid-row: 2;
    min-height: 180px;
}

/* ============================================================
   CHAMBER 6: THE SIGNAL — Full-Width Fade
   ============================================================ */
.signal-grid {
    grid-template-columns: 1fr;
}

.cell-signal {
    grid-column: 1 / -1;
    min-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.signal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    z-index: 1;
}

.signal-text {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    line-height: 1.0;
    color: var(--text-heading);
}

.signal-opacity-100 { opacity: 1; }
.signal-opacity-60 { opacity: 0.6; }
.signal-opacity-30 { opacity: 0.3; }
.signal-opacity-10 { opacity: 0.1; }

.bubble-dense .bubble {
    border-color: rgba(58, 90, 107, 0.5);
}

/* ---- NARRATIVE STRIP (Row 4 extension for manifesto) ---- */
/* Horizontal text scroll can be applied to any full-width cell */

/* ============================================================
   MOBILE RESPONSIVE (below 768px)
   ============================================================ */
@media (max-width: 768px) {
    #nav-strip {
        width: 30px;
    }

    #nav-strip .nav-label {
        font-size: 0.55rem;
    }

    #title-card,
    .transition-zone,
    .chamber {
        margin-left: 30px;
        width: calc(100% - 30px);
    }

    .bento-grid,
    .manifesto-grid,
    .mechanism-grid,
    .flow-grid,
    .network-grid {
        grid-template-columns: 1fr;
    }

    .bento-cell,
    .cell-manifesto-1,
    .cell-manifesto-2,
    .cell-manifesto-3,
    .cell-manifesto-4,
    .cell-manifesto-5,
    .cell-manifesto-6,
    .cell-mechanism-main,
    .cell-mechanism-desc-1,
    .cell-mechanism-desc-2,
    .cell-mechanism-desc-3,
    .cell-mechanism-desc-4,
    .cell-network-1,
    .cell-network-2,
    .cell-network-3,
    .cell-network-4,
    .cell-network-5,
    .cell-network-6 {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    /* Alternating width for street-poster aesthetic */
    .bento-cell:nth-child(odd) {
        width: 100%;
    }

    .bento-cell:nth-child(even) {
        width: 90%;
        margin-left: auto;
    }

    .flow-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .flow-cell {
        min-height: 100px;
    }

    .depth-large-text {
        font-size: clamp(4rem, 15vw, 8rem);
    }

    .signal-text {
        font-size: clamp(2rem, 8vw, 4rem);
    }
}

@media (max-width: 480px) {
    .flow-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    #main-title {
        font-size: clamp(2.5rem, 12vw, 5rem);
    }

    .chapter-title {
        font-size: clamp(1.4rem, 5vw, 2rem);
    }
}
