/* ==========================================================================
   GlobalToneCare — Styles
   Color Palette:
   #0B1929 Abyssal Midnight (primary bg)
   #122A42 Deep Current (secondary bg)
   #1A3A5C Pressure Blue (hover/active)
   #7FDBDA Bioluminescent Teal (primary accent)
   #4ECDC4 Signal Cyan (secondary accent)
   #B8D4E3 Mist Blue (tertiary text)
   #C5D8E8 Soft Ice (body text)
   #E8F4F8 Glacial White (emphasis)
   #2D7A8A Resonance Teal (borders)
   #0E2137 Shadow Ink (shadows)
   ========================================================================== */

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

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

body {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    color: #C5D8E8;
    line-height: 1.85;
    letter-spacing: 0.01em;
    background-color: #0B1929;
    overflow-x: hidden;
}

/* --- Breathing background gradient --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(ellipse at 60% 40%, #122A42 0%, #0B1929 70%);
    z-index: -10;
    animation: breatheGradient 30s ease-in-out infinite alternate;
}

@keyframes breatheGradient {
    0% {
        background: radial-gradient(ellipse at 60% 40%, #122A42 0%, #0B1929 70%);
    }
    33% {
        background: radial-gradient(ellipse at 45% 55%, #122A42 0%, #0B1929 70%);
    }
    66% {
        background: radial-gradient(ellipse at 55% 35%, #0E2137 0%, #0B1929 70%);
    }
    100% {
        background: radial-gradient(ellipse at 50% 50%, #122A42 0%, #0B1929 70%);
    }
}

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

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #7FDBDA;
    border-radius: 50%;
    opacity: 0;
    animation: particleFloat linear infinite;
}

@keyframes particleFloat {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: var(--p-opacity, 0.1);
    }
    90% {
        opacity: var(--p-opacity, 0.1);
    }
    100% {
        transform: translateY(calc(-100vh - 20px)) translateX(var(--p-drift, 20px));
        opacity: 0;
    }
}

/* --- Waveform Container --- */
#waveform-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

#waveform-bg {
    width: 100%;
    height: 100%;
}

.waveform-line {
    will-change: transform;
    transition: opacity 0.6s ease;
}

/* --- Navigation Dots --- */
#nav-dots {
    position: fixed;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    z-index: 100;
}

.nav-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(127, 219, 218, 0.2);
    border: 1px solid rgba(127, 219, 218, 0.3);
    cursor: pointer;
    position: relative;
    transition: background 0.4s ease, border-color 0.4s ease;
    padding: 0;
    outline: none;
}

.nav-dot.active {
    background: #7FDBDA;
    border-color: #7FDBDA;
    animation: pulseAttention 2s ease-in-out infinite;
}

.dot-halo {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid rgba(127, 219, 218, 0.15);
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.nav-dot.active .dot-halo {
    opacity: 1;
    animation: haloBreath 2s ease-in-out infinite;
}

@keyframes pulseAttention {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

@keyframes haloBreath {
    0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.6; transform: translate(-50%, -50%) scale(1.2); }
}

/* --- Sections Common --- */
.section {
    position: relative;
    z-index: 2;
    min-height: 100vh;
}

.section-heading {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: clamp(2rem, 4.5vw, 3.8rem);
    color: #7FDBDA;
    letter-spacing: 0.06em;
    line-height: 1.15;
    margin-bottom: 0.5em;
}

.section-subtitle {
    font-family: 'Newsreader', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    color: #B8D4E3;
    letter-spacing: 0.02em;
    line-height: 1.4;
    margin-bottom: 2em;
}

/* ==========================================================================
   Section 1 — The Threshold
   ========================================================================== */
#section-threshold {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

.threshold-content {
    position: relative;
    width: 100%;
    max-width: 900px;
}

#hero-waveform {
    width: 100%;
    height: 100px;
    overflow: visible;
    filter: drop-shadow(0 0 8px rgba(127, 219, 218, 0));
    transition: filter 2s ease;
}

#hero-waveform.glowing {
    filter: drop-shadow(0 0 8px rgba(127, 219, 218, 0.4));
}

#hero-wave-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke 1.5s ease, stroke-width 1.5s ease;
}

#hero-wave-path.drawn {
    stroke-dashoffset: 0;
}

#hero-wave-path.colored {
    stroke: #7FDBDA;
    stroke-width: 1.5;
}

.site-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: clamp(2.5rem, 6vw, 5rem);
    color: #7FDBDA;
    letter-spacing: 0.06em;
    line-height: 1.15;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1.5s ease, transform 1.5s ease;
    margin-bottom: 0.3em;
}

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

.site-tagline {
    font-family: 'Newsreader', serif;
    font-weight: 400;
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    color: #B8D4E3;
    letter-spacing: 0.02em;
    line-height: 1.4;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1.5s ease, transform 1.5s ease;
}

.site-tagline.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Scroll indicator */
.scroll-indicator {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.scroll-indicator.visible {
    opacity: 0.5;
}

.scroll-text {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 300;
    font-size: 0.8rem;
    color: #4ECDC4;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.scroll-arrow {
    width: 1px;
    height: 30px;
    background: linear-gradient(to bottom, #4ECDC4, transparent);
    animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
    0%, 100% { opacity: 0.3; transform: translateY(0); }
    50% { opacity: 0.7; transform: translateY(5px); }
}

/* ==========================================================================
   Section 2 — The Frequency Spectrum
   ========================================================================== */
#section-spectrum {
    min-height: 120vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6rem 2rem;
}

.section-inner {
    max-width: 1100px;
    width: 100%;
    text-align: center;
}

.card-field {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
    position: relative;
}

/* Asymmetric card positioning */
.glass-card {
    position: relative;
    width: 280px;
    padding: 2rem 1.5rem;
    background: rgba(18, 42, 66, 0.6);
    backdrop-filter: blur(12px) saturate(1.2);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
    border: 1px solid rgba(127, 219, 218, 0.12);
    border-radius: 12px;
    text-align: left;
    transition: border-color 0.4s ease, transform 0.4s ease, box-shadow 0.4s ease;
    overflow: visible;
    box-shadow: 0 8px 32px rgba(14, 33, 55, 0.4);
}

/* Fallback for browsers without backdrop-filter */
@supports not (backdrop-filter: blur(12px)) {
    .glass-card {
        background: rgba(18, 42, 66, 0.85);
    }
}

.glass-card:hover {
    border-color: rgba(127, 219, 218, 0.35);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(14, 33, 55, 0.6);
}

/* Asymmetric vertical offsets */
.card-pos-1 { margin-top: 0; }
.card-pos-2 { margin-top: 3rem; }
.card-pos-3 { margin-top: -1rem; }
.card-pos-4 { margin-top: 4rem; }
.card-pos-5 { margin-top: 1rem; }

/* Sonar ring on cards */
.sonar-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    border: 1px solid #4ECDC4;
    transform: translate(-50%, -50%);
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

.glass-card:hover .sonar-ring {
    animation: sonarPulse 1.2s ease-out forwards;
}

@keyframes sonarPulse {
    0% {
        width: 0;
        height: 0;
        opacity: 0.25;
    }
    100% {
        width: 300px;
        height: 300px;
        opacity: 0;
    }
}

.card-freq {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 300;
    font-size: 0.8rem;
    color: #4ECDC4;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.5rem;
}

.card-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: 1.3rem;
    color: #7FDBDA;
    letter-spacing: 0.04em;
    margin-bottom: 0.75rem;
}

.card-body {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: 0.95rem;
    color: #C5D8E8;
    line-height: 1.7;
}

/* Card border frequency pulse */
.glass-card.card-pos-1 { animation: borderPulse1 4s ease-in-out infinite; }
.glass-card.card-pos-2 { animation: borderPulse2 5s ease-in-out infinite; }
.glass-card.card-pos-3 { animation: borderPulse3 3.5s ease-in-out infinite; }
.glass-card.card-pos-4 { animation: borderPulse4 6s ease-in-out infinite; }
.glass-card.card-pos-5 { animation: borderPulse5 4.5s ease-in-out infinite; }

@keyframes borderPulse1 {
    0%, 100% { border-color: rgba(127, 219, 218, 0.12); }
    50% { border-color: rgba(127, 219, 218, 0.25); }
}
@keyframes borderPulse2 {
    0%, 100% { border-color: rgba(127, 219, 218, 0.12); }
    50% { border-color: rgba(78, 205, 196, 0.25); }
}
@keyframes borderPulse3 {
    0%, 100% { border-color: rgba(78, 205, 196, 0.12); }
    50% { border-color: rgba(127, 219, 218, 0.28); }
}
@keyframes borderPulse4 {
    0%, 100% { border-color: rgba(127, 219, 218, 0.12); }
    50% { border-color: rgba(127, 219, 218, 0.22); }
}
@keyframes borderPulse5 {
    0%, 100% { border-color: rgba(78, 205, 196, 0.12); }
    50% { border-color: rgba(127, 219, 218, 0.25); }
}

/* Fade reveal animation for cards */
.fade-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fade-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Section 3 — The Deep Resonance
   ========================================================================== */
#section-resonance {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8rem 2rem;
    position: relative;
    background: linear-gradient(180deg, #0B1929 0%, #122A42 40%, #1A3A5C 60%, #122A42 80%, #0B1929 100%);
    background-size: 100% 200%;
    animation: deepGradientShift 20s ease-in-out infinite alternate;
}

@keyframes deepGradientShift {
    0% { background-position: 0% 0%; }
    100% { background-position: 0% 100%; }
}

.resonance-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    pointer-events: none;
}

.sonar-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    border: 1px solid #4ECDC4;
    transform: translate(-50%, -50%);
    opacity: 0;
    animation: sonarExpand 4s ease-out infinite;
}

.sonar-pulse-1 { animation-delay: 0s; }
.sonar-pulse-2 { animation-delay: 1.3s; }
.sonar-pulse-3 { animation-delay: 2.6s; }

@keyframes sonarExpand {
    0% {
        width: 0;
        height: 0;
        opacity: 0.2;
    }
    100% {
        width: 600px;
        height: 600px;
        opacity: 0;
    }
}

.resonance-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 800px;
    width: 100%;
}

.prose-column {
    max-width: 42ch;
    margin: 0 auto;
    text-align: left;
}

.prose-column p {
    margin-bottom: 3rem;
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    color: #C5D8E8;
    line-height: 1.85;
    letter-spacing: 0.01em;
}

.prose-divider {
    display: flex;
    justify-content: center;
    margin-bottom: 3rem;
    opacity: 0.6;
}

/* ==========================================================================
   Section 4 — The Harmonic Convergence
   ========================================================================== */
#section-harmonic {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 4rem 2rem;
}

.convergence-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#convergence-svg {
    width: 100%;
    height: 100%;
}

.converge-line {
    transition: opacity 0.8s ease;
}

.harmonic-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 900px;
}

.harmonic-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 200;
    font-size: clamp(2.5rem, 5.5vw, 4.5rem);
    color: #E8F4F8;
    letter-spacing: 0.06em;
    line-height: 1.15;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.5s ease, transform 1.5s ease;
}

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

.site-footer {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.footer-text {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    color: #2D7A8A;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    body::before {
        animation: none;
    }
    .particle {
        display: none;
    }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    #nav-dots {
        right: 1rem;
        gap: 1rem;
    }

    .card-field {
        flex-direction: column;
        align-items: center;
    }

    .card-pos-1,
    .card-pos-2,
    .card-pos-3,
    .card-pos-4,
    .card-pos-5 {
        margin-top: 0;
    }

    .glass-card {
        width: 100%;
        max-width: 340px;
    }

    .resonance-bg {
        width: 300px;
        height: 300px;
    }

    @keyframes sonarExpand {
        0% { width: 0; height: 0; opacity: 0.2; }
        100% { width: 300px; height: 300px; opacity: 0; }
    }

    .prose-column {
        max-width: 100%;
    }
}
