/* ============================================================
   GlobalToneCheck.com — Spectral Frequency Visualizer
   ============================================================ */

/* --- Custom Properties (Design Palette) --- */
:root {
    --midnight-console: #0B1621;
    --studio-panel: #132B3A;
    --depth-layer: #1A3D50;
    --frost-white: #E8F0F2;
    --silver-mist: #A8B8C0;
    --bright-mist: #D4E0E6;
    --spectrometer-teal: #4AEDC4;
    --warm-amber-vu: #F2A154;
    --signal-hot: #E85A6F;
    --deep-void: #0D1F2D;

    --glass-bg: rgba(26, 61, 80, 0.4);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: rgba(0, 0, 0, 0.3);

    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'DM Sans', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

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

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

body {
    background: var(--deep-void);
    color: var(--silver-mist);
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.7;
    letter-spacing: 0.01em;
    font-weight: 400;
    overflow-x: hidden;
}

/* --- Particle Canvas --- */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* --- Navigation Dots --- */
#nav-dots {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.nav-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--silver-mist);
    opacity: 0.3;
    cursor: pointer;
    transition: opacity 0.4s ease, transform 0.4s ease, background-color 0.4s ease;
}

.nav-dot.active {
    opacity: 1;
    background: var(--spectrometer-teal);
    transform: scale(1.4);
}

/* --- Section Base --- */
.section {
    position: relative;
    min-height: 100vh;
    z-index: 1;
}

.section-works {
    min-height: 120vh;
}

/* --- Split Layout --- */
.split-layout {
    display: grid;
    grid-template-columns: 2fr 3fr;
    min-height: 100vh;
    width: 100%;
    transition: grid-template-columns 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.split-expanded .panel-left {
    /* narrower on the "how it works" section */
}

.split-expanded {
    grid-template-columns: 1.2fr 3.8fr;
}

/* --- Left Panel --- */
.panel-left {
    position: relative;
    background: var(--studio-panel);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem 3rem 4rem 2.5rem;
    overflow: hidden;
}

.panel-content {
    position: relative;
    z-index: 2;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.panel-content.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- VU Strip (left edge frequency bars) --- */
.vu-strip {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 2rem 0;
    z-index: 1;
}

.vu-bar {
    width: 3px;
    margin-left: 10px;
    height: 20px;
    border-radius: 1px;
    background: linear-gradient(to top, var(--spectrometer-teal), var(--warm-amber-vu), var(--signal-hot));
    transform-origin: bottom;
    transform: scaleY(0.2);
    animation: vuPulse 1.8s ease-in-out infinite;
}

.vu-bar:nth-child(1) { animation-delay: 0s; }
.vu-bar:nth-child(2) { animation-delay: 0.15s; }
.vu-bar:nth-child(3) { animation-delay: 0.3s; }
.vu-bar:nth-child(4) { animation-delay: 0.45s; }
.vu-bar:nth-child(5) { animation-delay: 0.6s; }
.vu-bar:nth-child(6) { animation-delay: 0.75s; }
.vu-bar:nth-child(7) { animation-delay: 0.9s; }
.vu-bar:nth-child(8) { animation-delay: 1.05s; }
.vu-bar:nth-child(9) { animation-delay: 1.2s; }
.vu-bar:nth-child(10) { animation-delay: 1.35s; }
.vu-bar:nth-child(11) { animation-delay: 1.5s; }
.vu-bar:nth-child(12) { animation-delay: 1.65s; }

@keyframes vuPulse {
    0%, 100% { transform: scaleY(0.2); }
    50% { transform: scaleY(1); }
}

/* --- Right Panel --- */
.panel-right {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    overflow: hidden;
}

/* --- Glass Cards --- */
.glass-card {
    width: 100%;
    height: 80%;
    min-height: 300px;
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    opacity: 0;
    filter: blur(20px);
    transition: opacity 0.8s ease, filter 0.8s ease;
}

@supports (backdrop-filter: blur(16px)) {
    .glass-card {
        background: var(--glass-bg);
        backdrop-filter: blur(16px) saturate(1.4);
        border: 1px solid var(--glass-border);
        box-shadow: 0 8px 32px var(--glass-shadow);
    }
}

@supports not (backdrop-filter: blur(16px)) {
    .glass-card {
        background: var(--depth-layer);
        border: 1px solid var(--glass-border);
        box-shadow: 0 8px 32px var(--glass-shadow);
    }
}

.glass-card.visible {
    opacity: 1;
    filter: blur(0);
}

/* --- Typography --- */
.hero-heading {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(2.2rem, 5vw, 4.8rem);
    letter-spacing: -0.03em;
    color: var(--frost-white);
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.hero-sub {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    color: var(--silver-mist);
    line-height: 1.7;
    max-width: 480px;
}

.section-heading {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(2.2rem, 5vw, 4.8rem);
    letter-spacing: -0.03em;
    color: var(--frost-white);
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--silver-mist);
    line-height: 1.7;
    margin-bottom: 1.25rem;
    max-width: 500px;
}

.emphasis-text {
    color: var(--bright-mist);
    font-weight: 500;
}

.mono-text {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    letter-spacing: 0.08em;
}

/* --- Data Readouts --- */
.data-readout {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-top: 2rem;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    background: rgba(11, 22, 33, 0.6);
    border: 1px solid var(--glass-border);
    max-width: 320px;
}

.readout-label {
    font-family: var(--font-mono);
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.08em;
    color: var(--silver-mist);
    text-transform: uppercase;
}

.readout-value {
    font-family: var(--font-mono);
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    letter-spacing: 0.08em;
    font-weight: 400;
}

.readout-teal {
    color: var(--spectrometer-teal);
}

.readout-amber {
    color: var(--warm-amber-vu);
}

.readout-hot {
    color: var(--signal-hot);
}

/* --- Waveform SVGs --- */
.waveform-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.wave-path {
    filter: drop-shadow(0 0 8px currentColor);
}

.wave-primary {
    stroke: var(--spectrometer-teal);
    filter: drop-shadow(0 0 12px rgba(74, 237, 196, 0.6));
}

.wave-teal {
    stroke: var(--spectrometer-teal);
    filter: drop-shadow(0 0 8px rgba(74, 237, 196, 0.5));
}

.wave-amber {
    stroke: var(--warm-amber-vu);
    filter: drop-shadow(0 0 8px rgba(242, 161, 84, 0.5));
}

.wave-hot {
    stroke: var(--signal-hot);
    filter: drop-shadow(0 0 8px rgba(232, 90, 111, 0.5));
}

.wave-merged {
    stroke: var(--spectrometer-teal);
    filter: drop-shadow(0 0 16px rgba(74, 237, 196, 0.7));
}

/* --- Equalizer --- */
.equalizer-vis {
    height: 85%;
}

.eq-container {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: clamp(1rem, 3vw, 3rem);
    width: 100%;
    height: 100%;
    padding: 2rem 1rem;
}

.eq-band {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    max-width: 80px;
    height: 100%;
    justify-content: flex-end;
}

.eq-bar-wrapper {
    width: 100%;
    height: 60%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.eq-bar {
    width: 100%;
    height: 0%;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(to top, var(--spectrometer-teal), var(--warm-amber-vu));
    transition: height 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 12px rgba(74, 237, 196, 0.3);
}

.eq-label {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: clamp(0.65rem, 0.9vw, 0.8rem);
    color: var(--silver-mist);
    text-align: center;
    white-space: nowrap;
}

.eq-value {
    color: var(--spectrometer-teal);
}

/* --- Lissajous / Resolution --- */
.section-resolution {
    display: flex;
    align-items: center;
    justify-content: center;
}

.resolution-fullscreen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    position: relative;
    padding: 3rem;
}

.lissajous-svg {
    width: clamp(280px, 50vw, 500px);
    height: clamp(280px, 50vw, 500px);
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 1s ease, transform 1s ease;
}

.lissajous-svg.visible {
    opacity: 1;
    transform: scale(1);
}

.grid-circle {
    fill: none;
    stroke: var(--depth-layer);
    stroke-width: 0.5;
}

.lissajous-trace {
    stroke: var(--spectrometer-teal);
    filter: drop-shadow(0 0 10px rgba(74, 237, 196, 0.6));
}

.resolution-text {
    text-align: center;
    margin-top: 3rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease 0.3s, transform 0.8s ease 0.3s;
}

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

.resolution-heading {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(2.2rem, 5vw, 4.8rem);
    letter-spacing: -0.03em;
    color: var(--frost-white);
    margin-bottom: 1rem;
}

.resolution-tagline {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--silver-mist);
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    line-height: 1.7;
    max-width: 500px;
    margin: 0 auto 0.75rem;
}

.resolution-data {
    margin-top: 1.5rem;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
}

/* --- Section Transitions (progressive disclosure) --- */
.section {
    opacity: 0;
    transition: opacity 0.6s ease;
}

.section.in-view {
    opacity: 1;
}

/* Opening section is always visible */
.section-opening {
    opacity: 1;
}

/* --- Opening animation --- */
.opening-content {
    opacity: 0;
    transform: translateY(30px);
}

.opening-content.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 1s ease, transform 1s ease;
}

/* --- Mobile Responsive (below 768px) --- */
@media (max-width: 768px) {
    .split-layout {
        grid-template-columns: 1fr;
    }

    .split-expanded {
        grid-template-columns: 1fr;
    }

    .panel-left {
        padding: 3rem 2rem 2rem 2.5rem;
        min-height: 50vh;
    }

    .panel-right {
        padding: 1.5rem;
        min-height: 50vh;
    }

    .glass-card {
        height: auto;
        min-height: 250px;
    }

    .vu-strip {
        width: 18px;
    }

    .eq-container {
        gap: 0.5rem;
    }

    .eq-label {
        font-size: 0.6rem;
    }

    .resolution-fullscreen {
        padding: 2rem 1rem;
    }

    .lissajous-svg {
        width: 260px;
        height: 260px;
    }

    #nav-dots {
        bottom: 1rem;
        right: 1rem;
    }

    .body-text,
    .hero-sub {
        max-width: 100%;
    }
}
