/* ============================================================
   cbdc.bar - Inflated 3D Aquarium Data Dashboard
   ============================================================ */

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

:root {
    --void: #0B0E14;
    --card-base: #141820;
    --card-edge: #0D1017;
    --grid-line: #1E2330;
    --text-primary: #F2F0EB;
    --text-secondary: #A8B2C1;
    --accent-teal: #00E6B0;
    --accent-orange: #FF6B35;
    --accent-purple: #7B5CFF;
    --accent-gold: #F5C842;
    --danger: #FF3B5C;
    --elastic: cubic-bezier(0.34, 1.56, 0.64, 1);
    --fade: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--void);
    color: var(--text-primary);
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(14px, 1.2vw, 18px);
    line-height: 1.6;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Navigation Pill --- */
.nav-pill {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgba(20, 24, 32, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 40px;
    padding: 10px 28px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.06);
}

.nav-pill-text {
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    font-weight: 400;
    font-size: 16px;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

/* --- Hero Section --- */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: var(--void);
}

.hero-content {
    text-align: center;
    z-index: 10;
    position: relative;
}

.hero-title {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(48px, 8vw, 120px);
    color: var(--text-primary);
    line-height: 1.15;
    letter-spacing: -0.02em;
    opacity: 0;
    transition: opacity 1.2s var(--fade);
}

.hero-title.visible {
    opacity: 1;
}

.hero-tagline {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(16px, 1.5vw, 22px);
    color: var(--text-secondary);
    margin-top: 20px;
    opacity: 0;
    transition: opacity 1.2s var(--fade);
}

.hero-tagline.visible {
    opacity: 1;
}

/* --- Hero Fish --- */
.hero-fish {
    position: absolute;
    z-index: 1;
    opacity: 0.25;
}

.hero-fish-1 {
    width: 180px;
    top: 20%;
    animation: swimRight 28s linear infinite;
    opacity: 0.2;
}

.hero-fish-2 {
    width: 120px;
    top: 60%;
    animation: swimLeft 22s linear infinite;
    opacity: 0.3;
}

.hero-fish-3 {
    width: 100px;
    top: 75%;
    animation: swimRight 32s linear infinite;
    animation-delay: -8s;
    opacity: 0.15;
}

.hero-fish-4 {
    width: 80px;
    top: 35%;
    animation: swimLeft 26s linear infinite;
    animation-delay: -12s;
    opacity: 0.12;
}

@keyframes swimRight {
    0% { left: -200px; }
    100% { left: calc(100vw + 200px); }
}

@keyframes swimLeft {
    0% { right: -200px; transform: scaleX(-1); }
    100% { right: calc(100vw + 200px); transform: scaleX(-1); }
}

/* --- Decorative Bubbles --- */
.bubble {
    position: absolute;
    border-radius: 50%;
    background: var(--accent-teal);
    opacity: 0.15;
    pointer-events: none;
}

.bubble-hero {
    z-index: 2;
}

.bubble-1 {
    width: 8px;
    height: 8px;
    left: 15%;
    bottom: -10px;
    animation: bubbleFloat 8s ease-in-out infinite;
}

.bubble-2 {
    width: 5px;
    height: 5px;
    left: 35%;
    bottom: -10px;
    animation: bubbleFloat 11s ease-in-out infinite;
    animation-delay: -3s;
}

.bubble-3 {
    width: 10px;
    height: 10px;
    left: 55%;
    bottom: -10px;
    animation: bubbleFloat 9s ease-in-out infinite;
    animation-delay: -5s;
}

.bubble-4 {
    width: 6px;
    height: 6px;
    left: 72%;
    bottom: -10px;
    animation: bubbleFloat 13s ease-in-out infinite;
    animation-delay: -7s;
}

.bubble-5 {
    width: 4px;
    height: 4px;
    left: 88%;
    bottom: -10px;
    animation: bubbleFloat 7s ease-in-out infinite;
    animation-delay: -2s;
}

@keyframes bubbleFloat {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.15;
    }
    90% {
        opacity: 0.08;
    }
    100% {
        transform: translateY(-100vh) translateX(20px);
        opacity: 0;
    }
}

/* --- Card Bubbles --- */
.card-bubbles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 24px;
    pointer-events: none;
    z-index: 0;
}

.bubble-card {
    width: 6px;
    height: 6px;
    position: absolute;
    bottom: -10px;
}

.bubble-card:nth-child(1) {
    left: 20%;
    animation: bubbleCardFloat 8s ease-in-out infinite;
}

.bubble-card:nth-child(2) {
    left: 55%;
    animation: bubbleCardFloat 11s ease-in-out infinite;
    animation-delay: -4s;
    width: 4px;
    height: 4px;
}

.bubble-card:nth-child(3) {
    left: 80%;
    animation: bubbleCardFloat 14s ease-in-out infinite;
    animation-delay: -7s;
    width: 8px;
    height: 8px;
}

@keyframes bubbleCardFloat {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.12;
    }
    90% {
        opacity: 0.05;
    }
    100% {
        transform: translateY(-300px) translateX(10px);
        opacity: 0;
    }
}

/* --- Card Grid Section --- */
.card-grid-section {
    padding: 80px 0;
}

.card-grid {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 clamp(24px, 4vw, 64px);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(16px, 2vw, 32px);
}

/* --- Cards --- */
.card {
    position: relative;
    border-radius: 24px;
    background: radial-gradient(ellipse at 40% 30%, var(--card-base) 0%, var(--card-edge) 100%);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.08);
    padding: clamp(24px, 3vw, 40px);
    overflow: hidden;
    transform: scale(0.92);
    opacity: 0;
    transition: transform 0.8s var(--elastic), opacity 0.8s var(--elastic), box-shadow 0.6s var(--elastic);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 320px;
}

.card.in-view {
    transform: scale(1);
    opacity: 1;
}

.card:hover {
    transform: scale(1.03);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5), inset 0 2px 6px rgba(255, 255, 255, 0.12);
}

.card.in-view:hover {
    transform: scale(1.03);
}

.card-span-2 {
    grid-column: span 2;
}

/* --- Card Content --- */
.card-content {
    position: relative;
    z-index: 2;
}

.card-title {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(20px, 2vw, 32px);
    color: var(--text-primary);
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
}

.card-body {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(14px, 1.2vw, 18px);
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.card-data {
    display: inline-block;
    margin-top: 4px;
}

.mono-data {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 13px;
    color: var(--accent-teal);
    letter-spacing: 0;
}

/* --- Card Fish --- */
.card-fish-container {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 16px;
}

.card-fish-svg {
    width: 140px;
    height: auto;
    transition: filter 0.6s var(--elastic);
}

.card:hover .card-fish-svg {
    filter: drop-shadow(0 0 12px currentColor);
}

.card-fish .card-fish-container .fish-discus {
    color: var(--accent-purple);
}

.card-fish .card-fish-container .fish-clown {
    color: var(--accent-orange);
}

.card-fish .card-fish-container .fish-idol {
    color: var(--accent-gold);
}

.card-fish .card-fish-container .fish-tang {
    color: var(--accent-teal);
}

/* --- Blue Tang Swim Animation --- */
.fish-swim-container {
    overflow: hidden;
}

.fish-swim {
    animation: tangSwim 8s ease-in-out infinite;
}

@keyframes tangSwim {
    0% { transform: translateX(-60px); }
    50% { transform: translateX(60px); }
    100% { transform: translateX(-60px); }
}

/* --- Fin Wave Animation --- */
.fin-wave {
    animation: finWave 2s ease-in-out infinite;
    transform-origin: center;
}

@keyframes finWave {
    0%, 100% { transform: rotate(-3deg) scaleY(0.95); }
    50% { transform: rotate(3deg) scaleY(1.05); }
}

/* --- Clownfish Band Pulse --- */
.clown-band {
    animation: bandPulse 1.8s ease-in-out infinite;
}

.clown-band-1 { animation-delay: 0s; }
.clown-band-2 { animation-delay: 0.3s; }
.clown-band-3 { animation-delay: 0.6s; }

@keyframes bandPulse {
    0%, 100% { opacity: 0.85; }
    50% { opacity: 1; }
}

/* --- Moorish Idol Dorsal Sway --- */
.idol-dorsal {
    animation: dorsalSway 3s ease-in-out infinite;
    transform-origin: 110px 55px;
}

@keyframes dorsalSway {
    0%, 100% { transform: rotate(-8deg); }
    50% { transform: rotate(8deg); }
}

/* --- Card Data Viz --- */
.card-viz {
    position: relative;
    z-index: 1;
    margin-top: 16px;
    display: flex;
    justify-content: center;
}

.viz-svg {
    width: 100%;
    max-width: 300px;
    height: auto;
}

.card-span-2 .viz-svg {
    max-width: 500px;
}

/* --- Yield Curve Animation --- */
.yield-path {
    stroke-dasharray: 320;
    stroke-dashoffset: 320;
    transition: stroke-dashoffset 1.5s var(--elastic);
}

.card.in-view .yield-path {
    stroke-dashoffset: 0;
}

/* --- Gauge Rotation --- */
.gauge-fill {
    transition: stroke-dasharray 1.5s var(--elastic);
}

/* Gauge hover acceleration */
.card:hover .gauge-fill {
    animation: gaugeRotate 2s linear infinite;
}

@keyframes gaugeRotate {
    0% { transform: rotate(-90deg); }
    100% { transform: rotate(270deg); }
}

/* Keep original transform for non-hovered */
.gauge-fill {
    transform-origin: center;
}

/* --- Sankey Flow Animation --- */
.sankey-flow {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 1.8s var(--elastic);
}

.card.in-view .sankey-flow {
    stroke-dashoffset: 0;
}

.sankey-flow-1 { transition-delay: 0s; }
.sankey-flow-2 { transition-delay: 0.15s; }
.sankey-flow-3 { transition-delay: 0.3s; }
.sankey-flow-4 { transition-delay: 0.45s; }
.sankey-flow-5 { transition-delay: 0.6s; }
.sankey-flow-6 { transition-delay: 0.75s; }
.sankey-flow-7 { transition-delay: 0.9s; }
.sankey-flow-8 { transition-delay: 1.05s; }

/* --- Wave Path Animation --- */
.wave-path {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 2s var(--elastic);
}

.card.in-view .wave-path {
    stroke-dashoffset: 0;
}

.wave-1 { transition-delay: 0s; }
.wave-2 { transition-delay: 0.3s; }

/* --- Bar Chart Animation --- */
.bar {
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.8s var(--elastic);
}

.card.in-view .bar {
    transform: scaleY(1);
}

.bar-1 { transition-delay: 0s; }
.bar-2 { transition-delay: 0.1s; }
.bar-3 { transition-delay: 0.2s; }
.bar-4 { transition-delay: 0.3s; }
.bar-5 { transition-delay: 0.4s; }
.bar-6 { transition-delay: 0.5s; }

/* --- Network Viz Pulse --- */
.viz-network circle {
    animation: nodePulse 3s ease-in-out infinite;
}

.viz-network circle:nth-child(2) { animation-delay: 0.5s; }
.viz-network circle:nth-child(3) { animation-delay: 1s; }
.viz-network circle:nth-child(4) { animation-delay: 1.5s; }
.viz-network circle:nth-child(5) { animation-delay: 2s; }

@keyframes nodePulse {
    0%, 100% { r: attr(r); opacity: 0.6; }
    50% { opacity: 0.9; }
}

/* --- Closing Section --- */
.closing {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--void);
    padding: 80px 24px;
}

.closing-fish {
    width: 40vw;
    max-width: 500px;
    margin-bottom: 48px;
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 0.8s var(--elastic), transform 0.8s var(--elastic);
}

.closing-fish.in-view {
    opacity: 1;
    transform: scale(1);
}

.fish-idol-large {
    width: 100%;
    height: auto;
}

.closing-content {
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s var(--elastic), transform 0.8s var(--elastic);
    transition-delay: 0.3s;
}

.closing-content.in-view {
    opacity: 1;
    transform: translateY(0);
}

.closing-domain {
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(28px, 4vw, 56px);
    color: var(--text-primary);
    margin-bottom: 16px;
}

.closing-tagline {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(14px, 1.2vw, 20px);
    color: var(--text-secondary);
    max-width: 480px;
    margin: 0 auto;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .card-span-2 {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
    .card-span-2 {
        grid-column: span 1;
    }
    .card {
        min-height: 260px;
    }
    .hero-fish {
        display: none;
    }
    .closing-fish {
        width: 70vw;
    }
}
