/* ============================================
   SocialDebug.Org — CSS
   Ocean Deep / Sci-Fi Diagnostic
   ============================================ */

:root {
    /* Color Palette — Ocean Deep */
    --abyss: #040e18;
    --deep-current: #081f35;
    --pressure-layer: #0d3251;
    --sonar-blue: #1a5276;
    --bioluminescent-teal: #64d8cb;
    --ice-reflection: #c8e6f0;
    --faded-signal: #8bb8cc;
    --deep-coral: #e07a5f;
    --faded-teal: #5a8fa3;

    /* Typography */
    --font-heading: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Source Serif 4', 'Source Serif Pro', Georgia, serif;
    --font-label: 'IBM Plex Sans', 'Helvetica Neue', sans-serif;
}

/* ============================================
   Reset & Base
   ============================================ */

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

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

body {
    background: var(--abyss);
    color: var(--faded-signal);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.2rem);
    line-height: 1.75;
    overflow-x: hidden;
}

/* ============================================
   Canvas Particle Layer
   ============================================ */

#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

/* ============================================
   Depth Navigation Dots
   ============================================ */

#depth-nav {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.depth-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sonar-blue);
    cursor: pointer;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0.4;
}

.depth-dot.active {
    background: var(--bioluminescent-teal);
    opacity: 1;
    box-shadow: 0 0 12px rgba(100, 216, 203, 0.6), 0 0 24px rgba(100, 216, 203, 0.3);
    transform: scale(1.4);
}

.depth-dot:hover {
    opacity: 0.8;
    transform: scale(1.2);
}

/* ============================================
   Sections — Depth Layers
   ============================================ */

.depth-section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 4rem 0;
}

.section-spacer {
    height: 20vh;
    position: relative;
}

.final-spacer {
    height: 10vh;
}

/* Gradient mesh backgrounds per section */
#hero {
    background:
        radial-gradient(ellipse at 20% 50%, rgba(100, 216, 203, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(13, 50, 81, 0.6) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 80%, rgba(26, 82, 118, 0.3) 0%, transparent 45%),
        radial-gradient(ellipse at 10% 90%, rgba(100, 216, 203, 0.03) 0%, transparent 30%),
        var(--abyss);
    background-size: 200% 200%;
    animation: meshDrift 30s infinite alternate ease-in-out;
}

#section-surface {
    background:
        radial-gradient(ellipse at 70% 30%, rgba(100, 216, 203, 0.06) 0%, transparent 40%),
        radial-gradient(ellipse at 30% 70%, rgba(13, 50, 81, 0.7) 0%, transparent 50%),
        radial-gradient(ellipse at 90% 80%, rgba(26, 82, 118, 0.25) 0%, transparent 35%),
        radial-gradient(ellipse at 15% 15%, rgba(8, 31, 53, 0.8) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 50%, rgba(100, 216, 203, 0.02) 0%, transparent 60%),
        var(--abyss);
    background-size: 200% 200%;
    animation: meshDrift2 30s infinite alternate ease-in-out;
}

#section-pressure {
    background:
        radial-gradient(ellipse at 40% 60%, rgba(100, 216, 203, 0.07) 0%, transparent 35%),
        radial-gradient(ellipse at 80% 40%, rgba(8, 31, 53, 0.9) 0%, transparent 50%),
        radial-gradient(ellipse at 20% 20%, rgba(13, 50, 81, 0.6) 0%, transparent 40%),
        radial-gradient(ellipse at 60% 90%, rgba(26, 82, 118, 0.2) 0%, transparent 45%),
        radial-gradient(ellipse at 10% 50%, rgba(100, 216, 203, 0.03) 0%, transparent 30%),
        var(--abyss);
    background-size: 200% 200%;
    animation: meshDrift3 30s infinite alternate ease-in-out;
}

#section-deep {
    background:
        radial-gradient(ellipse at 50% 40%, rgba(100, 216, 203, 0.08) 0%, transparent 30%),
        radial-gradient(ellipse at 20% 80%, rgba(8, 31, 53, 0.95) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 10%, rgba(13, 50, 81, 0.5) 0%, transparent 40%),
        radial-gradient(ellipse at 60% 70%, rgba(26, 82, 118, 0.15) 0%, transparent 45%),
        radial-gradient(ellipse at 90% 50%, rgba(100, 216, 203, 0.04) 0%, transparent 35%),
        radial-gradient(ellipse at 40% 10%, rgba(224, 122, 95, 0.03) 0%, transparent 25%),
        var(--abyss);
    background-size: 200% 200%;
    animation: meshDrift4 30s infinite alternate ease-in-out;
}

#section-resolution {
    background:
        radial-gradient(ellipse at 50% 50%, rgba(100, 216, 203, 0.1) 0%, transparent 40%),
        radial-gradient(ellipse at 30% 30%, rgba(13, 50, 81, 0.5) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 70%, rgba(26, 82, 118, 0.3) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 20%, rgba(139, 184, 204, 0.05) 0%, transparent 30%),
        var(--deep-current);
    background-size: 200% 200%;
    animation: meshDrift5 30s infinite alternate ease-in-out;
}

/* Mesh drift animations */
@keyframes meshDrift {
    0% { background-position: 0% 0%; }
    50% { background-position: 60% 40%; }
    100% { background-position: 100% 100%; }
}

@keyframes meshDrift2 {
    0% { background-position: 100% 0%; }
    50% { background-position: 40% 60%; }
    100% { background-position: 0% 100%; }
}

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

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

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

/* ============================================
   Central Content Column
   ============================================ */

.section-content {
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    z-index: 2;
}

/* ============================================
   Typography
   ============================================ */

h1 {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: clamp(2.4rem, 5vw, 4rem);
    color: var(--ice-reflection);
    letter-spacing: -0.01em;
    line-height: 1.2;
}

h2 {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    color: var(--ice-reflection);
    letter-spacing: -0.01em;
    line-height: 1.3;
    margin-bottom: 1.5rem;
}

p {
    margin-bottom: 1.5rem;
    color: var(--faded-signal);
}

em {
    font-style: italic;
    font-weight: 500;
}

.section-label {
    font-family: var(--font-label);
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    color: var(--faded-teal);
    text-transform: uppercase;
    display: block;
    margin-bottom: 1rem;
    font-variant: small-caps;
}

/* ============================================
   Hero Section
   ============================================ */

.hero-title {
    font-size: clamp(3rem, 6vw, 6rem);
    text-align: center;
    opacity: 0;
    margin-bottom: 1rem;
}

.hero-title .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
}

.hero-title .char.revealed {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.hero-tagline {
    text-align: center;
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    color: var(--faded-signal);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1s ease, transform 1s ease;
    margin-bottom: 3rem;
}

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

.scroll-line {
    width: 2px;
    height: 0;
    background: var(--bioluminescent-teal);
    margin: 0 auto;
    opacity: 0;
    transition: opacity 0.5s ease;
    animation: none;
}

.scroll-line.visible {
    opacity: 1;
    height: 100px;
    transition: height 1.5s ease, opacity 0.5s ease;
    animation: scrollPulse 3s infinite ease-in-out;
}

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

/* ============================================
   Sonar Pulse
   ============================================ */

.sonar-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
}

.sonar-pulse {
    width: 400px;
    height: 400px;
    opacity: 0;
}

.sonar-pulse.active {
    opacity: 1;
}

.sonar-ring {
    fill: none;
    stroke: var(--bioluminescent-teal);
    stroke-width: 1;
    opacity: 0;
}

.sonar-pulse.active .sonar-ring:nth-child(1) {
    animation: sonarExpand 3s ease-out 0s forwards;
}

.sonar-pulse.active .sonar-ring:nth-child(2) {
    animation: sonarExpand 3s ease-out 0.4s forwards;
}

.sonar-pulse.active .sonar-ring:nth-child(3) {
    animation: sonarExpand 3s ease-out 0.8s forwards;
}

@keyframes sonarExpand {
    0% {
        r: 10;
        opacity: 0.8;
        stroke-width: 1.5;
    }
    100% {
        r: 100;
        opacity: 0;
        stroke-width: 0.3;
    }
}

/* ============================================
   Diagnostic Panels
   ============================================ */

.diagnostic-panel {
    background: rgba(8, 31, 53, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(100, 200, 255, 0.15);
    border-radius: 16px;
    padding: 1.5rem;
    margin: 2rem 0;
    position: relative;
    opacity: 0;
    transform: scale(0.9) translateX(0);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.diagnostic-panel.visible {
    opacity: 1;
    transform: scale(1);
}

.panel-left {
    transform: scale(0.9) translateX(-40px);
}

.panel-left.visible {
    transform: scale(1) translateX(-40px);
}

.panel-right {
    transform: scale(0.9) translateX(60px);
}

.panel-right.visible {
    transform: scale(1) translateX(60px);
}

/* Panel border glow animation */
.diagnostic-panel::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 16px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(26, 82, 118, 0.3), rgba(100, 216, 203, 0.08));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* Panel status indicator */
.panel-status {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: statusPulse 2s infinite ease-in-out;
}

[data-status="healthy"] .panel-status {
    background: var(--bioluminescent-teal);
    box-shadow: 0 0 8px rgba(100, 216, 203, 0.6);
}

[data-status="fault"] .panel-status {
    background: var(--deep-coral);
    box-shadow: 0 0 8px rgba(224, 122, 95, 0.6);
}

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

.panel-label {
    font-family: var(--font-label);
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--faded-teal);
    text-transform: uppercase;
    font-variant: small-caps;
    display: block;
    margin-bottom: 0.75rem;
}

.panel-data {
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--faded-signal);
    margin-bottom: 0;
}

.data-highlight {
    font-family: var(--font-label);
    font-weight: 600;
    color: var(--bioluminescent-teal);
    font-variant-numeric: tabular-nums;
}

.fault-term {
    color: var(--deep-coral);
    font-weight: 500;
    position: relative;
}

.fault-term::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--deep-coral), var(--bioluminescent-teal));
    opacity: 0.7;
}

/* ============================================
   Section Scroll Animations
   ============================================ */

.depth-section .section-content > h2,
.depth-section .section-content > p,
.depth-section .section-content > .section-label {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.depth-section.in-view .section-content > h2,
.depth-section.in-view .section-content > p,
.depth-section.in-view .section-content > .section-label {
    opacity: 1;
    transform: translateY(0);
}

.depth-section.in-view .section-content > .section-label {
    transition-delay: 0s;
}

.depth-section.in-view .section-content > h2 {
    transition-delay: 0.1s;
}

.depth-section.in-view .section-content > p:nth-of-type(1) {
    transition-delay: 0.2s;
}

.depth-section.in-view .section-content > p:nth-of-type(2) {
    transition-delay: 0.3s;
}

/* Hero section is handled separately */
#hero .section-content > h1,
#hero .section-content > p {
    opacity: 0;
    transform: none;
    transition: none;
}

#hero.in-view .section-content > h1,
#hero.in-view .section-content > p {
    transform: none;
}

/* ============================================
   Resolution / Final Section
   ============================================ */

.resolution-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.resolution-heading {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: clamp(1.6rem, 3vw, 2.6rem);
    color: var(--ice-reflection);
    line-height: 1.5;
    margin-bottom: 2rem;
    max-width: 600px;
}

.resolution-sub {
    color: var(--faded-signal);
    max-width: 560px;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
}

/* ============================================
   Elastic Hover Effects
   ============================================ */

.diagnostic-panel:hover {
    transform: scale(1.03);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.panel-left:hover {
    transform: scale(1.03) translateX(-40px);
}

.panel-right:hover {
    transform: scale(1.03) translateX(60px);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    #depth-nav {
        right: 12px;
    }

    .section-content {
        padding: 0 1.5rem;
    }

    .panel-left,
    .panel-left.visible {
        transform: scale(1) translateX(0);
    }

    .panel-right,
    .panel-right.visible {
        transform: scale(1) translateX(0);
    }

    .panel-left:hover,
    .panel-right:hover {
        transform: scale(1.02) translateX(0);
    }

    .hero-title {
        font-size: clamp(2.4rem, 10vw, 4rem);
    }

    .sonar-pulse {
        width: 250px;
        height: 250px;
    }
}

@media (max-width: 480px) {
    .section-content {
        padding: 0 1rem;
    }

    .diagnostic-panel {
        padding: 1.2rem;
    }
}

/* ============================================
   Reduced Motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    #particle-canvas {
        display: none;
    }

    .hero-title,
    .hero-tagline,
    .scroll-line,
    .depth-section .section-content > h2,
    .depth-section .section-content > p,
    .depth-section .section-content > .section-label,
    .diagnostic-panel {
        opacity: 1 !important;
        transform: none !important;
    }
}
