/* ============================================
   cbdc.studio v2 - Styles
   ============================================ */

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

:root {
    --vault-black: #0a0b0f;
    --ledger-dark: #12131a;
    --settlement-gray: #1a1b24;
    --mint-protocol: #00e5a0;
    --clearing-amber: #f0a830;
    --platinum: #c8c8d0;
    --reserve-gray: #6b7280;
    --settlement-red: #e54040;
    --sovereign-blue: #2563eb;

    --ease-vault: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --timeline-offset: 61.8px;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--vault-black);
    color: var(--platinum);
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.75;
    letter-spacing: 0.015em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Micro-intaglio texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 3px,
        rgba(200, 200, 208, 0.02) 3px,
        rgba(200, 200, 208, 0.02) 4px
    );
}

/* --- Typography --- */
h2 {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--platinum);
    line-height: 1.1;
}

.data-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    color: var(--reserve-gray);
    text-transform: uppercase;
}

.data-sublabel {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    color: var(--reserve-gray);
    opacity: 0.6;
}

/* --- Depth Indicator --- */
.depth-indicator {
    position: fixed;
    top: 24px;
    right: 32px;
    z-index: 1000;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    color: var(--reserve-gray);
    cursor: pointer;
    padding: 8px 12px;
    transition: color 0.3s var(--ease-vault);
}

.depth-indicator:hover {
    color: var(--mint-protocol);
}

/* --- Navigation Overlay --- */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 11, 15, 0.96);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s var(--ease-vault);
}

.nav-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.nav-overlay-inner {
    position: relative;
    width: 100%;
    max-width: 400px;
    padding: 40px;
}

.nav-close {
    position: absolute;
    top: -20px;
    right: 0;
    background: none;
    border: none;
    color: var(--reserve-gray);
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.3s var(--ease-vault);
    font-family: 'IBM Plex Sans', sans-serif;
}

.nav-close:hover {
    color: var(--mint-protocol);
}

.nav-list {
    list-style: none;
}

.nav-list li {
    margin-bottom: 20px;
}

.nav-list a {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.6rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--reserve-gray);
    text-decoration: none;
    transition: color 0.3s var(--ease-vault);
    display: flex;
    align-items: baseline;
    gap: 16px;
}

.nav-list a:hover {
    color: var(--mint-protocol);
}

.nav-depth {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    color: var(--mint-protocol);
    opacity: 0.6;
    min-width: 20px;
}

/* --- Section Base --- */
.section {
    position: relative;
    width: 100%;
}

/* --- Section 1: Opening Split Screen --- */
.section-opening {
    height: 100vh;
    display: flex;
    overflow: hidden;
}

.split-left {
    width: 38.2%;
    height: 100%;
    background-color: var(--vault-black);
    position: relative;
    overflow: hidden;
}

#network-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.split-right {
    width: 61.8%;
    height: 100%;
    background-color: var(--ledger-dark);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 40px;
}

.title-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 0.85;
}

.title-letter {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--platinum);
    display: block;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s var(--ease-vault), transform 0.8s var(--ease-vault);
}

.title-letter.visible {
    opacity: 1;
    transform: translateY(0);
}

.title-subtitle {
    margin-top: 32px;
    opacity: 0;
    transition: opacity 1.2s var(--ease-vault) 1.5s;
}

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

/* --- Hash Fragments --- */
.hash-fragment {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: var(--reserve-gray);
    opacity: 0.3;
    display: inline-block;
}

.hash-margin {
    display: block;
    margin-top: 20px;
    text-align: right;
}

/* --- Horizontal Rule Transition --- */
.hr-line {
    width: 0%;
    height: 1px;
    background-color: var(--mint-protocol);
    margin: 0 auto;
    transition: width 1.2s var(--ease-vault);
}

.hr-line.drawn {
    width: 100%;
}

/* --- Timeline Container --- */
.timeline-container {
    position: relative;
    padding: 100px 0 0 0;
    min-height: 100vh;
}

/* --- Timeline Spine --- */
.timeline-spine {
    position: absolute;
    top: 0;
    left: var(--timeline-offset);
    width: 1px;
    height: 100%;
    background-color: rgba(0, 229, 160, 0.1);
    z-index: 1;
}

.timeline-progress {
    width: 100%;
    height: 0%;
    background-color: var(--mint-protocol);
    transition: height 0.1s linear;
}

/* --- Timeline Content Sections --- */
.section-timeline {
    position: relative;
    padding: 100px 0;
    min-height: 50vh;
    display: flex;
    align-items: flex-start;
}

.timeline-node {
    position: absolute;
    left: var(--timeline-offset);
    top: 120px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: transparent;
    border: 1px solid var(--mint-protocol);
    transform: translate(-50%, -50%);
    z-index: 2;
    transition: background-color 0.2s var(--ease-vault);
}

.timeline-node.active {
    background-color: var(--mint-protocol);
}

.timeline-content {
    position: relative;
    max-width: 560px;
    padding: 40px;
    background-color: var(--ledger-dark);
    border: 1px solid rgba(0, 229, 160, 0.08);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s var(--ease-vault), transform 0.7s var(--ease-vault);
    overflow: hidden;
}

.timeline-content.visible {
    opacity: 1;
    transform: translateY(0);
}

.timeline-content.right {
    margin-left: calc(var(--timeline-offset) + 60px);
}

.timeline-content.left {
    margin-left: calc(var(--timeline-offset) + 60px);
}

.guilloche-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.06;
    overflow: hidden;
}

.section-title {
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.section-body {
    font-weight: 300;
    color: var(--platinum);
    opacity: 0.85;
    position: relative;
    z-index: 1;
}

/* --- Data Interludes --- */
.section-interlude {
    height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 100px 0;
    overflow: hidden;
}

#particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.sankey-svg {
    width: 90%;
    max-width: 1200px;
    height: 60%;
}

.radial-burst {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.radial-ring {
    position: absolute;
    border-radius: 50%;
    border-width: 1px;
    border-style: solid;
    opacity: 0;
    transform: scale(0);
}

.interlude-label {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 10;
}

/* --- Guilloche Dividers --- */
.guilloche-divider {
    width: 100%;
    height: 40px;
    overflow: hidden;
    opacity: 0.15;
}

.guilloche-divider svg {
    width: 100%;
    height: 100%;
}

/* --- Section 7: Closing Coin --- */
.section-closing {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 40px;
}

.coin-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coin {
    width: 320px;
    height: 320px;
    border-radius: 50%;
    border: 1px solid var(--mint-protocol);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.3);
    transition: opacity 1s var(--ease-vault), transform 1s var(--ease-vault);
}

.coin.visible {
    opacity: 1;
    transform: scale(1);
}

.coin-guilloche {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.15;
}

.coin-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.coin-date {
    font-size: 0.7rem;
    color: var(--reserve-gray);
}

.coin-hash {
    font-size: 0.65rem;
    color: var(--reserve-gray);
    opacity: 0.5;
}

.coin-statement {
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.4rem);
    line-height: 1.6;
    color: var(--platinum);
    margin-top: 8px;
}

.closing-terminus {
    margin-top: 60px;
    opacity: 0.2;
}

/* --- Desktop: Alternating left/right timeline blocks --- */
@media (min-width: 769px) {
    .section-timeline[data-side="left"] {
        justify-content: flex-start;
    }

    .section-timeline[data-side="left"] .timeline-content.left {
        margin-left: 0;
        margin-right: 0;
        position: absolute;
        right: calc(100% - var(--timeline-offset) + 20px);
        left: auto;
        text-align: right;
    }

    .section-timeline[data-side="left"] .hash-margin {
        text-align: left;
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    :root {
        --timeline-offset: 24px;
    }

    .section-opening {
        flex-direction: column;
    }

    .split-left {
        width: 100%;
        height: 40vh;
    }

    .split-right {
        width: 100%;
        height: 60vh;
    }

    .timeline-content.right,
    .timeline-content.left {
        margin-left: calc(var(--timeline-offset) + 30px);
        margin-right: 20px;
        max-width: calc(100% - var(--timeline-offset) - 50px);
    }

    .coin {
        width: 260px;
        height: 260px;
    }

    .coin-content {
        padding: 28px;
    }

    .section-interlude {
        height: 60vh;
    }

    .depth-indicator {
        top: 16px;
        right: 16px;
    }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--vault-black);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 229, 160, 0.3);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 229, 160, 0.5);
}

/* --- Keyframes --- */
@keyframes guillocheRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- Selection --- */
::selection {
    background: rgba(0, 229, 160, 0.25);
    color: var(--platinum);
}
