/* ============================================
   nlbd.dev - Bathypelagic Research Interface
   ============================================ */

/* CSS Custom Properties */
:root {
    --c-abyss: #0A0E17;
    --c-hadal: #080C14;
    --c-trench: #050810;
    --c-cyan: #00F5D4;
    --c-magenta: #FF006E;
    --c-blue: #3A7EF2;
    --c-violet: #2D1B69;
    --c-text: #B8C9DC;
    --c-heading: #E8ECF1;
    --c-gold: #FBBF24;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--c-abyss);
    color: var(--c-text);
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.18rem);
    line-height: 1.75;
    letter-spacing: 0.006em;
    overflow-x: hidden;
    display: grid;
    grid-template-columns: 64px 1fr;
    min-height: 100vh;
}

/* ============================================
   Depth Gauge (Left Rail Navigation)
   ============================================ */
#depth-gauge {
    position: sticky;
    top: 0;
    height: 100vh;
    width: 64px;
    background: var(--c-hadal);
    border-right: 1px solid rgba(0, 245, 212, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    z-index: 100;
    grid-column: 1;
    grid-row: 1 / -1;
}

.depth-line {
    position: absolute;
    top: 15%;
    bottom: 15%;
    left: 50%;
    width: 1px;
    background: rgba(0, 245, 212, 0.06);
    transform: translateX(-50%);
}

.waypoint {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 24px 0;
    cursor: pointer;
    z-index: 2;
}

.waypoint-dot {
    width: 10px;
    height: 10px;
    border: 1.5px solid rgba(0, 245, 212, 0.3);
    border-radius: 50%;
    background: transparent;
    transition: transform 150ms ease-out, border-color 200ms ease-out, background-color 200ms ease-out, box-shadow 200ms ease-out;
}

.waypoint.active .waypoint-dot {
    background: rgba(0, 245, 212, 0.6);
    border-color: var(--c-cyan);
    animation: waypoint-pulse 3s ease-in-out infinite;
}

.waypoint.passed .waypoint-dot {
    background: rgba(0, 245, 212, 0.25);
    border-color: rgba(0, 245, 212, 0.4);
}

.waypoint:hover .waypoint-dot {
    transform: scale(1.4);
}

.waypoint:hover .waypoint-label {
    opacity: 0.8;
}

.waypoint-label {
    position: absolute;
    left: 50%;
    top: calc(100% + 4px);
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 400;
    font-size: 9px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--c-cyan);
    opacity: 0.4;
    transform: rotate(-90deg) translateX(-100%);
    transform-origin: top left;
    white-space: nowrap;
    transition: opacity 200ms ease-out;
}

@keyframes waypoint-pulse {
    0%, 100% { box-shadow: 0 0 6px rgba(0, 245, 212, 0.15); }
    50% { box-shadow: 0 0 12px rgba(0, 245, 212, 0.25); }
}

/* Waypoint hover ring */
.waypoint-ring {
    position: absolute;
    width: 10px;
    height: 10px;
    border: 1px solid var(--c-cyan);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
}

.waypoint-ring.animate {
    animation: waypoint-ring-expand 400ms ease-out forwards;
}

@keyframes waypoint-ring-expand {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(4); opacity: 0; }
}

/* ============================================
   Main Content Area
   ============================================ */
#content-area {
    grid-column: 2;
    position: relative;
}

/* ============================================
   Typography
   ============================================ */
.hero-title {
    font-family: 'Cormorant Garamond', 'Times New Roman', serif;
    font-weight: 300;
    font-size: clamp(3.2rem, 8vw, 7rem);
    letter-spacing: 0.025em;
    line-height: 1.05;
    color: var(--c-heading);
}

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

.hero-title span.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 200ms ease-out, transform 200ms ease-out;
}

.hero-tagline {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.2vw, 1.2rem);
    line-height: 1.75;
    color: var(--c-text);
    max-width: 52ch;
    margin-top: 1.5rem;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 500ms ease-out, transform 500ms ease-out;
}

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

.section-heading {
    font-family: 'Cormorant Garamond', 'Times New Roman', serif;
    font-weight: 600;
    font-size: clamp(1.5rem, 3.5vw, 2.6rem);
    letter-spacing: 0.015em;
    line-height: 1.2;
    color: var(--c-heading);
    margin-bottom: 1.2rem;
}

.section-heading--gold {
    color: var(--c-gold);
}

.section-body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.18rem);
    line-height: 1.75;
    letter-spacing: 0.006em;
    color: var(--c-text);
    max-width: 62ch;
    margin-bottom: 1rem;
}

/* HUD Readout Text */
.hud-readout {
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 400;
    font-size: clamp(0.65rem, 0.85vw, 0.82rem);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(0, 245, 212, 0.6);
    margin-top: 1rem;
}

.hud-readout--gold {
    color: rgba(251, 191, 36, 0.7);
    margin-top: 2rem;
}

/* Data Readout Labels */
.data-readout {
    position: absolute;
    top: clamp(1rem, 2vw, 1.5rem);
    right: clamp(1rem, 2vw, 2rem);
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 400;
    font-size: clamp(0.55rem, 0.7vw, 0.72rem);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(0, 245, 212, 0.4);
    opacity: 0;
    transition: opacity 300ms ease-out;
}

.data-readout--gold {
    color: rgba(251, 191, 36, 0.5);
}

.data-readout.visible {
    opacity: 1;
}

/* ============================================
   Bands / Sections
   ============================================ */
.band {
    position: relative;
    min-height: 100vh;
    padding: clamp(1.5rem, 4vw, 3rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.band-surface {
    background-color: var(--c-abyss);
    min-height: 100vh;
}

.band-meso {
    background-color: var(--c-hadal);
}

.band-abyss {
    background-color: var(--c-hadal);
}

.band-trench {
    background-color: var(--c-trench);
}

/* Section inner containers */
.section-inner {
    max-width: 58%;
    position: relative;
}

.section-inner--centered {
    max-width: 640px;
    margin: 0 auto;
}

/* Section entry animation for content children */
.content-children > * {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 450ms ease-out, transform 450ms ease-out;
}

.content-section.in-view .content-children > *:nth-child(1) { opacity: 1; transform: translateY(0); transition-delay: 0ms; }
.content-section.in-view .content-children > *:nth-child(2) { opacity: 1; transform: translateY(0); transition-delay: 70ms; }
.content-section.in-view .content-children > *:nth-child(3) { opacity: 1; transform: translateY(0); transition-delay: 140ms; }
.content-section.in-view .content-children > *:nth-child(4) { opacity: 1; transform: translateY(0); transition-delay: 210ms; }
.content-section.in-view .content-children > *:nth-child(5) { opacity: 1; transform: translateY(0); transition-delay: 280ms; }

/* Content section gap */
.content-section + .content-section {
    margin-top: clamp(2rem, 4vh, 4rem);
}

/* Content block hover */
.hud-bracket-group {
    position: relative;
    padding: clamp(1.5rem, 3vw, 2.5rem);
    border: 1px solid transparent;
    transition: border-color 200ms ease-out, box-shadow 200ms ease-out;
}

.hud-bracket-group:hover {
    border-color: rgba(0, 245, 212, 0.15);
    box-shadow: 0 0 24px rgba(0, 245, 212, 0.04);
}

.hud-bracket-group:hover .hud-bracket {
    opacity: 0.55;
}

/* ============================================
   HUD Corner Brackets
   ============================================ */
.hud-bracket {
    position: absolute;
    opacity: 0;
    transition: opacity 200ms ease-out;
}

.hud-bracket path {
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    transition: stroke-dashoffset 500ms ease-out;
}

.in-view .hud-bracket,
.band-surface .hud-bracket {
    opacity: 0.35;
}

.in-view .hud-bracket path,
.band-surface.hero-animated .hud-bracket path {
    stroke-dashoffset: 0;
}

.hud-bracket-tl { top: 0; left: 0; }
.hud-bracket-tr { top: 0; right: 0; }
.hud-bracket-bl { bottom: 0; left: 0; }
.hud-bracket-br { bottom: 0; right: 0; }

/* Gold bracket variant */
.hud-bracket-group--gold .hud-bracket {
    opacity: 0.45;
}

/* ============================================
   Scan Lines
   ============================================ */
.scan-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(0, 245, 212, 0.12);
    transform: scaleX(0);
    transform-origin: left;
    opacity: 0;
    z-index: 1;
    pointer-events: none;
}

.band-surface .scan-line {
    top: 50%;
}

.in-view .scan-line,
.band-surface.hero-animated .scan-line {
    animation: scan-sweep 400ms ease-in-out forwards, scan-fade 600ms ease-out 400ms forwards;
}

@keyframes scan-sweep {
    0% { transform: scaleX(0); opacity: 1; }
    100% { transform: scaleX(1); opacity: 1; }
}

@keyframes scan-fade {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* ============================================
   Sonar Assembly (Hero)
   ============================================ */
#sonar-assembly {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    z-index: 0;
    pointer-events: none;
}

#sonar-center {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    background: var(--c-cyan);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 200ms ease-out, width 200ms ease-out, height 200ms ease-out, box-shadow 200ms ease-out;
}

#sonar-center.active {
    opacity: 1;
    width: 6px;
    height: 6px;
    box-shadow: 0 0 30px rgba(0, 245, 212, 0.4);
}

#sonar-arm {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 1px;
    background: linear-gradient(90deg, rgba(0, 245, 212, 0.35), transparent);
    transform-origin: 0 0;
    opacity: 0;
    transform: rotate(0deg);
}

#sonar-arm.active {
    opacity: 1;
    animation: sonar-rotate 6s linear infinite;
}

@keyframes sonar-rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.sonar-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border: 1px solid var(--c-cyan);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    pointer-events: none;
}

.sonar-ring.active {
    animation: sonar-ring-expand 2s ease-out forwards;
}

@keyframes sonar-ring-expand {
    0% { width: 0; height: 0; opacity: 0.5; }
    100% { width: 400px; height: 400px; opacity: 0; }
}

/* ============================================
   Sonar Dividers (Abyss sections)
   ============================================ */
.sonar-divider {
    position: relative;
    width: 100%;
    height: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: clamp(2rem, 4vh, 4rem);
}

.sonar-divider-line {
    width: 0;
    height: 1px;
    background: var(--c-cyan);
    box-shadow: 0 0 12px rgba(0, 245, 212, 0.2);
    transition: width 600ms ease-out, opacity 600ms ease-out;
    opacity: 0;
}

.in-view .sonar-divider-line {
    width: 60%;
    opacity: 0.3;
}

/* ============================================
   Bubbles
   ============================================ */
#bubble-container {
    position: fixed;
    top: 0;
    left: 64px;
    width: calc(100% - 64px);
    height: 100%;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    will-change: transform, opacity;
}

.bubble-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at center, transparent 40%, rgba(0, 245, 212, 0.06) 100%);
    position: relative;
}

.bubble-highlight {
    position: absolute;
    top: 20%;
    left: 25%;
    width: 35%;
    height: 35%;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.3), transparent 70%);
    transition: background 150ms ease-out;
}

.bubble.near-cursor .bubble-highlight {
    background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.45), transparent 70%);
}

@keyframes bubble-rise {
    0% { transform: translateY(110vh); }
    100% { transform: translateY(-20vh); }
}

@keyframes bubble-wobble {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(12px); }
}

/* ============================================
   Ambient Particles
   ============================================ */
#particle-container {
    position: fixed;
    top: 0;
    left: 64px;
    width: calc(100% - 64px);
    height: 100%;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(0, 245, 212, 0.04);
    border-radius: 50%;
    animation: particle-drift 20s linear infinite;
    will-change: transform;
}

@keyframes particle-drift {
    0% { transform: translate(0, 0); opacity: 0.04; }
    25% { transform: translate(10px, -30px); opacity: 0.06; }
    50% { transform: translate(-5px, -60px); opacity: 0.04; }
    75% { transform: translate(8px, -90px); opacity: 0.06; }
    100% { transform: translate(0, -120px); opacity: 0.04; }
}

/* ============================================
   Hero Content Positioning
   ============================================ */
.hero-content {
    position: relative;
    z-index: 10;
    padding-left: clamp(2rem, 6vw, 6rem);
    padding-top: clamp(2rem, 8vh, 6rem);
    max-width: 60%;
}

/* ============================================
   Link Styles
   ============================================ */
a {
    color: var(--c-text);
    text-decoration: none;
    position: relative;
    transition: color 150ms ease-out;
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--c-cyan);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 200ms ease-out;
}

a:hover {
    color: var(--c-heading);
}

a:hover::after {
    transform: scaleX(1);
}

/* Retract on mouseout from right */
a:not(:hover)::after {
    transform-origin: right;
}

/* ============================================
   Hero Readout Typing Effect
   ============================================ */
#hero-readout {
    opacity: 0;
}

#hero-readout.visible {
    opacity: 1;
}

#hero-readout .char {
    opacity: 0;
    display: inline-block;
}

#hero-readout .char.typed {
    opacity: 1;
}

/* ============================================
   Loading / Entry Sequence
   ============================================ */
body.loading {
    overflow: hidden;
}

body.loading #depth-gauge {
    opacity: 0;
    transition: opacity 600ms ease-out;
}

body.loaded #depth-gauge {
    opacity: 1;
    transition: opacity 600ms ease-out;
}

/* ============================================
   Scroll Momentum - faster bubbles
   ============================================ */
body.scrolling .bubble {
    animation-duration: inherit;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    body {
        grid-template-columns: 48px 1fr;
    }

    #depth-gauge {
        width: 48px;
    }

    #bubble-container,
    #particle-container {
        left: 48px;
        width: calc(100% - 48px);
    }

    .hero-content {
        max-width: 90%;
        padding-left: clamp(1rem, 4vw, 2rem);
    }

    .section-inner {
        max-width: 90%;
    }

    .section-inner--centered {
        max-width: 90%;
    }

    .data-readout {
        display: none;
    }
}
