/* =============================================
   MONOPOLE.BAR - Retro-Futurist Physics Speakeasy
   ============================================= */

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

/* CSS Variables */
:root {
    --deep-navy: #0a0f1a;
    --instrument-dark: #1a2744;
    --cream: #f4ede0;
    --parchment: #e8dfd0;
    --copper: #b87333;
    --phosphor: #7ec8a0;
    --charcoal: #3a3024;
    --faded-trace: #a8c4d8;
    --warm-gray: #c8bfb0;
    --bezel: #2a3f5f;
    --grid-gap: 12px;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--deep-navy);
    color: var(--cream);
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    line-height: 1.65;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* =============================================
   BUBBLE TEXTURE OVERLAY
   ============================================= */
.bubble-texture {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(168,196,216,0.15) 1px, transparent 1px);
    background-size: 8px 8px;
    pointer-events: none;
    z-index: 1;
}

/* =============================================
   GRAIN OVERLAY
   ============================================= */
.grain-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    opacity: 0.05;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    background-size: 200px 200px;
}
.grain-overlay.heavy {
    opacity: 0.08;
}

/* =============================================
   FLOATING BUBBLES
   ============================================= */
.floating-bubbles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 3;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: rgba(168,196,216,0.08);
    border: 1px solid rgba(168,196,216,0.15);
    animation: bubble-drift linear infinite;
}

@keyframes bubble-drift {
    0% { transform: translateY(100vh) translateX(0); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-100vh) translateX(40px); opacity: 0; }
}

/* =============================================
   HERO SECTION
   ============================================= */
#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--deep-navy);
    overflow: hidden;
}

.hero-spiral {
    position: absolute;
    width: 60vmin;
    height: 60vmin;
    z-index: 4;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.hero-spiral.visible {
    opacity: 1;
}

#spiral-path {
    stroke-dasharray: 3000;
    stroke-dashoffset: 3000;
    transition: stroke-dashoffset 3s ease-out;
}

#spiral-path.animate {
    stroke-dashoffset: 0;
}

.hero-content {
    position: relative;
    z-index: 5;
    text-align: center;
    opacity: 0;
}

.hero-content.visible {
    opacity: 1;
}

.hero-title {
    font-size: clamp(5rem, 12vw, 12rem);
    color: var(--cream);
    letter-spacing: 0.12em;
    line-height: 0.9;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.hero-title.visible {
    opacity: 1;
    transform: translateY(0);
}

.hero-subtitle {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--copper);
    letter-spacing: 0.12em;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.hero-subtitle.visible {
    opacity: 1;
    transform: translateY(0);
}

.hero-tagline {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.9rem;
    color: var(--faded-trace);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-top: 2rem;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.hero-tagline.visible {
    opacity: 1;
}

/* Monopole field decorations */
.monopole-field-divider {
    width: 60px;
    height: 60px;
    margin: 0 auto 2rem;
    position: relative;
}

.monopole-field-divider::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, var(--copper) 2px, transparent 2px);
}

/* =============================================
   GRID SECTION
   ============================================= */
.grid-section {
    padding: clamp(1rem, 3vw, 3rem) clamp(1rem, 3vw, 3rem);
}

.instrument-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--grid-gap);
    max-width: 1400px;
    margin: 0 auto;
}

/* =============================================
   BLOCK BASE
   ============================================= */
.block {
    position: relative;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.block:hover {
    transform: scale(1.02);
}

/* =============================================
   READOUT BLOCKS
   ============================================= */
.readout-block {
    grid-column: span 2;
    background: var(--deep-navy);
    border: 1px solid var(--bezel);
    border-top: 4px solid var(--copper);
    padding: clamp(1.5rem, 3vw, 2.5rem) clamp(1rem, 2vw, 2rem);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 180px;
    opacity: 0;
    transform: translateY(30px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.6s ease, box-shadow 0.5s ease;
}

.readout-block.revealed {
    opacity: 1;
    transform: translateY(0);
}

.readout-block:hover {
    box-shadow: 0 0 12px rgba(126, 200, 160, 0.3);
    transform: scale(1.02);
}

.readout-value {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(2rem, 5vw, 5rem);
    color: var(--phosphor);
    line-height: 1.1;
}

.readout-value.small {
    font-size: clamp(1.5rem, 3.5vw, 3.5rem);
}

.readout-value sup {
    font-size: 0.55em;
}

.readout-label {
    font-family: 'Source Sans 3', sans-serif;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    color: var(--faded-trace);
    margin-top: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* =============================================
   NARRATIVE BLOCKS
   ============================================= */
.narrative-block {
    background: var(--cream);
    padding: clamp(2rem, 4vw, 4rem);
    color: var(--charcoal);
    position: relative;
    opacity: 0;
    clip-path: inset(0 100% 0 0);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), clip-path 0.8s ease, opacity 0.8s ease;
}

.narrative-block.revealed {
    opacity: 1;
    clip-path: inset(0 0 0 0);
}

.narrative-block:hover .copper-bar {
    width: 40%;
}

.copper-bar {
    width: 20%;
    height: 4px;
    background: var(--copper);
    margin-bottom: 1.5rem;
    transition: width 0.4s ease;
    min-width: 60px;
}

.block-title {
    font-size: clamp(1.5rem, 3vw, 3rem);
    color: var(--deep-navy);
    margin-bottom: 1rem;
    letter-spacing: 0.08em;
}

.narrative-block p {
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    line-height: 1.65;
    margin-bottom: 1rem;
    color: var(--charcoal);
}

.narrative-block p:last-child {
    margin-bottom: 0;
}

/* Span classes */
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }
.span-2-tall {
    grid-column: span 2;
    grid-row: span 2;
}

/* =============================================
   VIEWPORT BLOCKS (Interludes)
   ============================================= */
.viewport-block {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--deep-navy);
    overflow: hidden;
}

.interlude .chamber-trails,
.finale .chamber-trails {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
}

.interlude-text, .finale-content {
    position: relative;
    z-index: 5;
    text-align: center;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.interlude-text.revealed, .finale-content.revealed {
    opacity: 1;
}

.interlude-text h2, .finale-title {
    font-size: clamp(3rem, 8vw, 8rem);
    color: var(--cream);
    letter-spacing: 0.08em;
}

.interlude-sub {
    font-family: 'Source Sans 3', sans-serif;
    font-size: clamp(0.9rem, 1.5vw, 1.2rem);
    color: var(--faded-trace);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-top: 1rem;
}

/* =============================================
   CABRERA SECTION
   ============================================= */
.cabrera-section {
    flex-direction: column;
}

.cabrera-content {
    position: relative;
    z-index: 5;
    width: 100%;
    max-width: 900px;
    padding: clamp(2rem, 4vw, 4rem);
}

.cabrera-title {
    font-size: clamp(2.5rem, 6vw, 6rem);
    color: var(--cream);
    letter-spacing: 0.08em;
    text-align: center;
    margin-bottom: 2rem;
    opacity: 0;
    transition: opacity 1s ease;
}

.cabrera-title.revealed {
    opacity: 1;
}

.cabrera-graph-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 2rem;
    opacity: 0;
    transition: opacity 1s ease 0.3s;
}

.cabrera-graph-container.revealed {
    opacity: 1;
}

.cabrera-graph {
    width: 100%;
    height: auto;
}

#cabrera-line {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 2.5s ease-in-out;
}

#cabrera-line.animate {
    stroke-dashoffset: 0;
}

.cabrera-narrative {
    max-width: 700px;
    margin: 0 auto;
    opacity: 0;
    transition: opacity 1s ease;
}

.cabrera-narrative.revealed {
    opacity: 1;
}

.cabrera-text {
    font-family: 'Source Sans 3', sans-serif;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    color: var(--cream);
    line-height: 1.75;
    text-align: center;
}

/* =============================================
   FINALE SECTION
   ============================================= */
.finale-content {
    max-width: 700px;
    padding: 2rem;
}

.finale-title {
    font-size: clamp(3rem, 8vw, 7rem);
    margin-bottom: 1.5rem;
}

.finale-text {
    font-family: 'Source Sans 3', sans-serif;
    font-size: clamp(0.95rem, 1.3vw, 1.15rem);
    color: var(--faded-trace);
    line-height: 1.75;
    margin-bottom: 2rem;
}

.finale-data {
    text-align: center;
}

.finale-readout {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--phosphor);
    letter-spacing: 0.05em;
}

/* =============================================
   FOOTER
   ============================================= */
.site-footer {
    background: var(--deep-navy);
    border-top: 1px solid var(--bezel);
    padding: 2rem;
}

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-mark {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.2rem;
    color: var(--cream);
    letter-spacing: 0.12em;
}

.footer-note {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.85rem;
    color: var(--warm-gray);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* =============================================
   RESPONSIVE: TABLET
   ============================================= */
@media (max-width: 1199px) and (min-width: 768px) {
    :root { --grid-gap: 8px; }
    .instrument-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .readout-block { grid-column: span 2; }
    .span-3, .span-4, .span-6 { grid-column: span 4; }
    .span-2-tall { grid-column: span 2; grid-row: span 1; }
}

/* =============================================
   RESPONSIVE: MOBILE
   ============================================= */
@media (max-width: 767px) {
    .instrument-grid {
        grid-template-columns: 1fr 1fr;
    }
    .readout-block { grid-column: span 1; min-height: 140px; }
    .span-2, .span-3, .span-4, .span-6, .narrative-block, .span-2-tall {
        grid-column: span 2;
        grid-row: span 1;
    }
    .footer-inner {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}
