/* =========================================================================
   supplychain.observer
   Subaquatic Logistics Cathedral — luxurious deep-sea control room
   Palette:
     Deep Background      #0B1E2D
     Mid Depth            #133847
     Surface Accent       #1E6B6B
     Pearl Warm           #FFF5EB
     Coral Blush          #F5D6C3
     Sand Whisper         #D4C8BA
     Bioluminescent Cyan  #7ECEC1
     Abyssal Teal         #0A3D3D
     Warning Amber        #E8B86D
   Fonts:
     Libre Baskerville (display, italics)
     Source Sans 3       (body, humanist)
     DM Mono             (data, accent)
   ========================================================================= */

:root {
    --c-deep:        #0B1E2D;
    --c-mid:         #133847;
    --c-surface:     #1E6B6B;
    --c-pearl:       #FFF5EB;
    --c-coral:       #F5D6C3;
    --c-sand:        #D4C8BA;
    --c-bio:         #7ECEC1;
    --c-abyss:       #0A3D3D;
    --c-amber:       #E8B86D;
    --c-deepsea:     #2A4A4A;

    --ease-elastic:  cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-water:    cubic-bezier(0.22, 0.61, 0.36, 1);

    --pad-x:         clamp(1.4rem, 4vw, 4rem);
    --pad-gauge:     clamp(2.2rem, 5vw, 4.6rem);

    --font-display:  "Libre Baskerville", "Lora", Georgia, serif;
    --font-body:     "Source Sans 3", "Inter", "Helvetica Neue", Arial, sans-serif;
    --font-mono:     "DM Mono", "JetBrains Mono", "Menlo", monospace;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--c-deep);
    color: var(--c-sand);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    overflow-x: hidden;
    min-height: 100vh;
    perspective: 1200px;
    transition: background-color 1.4s var(--ease-water);
}

body.depth-surface     { background-color: #0B1E2D; }
body.depth-thermocline { background-color: #102E3C; }
body.depth-midnight    { background-color: #133847; }
body.depth-bathyal     { background-color: #0E2F3C; }
body.depth-abyss       { background-color: #0A3D3D; }

/* =========================================================================
   Background ambient layers
   ========================================================================= */
#particle-field {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 800ms var(--ease-water);
}

#particle-field.visible {
    opacity: 1;
}

.coral-network {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.15;
    transition: opacity 1.6s var(--ease-water);
    filter: blur(0.4px);
}

body.depth-abyss .coral-network {
    opacity: 0.25;
}

.cartography {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    opacity: 0.85;
}

/* Cursor trail */
.cursor-trail {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
}

.cursor-trail .trail-dot {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--c-bio);
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 0 12px rgba(126, 206, 193, 0.8);
}

/* =========================================================================
   Depth Gauge (left rail navigation)
   ========================================================================= */
.depth-gauge {
    position: fixed;
    top: 8vh;
    left: clamp(0.8rem, 2vw, 2.2rem);
    bottom: 8vh;
    width: 14px;
    z-index: 50;
    pointer-events: auto;
}

.gauge-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    background: linear-gradient(
        to bottom,
        var(--c-pearl) 0%,
        var(--c-coral) 14%,
        var(--c-bio) 36%,
        var(--c-surface) 60%,
        var(--c-mid) 80%,
        var(--c-abyss) 100%
    );
    border-radius: 2px;
    box-shadow: 0 0 18px rgba(126, 206, 193, 0.18);
}

.gauge-dot {
    position: absolute;
    top: 0;
    left: 50%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--c-pearl);
    transform: translate(-50%, -50%);
    box-shadow:
        0 0 14px rgba(255, 245, 235, 0.7),
        0 0 28px rgba(126, 206, 193, 0.4);
    transition: top 0.6s var(--ease-elastic), background 1.2s var(--ease-water);
}

body.depth-abyss .gauge-dot {
    background: var(--c-amber);
    animation: abyssPulse 3.2s ease-in-out infinite;
}

@keyframes abyssPulse {
    0%, 100% { box-shadow: 0 0 14px rgba(232, 184, 109, 0.6), 0 0 28px rgba(126, 206, 193, 0.3); }
    50%      { box-shadow: 0 0 26px rgba(232, 184, 109, 0.95), 0 0 52px rgba(126, 206, 193, 0.6); }
}

.gauge-marks {
    list-style: none;
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.gauge-marks li {
    position: absolute;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 245, 235, 0.35);
    cursor: pointer;
    pointer-events: auto;
}

.gauge-marks li span {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--c-bio);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s var(--ease-elastic);
    white-space: nowrap;
    pointer-events: none;
}

.gauge-marks li:hover span,
.gauge-marks li.active span {
    opacity: 1;
    transform: translateY(-50%) translateX(4px);
}

/* =========================================================================
   Main descent column
   ========================================================================= */
.descent {
    position: relative;
    z-index: 10;
    padding-left: var(--pad-gauge);
    padding-right: var(--pad-x);
    transform-style: preserve-3d;
}

.depth-plane {
    position: relative;
    min-height: 100vh;
    padding-top: clamp(4rem, 12vh, 10rem);
    padding-bottom: clamp(4rem, 12vh, 10rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    transform-style: preserve-3d;
    will-change: transform, opacity;
}

/* =========================================================================
   Surface plane (hero)
   ========================================================================= */
.plane-surface {
    padding-top: 18vh;
}

.surface-line {
    position: absolute;
    top: 14%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent 0%,
        rgba(126, 206, 193, 0.5) 8%,
        rgba(126, 206, 193, 0.5) 92%,
        transparent 100%
    );
    transform-origin: left center;
    transform: scaleX(0);
    transition: transform 1.2s var(--ease-elastic);
}

.surface-line.drawn {
    transform: scaleX(1);
}

.hero-stack {
    max-width: 65ch;
    width: 100%;
}

.meta-eyebrow {
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: clamp(0.7rem, 1.1vw, 0.82rem);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--c-bio);
    margin-bottom: 1.6rem;
    opacity: 0;
    animation: fadeUp 0.9s var(--ease-water) 0.5s forwards;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2.2rem, 5vw, 4rem);
    line-height: 1.12;
    letter-spacing: 0.01em;
    color: var(--c-pearl);
    margin-bottom: 1.8rem;
}

.hero-line {
    display: block;
    overflow: hidden;
}

.hero-line span.letter,
.hero-line .letter {
    display: inline-block;
    transform: translateY(40%) scale(1.1);
    opacity: 0;
}

.hero-line.animated .letter {
    animation: letterRise 0.9s var(--ease-elastic) forwards;
}

.hero-line em {
    font-style: italic;
    color: var(--c-coral);
}

@keyframes letterRise {
    0%   { transform: translateY(40%) scale(1.1); opacity: 0; }
    60%  { transform: translateY(-3%) scale(0.99); opacity: 1; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes fadeUp {
    0%   { opacity: 0; transform: translateY(12px); }
    100% { opacity: 1; transform: translateY(0); }
}

.hero-subtitle {
    font-weight: 300;
    color: var(--c-sand);
    max-width: 52ch;
    margin-top: 1.2rem;
    opacity: 0;
    animation: fadeUp 1.1s var(--ease-water) 1.6s forwards;
}

/* Data ribbon */
.data-ribbon {
    position: relative;
    margin-top: 3rem;
    height: 32px;
    overflow: hidden;
    border-top: 1px solid rgba(126, 206, 193, 0.18);
    border-bottom: 1px solid rgba(126, 206, 193, 0.18);
    background:
        linear-gradient(90deg,
            rgba(11, 30, 45, 0.9) 0%,
            rgba(11, 30, 45, 0) 8%,
            rgba(11, 30, 45, 0) 92%,
            rgba(11, 30, 45, 0.9) 100%);
    opacity: 0;
    animation: fadeUp 1.2s var(--ease-water) 2.0s forwards;
}

.ribbon-track {
    display: flex;
    gap: 3.2rem;
    height: 100%;
    align-items: center;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    color: var(--c-bio);
    will-change: transform;
    animation: ribbonScroll 60s linear infinite;
    padding-left: 100%;
}

.ribbon-track span {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.ribbon-track .ribbon-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--c-bio);
    box-shadow: 0 0 8px rgba(126, 206, 193, 0.7);
}

.ribbon-track .ribbon-amber {
    color: var(--c-amber);
}

@keyframes ribbonScroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-100%); }
}

/* =========================================================================
   Observation panels
   ========================================================================= */
.observation-panel {
    position: relative;
    max-width: min(72ch, 65vw);
    padding: clamp(1.6rem, 3.4vw, 2.8rem);
    border-radius: 16px;
    background: rgba(15, 40, 55, 0.42);
    backdrop-filter: blur(12px) saturate(1.4);
    -webkit-backdrop-filter: blur(12px) saturate(1.4);
    border: 1px solid rgba(255, 240, 230, 0.12);
    box-shadow:
        inset 0 0 30px rgba(180, 230, 220, 0.06),
        0 0 60px rgba(11, 30, 45, 0.4);
    transform: translateY(48px) scale(0.96);
    opacity: 0;
    transition:
        transform 1.1s var(--ease-elastic),
        opacity 0.9s var(--ease-water);
    will-change: transform, opacity;
    overflow: hidden;
}

.observation-panel::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 17px;
    padding: 1px;
    background: linear-gradient(
        135deg,
        rgba(126, 206, 193, 0.0) 0%,
        rgba(126, 206, 193, 0.5) 25%,
        rgba(245, 214, 195, 0.5) 50%,
        rgba(232, 184, 109, 0.5) 75%,
        rgba(126, 206, 193, 0.0) 100%);
    background-size: 300% 300%;
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    opacity: 0.55;
    animation: shimmer 12s linear infinite;
    pointer-events: none;
}

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

.observation-panel.in-view {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.observation-panel.panel-wide {
    max-width: min(92ch, 78vw);
}

.observation-panel.panel-final {
    max-width: min(68ch, 60vw);
    background: rgba(10, 61, 61, 0.5);
}

/* Light-panel variant — uses deep-sea green text on warm pearl per DESIGN.md */
.observation-panel.panel-light {
    background: rgba(255, 245, 235, 0.92);
    color: #2A4A4A;
}

.observation-panel.panel-light .panel-title,
.observation-panel.panel-light .panel-body p {
    color: #2A4A4A;
}

.panel-header {
    margin-bottom: 1.6rem;
}

.panel-tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--c-bio);
    margin-bottom: 0.9rem;
    padding: 0.25rem 0.7rem 0.3rem;
    border: 1px solid rgba(126, 206, 193, 0.3);
    border-radius: 999px;
}

.panel-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.6rem, 3.4vw, 2.6rem);
    line-height: 1.18;
    letter-spacing: 0.01em;
    color: var(--c-pearl);
}

.panel-title em {
    font-style: italic;
    color: var(--c-coral);
}

.panel-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.4rem 1.8rem;
    padding: 1.2rem 0 1.6rem;
    border-bottom: 1px solid rgba(212, 200, 186, 0.12);
    margin-bottom: 1.6rem;
}

.data-cell {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.data-label {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--c-sand);
    opacity: 0.75;
}

.data-value {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: clamp(1.2rem, 2.2vw, 1.55rem);
    letter-spacing: 0.04em;
    color: var(--c-bio);
}

.panel-body p {
    margin-bottom: 1.05rem;
    color: var(--c-sand);
}

.panel-body p:last-child {
    margin-bottom: 0;
}

.panel-body em {
    font-style: italic;
    color: var(--c-coral);
}

.panel-body .bio {
    font-family: var(--font-mono);
    color: var(--c-bio);
    font-weight: 500;
}

.panel-aside {
    margin-top: 1.4rem !important;
    padding-left: 1rem;
    border-left: 1px solid rgba(245, 214, 195, 0.35);
    color: var(--c-coral) !important;
    font-weight: 300;
    font-size: 0.95em;
}

.panel-body.two-column {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 2.2rem;
    align-items: start;
}

@media (max-width: 820px) {
    .panel-body.two-column {
        grid-template-columns: 1fr;
    }
}

/* Filament list */
.filament-list {
    list-style: none;
    margin-top: 1.6rem;
    padding-top: 1.4rem;
    border-top: 1px solid rgba(212, 200, 186, 0.12);
    display: grid;
    gap: 0.6rem;
}

.filament-list li {
    display: grid;
    grid-template-columns: 14px 1fr auto;
    align-items: center;
    gap: 0.9rem;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    color: var(--c-sand);
}

.filament-list .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--c-bio);
    box-shadow: 0 0 8px rgba(126, 206, 193, 0.7);
    animation: filamentPulse 4.6s ease-in-out infinite;
}

.filament-list li:nth-child(2) .dot { animation-delay: 0.6s; }
.filament-list li:nth-child(3) .dot { animation-delay: 1.4s; }
.filament-list li:nth-child(4) .dot { animation-delay: 2.2s; }

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

.filament-label {
    color: var(--c-pearl);
    font-weight: 300;
}

.filament-value {
    color: var(--c-bio);
    font-weight: 500;
}

/* Manifest card */
.manifest-card {
    border: 1px solid rgba(126, 206, 193, 0.18);
    border-radius: 12px;
    padding: 1.2rem 1.3rem;
    background: rgba(11, 30, 45, 0.4);
}

.manifest-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--c-amber);
    margin-bottom: 0.9rem;
}

.manifest-list {
    list-style: none;
    display: grid;
    gap: 0.55rem;
}

.manifest-list li {
    display: grid;
    grid-template-columns: 1fr auto 1.1fr;
    gap: 0.9rem;
    align-items: baseline;
    padding: 0.5rem 0;
    border-bottom: 1px dashed rgba(212, 200, 186, 0.12);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
}

.manifest-list li:last-child {
    border-bottom: none;
}

.m-route {
    color: var(--c-bio);
    font-weight: 500;
}

.m-load {
    color: var(--c-pearl);
    font-weight: 400;
}

.m-cargo {
    color: var(--c-sand);
    font-weight: 300;
    text-align: right;
    font-style: italic;
    font-family: var(--font-body);
}

/* Ambient callout (jellyfish quote) */
.ambient-callout {
    position: absolute;
    right: clamp(1rem, 6vw, 6rem);
    top: 50%;
    transform: translateY(-50%);
    width: clamp(120px, 18vw, 220px);
    pointer-events: none;
}

.jellyfish {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50% 50% 45% 45%;
    background:
        radial-gradient(ellipse at 50% 35%,
            rgba(255, 245, 235, 0.5) 0%,
            rgba(245, 214, 195, 0.3) 25%,
            rgba(126, 206, 193, 0.2) 55%,
            transparent 80%);
    filter: blur(4px);
    animation: jellyDrift 8s ease-in-out infinite;
    margin-bottom: 1rem;
}

@keyframes jellyDrift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25%      { transform: translate(8px, -12px) scale(1.04); }
    50%      { transform: translate(-6px, -22px) scale(0.98); }
    75%      { transform: translate(10px, -10px) scale(1.02); }
}

.ambient-quote {
    font-family: var(--font-display);
    font-weight: 400;
    font-style: italic;
    color: var(--c-coral);
    text-align: center;
    font-size: 1.05rem;
    line-height: 1.4;
    opacity: 0.7;
}

/* =========================================================================
   Fog bands
   ========================================================================= */
.fog-band {
    position: relative;
    height: 30vh;
    pointer-events: none;
}

.fog-band-down {
    background: linear-gradient(to bottom,
        transparent 0%,
        rgba(11, 30, 45, 0.6) 50%,
        rgba(19, 56, 71, 0.85) 100%);
}

.fog-band-deep {
    background: linear-gradient(to bottom,
        rgba(19, 56, 71, 0.85) 0%,
        rgba(11, 30, 45, 1) 50%,
        rgba(19, 56, 71, 0.85) 100%);
    height: 40vh;
}

.fog-band-deeper {
    background: linear-gradient(to bottom,
        rgba(19, 56, 71, 0.85) 0%,
        rgba(11, 30, 45, 1) 50%,
        rgba(10, 61, 61, 0.92) 100%);
    height: 45vh;
}

.fog-band-abyss {
    background: linear-gradient(to bottom,
        rgba(10, 61, 61, 0.92) 0%,
        rgba(10, 61, 61, 1) 50%,
        rgba(10, 61, 61, 0.94) 100%);
    height: 50vh;
}

/* =========================================================================
   Abyss footer
   ========================================================================= */
.signoff {
    margin-top: 1.6rem !important;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    color: var(--c-pearl);
}

.warm-glow {
    color: var(--c-amber);
}

.abyss-footer {
    margin-top: 5rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(126, 206, 193, 0.18);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.8rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: var(--c-sand);
    opacity: 0.7;
    max-width: min(92ch, 78vw);
}

.footer-line .bio,
.footer-coords .bio {
    color: var(--c-bio);
    font-weight: 500;
}

/* =========================================================================
   Reveal helpers
   ========================================================================= */
.reveal {
    transform: translateY(60px) scale(0.96);
    opacity: 0;
}

.reveal.in-view {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 720px) {
    .descent {
        padding-left: clamp(2.4rem, 8vw, 3.2rem);
        padding-right: 1.2rem;
    }

    .observation-panel,
    .observation-panel.panel-wide,
    .observation-panel.panel-final {
        max-width: 100%;
    }

    .ambient-callout {
        display: none;
    }

    .depth-gauge {
        left: 0.4rem;
    }

    .gauge-marks li span {
        display: none;
    }
}

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