/* =============================================
   bada.moe — Muted Pop-Art Futures
   Diagonal Broadcast Transmission
   ============================================= */

/* --- CSS Custom Properties --- */
:root {
    --midnight-indigo: #1a1a2e;
    --parchment-cream: #f0e6d3;
    --signal-red: #e63946;
    --dusty-cerulean: #457b9d;
    --faded-saffron: #e9c46a;
    --twilight-mauve: #6b6b8d;
    --deep-charcoal: #3d3d5c;
    --warm-smoke: #2a2a3e;

    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Source Serif 4', 'Source Serif Pro', Georgia, serif;
    --font-accent: 'Space Grotesk', 'Arial', sans-serif;

    --wave-amp: 20;
    --scroll-progress: 0;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: var(--midnight-indigo);
    color: var(--deep-charcoal);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    line-height: 1.72;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Navigation Beacon --- */
.nav-beacon {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1000;
}

.beacon-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--warm-smoke);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    animation: beaconPulse 0.8s ease-in-out infinite alternate;
    transition: transform 0.3s ease;
    border: 2px solid var(--signal-red);
}

.beacon-icon:hover {
    transform: scale(1.15);
}

.beacon-icon svg {
    display: block;
}

.beacon-wave {
    animation: beaconWaveAnim 2s ease-in-out infinite;
}

@keyframes beaconPulse {
    0% { box-shadow: 0 0 0 0 rgba(230, 57, 70, 0.4); }
    100% { box-shadow: 0 0 0 10px rgba(230, 57, 70, 0); }
}

@keyframes beaconWaveAnim {
    0%, 100% { d: path("M5,20 Q10,10 15,20 Q20,30 25,20 Q30,10 35,20"); }
    50% { d: path("M5,20 Q10,28 15,20 Q20,12 25,20 Q30,28 35,20"); }
}

.beacon-menu {
    position: absolute;
    top: 60px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.nav-beacon:hover .beacon-menu,
.nav-beacon.active .beacon-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.beacon-link {
    font-family: var(--font-accent);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--parchment-cream);
    text-decoration: none;
    background: var(--warm-smoke);
    padding: 0.5rem 1rem;
    border-radius: 2px;
    white-space: nowrap;
    border-left: 2px solid var(--signal-red);
    transition: background 0.2s ease, color 0.2s ease;
}

.beacon-link:hover {
    background: var(--signal-red);
    color: var(--parchment-cream);
}

/* --- Grid System --- */
.grid-container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2.4rem;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2.4rem;
    position: relative;
    z-index: 2;
}

/* --- Diagonal Sections --- */
.diagonal-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.section-content {
    width: 100%;
    position: relative;
}

/* --- Section 1: Opening Transmission --- */
.section-1 {
    background: var(--midnight-indigo);
    clip-path: polygon(0 0, 100% 0, 100% 88%, 0 100%);
    z-index: 5;
    padding: 6rem 0 10rem;
}

.hero-text {
    grid-column: 1 / 6;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.hero-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(3.2rem, 9vw, 8rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--parchment-cream);
    -webkit-text-stroke: 2px var(--signal-red);
    text-stroke: 2px var(--signal-red);
    paint-order: stroke fill;
    line-height: 1;
    margin-bottom: 1.5rem;
}

.hero-tagline {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    line-height: 1.72;
    color: var(--d4c5b0);
    color: #d4c5b0;
    max-width: 38ch;
}

.hero-waveform {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 65%;
    height: 300px;
    z-index: 1;
    opacity: 0.6;
}

.waveform-path {
    stroke-dasharray: 3200;
    stroke-dashoffset: 3200;
}

.waveform-path.animate {
    animation: drawWaveform 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes drawWaveform {
    to { stroke-dashoffset: 0; }
}

/* --- Section 2: Signal Lock --- */
.section-2 {
    background: var(--parchment-cream);
    clip-path: polygon(0 8%, 100% 0, 100% 92%, 0 100%);
    margin-top: -10vh;
    z-index: 4;
    padding: 10rem 0;
}

.halftone-overlay {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, var(--deep-charcoal) 1px, transparent 1px);
    background-size: 8px 8px;
    opacity: 0.1;
    pointer-events: none;
    z-index: 0;
}

.signal-illustration {
    grid-column: 1 / 6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vector-art {
    width: 100%;
    max-height: 50vh;
}

.art-shape {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.section-2.in-view .art-shape-1 { opacity: 1; transform: translateY(0); transition-delay: 0ms; }
.section-2.in-view .art-shape-2 { opacity: 1; transform: translateY(0); transition-delay: 100ms; }
.section-2.in-view .art-shape-3 { opacity: 1; transform: translateY(0); transition-delay: 200ms; }
.section-2.in-view .art-shape-4 { opacity: 1; transform: translateY(0); transition-delay: 300ms; }
.section-2.in-view .art-shape-5 { opacity: 1; transform: translateY(0); transition-delay: 400ms; }
.section-2.in-view .art-shape-6 { opacity: 1; transform: translateY(0); transition-delay: 500ms; }
.section-2.in-view .art-shape-7 { opacity: 1; transform: translateY(0); transition-delay: 600ms; }
.section-2.in-view .art-shape-8 { opacity: 1; transform: translateY(0); transition-delay: 700ms; }
.section-2.in-view .art-shape-9 { opacity: 1; transform: translateY(0); transition-delay: 800ms; }
.section-2.in-view .art-shape-10 { opacity: 1; transform: translateY(0); transition-delay: 900ms; }
.section-2.in-view .art-shape-11 { opacity: 1; transform: translateY(0); transition-delay: 1000ms; }
.section-2.in-view .art-shape-12 { opacity: 1; transform: translateY(0); transition-delay: 1100ms; }

.signal-text {
    grid-column: 7 / 12;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.5rem;
}

/* --- Section Headings --- */
.section-heading {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.1;
    position: relative;
    display: inline-block;
}

.section-2 .section-heading {
    color: var(--midnight-indigo);
}

.section-3 .section-heading {
    color: var(--parchment-cream);
    -webkit-text-stroke: 2px var(--signal-red);
    text-stroke: 2px var(--signal-red);
    paint-order: stroke fill;
}

.heading-text {
    display: block;
}

/* --- Wavy Underline Draw --- */
.wavy-underline {
    display: block;
    width: 100%;
    height: 12px;
    margin-top: 0.3rem;
}

.underline-path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.underline-draw-trigger.drawn .underline-path {
    stroke-dashoffset: 0;
}

/* --- Section Body Text --- */
.section-body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    line-height: 1.72;
    max-width: 38ch;
    color: var(--deep-charcoal);
}

.section-body.light-text {
    color: #d4c5b0;
}

/* --- Section 3: Frequency Scan --- */
.section-3 {
    background: var(--warm-smoke);
    clip-path: polygon(0 0, 100% 10%, 100% 90%, 0 100%);
    margin-top: -10vh;
    z-index: 3;
    padding: 10rem 0;
}

.frequency-text {
    grid-column: 1 / 6;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.2rem;
}

.micro-waveform {
    width: 150px;
    height: 20px;
}

.micro-wave-path {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.section-3.in-view .micro-wave-path {
    stroke-dashoffset: 0;
}

.frequency-waves {
    grid-column: 7 / 13;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.wave-viz {
    width: 100%;
    height: 80vh;
}

/* Oscillating wave animations */
.oscillating-wave {
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    animation-direction: alternate;
}

.wave-1 {
    animation-name: oscillateWave1;
    animation-duration: 10s;
}

.wave-2 {
    animation-name: oscillateWave2;
    animation-duration: 8s;
}

.wave-3 {
    animation-name: oscillateWave3;
    animation-duration: 12s;
}

@keyframes oscillateWave1 {
    0% { d: path("M0,200 Q62.5,100 125,200 Q187.5,300 250,200 Q312.5,100 375,200 Q437.5,300 500,200"); }
    50% { d: path("M0,200 Q62.5,140 125,200 Q187.5,260 250,200 Q312.5,140 375,200 Q437.5,260 500,200"); }
    100% { d: path("M0,200 Q62.5,60 125,200 Q187.5,340 250,200 Q312.5,60 375,200 Q437.5,340 500,200"); }
}

@keyframes oscillateWave2 {
    0% { d: path("M0,300 Q62.5,230 125,300 Q187.5,370 250,300 Q312.5,230 375,300 Q437.5,370 500,300"); }
    50% { d: path("M0,300 Q62.5,260 125,300 Q187.5,340 250,300 Q312.5,260 375,300 Q437.5,340 500,300"); }
    100% { d: path("M0,300 Q62.5,190 125,300 Q187.5,410 250,300 Q312.5,190 375,300 Q437.5,410 500,300"); }
}

@keyframes oscillateWave3 {
    0% { d: path("M0,400 Q62.5,350 125,400 Q187.5,450 250,400 Q312.5,350 375,400 Q437.5,450 500,400"); }
    50% { d: path("M0,400 Q62.5,370 125,400 Q187.5,430 250,400 Q312.5,370 375,400 Q437.5,430 500,400"); }
    100% { d: path("M0,400 Q62.5,300 125,400 Q187.5,500 250,400 Q312.5,300 375,400 Q437.5,500 500,400"); }
}

/* --- Section 4: Interstitial Letterbox --- */
.letterbox-section {
    background: var(--parchment-cream);
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -6vh;
    z-index: 2;
    position: relative;
    padding: 4rem 2.4rem;
}

.letterbox-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    width: 100%;
    max-width: 1000px;
}

.letterbox-line {
    width: 100%;
    height: 2px;
}

.draw-line {
    transition: x1 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), x2 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.letterbox-section.in-view .line-top .draw-line {
    x1: 0;
    x2: 1200;
}

.letterbox-section.in-view .line-bottom .draw-line {
    x1: 0;
    x2: 1200;
}

.letterbox-statement {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--midnight-indigo);
    text-align: center;
    line-height: 1.3;
    max-width: 20ch;
}

.letterbox-statement mark {
    background: rgba(233, 196, 106, 0.2);
    color: var(--midnight-indigo);
    padding: 0.1em 0.3em;
    border-radius: 2px;
}

/* --- Section 5: Resonance Close --- */
.section-5 {
    background: var(--midnight-indigo);
    clip-path: polygon(0 15%, 100% 0, 100% 100%, 0 100%);
    margin-top: -10vh;
    z-index: 1;
    padding: 14rem 0 6rem;
    min-height: 100vh;
}

.resonance-waves {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Resonance wave animations */
.res-wave-1 { animation: resOscillate1 6s ease-in-out infinite alternate; }
.res-wave-2 { animation: resOscillate2 8s ease-in-out infinite alternate; }
.res-wave-3 { animation: resOscillate3 10s ease-in-out infinite alternate; }
.res-wave-4 { animation: resOscillate4 12s ease-in-out infinite alternate; }
.res-wave-5 { animation: resOscillate5 14s ease-in-out infinite alternate; }

@keyframes resOscillate1 {
    0% { d: path("M0,300 Q75,150 150,300 Q225,450 300,300 Q375,150 450,300 Q525,450 600,300 Q675,150 750,300 Q825,450 900,300 Q975,150 1050,300 Q1125,450 1200,300"); }
    100% { d: path("M0,300 Q75,200 150,300 Q225,400 300,300 Q375,200 450,300 Q525,400 600,300 Q675,200 750,300 Q825,400 900,300 Q975,200 1050,300 Q1125,400 1200,300"); }
}

@keyframes resOscillate2 {
    0% { d: path("M0,280 Q100,180 200,280 Q300,380 400,280 Q500,180 600,280 Q700,380 800,280 Q900,180 1000,280 Q1100,380 1200,280"); }
    100% { d: path("M0,280 Q100,220 200,280 Q300,340 400,280 Q500,220 600,280 Q700,340 800,280 Q900,220 1000,280 Q1100,340 1200,280"); }
}

@keyframes resOscillate3 {
    0% { d: path("M0,320 Q60,220 120,320 Q180,420 240,320 Q300,220 360,320 Q420,420 480,320 Q540,220 600,320 Q660,420 720,320 Q780,220 840,320 Q900,420 960,320 Q1020,220 1080,320 Q1140,420 1200,320"); }
    100% { d: path("M0,320 Q60,270 120,320 Q180,370 240,320 Q300,270 360,320 Q420,370 480,320 Q540,270 600,320 Q660,370 720,320 Q780,270 840,320 Q900,370 960,320 Q1020,270 1080,320 Q1140,370 1200,320"); }
}

@keyframes resOscillate4 {
    0% { d: path("M0,250 Q150,100 300,250 Q450,400 600,250 Q750,100 900,250 Q1050,400 1200,250"); }
    100% { d: path("M0,250 Q150,180 300,250 Q450,320 600,250 Q750,180 900,250 Q1050,320 1200,250"); }
}

@keyframes resOscillate5 {
    0% { d: path("M0,350 Q120,250 240,350 Q360,450 480,350 Q600,250 720,350 Q840,450 960,350 Q1080,250 1200,350"); }
    100% { d: path("M0,350 Q120,300 240,350 Q360,400 480,350 Q600,300 720,350 Q840,400 960,350 Q1080,300 1200,350"); }
}

.resonance-text {
    grid-column: 4 / 10;
    text-align: center;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
}

.resonance-text .section-body {
    max-width: 45ch;
}

.closing-signature {
    font-family: var(--font-accent);
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--signal-red);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 0 1.5rem;
    }

    .hero-text {
        grid-column: 1 / -1;
    }

    .signal-illustration {
        grid-column: 1 / -1;
        order: 2;
    }

    .signal-text {
        grid-column: 1 / -1;
        order: 1;
    }

    .frequency-text {
        grid-column: 1 / -1;
    }

    .frequency-waves {
        grid-column: 1 / -1;
        min-height: 40vh;
    }

    .resonance-text {
        grid-column: 1 / -1;
    }

    .hero-waveform {
        width: 90%;
        opacity: 0.3;
    }

    .section-1 {
        padding: 4rem 0 8rem;
    }

    .section-2,
    .section-3 {
        padding: 8rem 0;
    }

    .section-5 {
        padding: 10rem 0 4rem;
    }

    .vector-art {
        max-height: 35vh;
    }

    .nav-beacon {
        top: 1rem;
        right: 1rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        -webkit-text-stroke: 1px var(--signal-red);
        text-stroke: 1px var(--signal-red);
    }

    .section-heading {
        font-size: clamp(2rem, 8vw, 3rem);
    }

    .letterbox-statement {
        font-size: clamp(1.5rem, 6vw, 2.5rem);
    }
}
