/* ═══════════════════════════════════════════
   DESIGN TOKENS
   ═══════════════════════════════════════════ */
:root {
    /* Palette */
    --c-bg:          #0a0e17;
    --c-bg-alt:      #0f1420;
    --c-surface:     #111827;
    --c-surface-alt: #1a2233;
    --c-border:      #1e293b;
    --c-border-hover:#334155;
    --c-text:        #e2e8f0;
    --c-text-muted:  #94a3b8;
    --c-text-dim:    #64748b;
    --c-accent:      #3b82f6;
    --c-accent-glow: rgba(59,130,246,0.15);
    --c-green:       #22c55e;
    --c-red:         #ef4444;
    --c-purple:      #a78bfa;
    --c-blue:        #38bdf8;

    /* Layout */
    --max-w:         1400px;
    --gap:           1.5rem;
    --radius:        12px;
    --radius-sm:     8px;

    /* Typography */
    --font:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono:     'JetBrains Mono', 'Fira Code', monospace;
}

/* ═══════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: 5rem;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font);
    background: var(--c-bg);
    color: var(--c-text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ═══════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════ */
.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.grid {
    display: grid;
    gap: var(--gap);
}
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

/* ═══════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════ */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--c-border);
}

.header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 4rem;
}

.header__logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--c-text);
    text-decoration: none;
    letter-spacing: -0.02em;
}
.header__logo-dot { color: var(--c-accent); }

.header__nav {
    display: flex;
    gap: 0.25rem;
}

.header__link {
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--c-text-muted);
    transition: color 0.2s, background 0.2s;
    text-decoration: none;
}
.header__link:hover {
    color: var(--c-text);
    background: var(--c-surface);
    text-decoration: none;
}

/* Burger */
.header__burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}
.header__burger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--c-text-muted);
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}
.header__burger.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.header__burger.is-active span:nth-child(2) { opacity: 0; }
.header__burger.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ═══════════════════════════════════════════
   TICKER
   ═══════════════════════════════════════════ */
.ticker-section {
    border-bottom: 1px solid var(--c-border);
    background: var(--c-surface);
    overflow: hidden;
}

.ticker {
    position: relative;
    height: 48px;
    display: flex;
    align-items: center;
    overflow: hidden;
    mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
}

.ticker__track {
    display: flex;
    align-items: center;
    gap: 2.5rem;
    white-space: nowrap;
    will-change: transform;
    animation: ticker-scroll 45s linear infinite;
}

.ticker__track:hover {
    animation-play-state: paused;
}

@keyframes ticker-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.ticker__item {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--c-text);
    cursor: default;
    user-select: none;
}

.ticker__name {
    color: var(--c-text-muted);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.ticker__price {
    font-family: var(--font-mono);
    font-weight: 600;
}

.ticker__change {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
}

.ticker__change--up {
    color: var(--c-green);
    background: rgba(34, 197, 94, 0.1);
}

.ticker__change--down {
    color: var(--c-red);
    background: rgba(239, 68, 68, 0.1);
}

.ticker__change--neutral {
    color: var(--c-text-dim);
    background: rgba(100, 116, 139, 0.1);
}

.ticker__sep {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--c-border);
    flex-shrink: 0;
}

.ticker__loading {
    color: var(--c-text-dim);
    font-size: 0.8125rem;
    padding: 0 1.5rem;
}

/* ═══════════════════════════════════════════
   SECTIONS
   ═══════════════════════════════════════════ */
.section {
    padding: 4rem 0;
}
.section--alt {
    background: var(--c-bg-alt);
}

.section__title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
}

.section__subtitle {
    color: var(--c-text-muted);
    font-size: 1.0625rem;
    margin-bottom: 2.5rem;
}

.section__heading {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 2.5rem 0 1.25rem;
    color: var(--c-text-muted);
}

/* ═══════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════ */
.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.25s, box-shadow 0.25s;
}
.card:hover {
    border-color: var(--c-border-hover);
    box-shadow: 0 0 0 1px var(--c-border-hover), 0 8px 32px rgba(0,0,0,0.3);
}

.card--chart {
    height: 480px;
}

.card--chart-sm {
    height: 380px;
}

.card--currency {
    padding: 1.25rem 1.5rem;
}

.chart-wrapper--currency {
    height: 260px;
}

.section__source {
    margin-top: 1.25rem;
    font-size: 0.8125rem;
    color: var(--c-text-dim);
}

.card--wide {
    padding: 1.75rem;
}

.card--stat {
    padding: 1.75rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.card__title {
    font-size: 1.0625rem;
    font-weight: 600;
}

.card__badge {
    font-family: var(--font-mono);
    font-size: 0.9375rem;
    font-weight: 600;
    padding: 0.375rem 0.875rem;
    border-radius: 999px;
}
.card__badge--accent {
    background: var(--c-accent-glow);
    color: var(--c-accent);
    border: 1px solid rgba(59,130,246,0.3);
}

.card__source {
    margin-top: 1rem;
    font-size: 0.8125rem;
    color: var(--c-text-dim);
}

/* Stat cards */
.card__stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    margin-bottom: 0.25rem;
}
.card__stat-icon--green  { background: rgba(34,197,94,0.1);  color: var(--c-green); }
.card__stat-icon--red    { background: rgba(239,68,68,0.1);  color: var(--c-red); }
.card__stat-icon--blue   { background: rgba(56,189,248,0.1); color: var(--c-blue); }
.card__stat-icon--purple { background: rgba(167,139,250,0.1);color: var(--c-purple); }

.card__stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card__stat-value {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.card__stat-value--green  { color: var(--c-green); }
.card__stat-value--red    { color: var(--c-red); }
.card__stat-value--blue   { color: var(--c-blue); }
.card__stat-value--purple { color: var(--c-purple); }

.card__stat-desc {
    font-size: 0.8125rem;
    color: var(--c-text-dim);
}

/* ═══════════════════════════════════════════
   CHARTS
   ═══════════════════════════════════════════ */
.chart-wrapper {
    position: relative;
    height: 320px;
}
.chart-wrapper--sm {
    height: 240px;
}

/* ═══════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════ */
.footer {
    border-top: 1px solid var(--c-border);
    padding: 2.5rem 0;
    background: var(--c-surface);
}

.footer__inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
}

.footer__brand {
    font-weight: 700;
    font-size: 1.125rem;
    display: block;
    margin-bottom: 0.375rem;
}

.footer__copy,
.footer__disclaimer {
    color: var(--c-text-dim);
    font-size: 0.8125rem;
}

.footer__sources {
    font-size: 0.875rem;
    color: var(--c-text-muted);
    margin-bottom: 0.375rem;
}
.footer__sources a {
    color: var(--c-text-muted);
    text-decoration: underline;
    text-decoration-color: var(--c-border);
    text-underline-offset: 2px;
}
.footer__sources a:hover {
    color: var(--c-accent);
}

.footer__right {
    text-align: right;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 1024px) {
    .grid--4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .header__nav {
        display: none;
        position: fixed;
        inset: 4rem 0 0 0;
        flex-direction: column;
        background: rgba(10, 14, 23, 0.97);
        backdrop-filter: blur(16px);
        padding: 1.5rem;
        gap: 0.25rem;
    }
    .header__nav.is-open { display: flex; }
    .header__burger { display: flex; }

    .header__link {
        padding: 0.875rem 1rem;
        font-size: 1rem;
    }

    .grid--2,
    .grid--3,
    .grid--4 {
        grid-template-columns: 1fr;
    }

    .card--chart { height: 360px; }
    .card--chart-sm { height: 300px; }

    .section__title { font-size: 1.5rem; }

    .footer__inner {
        flex-direction: column;
    }
    .footer__right {
        text-align: left;
    }
}

@media (max-width: 480px) {
    .container { padding: 0 1rem; }
    .section { padding: 2.5rem 0; }
    .card--chart { height: 300px; }
    .card__stat-value { font-size: 1.5rem; }
}
