/* historical.quest - Cyberpunk Data-Viz Dashboard */
/* Palette: #0f172a, #1e293b, #334155, #e2e8f0, #3b82f6, #8b5cf6, #06b6d4, #f59e0b */
/* Fonts: Space Grotesk (display), Inter (body), Fira Code (data), Lora (accent) */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: #0f172a;
    color: #e2e8f0;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ============================================
   HERO ZONE: 0-100vh
   ============================================ */

.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 600px 400px at 50% 40%, rgba(59, 130, 246, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 400px 300px at 30% 60%, rgba(139, 92, 246, 0.04) 0%, transparent 70%);
    pointer-events: none;
}

.hero-content {
    text-align: center;
    position: relative;
    z-index: 1;
}

.brand {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.2rem, 6vw, 3.6rem);
    color: #e2e8f0;
    letter-spacing: -0.02em;
}

.brand-dot {
    color: #3b82f6;
}

.hero-metric {
    margin-top: 2rem;
    text-align: center;
}

.metric-num {
    font-family: 'Fira Code', monospace;
    font-weight: 500;
    font-size: clamp(3rem, 8vw, 5rem);
    color: #f59e0b;
    display: block;
    line-height: 1.1;
}

.metric-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    display: block;
    margin-top: 0.5rem;
}

.gradient-bar {
    width: 240px;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    margin: 2rem auto 0;
    border-radius: 2px;
    position: relative;
}

.gradient-bar::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #8b5cf6;
}

.hero-sub-metrics {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 3rem;
}

.sub-metric {
    text-align: center;
}

.sub-metric-num {
    font-family: 'Fira Code', monospace;
    font-weight: 500;
    font-size: 1.25rem;
    color: #e2e8f0;
    display: block;
}

.sub-metric-label {
    font-size: 0.65rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: block;
    margin-top: 0.2rem;
}

.sub-metric-divider {
    width: 1px;
    height: 28px;
    background: #334155;
}

/* ============================================
   ANALYSIS SECTION: 100-260vh
   ============================================ */

.analysis {
    padding: 4rem 1.5rem 6rem;
    max-width: 900px;
    margin: 0 auto;
}

.analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.panel {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(90deg, rgba(51, 65, 85, 0.15) 1px, transparent 1px),
        linear-gradient(rgba(51, 65, 85, 0.15) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
}

.panel-wide {
    grid-column: 1 / -1;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    position: relative;
    z-index: 1;
}

.panel-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    color: #e2e8f0;
}

.panel-badge {
    font-family: 'Fira Code', monospace;
    font-size: 0.6rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(51, 65, 85, 0.5);
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    border: 1px solid #334155;
}

.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    position: relative;
    z-index: 1;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.bar-label {
    font-family: 'Fira Code', monospace;
    font-size: 0.65rem;
    color: #64748b;
    min-width: 60px;
    text-align: right;
}

.bar-track {
    flex: 1;
    height: 20px;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 4px;
    position: relative;
}

.bar {
    height: 100%;
    border-radius: 4px;
    position: relative;
    width: 0;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.bar[data-color="blue"] {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.bar[data-color="purple"] {
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
}

.bar[data-color="cyan"] {
    background: linear-gradient(90deg, #06b6d4, #22d3ee);
}

.bar-dot {
    position: absolute;
    right: -3px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #e2e8f0;
    opacity: 0;
    transition: opacity 0.3s ease 0.8s;
}

.bar.animated .bar-dot {
    opacity: 1;
}

.bar-val {
    font-family: 'Fira Code', monospace;
    font-size: 0.7rem;
    color: #e2e8f0;
    min-width: 40px;
    text-align: right;
}

.chart-axis {
    display: flex;
    justify-content: space-between;
    margin-top: 0.75rem;
    padding-left: 68px;
    position: relative;
    z-index: 1;
}

.axis-label {
    font-family: 'Fira Code', monospace;
    font-size: 0.55rem;
    color: #475569;
}

/* Timeline Distribution */
.timeline-viz {
    position: relative;
    z-index: 1;
}

.timeline-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 100px;
    padding: 0 0.25rem;
}

.timeline-bar {
    flex: 1;
    border-radius: 2px 2px 0 0;
    min-width: 3px;
    transition: height 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
    opacity: 0;
    cursor: default;
}

.timeline-bar:hover {
    filter: brightness(1.3);
}

.timeline-axis {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    padding: 0 0.25rem;
}

/* Key Metrics */
.key-metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.key-metric {
    text-align: center;
    padding: 0.75rem 0.5rem;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 6px;
    border: 1px solid rgba(51, 65, 85, 0.5);
}

.key-metric-value {
    font-family: 'Fira Code', monospace;
    font-weight: 500;
    font-size: 1.4rem;
    display: block;
    line-height: 1.2;
}

.key-metric-value[data-color="amber"] { color: #f59e0b; }
.key-metric-value[data-color="blue"] { color: #3b82f6; }
.key-metric-value[data-color="purple"] { color: #8b5cf6; }
.key-metric-value[data-color="cyan"] { color: #06b6d4; }

.key-metric-name {
    font-size: 0.65rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-top: 0.3rem;
}

.key-metric-trend {
    font-family: 'Fira Code', monospace;
    font-size: 0.6rem;
    display: block;
    margin-top: 0.25rem;
}

.trend-up { color: #22c55e; }
.trend-down { color: #ef4444; }

/* ============================================
   COMPARE SECTION: 260-340vh
   ============================================ */

.compare {
    padding: 4rem 1.5rem 6rem;
    max-width: 900px;
    margin: 0 auto;
}

.section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: #e2e8f0;
    text-align: center;
    margin-bottom: 2rem;
}

.compare-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.compare-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 1.5rem 1rem;
    text-align: center;
    transition: border-color 0.3s ease, transform 0.3s ease;
    cursor: default;
}

.compare-card:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
}

.era-icon {
    display: block;
    margin-bottom: 0.75rem;
}

.era-name {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    color: #8b5cf6;
    display: block;
}

.era-period {
    font-family: 'Fira Code', monospace;
    font-size: 0.55rem;
    color: #475569;
    display: block;
    margin-top: 0.2rem;
}

.era-score {
    font-family: 'Fira Code', monospace;
    font-weight: 500;
    font-size: 1.8rem;
    color: #e2e8f0;
    display: block;
    margin: 0.5rem 0 0.15rem;
    line-height: 1.1;
}

.era-label {
    font-size: 0.55rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
}

.era-bar {
    margin-top: 0.75rem;
    height: 3px;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 2px;
    overflow: hidden;
}

.era-bar-fill {
    height: 100%;
    border-radius: 2px;
    width: 0;
    transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================
   QUERY SECTION: 340vh+
   ============================================ */

.query {
    padding: 6rem 2rem 4rem;
    text-align: center;
}

.query-content {
    max-width: 600px;
    margin: 0 auto;
}

.search-container {
    margin-bottom: 3rem;
}

.search-bar {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 0.9rem 1.75rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    cursor: text;
    min-width: 380px;
}

.search-bar:hover {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.search-text {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: #64748b;
    white-space: nowrap;
}

.search-suggestions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.suggestion {
    font-family: 'Fira Code', monospace;
    font-size: 0.65rem;
    color: #64748b;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid #334155;
    border-radius: 4px;
    padding: 0.3rem 0.6rem;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.suggestion:hover {
    color: #3b82f6;
    border-color: #3b82f6;
}

.query-footer {
    margin-top: 2rem;
}

.query-brand {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    color: #334155;
    display: block;
}

.query-tagline {
    font-family: 'Lora', serif;
    font-size: 0.7rem;
    color: #1e293b;
    display: block;
    margin-top: 0.4rem;
    font-style: italic;
}

/* ============================================
   ANIMATIONS & TRANSITIONS
   ============================================ */

.fade-in {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered reveal for children */
.fade-in.visible .bar-row:nth-child(1) { transition-delay: 0.05s; }
.fade-in.visible .bar-row:nth-child(2) { transition-delay: 0.1s; }
.fade-in.visible .bar-row:nth-child(3) { transition-delay: 0.15s; }
.fade-in.visible .bar-row:nth-child(4) { transition-delay: 0.2s; }
.fade-in.visible .bar-row:nth-child(5) { transition-delay: 0.25s; }
.fade-in.visible .bar-row:nth-child(6) { transition-delay: 0.3s; }
.fade-in.visible .bar-row:nth-child(7) { transition-delay: 0.35s; }

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .analysis-grid {
        grid-template-columns: 1fr;
    }

    .panel-wide {
        grid-column: auto;
    }

    .compare-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-sub-metrics {
        flex-direction: column;
        gap: 1rem;
    }

    .sub-metric-divider {
        width: 40px;
        height: 1px;
    }

    .search-bar {
        min-width: auto;
        width: 100%;
        max-width: 380px;
    }
}

@media (max-width: 480px) {
    .compare-cards {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .compare-card {
        padding: 1rem 0.75rem;
    }

    .era-score {
        font-size: 1.4rem;
    }
}
