/* ============================================
   cbdc.bar - Styles
   ============================================ */

/* CSS Custom Properties */
:root {
    --void: #0a1628;
    --surface: #14233d;
    --shadow-dark: #060e1c;
    --shadow-light: #1c3358;
    --accent-primary: #4a7cff;
    --accent-secondary: #3de8b0;
    --text-primary: #d4dce8;
    --text-secondary: #7a8ba6;
    --highlight: #c9a84c;
    --accent-light: #6b9aff;
    --divider: #2a3a5c;
    --neo-outer: #0d1a2e;
    --neo-surface: #1a2d4a;
    --coin-stroke: #6b7fa3;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--void);
    color: var(--text-primary);
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.5vw, 1.15rem);
    line-height: 1.75;
    overflow-x: hidden;
}

/* ============================================
   Scroll Progress Indicator
   ============================================ */
#scroll-progress {
    position: fixed;
    top: 0;
    right: 0;
    width: 2px;
    height: 0%;
    background-color: var(--accent-primary);
    z-index: 1000;
    transition: height 100ms linear;
}

/* ============================================
   Tooltip
   ============================================ */
#tooltip-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--surface);
    color: var(--text-secondary);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    z-index: 999;
    box-shadow: 4px 4px 12px var(--shadow-dark), inset -1px -1px 4px rgba(28, 51, 88, 0.4);
    transition: background-color 300ms ease-out;
}

#tooltip-trigger:hover {
    background-color: var(--accent-secondary);
    color: var(--void);
}

#tooltip {
    position: absolute;
    bottom: 48px;
    right: 0;
    background-color: var(--accent-secondary);
    color: var(--void);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    padding: 8px 12px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 300ms ease-out, transform 300ms ease-out;
}

#tooltip-trigger:hover #tooltip {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Sections
   ============================================ */
.section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.section-tall {
    min-height: 300vh;
}

.section-inner {
    position: relative;
    width: 100%;
    max-width: 1200px;
    padding: 60px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.section-split {
    flex-direction: row;
    gap: 60px;
}

.section-centered {
    align-items: center;
    justify-content: center;
}

/* Section dividers */
.section-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-top: 1px solid rgba(42, 58, 92, 0.4);
}

/* Section transition effects (applied via JS) */
.section.section-exiting {
    transform: scale(0.98);
    opacity: 0.6;
    transition: transform 800ms ease-out, opacity 600ms ease-out;
}

.section.section-entering {
    transform: scale(1);
    opacity: 1;
    transition: transform 800ms ease-out, opacity 600ms ease-out;
}

/* ============================================
   Micro-Typography Fragments
   ============================================ */
.micro-fragment {
    position: absolute;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.04;
    pointer-events: none;
    letter-spacing: 0.08em;
    animation: fragment-drift 60s ease-in-out infinite;
    animation-delay: var(--drift-delay, 0s);
}

@keyframes fragment-drift {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* ============================================
   Hero Section (Section 1)
   ============================================ */
#section-hero .section-inner {
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.hero-title {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(4rem, 10vw, 12rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-primary);
    opacity: 0;
    transform: translateY(-40px);
    animation: hero-title-enter 600ms ease-out 3400ms forwards;
}

@keyframes hero-title-enter {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.loading-bar {
    width: 80vw;
    height: 8px;
    background-color: var(--surface);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    margin: 24px 0;
}

.loading-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-light));
    border-radius: 4px;
    box-shadow: 0 0 8px rgba(74, 124, 255, 0.3);
    position: relative;
}

/* Hero bar specific animation */
#hero-bar {
    opacity: 0;
    animation: hero-bar-track-enter 400ms ease-in 500ms forwards;
}

@keyframes hero-bar-track-enter {
    to { opacity: 1; }
}

#hero-bar-fill {
    animation: hero-bar-fill-anim 2500ms ease-out 900ms forwards;
}

@keyframes hero-bar-fill-anim {
    from { width: 0%; }
    to { width: 73%; }
}

/* Hero bar gentle pulse after fill */
#hero-bar-fill {
    animation: hero-bar-fill-anim 2500ms ease-out 900ms forwards, hero-bar-pulse 3s ease-in-out 3400ms infinite;
}

@keyframes hero-bar-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

.hero-date {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    opacity: 0;
    animation: hero-date-enter 300ms ease-out 4000ms forwards;
}

@keyframes hero-date-enter {
    to { opacity: 1; }
}

/* ============================================
   Micro-Bars (Section Dividers)
   ============================================ */
.micro-bar {
    width: 120px;
    height: 2px;
    background-color: var(--surface);
    border-radius: 2px;
    overflow: hidden;
    margin: 20px 0;
}

.micro-bar-fill {
    height: 100%;
    width: var(--fill, 50%);
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-light));
    border-radius: 2px;
    box-shadow: 0 0 4px rgba(74, 124, 255, 0.2);
}

/* ============================================
   Section 2: What Was (Wireframe Coin)
   ============================================ */
.split-left {
    flex: 0 0 40%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.split-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
}

.section-heading {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(2rem, 5vw, 5rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.body-text {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.5vw, 1.15rem);
    line-height: 1.75;
    color: var(--text-primary);
}

.mono-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    letter-spacing: 0.08em;
    color: var(--text-secondary);
}

.coin-container {
    width: clamp(180px, 25vw, 300px);
    height: clamp(180px, 25vw, 300px);
    perspective: 600px;
}

.wireframe-coin {
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    animation: coin-rotate 12s linear infinite paused;
}

.wireframe-coin.active {
    animation-play-state: running;
}

@keyframes coin-rotate {
    from { transform: rotateY(0deg) rotateX(15deg); }
    to { transform: rotateY(360deg) rotateX(15deg); }
}

.coin-edge {
    fill: none;
    stroke: var(--coin-stroke);
    stroke-width: 0.5;
    opacity: 0.6;
}

.coin-edge.accent {
    stroke: var(--highlight);
}

.coin-vertex {
    fill: var(--highlight);
    opacity: 0.6;
}

.wireframe-coin.drifting .coin-vertex {
    animation: vertex-drift var(--vdur, 4s) ease-in-out infinite;
}

@keyframes vertex-drift {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(var(--vdx, 1px), var(--vdy, -1px)); }
    75% { transform: translate(calc(var(--vdx, 1px) * -1), calc(var(--vdy, -1px) * -1)); }
}

/* ============================================
   Section 3: What Is (Sonar + Card)
   ============================================ */
.sonar-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vw;
    height: 60vw;
    pointer-events: none;
}

.sonar-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    border: 1px solid var(--accent-primary);
    opacity: 0;
    transform: translate(-50%, -50%);
    animation: sonar-expand 3s ease-out infinite;
    animation-delay: var(--ring-delay, 0s);
}

@keyframes sonar-expand {
    0% {
        width: 0;
        height: 0;
        opacity: 0.15;
    }
    100% {
        width: 60vw;
        height: 60vw;
        opacity: 0;
    }
}

/* Neomorphic Card */
.neo-card {
    background-color: var(--neo-surface);
    border-radius: 24px;
    box-shadow: 8px 8px 24px var(--neo-outer), inset -2px -2px 8px rgba(28, 51, 88, 0.4);
    transition: box-shadow 300ms ease-out, transform 300ms ease-out;
}

.neo-card:hover {
    box-shadow: 12px 12px 32px var(--neo-outer), inset -2px -2px 8px rgba(28, 51, 88, 0.4);
    transform: translateY(-2px);
}

.definition-card {
    max-width: 480px;
    padding: 48px 40px;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.definition-card .section-heading {
    font-size: clamp(1.5rem, 3vw, 3rem);
    margin-bottom: 8px;
}

/* ============================================
   Section 4: What Becomes (Currency Grid)
   ============================================ */
.currency-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 560px;
    margin-top: 40px;
}

/* Bauhaus-influenced asymmetric offsets */
.currency-tile:nth-child(2) {
    margin-top: 24px;
}

.currency-tile:nth-child(5) {
    margin-top: -16px;
}

.currency-tile:nth-child(8) {
    margin-top: 32px;
}

.currency-tile {
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-radius: 16px;
    cursor: default;
}

.currency-symbol {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 2.5rem;
    color: var(--text-primary);
    transition: opacity 600ms ease-out;
}

.unified-glyph {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 600ms ease-out;
}

.currency-tile.morphed .currency-symbol {
    opacity: 0;
}

.currency-tile.morphed .unified-glyph {
    opacity: 1;
    animation: glyph-clip-reveal 1.2s ease-out forwards;
}

@keyframes glyph-clip-reveal {
    from { clip-path: circle(0% at 50% 50%); }
    to { clip-path: circle(100% at 50% 50%); }
}

/* Unified pulse after all morphed */
.currency-grid.all-morphed .currency-tile.morphed .unified-glyph {
    animation: unified-pulse 2s ease-in-out infinite;
}

@keyframes unified-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ============================================
   Section 5: The Bar
   ============================================ */
.section-tall .section-inner {
    position: sticky;
    top: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bar-section-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.final-bar-container {
    display: flex;
    align-items: center;
    gap: 24px;
}

.final-bar {
    width: 60vw;
}

#final-bar-fill {
    width: 74%;
    transition: width 100ms linear;
}

.final-bar-percent {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    min-width: 60px;
}

.bar-question {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--text-secondary);
    font-style: italic;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .section-split {
        flex-direction: column;
        gap: 40px;
    }

    .split-left {
        flex: none;
    }

    .currency-grid {
        gap: 16px;
    }

    .currency-tile {
        width: 100px;
        height: 100px;
    }

    .currency-symbol {
        font-size: 1.8rem;
    }

    .unified-glyph {
        width: 40px;
        height: 40px;
    }

    .section-inner {
        padding: 40px 20px;
    }

    .definition-card {
        padding: 32px 24px;
    }

    .final-bar-container {
        flex-direction: column;
        gap: 16px;
    }

    .final-bar {
        width: 85vw;
    }
}
