:root {
    /* Intersection observer narrative in Zone A has a corresponding data set for the three instrument cells. When each section reaches 50% visibility the strip updates. */
    --deep-basalt: #1a1916;
    --frosted-chrome: #2e2d2a;
    --oxidized-silver: #b8b0a4;
    --polished-nickel: #d4cec4;
    --bubble-iridescence: #7eb8c9;
    --fired-clay: #a67c52;
    --mica-shimmer: rgba(255, 248, 240, 0.09);
    --tarnished-brass: #3d3828;
    --slate-mineral: #2a3038;
    --body-chrome: #c8c0b8;
    --instrument-muted: #8a8278;
    --font-recursive: "Recursive", Inter, system-ui, sans-serif;
    --ease-morph: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html, body { width: 100%; height: 100%; }

body {
    font-family: var(--font-recursive);
    background: var(--deep-basalt);
    color: var(--body-chrome);
    overflow: hidden;
}

.substrate-layer {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(circle at 18% 22%, rgba(166, 124, 82, 0.18), transparent 28%),
        radial-gradient(ellipse at 78% 18%, rgba(42, 48, 56, 0.92), transparent 46%),
        radial-gradient(ellipse at 30% 82%, rgba(61, 56, 40, 0.88), transparent 44%),
        radial-gradient(circle at 70% 72%, rgba(126, 184, 201, 0.10), transparent 25%),
        linear-gradient(135deg, var(--deep-basalt) 0%, var(--tarnished-brass) 48%, var(--slate-mineral) 100%);
    background-size: 140% 140%, 130% 130%, 150% 150%, 110% 110%, 100% 100%;
    animation: substrateMorph 120s ease-in-out infinite;
}

.substrate-layer::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 248, 240, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 248, 240, 0.014) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(circle at center, black, transparent 78%);
}

@keyframes substrateMorph {
    0%, 100% { background-position: 0% 0%, 100% 20%, 10% 100%, 80% 80%, center; }
    50% { background-position: 80% 70%, 20% 60%, 90% 10%, 30% 20%, center; }
}

.bubble-field {
    position: fixed;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(126, 184, 201, 0.15), rgba(126, 184, 201, 0.03) 50%, transparent 70%);
    border: 1px solid rgba(255, 248, 240, 0.06);
    box-shadow: inset 0 0 20px rgba(126, 184, 201, 0.08), 0 0 40px rgba(126, 184, 201, 0.04), inset -10px -16px 30px rgba(212, 206, 196, 0.025);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    transform: translate3d(0, 0, 0);
}

.dashboard {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: grid;
    grid-template-areas: "primary instruments";
    grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr);
    gap: clamp(1rem, 2vw, 1.5rem);
    padding: clamp(1rem, 2.5vw, 2rem);
}

.glass-panel {
    background: rgba(46, 45, 42, 0.65);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    border: 1px solid var(--mica-shimmer);
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 248, 240, 0.05), inset 0 -1px 0 rgba(126, 184, 201, 0.035);
}

.primary-panel {
    grid-area: primary;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
}

.primary-panel::-webkit-scrollbar { width: 7px; }
.primary-panel::-webkit-scrollbar-track { background: transparent; }
.primary-panel::-webkit-scrollbar-thumb { background: rgba(184, 176, 164, 0.26); border-radius: 999px; }

.narrative-section {
    min-height: calc(100vh - clamp(2rem, 5vw, 4rem));
    scroll-snap-align: start;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: center;
    justify-items: center;
    padding: clamp(1.5rem, 4.2vw, 4.5rem);
    gap: clamp(1.75rem, 4vw, 3.5rem);
    opacity: 0.46;
    transform: scale(0.985);
    transition: opacity 0.8s var(--ease-morph), transform 0.8s var(--ease-morph), filter 0.8s var(--ease-morph);
    filter: blur(0.4px);
}

.narrative-section.active { opacity: 1; transform: scale(1); filter: blur(0); }

.section-copy { width: min(100%, 760px); }

.eyebrow, .annotation, .metric-label {
    font-variation-settings: "wght" 500, "CASL" 0, "MONO" 1;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--instrument-muted);
}

.eyebrow { font-size: 0.82rem; margin-bottom: 0.85rem; }

.heading-display {
    font-family: var(--font-recursive);
    font-size: clamp(2.4rem, 6vw, 5.5rem);
    font-variation-settings: "wght" 700, "CASL" 0.3, "MONO" 0;
    letter-spacing: -0.03em;
    line-height: 0.92;
    color: var(--oxidized-silver);
    text-shadow: 0 0 22px rgba(184, 176, 164, 0.08);
    transition: font-variation-settings 1.2s var(--ease-morph), color 1.2s var(--ease-morph);
}

.narrative-section:not(.active) .heading-display { font-variation-settings: "wght" 300, "CASL" 0, "MONO" 0; }
.heading-display:hover { font-variation-settings: "wght" 400, "CASL" 0, "MONO" 0; color: var(--polished-nickel); }

.body-text {
    margin-top: 1.35rem;
    max-width: 68ch;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    line-height: 1.65;
    color: var(--body-chrome);
    font-variation-settings: "wght" 400, "CASL" 0.15, "MONO" 0;
}

.annotation { font-size: 0.76rem; color: rgba(184, 176, 164, 0.62); }

.chrome-reflection {
    height: 1px;
    width: 100%;
    margin: 1.5rem 0;
    background: linear-gradient(90deg, transparent, rgba(184, 176, 164, 0.20), rgba(126, 184, 201, 0.16), transparent);
}

.polyhedron-container {
    position: relative;
    width: min(55vh, 420px, 86vw);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    perspective: 1000px;
}

.polyhedron-container::before {
    content: "";
    position: absolute;
    inset: 16%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(126, 184, 201, 0.10), transparent 66%);
    filter: blur(16px);
}

.polyhedron {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: visible;
    filter: drop-shadow(0 0 22px rgba(126, 184, 201, 0.22));
    animation: polyRotate 60s linear infinite;
}

.polyhedron-group { transform-origin: center; transition: transform 1.5s var(--ease-morph); animation: crystalBreath 6s ease-in-out infinite; }
.polyhedron-group.shifted { transform: rotateX(30deg) rotateZ(-20deg); }
.polyhedron-group.folded { transform: rotateY(45deg) rotateX(20deg); }

.facet { fill: rgba(126, 184, 201, 0.025); stroke: rgba(212, 206, 196, 0.05); stroke-width: 1; }
.edge { stroke: var(--bubble-iridescence); stroke-width: 1.5; opacity: 0.40; transition: opacity 0.6s ease-in-out; }
.vertex { fill: var(--bubble-iridescence); opacity: 0.65; transition: opacity 0.6s ease-in-out, r 0.6s ease-in-out; }
.active .edge { opacity: 0.72; }
.active .vertex { opacity: 1; }

@keyframes polyRotate { to { transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg); } }
@keyframes crystalBreath { 0%, 100% { scale: 0.985; } 50% { scale: 1.025; } }

.zone-b {
    grid-area: instruments;
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 2vw, 1.5rem);
    min-height: 0;
}

.instrument-cell { flex: 1 1 0; min-height: 30vh; opacity: 0.68; transition: opacity 0.8s var(--ease-morph), transform 0.8s var(--ease-morph); }
.instrument-cell.active { opacity: 1; transform: translateX(-4px); }

.instrument-panel {
    height: 100%;
    padding: clamp(1.5rem, 3vw, 3rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.85rem;
    position: relative;
    overflow: hidden;
}

.instrument-panel::after {
    content: "";
    position: absolute;
    inset: auto 8% 16% 8%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(166, 124, 82, 0.55), transparent);
}

.instrument-cell:nth-child(1) .instrument-panel { backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2); }
.instrument-cell:nth-child(2) .instrument-panel { backdrop-filter: blur(20px) saturate(1.2); -webkit-backdrop-filter: blur(20px) saturate(1.2); }
.instrument-cell:nth-child(3) .instrument-panel { backdrop-filter: blur(28px) saturate(1.2); -webkit-backdrop-filter: blur(28px) saturate(1.2); }

.metric-label { font-size: 0.85rem; }
.metric-value {
    color: var(--polished-nickel);
    font-size: clamp(2rem, 4vw, 3.6rem);
    line-height: 0.95;
    font-variation-settings: "wght" 700, "CASL" 0.3, "MONO" 0;
    letter-spacing: -0.045em;
}
.metric-description { color: rgba(200, 192, 184, 0.78); font-size: 0.95rem; line-height: 1.5; font-variation-settings: "wght" 400, "CASL" 0.15, "MONO" 0; }
.instrument-cell.is-swapping .metric-label, .instrument-cell.is-swapping .metric-value, .instrument-cell.is-swapping .metric-description { animation: materialize 0.65s var(--ease-morph); }
.narrative-section.active .section-copy { animation: materialize 0.8s var(--ease-morph); }

@keyframes materialize { from { opacity: 0; transform: scale(0.97) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }

@keyframes bubbleFloat1 { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(22px, -42px, 0); } }
@keyframes bubbleFloat2 { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(-28px, -52px, 0); } }
@keyframes bubbleFloat3 { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(34px, 28px, 0); } }
@keyframes bubbleFloat4 { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(-36px, 24px, 0); } }

@media (max-width: 900px) {
    body { overflow: auto; }
    .dashboard { position: relative; min-height: 100vh; grid-template-areas: "instruments" "primary"; grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .zone-b { flex-direction: row; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 0.25rem; }
    .instrument-cell { min-width: 280px; min-height: 150px; scroll-snap-align: start; }
    .primary-panel { height: auto; min-height: 70vh; }
    .narrative-section { min-height: 78vh; }
}

@media (max-width: 600px) {
    .dashboard { padding: 1rem; }
    .zone-b { flex-direction: column; overflow: visible; }
    .instrument-cell { min-width: 100%; min-height: 132px; }
    .narrative-section { padding: 1.4rem; }
    .polyhedron-container { width: min(74vw, 300px); }
}
