/* continuum.quest - Immersive underwater scroll experience */

/* ========================================
   CSS CUSTOM PROPERTIES
   ======================================== */
:root {
    --hadal-black: #040E14;
    --abyssal-teal: #071E2A;
    --thermocline: #0A3D4F;
    --frost-white: #E8F0F2;
    --coral-burst: #E8724A;
    --anemone-orange: #F5A962;
    --lumen-green: #4FE0B0;
    --reef-slate: #2A5565;

    --depth: 0;
    --bg-r: 232;
    --bg-g: 240;
    --bg-b: 242;
    --text-primary: #0A3D4F;
    --text-secondary: #2A5565;
    --text-body: #1A3A47;
}

/* ========================================
   RESET & BASE
   ======================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: 17px;
    line-height: 1.8;
    letter-spacing: 0.01em;
    background-color: rgb(var(--bg-r), var(--bg-g), var(--bg-b));
    color: var(--text-body);
    overflow-x: hidden;
    transition: background-color 0.05s linear, color 0.05s linear;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */
h1, h2, h3 {
    font-family: 'Jost', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

h1 {
    font-weight: 600;
    font-size: clamp(36px, 5vw, 64px);
}

h2 {
    font-weight: 500;
    font-size: clamp(24px, 3.5vw, 44px);
}

h3 {
    font-weight: 400;
    font-size: clamp(18px, 2.5vw, 28px);
}

code {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 14px;
    letter-spacing: 0.03em;
}

/* ========================================
   ZONE: SURFACE (0-100vh)
   ======================================== */
.zone-surface {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
}

.surface-content {
    margin-top: 40vh;
    text-align: center;
}

.site-title {
    font-family: 'Jost', sans-serif;
    font-weight: 600;
    font-size: clamp(40px, 7vw, 72px);
    color: var(--text-primary);
    letter-spacing: 0.08em;
    transition: color 0.05s linear;
}

.site-subtitle {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: 16px;
    color: var(--text-secondary);
    margin-top: 1rem;
    transition: color 0.05s linear;
}

.depth-line-surface {
    position: absolute;
    top: 75vh;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #2A5565;
}

.scroll-prompt {
    position: absolute;
    top: calc(75vh + 1.5rem);
    left: 50%;
    transform: translateX(-50%);
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    transition: color 0.05s linear, opacity 0.3s ease;
}

.scroll-prompt.faded {
    opacity: 0;
}

/* ========================================
   DEPTH MARKERS
   ======================================== */
.depth-marker {
    position: relative;
    width: 100%;
    height: 1px;
    background-color: rgba(42, 85, 101, 0.3);
    margin: 4rem 0;
}

.depth-label {
    position: absolute;
    right: 2rem;
    top: -0.8em;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 12px;
    color: var(--reef-slate);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color 0.05s linear;
}

/* ========================================
   TUTORIAL STEPS
   ======================================== */
.step {
    max-width: 720px;
    margin-left: 15%;
    margin-bottom: 4rem;
    padding: 2rem 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.step.visible {
    opacity: 1;
    transform: translateY(0);
}

.step-number {
    font-family: 'Jost', sans-serif;
    font-weight: 600;
    font-size: 48px;
    color: #E8724A;
    display: block;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.step h2 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    transition: color 0.05s linear;
}

.step .body {
    color: var(--text-body);
    margin-bottom: 1.5rem;
    transition: color 0.05s linear;
}

.code-block {
    border: 1px solid #2A5565;
    background-color: #071E2A;
    padding: 1rem 1.5rem;
    border-radius: 2px;
    overflow-x: auto;
}

.code-block code {
    color: #4FE0B0;
    white-space: nowrap;
}

/* ========================================
   SWIMMING FISH (Horizontal Crossers)
   ======================================== */
.swim-fish {
    position: relative;
    width: 100%;
    height: 80px;
    overflow: hidden;
    margin: 2rem 0;
    pointer-events: none;
}

.swim-fish .fish-svg {
    position: absolute;
    height: 60px;
    width: auto;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.swim-fish.active .fish-svg {
    opacity: 1;
    animation: swimAcross 6s linear forwards;
}

.swim-fish-2.active .fish-svg {
    animation-duration: 5s;
    animation-name: swimAcrossReverse;
}

.swim-fish-3.active .fish-svg {
    animation-duration: 7s;
}

.swim-fish-4.active .fish-svg {
    animation-duration: 8s;
    animation-name: swimAcrossReverse;
}

@keyframes swimAcross {
    0% {
        right: -150px;
        top: 40px;
    }
    12.5% {
        top: 25px;
    }
    25% {
        top: 45px;
    }
    37.5% {
        top: 20px;
    }
    50% {
        top: 42px;
    }
    62.5% {
        top: 28px;
    }
    75% {
        top: 40px;
    }
    87.5% {
        top: 22px;
    }
    100% {
        right: calc(100% + 150px);
        top: 35px;
    }
}

@keyframes swimAcrossReverse {
    0% {
        left: -150px;
        top: 35px;
    }
    12.5% {
        top: 22px;
    }
    25% {
        top: 42px;
    }
    37.5% {
        top: 28px;
    }
    50% {
        top: 38px;
    }
    62.5% {
        top: 25px;
    }
    75% {
        top: 44px;
    }
    87.5% {
        top: 30px;
    }
    100% {
        left: calc(100% + 150px);
        top: 38px;
    }
}

/* ========================================
   FISH SCHOOL (Background)
   ======================================== */
.fish-school {
    position: relative;
    width: 100%;
    height: 120px;
    overflow: hidden;
    pointer-events: none;
}

.school-fish {
    position: absolute;
    width: 30px;
    height: 15px;
}

.sf-1 { animation: schoolSwim 8s linear infinite; top: 20px; animation-delay: 0s; }
.sf-2 { animation: schoolSwim 8s linear infinite; top: 40px; animation-delay: -1.2s; }
.sf-3 { animation: schoolSwim 8s linear infinite; top: 55px; animation-delay: -2.5s; }
.sf-4 { animation: schoolSwim 8s linear infinite; top: 70px; animation-delay: -3.8s; }
.sf-5 { animation: schoolSwim 8s linear infinite; top: 85px; animation-delay: -5s; }
.sf-6 { animation: schoolSwim 9s linear infinite; top: 30px; animation-delay: -1.8s; }
.sf-7 { animation: schoolSwim 9s linear infinite; top: 65px; animation-delay: -4.2s; }

@keyframes schoolSwim {
    0% {
        left: -40px;
        transform: translateY(0px);
    }
    25% {
        transform: translateY(-8px);
    }
    50% {
        transform: translateY(5px);
    }
    75% {
        transform: translateY(-3px);
    }
    100% {
        left: calc(100% + 40px);
        transform: translateY(0px);
    }
}

/* ========================================
   ZONE: THERMOCLINE (100vh-250vh)
   ======================================== */
.zone-thermocline {
    padding: 4rem 0;
    position: relative;
}

/* ========================================
   ZONE: MESOPELAGIC (250vh-450vh)
   ======================================== */
.zone-mesopelagic {
    padding: 4rem 0;
    position: relative;
}

.paired-content {
    display: flex;
    gap: 3rem;
    max-width: 900px;
    margin-left: 15%;
    margin-bottom: 4rem;
    align-items: flex-start;
}

.text-column {
    flex: 1;
    max-width: 420px;
}

.text-column .step {
    margin-left: 0;
}

/* ========================================
   SPECIMEN CARDS
   ======================================== */
.specimen-card {
    width: 300px;
    flex-shrink: 0;
    perspective: 800px;
}

.specimen-inner {
    background: rgba(7, 30, 42, 0.6);
    border: 1px solid #2A5565;
    border-radius: 4px;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.15s ease-out, box-shadow 0.3s ease;
    box-shadow: 0 0 40px rgba(79, 224, 176, 0.15);
    transform-style: preserve-3d;
    will-change: transform;
}

.specimen-inner:hover {
    box-shadow: 0 0 60px rgba(79, 224, 176, 0.25);
}

.specimen-fish {
    width: 100%;
    height: auto;
    max-height: 140px;
    margin-bottom: 1rem;
}

.specimen-label {
    display: block;
    font-family: 'Jost', sans-serif;
    font-weight: 500;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #E8F0F2;
    margin-bottom: 0.5rem;
}

.specimen-data {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: #4FE0B0;
    letter-spacing: 0.03em;
}

/* ========================================
   ZONE: ABYSSAL (450vh-600vh)
   ======================================== */
.zone-abyssal {
    padding: 6rem 0;
}

.field-guide-title {
    font-family: 'Jost', sans-serif;
    font-weight: 600;
    font-size: clamp(24px, 3.5vw, 44px);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 4rem;
    transition: color 0.05s linear;
}

.field-guide-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem;
}

.guide-entry {
    background: rgba(7, 30, 42, 0.5);
    border: 1px solid #2A5565;
    border-radius: 4px;
    padding: 1.5rem;
    text-align: center;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.guide-entry:hover {
    box-shadow: 0 0 30px rgba(79, 224, 176, 0.12);
    transform: translateY(-4px);
}

.guide-fish-container {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.guide-fish {
    width: 100%;
    max-width: 120px;
    height: auto;
}

.guide-species {
    font-family: 'Jost', sans-serif;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #E8F0F2;
    margin-bottom: 1rem;
}

.guide-readout {
    border-top: 1px solid rgba(42, 85, 101, 0.4);
    padding-top: 0.75rem;
}

.guide-readout code {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: #4FE0B0;
    letter-spacing: 0.03em;
    line-height: 1.8;
}

/* ========================================
   ZONE: HADAL (600vh+)
   ======================================== */
.zone-hadal {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 0;
}

.hadal-content {
    text-align: center;
}

.bioluminescent-fish {
    margin-bottom: 3rem;
    animation: gentleDrift 6s ease-in-out infinite;
}

@keyframes gentleDrift {
    0%, 100% {
        transform: translateY(0px) translateX(0px);
    }
    25% {
        transform: translateY(-8px) translateX(4px);
    }
    50% {
        transform: translateY(4px) translateX(-3px);
    }
    75% {
        transform: translateY(-5px) translateX(2px);
    }
}

.hadal-fish {
    width: 160px;
    height: auto;
}

.hadal-lure {
    animation: biolumPulse 4s ease-in-out infinite;
}

.hadal-glow-1 {
    animation: biolumPulse 4s ease-in-out infinite;
    animation-delay: 0.2s;
}

.hadal-glow-2 {
    animation: biolumPulse 4s ease-in-out infinite;
    animation-delay: 0.4s;
}

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

.angler-lure {
    animation: biolumPulse 4s ease-in-out infinite;
}

.angler-glow {
    animation: biolumPulse 4s ease-in-out infinite;
    animation-delay: 0.3s;
}

.hadal-message {
    font-family: 'Jost', sans-serif;
    font-weight: 300;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: #E8F0F2;
    margin-bottom: 2rem;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.hadal-message.visible {
    opacity: 0.7;
}

.hadal-readout {
    border: 1px solid rgba(42, 85, 101, 0.3);
    background: rgba(7, 30, 42, 0.4);
    padding: 0.75rem 1.5rem;
    display: inline-block;
    border-radius: 2px;
    opacity: 0;
    transition: opacity 1.5s ease 0.5s;
}

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

.hadal-readout code {
    color: #4FE0B0;
    font-size: 12px;
}

/* ========================================
   BUBBLES (Decorative)
   ======================================== */
.bubbles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background-color: #4FE0B0;
    animation: bubbleRise linear infinite;
}

@keyframes bubbleRise {
    0% {
        transform: translateY(0) translateX(0);
        opacity: var(--bubble-opacity, 0.15);
    }
    25% {
        transform: translateY(-25vh) translateX(8px);
    }
    50% {
        transform: translateY(-50vh) translateX(-5px);
    }
    75% {
        transform: translateY(-75vh) translateX(6px);
    }
    100% {
        transform: translateY(-100vh) translateX(-3px);
        opacity: 0;
    }
}

/* ========================================
   DEPTH-DRIVEN COLOR CLASSES
   ======================================== */
body.depth-surface {
    --text-primary: #0A3D4F;
    --text-secondary: #2A5565;
    --text-body: #1A3A47;
}

body.depth-thermocline {
    --text-primary: #E8F0F2;
    --text-secondary: #C2D8E0;
    --text-body: #C2D8E0;
}

body.depth-mesopelagic {
    --text-primary: #E8F0F2;
    --text-secondary: #C2D8E0;
    --text-body: #C2D8E0;
}

body.depth-abyssal {
    --text-primary: #E8F0F2;
    --text-secondary: #C2D8E0;
    --text-body: #C2D8E0;
}

body.depth-hadal {
    --text-primary: #E8F0F2;
    --text-secondary: #C2D8E0;
    --text-body: #C2D8E0;
}

/* Dynamic coloring via CSS variables */
.site-title,
.step h2,
.field-guide-title {
    color: var(--text-primary);
}

.site-subtitle,
.scroll-prompt,
.depth-label {
    color: var(--text-secondary);
}

.step .body {
    color: var(--text-body);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 900px) {
    .field-guide-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .paired-content {
        flex-direction: column;
        margin-left: 5%;
        margin-right: 5%;
    }

    .specimen-card {
        width: 100%;
        max-width: 300px;
    }

    .step {
        margin-left: 5%;
        margin-right: 5%;
    }
}

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

    .step {
        margin-left: 1rem;
        margin-right: 1rem;
    }

    .paired-content {
        margin-left: 1rem;
        margin-right: 1rem;
    }
}
