/* ============================================================
   cbdc.bar — Styles
   Luxury-Premium Fintech Noir
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    --vault-black: #0F1318;
    --carbon-plate: #1A2028;
    --graphite-field: #2D3239;
    --platinum-white: #E8ECF0;
    --steel-mist: #8A95A3;
    --brushed-chrome: #6B7B8D;
    --signal-silver: #C5CED8;
    --sovereign-gold: #B89F6A;
    --deep-pewter: #1E252D;
    --cool-slate: #3A4553;
    --light-chrome: #B8BFC6;

    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'DM Sans', system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    --ease-controlled: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-decel: cubic-bezier(0.33, 0, 0, 1);

    --mesh-offset-x: 0%;
    --mesh-offset-y: 0%;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--vault-black);
    color: var(--platinum-white);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.65;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* --- Vault (Section) Base --- */
.vault {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    perspective: 1200px;
}

.vault-threshold {
    min-height: 100vh;
}

.vault-mandate {
    min-height: 100vh;
}

.vault-infrastructure {
    min-height: 100vh;
}

.vault-signal {
    min-height: 80vh;
}

.vault-seal {
    min-height: 60vh;
}

/* --- Vault Transition States --- */
.vault.vault-exiting .vault-content {
    transform: perspective(800px) translateZ(-200px);
    filter: blur(3px);
    opacity: 0.4;
    transition: transform 0.8s var(--ease-decel), filter 0.8s var(--ease-decel), opacity 0.8s var(--ease-decel);
}

.vault.vault-entering .vault-content {
    transform: perspective(800px) translateZ(0);
    filter: blur(0);
    opacity: 1;
    transition: transform 0.8s var(--ease-controlled), filter 0.8s var(--ease-controlled), opacity 0.8s var(--ease-controlled);
}

/* --- Background Plane --- */
.vault-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* --- Gradient Meshes --- */
.gradient-mesh {
    position: absolute;
    inset: 0;
    opacity: 1;
}

/* Vault 0: Hero mesh — radial from deep pewter center to vault black edges */
.mesh-0 {
    background:
        radial-gradient(ellipse 80% 70% at 50% 50%, var(--deep-pewter) 0%, var(--vault-black) 100%),
        radial-gradient(ellipse 50% 60% at calc(70% + var(--mesh-offset-x)) calc(30% + var(--mesh-offset-y)), var(--cool-slate) 0%, transparent 70%);
    opacity: 1;
    filter: blur(20px);
    transition: filter 2s var(--ease-controlled);
}

.mesh-0.mesh-resolved {
    filter: blur(0);
}

/* Vault 1: Denser, more complex */
.mesh-1 {
    background:
        radial-gradient(ellipse 60% 50% at calc(30% + var(--mesh-offset-x)) calc(40% + var(--mesh-offset-y)), var(--cool-slate) 0%, transparent 70%),
        radial-gradient(ellipse 70% 60% at calc(70% + var(--mesh-offset-x)) calc(60% + var(--mesh-offset-y)), var(--deep-pewter) 0%, transparent 60%),
        radial-gradient(ellipse 90% 80% at 50% 50%, var(--graphite-field) 0%, var(--vault-black) 100%),
        linear-gradient(165deg, var(--vault-black) 0%, var(--graphite-field) 40%, var(--carbon-plate) 100%);
}

/* Vault 2: Architectural */
.mesh-2 {
    background:
        radial-gradient(ellipse 50% 40% at calc(40% + var(--mesh-offset-x)) calc(50% + var(--mesh-offset-y)), var(--cool-slate) 0%, transparent 65%),
        radial-gradient(ellipse 80% 70% at calc(60% + var(--mesh-offset-x)) calc(40% + var(--mesh-offset-y)), var(--deep-pewter) 0%, transparent 70%),
        conic-gradient(from 200deg at 50% 50%, var(--vault-black) 0%, var(--graphite-field) 25%, var(--vault-black) 50%, var(--deep-pewter) 75%, var(--vault-black) 100%);
    opacity: 0.85;
}

/* Vault 3: Aurora — most complex, 5 layers */
.mesh-3 {
    background:
        radial-gradient(ellipse 40% 50% at calc(25% + var(--mesh-offset-x)) calc(35% + var(--mesh-offset-y)), var(--cool-slate) 0%, transparent 60%),
        radial-gradient(ellipse 35% 45% at calc(75% + var(--mesh-offset-x)) calc(65% + var(--mesh-offset-y)), var(--graphite-field) 0%, transparent 55%),
        radial-gradient(ellipse 25% 30% at calc(50% + var(--mesh-offset-x)) calc(50% + var(--mesh-offset-y)), var(--light-chrome) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at calc(50% + var(--mesh-offset-x)) calc(20% + var(--mesh-offset-y)), var(--deep-pewter) 0%, transparent 70%),
        conic-gradient(from 135deg at 60% 50%, var(--vault-black) 0%, var(--cool-slate) 15%, var(--vault-black) 30%, var(--graphite-field) 50%, var(--vault-black) 70%, var(--deep-pewter) 85%, var(--vault-black) 100%),
        linear-gradient(165deg, var(--vault-black) 0%, var(--graphite-field) 40%, var(--carbon-plate) 100%);
}

/* Vault 4: Simplest — calm radial */
.mesh-4 {
    background:
        radial-gradient(ellipse 70% 60% at 50% 50%, var(--deep-pewter) 0%, var(--vault-black) 100%);
}

/* --- Guilloche Pattern --- */
.guilloche-pattern {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 50%;
    height: 50%;
    pointer-events: none;
    opacity: 1;
}

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

/* --- Perspective Grid --- */
.perspective-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.grid-1 {
    background:
        linear-gradient(to right, rgba(107, 123, 141, 0.08) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(107, 123, 141, 0.08) 1px, transparent 1px);
    background-size: 80px 80px;
    transform: perspective(600px) rotateX(45deg);
    transform-origin: 60% 40%;
    opacity: 0.5;
}

/* --- Content Plane --- */
.vault-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 32px;
    transition: transform 0.8s var(--ease-decel), filter 0.8s var(--ease-decel), opacity 0.8s var(--ease-decel);
}

/* --- Foreground Plane --- */
.vault-fg {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

/* Foreground rules */
.fg-rule {
    position: absolute;
    display: block;
    background: rgba(107, 123, 141, 0.4);
}

.fg-rule-h {
    height: 1px;
    width: 100%;
    left: 0;
}

.fg-rule-diag {
    height: 1px;
    width: 140%;
    left: -20%;
    top: 60%;
    transform: rotate(-8deg);
}

.fg-rule-top {
    top: 10%;
}

.fg-rule-bottom {
    bottom: 10%;
}

.fg-rule-seal {
    bottom: 20%;
}

.fg-rule-signal-1 {
    top: 15%;
}

.fg-rule-signal-2 {
    top: 50%;
    width: 60%;
    left: 20%;
}

.fg-rule-signal-3 {
    bottom: 15%;
}

/* Foreground diamonds */
.fg-diamond {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--signal-silver);
    transform: rotate(45deg);
    opacity: 0.6;
}

.vault-threshold .fg-diamond {
    bottom: 20%;
    right: 15%;
}

.fg-diamond-1 {
    top: 25%;
    left: 8%;
}

.fg-diamond-2 {
    bottom: 30%;
    right: 12%;
}

.fg-diamond-3 {
    top: 50%;
    right: 5%;
}

.fg-diamond-4 {
    top: 20%;
    left: 10%;
}

.fg-diamond-5 {
    top: 40%;
    right: 8%;
}

.fg-diamond-6 {
    bottom: 25%;
    left: 15%;
}

.fg-diamond-7 {
    bottom: 35%;
    right: 20%;
}

/* Dense foreground */
.vault-fg-dense .chevron-marks-fg {
    position: absolute;
    bottom: 25%;
    left: 10%;
}

/* --- Tilt 3D --- */
.tilt-3d {
    transform: perspective(1200px) rotateY(2deg);
    will-change: transform;
    transform-style: preserve-3d;
}

.tilt-3d-interactive {
    transform: perspective(1000px) rotateX(1deg) rotateY(-1deg);
    will-change: transform;
    transform-style: preserve-3d;
    transition: transform 0.15s ease-out;
}

/* --- VAULT 0: THE THRESHOLD --- */
.vault-threshold .vault-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
}

.site-title {
    font-family: var(--font-display);
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 600;
    color: var(--sovereign-gold);
    letter-spacing: 0.06em;
    line-height: 1.05;
    text-transform: uppercase;
    opacity: 0;
    transform: translateX(-40px);
    animation: titleEnter 0.8s var(--ease-controlled) 0.5s forwards;
}

@keyframes titleEnter {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.site-tagline {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    color: var(--steel-mist);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 1.5rem;
    opacity: 0;
    animation: taglineEnter 0.6s var(--ease-controlled) 1s forwards;
}

@keyframes taglineEnter {
    to {
        opacity: 1;
    }
}

/* --- VAULT 1: THE MANDATE --- */
.vault-mandate .vault-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 0;
    padding-top: 10vh;
    padding-bottom: 10vh;
}

.panel {
    background: var(--carbon-plate);
    box-shadow: 0 4px 40px rgba(22, 27, 34, 0.25);
    padding: clamp(2rem, 4vw, 3.5rem);
    max-width: 640px;
    width: 100%;
    position: relative;
}

.panel-left {
    transform: perspective(1200px) rotateY(1.5deg);
    align-self: flex-start;
    margin-left: 8%;
    opacity: 0;
    transition: opacity 0.8s var(--ease-controlled), transform 0.8s var(--ease-controlled);
}

.panel-left.panel-visible {
    opacity: 1;
    transform: perspective(1200px) rotateY(1.5deg);
}

.panel-right {
    transform: perspective(1200px) rotateY(-1.5deg);
    align-self: flex-end;
    margin-right: 8%;
    margin-top: -80px;
    opacity: 0;
    transition: opacity 0.8s var(--ease-controlled) 0.2s, transform 0.8s var(--ease-controlled) 0.2s;
}

.panel-right.panel-visible {
    opacity: 1;
    transform: perspective(1200px) rotateY(-1.5deg);
}

/* Initial entry states for panels */
.panel-left:not(.panel-visible) {
    transform: perspective(1200px) rotateY(8deg);
}

.panel-right:not(.panel-visible) {
    transform: perspective(1200px) rotateY(-8deg);
}

/* Chevron marks */
.chevron-marks {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem 0;
    justify-content: center;
}

.chevron {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--brushed-chrome);
    opacity: 0.3;
    letter-spacing: 0.08em;
}

/* --- Section Headings --- */
.section-heading {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 600;
    color: var(--platinum-white);
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    color: var(--steel-mist);
    line-height: 1.65;
    letter-spacing: 0.01em;
    max-width: 640px;
    margin-bottom: 1rem;
}

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

/* --- VAULT 2: THE INFRASTRUCTURE --- */
.vault-infrastructure .vault-content {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding-top: 10vh;
    padding-bottom: 10vh;
}

.panel-wide {
    background: var(--carbon-plate);
    box-shadow: 0 4px 40px rgba(22, 27, 34, 0.25);
    padding: clamp(2.5rem, 5vw, 4rem);
    width: calc(10 / 12 * 100%);
    max-width: 1200px;
    border-left: 2px solid var(--signal-silver);
    position: relative;
    opacity: 0;
    transition: opacity 0.8s var(--ease-controlled);
}

.panel-wide::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 50% at 30% 40%, var(--cool-slate) 0%, transparent 70%);
    opacity: 0.1;
    pointer-events: none;
}

.panel-wide.panel-visible {
    opacity: 1;
}

.infra-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(2rem, 3vw, 3rem);
    margin-top: 2rem;
}

.infra-item {
    position: relative;
    padding-left: 1.5rem;
}

/* Diamond marker */
.diamond-marker {
    position: absolute;
    left: 0;
    top: 0.5rem;
    width: 6px;
    height: 6px;
    background: var(--signal-silver);
    transform: rotate(45deg);
    display: block;
}

.mono-label {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--signal-silver);
    display: block;
    margin-bottom: 0.75rem;
}

.mono-data {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brushed-chrome);
    display: block;
    margin-top: 0.75rem;
    opacity: 0.7;
}

/* --- VAULT 3: THE SIGNAL --- */
.vault-signal .vault-content {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    padding: 20vh 32px;
}

.signal-text {
    text-align: center;
    max-width: 900px;
}

.signal-phrase {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 600;
    color: var(--platinum-white);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.sovereign-gold {
    color: var(--sovereign-gold);
}

/* --- VAULT 4: THE SEAL --- */
.vault-seal .vault-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 8vh 32px;
}

.seal-caption {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--steel-mist);
    margin-bottom: 3rem;
    opacity: 0.7;
}

.sovereign-seal {
    width: clamp(200px, 30vw, 400px);
    height: clamp(200px, 30vw, 400px);
}

.seal-svg {
    width: 100%;
    height: 100%;
}

/* SVG path-draw animation */
.seal-circle,
.seal-line,
.seal-diamond,
.seal-rosette {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 3s var(--ease-decel);
}

.vault-seal.seal-animate .seal-circle,
.vault-seal.seal-animate .seal-line,
.vault-seal.seal-animate .seal-diamond,
.vault-seal.seal-animate .seal-rosette {
    stroke-dashoffset: 0;
}

/* Staggered seal drawing */
.vault-seal.seal-animate .seal-circle-1 { transition-delay: 0s; }
.vault-seal.seal-animate .seal-circle-2 { transition-delay: 0.15s; }
.vault-seal.seal-animate .seal-circle-3 { transition-delay: 0.3s; }
.vault-seal.seal-animate .seal-circle-4 { transition-delay: 0.45s; }
.vault-seal.seal-animate .seal-circle-5 { transition-delay: 0.6s; }
.vault-seal.seal-animate .seal-circle-6 { transition-delay: 0.75s; }
.vault-seal.seal-animate .seal-line { transition-delay: 0.5s; }
.vault-seal.seal-animate .seal-diamond { transition-delay: 1s; }
.vault-seal.seal-animate .seal-rosette { transition-delay: 1.2s; }

/* --- Responsive --- */
@media (max-width: 768px) {
    .vault-mandate .vault-content {
        padding-top: 5vh;
        padding-bottom: 5vh;
    }

    .panel-left,
    .panel-right {
        margin-left: 0;
        margin-right: 0;
        align-self: center;
    }

    .panel-right {
        margin-top: 0;
    }

    .infra-grid {
        grid-template-columns: 1fr;
    }

    .panel-wide {
        width: 100%;
    }

    .tilt-3d {
        transform: perspective(1200px) rotateY(1deg);
    }

    .panel-left {
        transform: perspective(1200px) rotateY(1deg);
    }

    .panel-left.panel-visible {
        transform: perspective(1200px) rotateY(1deg);
    }

    .panel-right {
        transform: perspective(1200px) rotateY(-1deg);
    }

    .panel-right.panel-visible {
        transform: perspective(1200px) rotateY(-1deg);
    }

    .panel-left:not(.panel-visible) {
        transform: perspective(1200px) rotateY(5deg);
    }

    .panel-right:not(.panel-visible) {
        transform: perspective(1200px) rotateY(-5deg);
    }
}

@media (max-width: 480px) {
    .vault-content {
        padding: 0 16px;
    }

    .vault-signal .vault-content {
        padding: 15vh 16px;
    }

    .panel {
        padding: clamp(1.5rem, 3vw, 2.5rem);
    }

    .panel-wide {
        padding: clamp(1.5rem, 3vw, 2.5rem);
    }
}
