/* ============================================
   globaltonecheck.com — Vaporwave Frequency Lab
   ============================================ */

:root {
    --deep-navy: #0a0e1a;
    --panel-navy: #0d1b3c;
    --metallic-edge: #3a4a6b;
    --hot-pink: #ff71ce;
    --electric-cyan: #01cdfe;
    --soft-violet: #b967ff;
    --lavender-white: #e8e0f0;
    --muted-lavender: #9e97b0;
    --sunset-orange: #f3a952;
    --gradient-accent: linear-gradient(135deg, #ff71ce 0%, #b967ff 40%, #01cdfe 100%);
    --gradient-metallic: linear-gradient(180deg, #0d1b3c 0%, #0a0e1a 100%);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--deep-navy);
    color: var(--muted-lavender);
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.65;
    overflow-x: hidden;
    position: relative;
}

/* ---- Noise Overlay ---- */
.noise-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.04;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' 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: 256px 256px;
    animation: grain 0.5s steps(6) infinite;
}

@keyframes grain {
    0%, 100% { background-position: 0 0; }
    16% { background-position: -50px -30px; }
    33% { background-position: 30px -60px; }
    50% { background-position: -60px 50px; }
    66% { background-position: 50px 20px; }
    83% { background-position: -30px 60px; }
}

/* ---- Scan Lines ---- */
.scanlines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9998;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 2px,
        rgba(10, 14, 26, 0.12) 2px,
        rgba(10, 14, 26, 0.12) 4px
    );
    opacity: 0.5;
}

/* ---- Navigation ---- */
.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(58, 74, 107, 0.3);
    z-index: 1000;
}

.nav-logo {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    color: var(--lavender-white);
    text-transform: uppercase;
}

.nav-tune-icon {
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.nav-tune-icon:hover {
    opacity: 1;
}

/* ---- Section: Tuning (Hero) ---- */
.section-tuning {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding-top: 48px;
}

.oscilloscope {
    position: relative;
    width: min(85vw, 700px);
    aspect-ratio: 4 / 2.5;
    background: radial-gradient(ellipse at center, #0d1b3c 0%, #0a0e1a 100%);
    border-radius: 24px;
    border: 1px solid var(--metallic-edge);
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 0 80px rgba(1, 205, 254, 0.08),
        0 0 160px rgba(185, 103, 255, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
    overflow: hidden;
}

.oscilloscope::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 24px;
    background: linear-gradient(
        90deg,
        rgba(58, 74, 107, 0.05) 0%,
        rgba(58, 74, 107, 0.02) 50%,
        rgba(58, 74, 107, 0.05) 100%
    );
    pointer-events: none;
}

.oscilloscope-indicator {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--hot-pink);
    animation: blink-indicator 1.25s ease-in-out infinite;
}

@keyframes blink-indicator {
    0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--hot-pink); }
    50% { opacity: 0.2; box-shadow: 0 0 2px var(--hot-pink); }
}

.oscilloscope-wave {
    width: 100%;
    height: 120px;
    margin-bottom: 20px;
}

.wave-path {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    animation: drawWave 2s ease-out forwards;
}

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

.oscilloscope-wave {
    animation: wavePulse 3s ease-in-out infinite;
}

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

.oscilloscope-readout {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(1rem, 2.5vw, 1.8rem);
    color: var(--electric-cyan);
    letter-spacing: 0.15em;
    margin-bottom: 16px;
    min-height: 1.5em;
}

.readout-cursor {
    animation: cursorBlink 0.8s step-end infinite;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.oscilloscope-data {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.data-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.65rem, 0.9vw, 0.8rem);
    color: var(--muted-lavender);
    letter-spacing: 0.08em;
}

.data-value {
    color: var(--electric-cyan);
}

/* ---- Wave Dividers ---- */
.wave-divider {
    width: 100%;
    height: 40px;
    overflow: hidden;
}

.wave-divider svg {
    width: 100%;
    height: 100%;
}

/* ---- Section: Frequency Scan ---- */
.section-frequency {
    padding: 80px 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--lavender-white);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 12px;
}

.section-subtitle {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    color: var(--electric-cyan);
    text-align: center;
    letter-spacing: 0.05em;
    margin-bottom: 60px;
    opacity: 0.7;
}

/* ---- Card Grid ---- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: minmax(200px, auto);
    gap: 16px;
}

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

@media (max-width: 600px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
}

/* ---- Channel Card ---- */
.channel-card {
    position: relative;
    perspective: 1000px;
    min-height: 220px;
    cursor: default;
}

.channel-card.tall {
    min-height: 280px;
}

.card-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 8px;
    border: 1px solid var(--metallic-edge);
    border-left: 4px solid var(--card-accent);
    transition: transform 0.6s ease-in-out;
    overflow: hidden;
}

.card-face::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        rgba(58, 74, 107, 0.05) 0%,
        rgba(58, 74, 107, 0.02) 50%,
        rgba(58, 74, 107, 0.05) 100%
    );
    pointer-events: none;
}

.card-back {
    background: var(--gradient-metallic);
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotateY(0deg);
}

.card-front {
    background: var(--gradient-metallic);
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
}

.channel-card.flipped .card-back {
    transform: rotateY(-180deg);
}

.channel-card.flipped .card-front {
    transform: rotateY(0deg);
}

.card-front:hover::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' 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: 256px 256px;
    opacity: 0.06;
    mix-blend-mode: overlay;
    pointer-events: none;
    border-radius: 8px;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(180deg, #0d1b3c 0%, transparent 100%);
    min-height: 48px;
}

.card-label {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--lavender-white);
}

.card-display {
    flex: 1;
    padding: 0 16px 12px;
}

.card-display p {
    font-family: 'Work Sans', sans-serif;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--muted-lavender);
}

.card-data {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    color: var(--electric-cyan);
    margin-top: 8px;
    letter-spacing: 0.05em;
    opacity: 0.7;
}

.card-meter {
    height: 32px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
}

.meter-fill {
    height: 4px;
    width: 0%;
    background: var(--gradient-accent);
    border-radius: 2px;
    transition: width 1.2s ease-out;
    box-shadow: 0 0 8px rgba(255, 113, 206, 0.3);
}

.channel-card.flipped .meter-fill {
    width: var(--meter-width, 70%);
}

/* Card hover effects */
.channel-card.flipped .card-front:hover .card-header svg path {
    stroke-width: 2.5;
}

/* ---- Section: Waveform Gallery ---- */
.section-gallery {
    padding: 80px 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.waveform-strip {
    position: relative;
    height: 320px;
    margin-top: 40px;
}

.waveform-item {
    position: absolute;
    left: 0;
    right: 0;
    height: 120px;
    transition: transform 0.3s ease;
    cursor: default;
}

.waveform-item:nth-child(1) { top: 0; }
.waveform-item:nth-child(2) { top: 50px; }
.waveform-item:nth-child(3) { top: 100px; }
.waveform-item:nth-child(4) { top: 150px; }
.waveform-item:nth-child(5) { top: 200px; }

.waveform-item:hover {
    transform: scaleY(1.3);
    z-index: 10;
}

.waveform-item:hover .wave-label {
    opacity: 1;
    color: var(--lavender-white);
}

.gallery-wave {
    width: 100%;
    height: 100%;
}

.gallery-wave-path {
    stroke-dasharray: 2500;
    stroke-dashoffset: 2500;
    transition: stroke-dashoffset 2s ease-out;
}

.waveform-item.drawn .gallery-wave-path {
    stroke-dashoffset: 0;
}

.wave-label {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    color: var(--muted-lavender);
    letter-spacing: 0.1em;
    opacity: 0.5;
    transition: opacity 0.3s ease, color 0.3s ease;
}

/* ---- Section: Signal Off ---- */
.section-signaloff {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.shutdown-screen {
    width: min(85vw, 700px);
    aspect-ratio: 4 / 2.5;
    background: radial-gradient(ellipse at center, #0d1b3c 0%, #0a0e1a 100%);
    border-radius: 24px;
    border: 1px solid var(--metallic-edge);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    transition: transform 1s ease-in, opacity 0.8s ease;
    overflow: hidden;
}

.shutdown-screen.shutting-down {
    animation: crtShutdown 2s ease-in forwards;
}

@keyframes crtShutdown {
    0% { transform: scaleX(1) scaleY(1); opacity: 1; }
    50% { transform: scaleX(1) scaleY(0.005); opacity: 1; }
    75% { transform: scaleX(0.01) scaleY(0.005); opacity: 0.8; }
    100% { transform: scaleX(0) scaleY(0); opacity: 0; }
}

.flatline-wave {
    width: 100%;
    height: 80px;
    margin-bottom: 24px;
    opacity: 0.5;
}

.flatline {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 1.5s ease-out;
}

.section-signaloff.visible .flatline {
    stroke-dashoffset: 0;
}

.shutdown-text {
    text-align: center;
}

.mono-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    color: var(--muted-lavender);
    letter-spacing: 0.1em;
    opacity: 0.6;
    transition: opacity 2s ease;
}

.section-signaloff.faded .mono-text {
    opacity: 0.2;
}

/* ---- Ambient Waves ---- */
.ambient-waves {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.ambient-wave {
    position: absolute;
    width: 140%;
    height: 100px;
    left: -20%;
}

.ambient-wave-1 {
    top: 30%;
    animation: ambientDrift1 20s linear infinite;
}

.ambient-wave-2 {
    top: 65%;
    animation: ambientDrift2 25s linear infinite;
}

@keyframes ambientDrift1 {
    0% { transform: translateX(0); }
    100% { transform: translateX(-14%); }
}

@keyframes ambientDrift2 {
    0% { transform: translateX(-14%); }
    100% { transform: translateX(0); }
}

/* ---- Links ---- */
a {
    color: var(--hot-pink);
    text-decoration: none;
    position: relative;
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--hot-pink);
    transition: width 0.3s ease;
}

a:hover::after {
    width: 100%;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--deep-navy);
}

::-webkit-scrollbar-thumb {
    background: var(--metallic-edge);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--soft-violet);
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .oscilloscope {
        width: 95vw;
        padding: 24px;
    }

    .oscilloscope-data {
        gap: 12px;
        font-size: 0.65rem;
    }

    .section-frequency,
    .section-gallery {
        padding: 60px 16px;
    }

    .waveform-strip {
        height: 280px;
    }

    .waveform-item:nth-child(1) { top: 0; }
    .waveform-item:nth-child(2) { top: 40px; }
    .waveform-item:nth-child(3) { top: 80px; }
    .waveform-item:nth-child(4) { top: 120px; }
    .waveform-item:nth-child(5) { top: 160px; }

    .shutdown-screen {
        width: 95vw;
        padding: 24px;
    }
}
