/* ============================================
   cbdc.bar - Styles
   Mid-century modern + botanical data-viz
   ============================================ */

/* === CSS Custom Properties === */
:root {
    /* Palette */
    --cream-vellum: #FAF7F2;
    --deep-walnut: #2C1810;
    --polished-silver: #E8E8E8;
    --brushed-steel: #B8B8B8;
    --gunmetal: #5A5A5A;
    --mirror-flash: #F5F5F5;
    --botanical-rose: #C45B4A;
    --fern-verde: #4A7C59;
    --aged-brass: #B8860B;
    --oxide-copper: #2D6A4F;
    --warm-ivory: #F5EDE0;
    --carbon-ink: #1A1A1A;

    /* Typography */
    --font-display: 'Roboto Slab', serif;
    --font-body: 'Source Sans 3', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    /* Spacing */
    --eames-gap: 24px;
    --nav-height: 64px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.7;
    color: var(--gunmetal);
    background-color: #fff;
    overflow-x: hidden;
}

body.loaded {
    background-color: var(--cream-vellum);
    transition: background-color 600ms ease-out;
}

/* === Navigation === */
.nav-bar {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--nav-height);
    background: rgba(232, 232, 232, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--brushed-steel);
}

.nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
}

.nav-logo {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: 0.03em;
    color: var(--carbon-ink);
    text-decoration: none;
    background: linear-gradient(180deg, #C0C0C0 0%, #F5F5F5 40%, #A0A0A0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0;
}

.nav-link {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gunmetal);
    text-decoration: none;
    padding: 8px 20px;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 20px;
    right: 20px;
    height: 1px;
    background: var(--botanical-rose);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 250ms ease;
}

.nav-link:hover::after {
    transform: scaleX(1);
}

.nav-divider {
    width: 1px;
    height: 20px;
    background: #C0C0C0;
}

/* === Hero Section === */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--cream-vellum);
    position: relative;
}

.hero-content {
    text-align: center;
    padding: 40px;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(4rem, 12vw, 8rem);
    letter-spacing: 0.03em;
    background: linear-gradient(180deg, #C0C0C0 0%, #F5F5F5 35%, #A0A0A0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    opacity: 0;
    transform: translateY(16px);
    line-height: 1.1;
}

.hero-title.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 500ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Chrome text shadow workaround - use a pseudo element */
.hero-title::after {
    content: 'cbdc.bar';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(4rem, 12vw, 8rem);
    letter-spacing: 0.03em;
    color: transparent;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    -webkit-text-fill-color: transparent;
    pointer-events: none;
    z-index: -1;
}

.hero-line-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 24px auto;
    position: relative;
    height: 60px;
}

.hero-line {
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--brushed-steel), var(--mirror-flash), var(--brushed-steel));
    transition: width 800ms ease-out;
}

.hero-line.visible {
    width: 40vw;
}

.hero-sprig {
    position: absolute;
    right: calc(50% - 20vw - 80px);
    top: 0;
    opacity: 0;
}

.hero-sprig.visible {
    opacity: 1;
    transition: opacity 300ms ease;
}

.hero-sprig .sprig-stem,
.hero-sprig .sprig-leaf1,
.hero-sprig .sprig-leaf2,
.hero-sprig .sprig-leaf3 {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
}

.hero-sprig.visible .sprig-stem {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1200ms ease;
}

.hero-sprig.visible .sprig-leaf1 {
    stroke-dasharray: none;
    opacity: 0;
    animation: leafFadeIn 400ms 400ms ease forwards;
}

.hero-sprig.visible .sprig-leaf2 {
    stroke-dasharray: none;
    opacity: 0;
    animation: leafFadeIn 400ms 600ms ease forwards;
}

.hero-sprig.visible .sprig-leaf3 {
    stroke-dasharray: none;
    opacity: 0;
    animation: leafFadeIn 400ms 800ms ease forwards;
}

@keyframes leafFadeIn {
    to { opacity: 0.7; }
}

.hero-tagline {
    font-family: var(--font-body);
    font-weight: 400;
    font-style: italic;
    font-size: 1.2rem;
    color: var(--gunmetal);
    opacity: 0;
    margin-top: 8px;
}

.hero-tagline.visible {
    opacity: 1;
    transition: opacity 400ms ease;
}

.hero-chevron {
    font-family: var(--font-body);
    font-size: 1.6rem;
    color: var(--brushed-steel);
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    animation: none;
}

.hero-chevron.visible {
    animation: chevronPulse 2s ease-in-out infinite;
}

@keyframes chevronPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

/* === Section Dividers === */
.section-divider {
    width: 100%;
    height: 40px;
    overflow: hidden;
    background: var(--cream-vellum);
}

.divider-pattern {
    width: 100%;
    height: 40px;
}

/* === Masonry Zones === */
.masonry-zone {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 40px;
    background: var(--cream-vellum);
}

.zone-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    letter-spacing: 0.03em;
    color: var(--carbon-ink);
    margin-bottom: 8px;
}

.zone-subtitle {
    font-family: var(--font-body);
    font-weight: 400;
    font-style: italic;
    font-size: 1.05rem;
    color: var(--gunmetal);
    margin-bottom: 40px;
}

.masonry-grid {
    column-count: 3;
    column-gap: var(--eames-gap);
}

/* === Masonry Cards === */
.masonry-card {
    break-inside: avoid;
    margin-bottom: var(--eames-gap);
    background: var(--cream-vellum);
    border-radius: 6px;
    padding: 24px;
    position: relative;
    overflow: visible;
    /* Chrome border via pseudo-element */
    border: none;
}

.masonry-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 6px;
    padding: 1px;
    background: linear-gradient(135deg, #E8E8E8 0%, #F5F5F5 30%, #B8B8B8 50%, #F5F5F5 70%, #E8E8E8 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    transition: background 300ms ease;
}

.masonry-card:hover::before {
    background: linear-gradient(135deg, #E8E8E8 0%, #F5F5F5 50%, #B8B8B8 60%, #F5F5F5 80%, #E8E8E8 100%);
}

/* Animated entrance */
.masonry-card[data-animate] {
    opacity: 0;
    transform: translateY(24px);
}

.masonry-card[data-animate].in-view {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 400ms ease, transform 400ms ease;
}

/* Featured card */
.masonry-card.featured {
    padding: 28px;
}

.masonry-card.featured::before {
    padding: 2px;
}

/* Corner flourish */
.card-corner-flourish {
    position: absolute;
    top: -12px;
    right: -12px;
    z-index: 2;
    opacity: 0;
}

.masonry-card.in-view .card-corner-flourish {
    opacity: 1;
    transition: opacity 400ms 200ms ease;
}

.card-corner-flourish svg path {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
}

.masonry-card.in-view .card-corner-flourish svg path {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 600ms 300ms ease;
}

/* Card typography */
.card-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    letter-spacing: 0.03em;
    color: var(--carbon-ink);
    margin-bottom: 16px;
}

.card-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.7;
    color: var(--gunmetal);
    margin-bottom: 12px;
}

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

.card-caption {
    font-family: var(--font-body);
    font-weight: 400;
    font-style: italic;
    font-size: 0.85rem;
    color: var(--brushed-steel);
    margin-top: 12px;
}

/* Quote card */
.quote-card {
    background: linear-gradient(135deg, var(--cream-vellum) 0%, #F5F0E8 100%);
}

.card-quote {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    letter-spacing: 0.02em;
    line-height: 1.5;
    color: var(--oxide-copper);
    margin-bottom: 12px;
}

.card-cite {
    font-family: var(--font-body);
    font-weight: 400;
    font-style: italic;
    font-size: 0.85rem;
    color: var(--brushed-steel);
}

/* Steel plate card */
.steel-plate {
    background: radial-gradient(circle at 2px 2px, #E6E6E6 1px, transparent 1px),
                radial-gradient(circle at 6px 6px, #EBEBEB 1px, transparent 1px);
    background-size: 8px 8px;
    position: relative;
}

.steel-plate::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 6px;
    background: linear-gradient(135deg, transparent 30%, rgba(245, 245, 245, 0.3) 50%, transparent 70%);
    pointer-events: none;
}

.data-highlight {
    text-align: center;
    padding: 16px 0 12px;
}

.data-number {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    letter-spacing: 0.05em;
    color: var(--carbon-ink);
    display: block;
    line-height: 1.1;
}

.data-unit {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--botanical-rose);
    display: block;
    margin-top: 4px;
}

/* Pattern card */
.pattern-card {
    padding: 12px;
}

.botanical-pattern {
    display: flex;
    justify-content: center;
}

/* Card viz */
.card-viz {
    margin: 8px 0;
}

.card-viz svg {
    display: block;
    width: 100%;
}

/* Viz typography */
.viz-label {
    font-family: var(--font-body);
}

.viz-data {
    font-family: var(--font-body);
    font-weight: 600;
}

.viz-mono {
    font-family: var(--font-mono);
    font-weight: 400;
    letter-spacing: 0.05em;
}

/* Root bar animation */
.root-bar {
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 800ms ease;
}

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

/* Vine path animation */
.vine-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
}

.in-view .vine-path {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1500ms ease;
}

/* Vine point hover */
.vine-point {
    cursor: pointer;
    transition: transform 200ms ease;
}

.vine-point:hover path {
    fill: var(--botanical-rose);
    transform: scale(1.3);
    transform-origin: center;
    transition: fill 200ms ease, transform 200ms ease;
}

/* Petal animation */
.petal {
    transform: scale(0) rotate(-30deg);
    transform-origin: center;
    transition: transform 600ms ease;
}

.in-view .petal {
    transform: scale(1) rotate(0deg);
}

/* Tooltip */
.viz-tooltip {
    position: absolute;
    background: linear-gradient(180deg, #E8E8E8, #D0D0D0);
    border: 1px solid var(--brushed-steel);
    border-radius: 3px;
    padding: 4px 8px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--carbon-ink);
    pointer-events: none;
    opacity: 0;
    transition: opacity 150ms ease;
    z-index: 100;
    white-space: nowrap;
}

.viz-tooltip.active {
    opacity: 1;
}

/* === Narrative Bands === */
.narrative-band {
    width: 100vw;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.dark-band {
    background-color: var(--deep-walnut);
}

.silver-band {
    background-color: var(--polished-silver);
}

.band-watermark {
    position: absolute;
    left: 30%;
    top: 20%;
    transform: translate(-50%, -20%);
    pointer-events: none;
    z-index: 0;
}

.band-content {
    position: relative;
    z-index: 1;
    width: 80%;
    max-width: 900px;
    text-align: center;
    padding: 60px 0;
}

.band-viz {
    width: 100%;
    display: flex;
    justify-content: center;
}

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

.band-caption {
    font-family: var(--font-body);
    font-weight: 400;
    font-style: italic;
    font-size: 1rem;
    color: var(--warm-ivory);
    margin-top: 24px;
}

.band-caption-dark {
    color: var(--gunmetal);
}

/* Large petal chart */
.petal-chart-large .petal {
    transform: scale(0) rotate(-45deg);
    transform-origin: center;
}

.petal-chart-large.in-view .petal {
    transform: scale(1) rotate(0deg);
    transition: transform 800ms ease;
}

/* Large vine chart */
.vine-chart-large .vine-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
}

.vine-chart-large.in-view .vine-path {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 2000ms ease;
}

/* === Footer === */
.site-footer {
    background-color: var(--deep-walnut);
    padding: 80px 40px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

.footer-wreath {
    display: flex;
    justify-content: center;
}

.footer-wreath svg {
    width: 200px;
    height: 200px;
}

/* Wreath hover interactions */
.wreath-leaf {
    transition: fill 400ms ease, opacity 400ms ease;
}

.footer-wreath:hover .wreath-leaf {
    opacity: 0.5;
}

.wreath-flower {
    transition: fill 400ms ease, opacity 400ms ease, transform 400ms ease;
    transform-origin: center;
}

.footer-wreath:hover .wreath-flower {
    fill: var(--botanical-rose);
    opacity: 0.8;
    transform: rotate(15deg);
}

.footer-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.footer-domain {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 2rem;
    letter-spacing: 0.03em;
    background: linear-gradient(180deg, #C0C0C0 0%, #F5F5F5 35%, #A0A0A0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-tagline {
    font-family: var(--font-body);
    font-weight: 400;
    font-style: italic;
    font-size: 1rem;
    color: var(--warm-ivory);
    opacity: 0.7;
}

/* === Responsive: Tablet === */
@media (max-width: 1024px) {
    .masonry-grid {
        column-count: 2;
    }

    .nav-inner {
        padding: 0 24px;
    }

    .masonry-zone {
        padding: 48px 24px;
    }

    .band-content {
        width: 90%;
    }
}

/* === Responsive: Mobile === */
@media (max-width: 640px) {
    .masonry-grid {
        column-count: 1;
    }

    .nav-inner {
        padding: 0 16px;
    }

    .nav-links {
        display: none;
    }

    .masonry-zone {
        padding: 36px 16px;
    }

    .hero-line.visible {
        width: 70vw;
    }

    .hero-sprig {
        display: none;
    }

    .band-content {
        width: 95%;
        padding: 40px 0;
    }

    .site-footer {
        padding: 60px 20px;
    }

    .footer-wreath svg {
        width: 150px;
        height: 150px;
    }
}
