/**
 * ========================================
 * Kumagaizo - STYLES
 * ========================================
 */

/* ========== CSS & VARIABLES ========== */

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

/* Dark Theme (Default) */
[data-theme="dark"] {
    --bg-primary:   #0f0f0f;
    --bg-secondary:  #141414;
    --bg-tertiary:   #191919;
    --bg-elevated:   #1e1e1e;
    --bg-hover:      #242424;
    
    --text-primary:  #f0f0f0;
    --text-secondary:#b0b0b0;
    --text-tertiary: #808080;
    --text-muted:    #606060;
    
    --border-primary:   #242424;
    --border-secondary: #2a2a2a;
    --border-subtle:    #1e1e1e;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.40);
    --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.35);
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary:   #ffffff;
    --bg-secondary:  #fcfcfc;
    --bg-tertiary:   #f8f8f8;
    --bg-elevated:   #f6f6f6;
    --bg-hover:      #f2f2f2;
    
    --text-primary:  #1a1a1a;
    --text-secondary:#4d4d4d;
    --text-tertiary: #737373;
    --text-muted:    #9e9e9e;
    
    --border-primary:   #e5e5e5;
    --border-secondary: #eeeeee;
    --border-subtle:    #f5f5f5;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.035);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.045);
    --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.055);
}

:root {
    --category-models:        #6366F1;
    --category-applications:  #0EA5E9;
    --category-hardware:      #F59E0B;
    --category-policy:        #10B981;
    --category-physical:     #8B5CF6;
    
    --accent-primary:         #ADA8A5;
    
    --accent-rgb: 173, 168, 165; /* For the pulse chart - adjust to your accent color */
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    
    /* Typography */
    --font-sans: 'Geist Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'Geist Mono', ui-monospace, monospace;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
}

/* ========== BASE STYLES ========== */

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    /*overflow: hidden;*/
    height: 100vh;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

.section {
    padding-top: 6rem;
    padding-bottom: 6rem;
}

.container {
    padding-left: 1rem;
    padding-right: 1rem;
    display: flex;
    flex-direction: column;
    row-gap: 3rem;
}

.content-wrapper {
    display: flex;
    flex-direction: column;
    row-gap: 1rem;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    overflow: hidden;
    position: relative;
}

/* ========== HEADER ========== */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    flex-shrink: 0;
    height: 56px;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    min-width: 200px;
}

.header-center {
    display: flex;
    justify-content: center;
    flex: 1;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    min-width: 200px;
    justify-content: flex-end;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: default;
}

.logo-mark {
    font-size: 1.125rem;
    color: var(--accent-primary);
}

.logo-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    text-decoration: none;
}

/* View Switcher */
.view-switcher {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 2px;
}

.view-btn {
    padding: var(--space-xs) var(--space-md);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.view-btn:hover {
    color: var(--text-primary);
}

.view-btn.active {
    background: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* Theme Toggle */
.theme-toggle {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
[data-theme="light"] .icon-sun { display: block; }
[data-theme="light"] .icon-moon { display: none; }

/* Credit */
.credit {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

/* ========== MAIN CANVAS ========== */

.canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: var(--bg-primary);
}

.view {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.view.active {
    opacity: 1;
    visibility: visible;
}

/* ========== GRID VIEW ========== */

.grid-container {
    height: 100%;
    overflow-y: auto;
    padding: var(--space-lg) var(--space-xl);
}

.grid-sort {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    justify-content: center;
}

.sort-label {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.sort-btn {
    padding: var(--space-xs) var(--space-sm);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sort-btn:hover {
    color: var(--text-primary);
}

.sort-btn.active {
    background: var(--bg-tertiary);
    border-color: var(--border-primary);
    color: var(--text-primary);
}

/* Grid Layout */
.grid-events {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-sm);
}

/* Grid Card */
.grid-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.grid-card:hover {
    border-color: var(--border-secondary);
    box-shadow: var(--shadow-md);
}

.grid-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-sm);
}

.grid-card-company {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
}

.grid-card-date {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.grid-card-title {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.3;
    margin-bottom: var(--space-sm);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Category badge for grid cards */
.grid-card-category {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.grid-card-category::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.grid-card-category[data-category="models"]::before { background: var(--category-models); }
.grid-card-category[data-category="applications"]::before { background: var(--category-applications); }
.grid-card-category[data-category="hardware"]::before { background: var(--category-hardware); }
.grid-card-category[data-category="policy"]::before { background: var(--category-policy); }
.grid-card-category[data-category="physical"]::before { background: var(--category-physical); }

/* ========== TIMELINE VIEW ========== */

.timeline-hint {
    position: absolute;
    top: var(--space-md);
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    z-index: 10;
    pointer-events: none;
}

.timeline-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
    cursor: grab;
}

.timeline-container.dragging {
    cursor: grabbing;
}

.timeline-container.dragging * {
    pointer-events: none;
}

.timeline-scroll {
    position: relative;
    height: 100%;
    min-width: 100%;
    will-change: transform;
}

.timeline-track {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    background: var(--border-secondary);
    transform: translateY(-50%);
}

.timeline-events {
    position: relative;
    height: 100%;
}

/* Year Markers */
.timeline-year-marker {
    position: absolute;
    top: calc(50% - 60px);
    transform: translateX(-50%);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-tertiary);
    background: var(--bg-primary);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

/* Timeline Event */
.timeline-event {
    position: absolute;
    top: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transform: translateX(-50%);
}

.timeline-event.below {
    top: calc(50% - 6px);
}

.timeline-event.above {
    top: auto;
    bottom: calc(50% - 6px);
    flex-direction: column-reverse;
}

.timeline-event:hover {
    z-index: 10;
}

.timeline-event:hover .timeline-event-card {
    border-color: var(--border-secondary);
    box-shadow: var(--shadow-lg);
}

/* Dot */
.timeline-event-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 3px solid var(--text-tertiary);
    flex-shrink: 0;
    z-index: 2;
    transition: all var(--transition-fast);
}

.timeline-event:hover .timeline-event-dot {
    transform: scale(1.3);
    border-color: var(--text-primary);
}

.timeline-event.selected .timeline-event-dot {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.3);
}

/* Dot colors by category */
.timeline-event[data-category="models"] .timeline-event-dot { border-color: var(--category-models); }
.timeline-event[data-category="applications"] .timeline-event-dot { border-color: var(--category-applications); }
.timeline-event[data-category="hardware"] .timeline-event-dot { border-color: var(--category-hardware); }
.timeline-event[data-category="policy"] .timeline-event-dot { border-color: var(--category-policy); }
.timeline-event[data-category="physical"] .timeline-event-dot { border-color: var(--category-physical); }

/* Connector */
.timeline-event-connector {
    width: 1px;
    height: 20px;
    background: var(--border-primary);
    flex-shrink: 0;
}

/* Card */
.timeline-event-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    min-width: 140px;
    max-width: 180px;
    text-align: center;
    transition: all var(--transition-fast);
}

.timeline-event-title {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.timeline-event-date {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    margin-bottom: var(--space-xs);
}

.timeline-event-category {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.625rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.timeline-event-category::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

.timeline-event-category[data-category="models"]::before { background: var(--category-models); }
.timeline-event-category[data-category="applications"]::before { background: var(--category-applications); }
.timeline-event-category[data-category="hardware"]::before { background: var(--category-hardware); }
.timeline-event-category[data-category="policy"]::before { background: var(--category-policy); }
.timeline-event-category[data-category="physical"]::before { background: var(--category-physical); }

/* Empty State */
.empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state-text {
    font-size: 0.875rem;
}

/* ========== EVENT PANEL ========== */

.event-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 400px;
    max-width: 100%;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-primary);
    transform: translateX(100%);
    transition: transform var(--transition-normal);
    z-index: 50;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.event-panel.open {
    transform: translateX(0);
}

.panel-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    z-index: 10;
}

.panel-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.panel-content {
    padding: var(--space-xl);
    overflow-y: auto;
    flex: 1;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}

.panel-company {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.panel-date {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.panel-title {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: var(--space-lg);
}

/* Category Badge in Panel */
.category-badge-container {
    margin-bottom: var(--space-lg);
}

.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
}

.category-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.category-badge[data-category="models"]::before { background: var(--category-models); }
.category-badge[data-category="applications"]::before { background: var(--category-applications); }
.category-badge[data-category="hardware"]::before { background: var(--category-hardware); }
.category-badge[data-category="policy"]::before { background: var(--category-policy); }
.category-badge[data-category="physical"]::before { background: var(--category-physical); }

/* Panel Sections */
.panel-section {
    margin-bottom: var(--space-lg);
}

.section-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: var(--space-sm);
}

.section-title svg {
    opacity: 0.7;
}

.section-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Source Link */
.source-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--accent-primary);
    text-decoration: none;
    margin-top: var(--space-sm);
    transition: opacity var(--transition-fast);
}

.source-link:hover {
    opacity: 0.8;
}

/* Outcome Date */
.outcome-date {
    display: block;
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-top: var(--space-sm);
}

/* Tags */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.tag {
    font-size: 0.75rem;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-transform: uppercase;
}

/* ========== FILTER BAR ========== */

.filter-bar {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-primary);
    z-index: 100;
    flex-shrink: 0;
    min-height: auto;
}

.filter-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-toggle:hover {
    color: var(--text-primary);
}

.filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--accent-primary);
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    font-weight: 600;
}

.filter-count:empty {
    display: none;
}

.filter-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    overflow: visible;
    width: 100%;
}

/* Stats */
.filter-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
}

.stat-number {
    font-size: 0.875rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.stat-text {
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

/* Filter Groups Container */
.filter-groups {
    display: flex;
    gap: var(--space-xl);
    justify-content: center;
    flex-wrap: wrap;
}

/* Individual Filter Group */
.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    min-width: 200px;
}

.filter-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
}

.filter-group-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
}

/* Filter Section (legacy support) */
.filter-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.filter-section-header {
    display: flex;
    justify-content: flex-end;
}

.filter-actions {
    display: flex;
    gap: var(--space-xs);
}

.filter-action {
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    font-size: 0.6875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-action:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Filter Buttons */
.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
}

.filter-btn {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.filter-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-secondary);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--text-primary);
    border-color: var(--text-primary);
    color: var(--bg-primary);
}

/* Time Section */
.time-section {
    padding-top: var(--space-sm);
}

.time-range-wrapper {
    position: relative;
    margin-bottom: var(--space-sm);
}

.time-range-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--border-primary);
    border-radius: var(--radius-full);
    transform: translateY(-50%);
}

.time-range-selected {
    position: absolute;
    top: 50%;
    height: 4px;
    background: var(--accent-primary);
    border-radius: var(--radius-full);
    transform: translateY(-50%);
    pointer-events: none;
}

.time-range-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    margin: 0;
}

.time-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--text-primary);
    border: 2px solid var(--bg-primary);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast);
}

.time-range-input::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.time-range-input::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--text-primary);
    border: 2px solid var(--bg-primary);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: var(--shadow-md);
}

.time-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.time-range-display {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Footer Links */
.footer-links {
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-primary);
}

.footer-links a {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--text-secondary);
}

.footer-divider {
    color: var(--text-muted);
}

/* Keyboard Hint */
.keyboard-hint {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ========================================
   STATS VIEW - WOW FACTOR REDESIGN
   ======================================== */
#statsView {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Container */
.stats-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem 6rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ========== INSIGHT CARDS ========== */
.insight-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 0.3rem;
    padding: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Featured Card (Top Insight) */
.insight-featured {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border: 1px solid var(--accent);
    padding: 2rem;
}

.insight-content {
    flex: 1;
}

.insight-headline {
    font-family: var(--font-sans);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.insight-detail {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Card Headers */
.insight-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.insight-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.insight-subtitle {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.insight-footnote {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-subtle);
}

/* Wide card */
.insight-wide {
    grid-column: 1 / -1;
}

/* ========== GRIDS ========== */
.stats-grid-insights {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.stats-grid-bottom {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

/* ========== THE RACE (Podium) ========== */
.race-podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0.5rem;
    min-height: 140px;
    padding-top: 1rem;
}

.podium-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.podium-bar {
    width: 48px;
    background: var(--bg-tertiary);
    border-radius: 6px 6px 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 0.5rem;
    transition: all 0.3s ease;
}

.podium-bar[data-company="openai"] { background: #13A47D; }
.podium-bar[data-company="anthropic"] { background: #D87756; }
.podium-bar[data-company="google"] { background:#1566E6; }
.podium-bar[data-company="meta"] { background:#A0D4F3; }
.podium-bar[data-company="mistral"] { background: #ff7000; }
.podium-bar[data-company="xai"] { background: #7E97D2; }
.podium-bar[data-company="deepseek"] { background: #4D6BFE; }

.podium-count {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}

.podium-rank {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.2);
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.25rem;
}

.podium-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========== THE SHIFT ========== */
.shift-comparison {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.shift-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.shift-category {
    width: 80px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: right;
    flex-shrink: 0;
}

.shift-bars {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 20px;
}

.shift-bar-old {
    height: 100%;
    background: var(--bg-tertiary);
    border-radius: 3px;
    opacity: 0.5;
}

.shift-bar-new {
    height: 100%;
    border-radius: 3px;
}

.shift-bar-new[data-category="models"] { background: var(--category-models); }
.shift-bar-new[data-category="applications"] { background: var(--category-applications); }
.shift-bar-new[data-category="hardware"] { background: var(--category-hardware); }
.shift-bar-new[data-category="policy"] { background: var(--category-policy); }
.shift-bar-new[data-category="physical"] { background: var(--category-physical); }

.shift-change {
    width: 50px;
    font-size: 0.7rem;
    font-weight: 600;
    text-align: right;
    flex-shrink: 0;
}

.shift-change.positive { color: var(--text-tertiary); }
.shift-change.negative { color: var(--text-tertiary); }
.shift-change.neutral { color: var(--text-tertiary); }

/* ========== HOTTEST STREAK ========== */
.streak-content {
    text-align: center;
}

.streak-company {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.streak-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.streak-unit {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    display: block;
    margin-top: 0.25rem;
}

.streak-period {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-subtle);
}

/* ========== SLEEPER ========== */
.sleeper-content {
    text-align: center;
}

.sleeper-company {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.sleeper-days {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.sleeper-label {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    display: block;
    margin-top: 0.25rem;
}

.sleeper-since {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-subtle);
}

/* ========== PULSE CHART ========== */
.pulse-chart {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 1rem;
}

.pulse-row {
    display: grid;
    grid-template-columns: 45px repeat(12, 1fr);
    gap: 2px;
}

.pulse-header-row {
    margin-bottom: 4px;
}

.pulse-year-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.5rem;
    font-family: var(--font-mono);
}

.pulse-month-label {
    font-size: 0.6rem;
    color: var(--text-tertiary);
    text-align: center;
}

.pulse-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    background: var(--bg-tertiary);
    position: relative;
    transition: transform 0.15s ease;
    cursor: default;
}

.pulse-cell:hover {
    transform: scale(0.95);
    z-index: 10;
}

/* Tooltip on hover */
.pulse-cell::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 100;
}

.pulse-cell:hover::after {
    opacity: 1;
}

/* Intensity levels using data-level */
.pulse-cell[data-level="0"] { background: var(--bg-tertiary); }
.pulse-cell[data-level="1"] { background: rgba(var(--accent-rgb), 0.2); }
.pulse-cell[data-level="2"] { background: rgba(var(--accent-rgb), 0.4); }
.pulse-cell[data-level="3"] { background: rgba(var(--accent-rgb), 0.6); }
.pulse-cell[data-level="4"] { background: rgba(var(--accent-rgb), 0.8); }
.pulse-cell[data-level="5"] { background: var(--accent); }

.pulse-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    color: var(--text-tertiary);
}

.pulse-legend-label {
    margin: 0 0.25rem;
}

.pulse-legend-box {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.pulse-legend-box[data-level="0"] { background: var(--bg-tertiary); }
.pulse-legend-box[data-level="1"] { background: rgba(var(--accent-rgb), 0.2); }
.pulse-legend-box[data-level="2"] { background: rgba(var(--accent-rgb), 0.4); }
.pulse-legend-box[data-level="3"] { background: rgba(var(--accent-rgb), 0.6); }
.pulse-legend-box[data-level="4"] { background: rgba(var(--accent-rgb), 0.8); }
.pulse-legend-box[data-level="5"] { background: var(--accent); }

/* ========== FOCUS SHIFT ========== */
.focus-shift {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.focus-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.focus-category {
    width: 100px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.focus-arrow {
    font-size: 1rem;
    flex-shrink: 0;
}

.focus-arrow.up { color: var(--text-tertiary); }
.focus-arrow.down { color: var(--text-tertiary); }
.focus-arrow.same { color: var(--text-tertiary); }

.focus-change {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.focus-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.focus-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.focus-bar-fill[data-category="models"] { background: var(--category-models); }
.focus-bar-fill[data-category="applications"] { background: var(--category-applications); }
.focus-bar-fill[data-category="hardware"] { background: var(--category-hardware); }
.focus-bar-fill[data-category="policy"] { background: var(--category-policy); }
.focus-bar-fill[data-category="physical"] { background: var(--category-physical); }

/* ========== TAGS ========== */
.stats-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.stats-tag {
    padding: 0.35rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    text-transform: uppercase;
}

.stats-tag-count {
    margin-left: 0.25rem;
    opacity: 0.6;
}

/* Size variations for tag cloud effect */
.stats-tag[data-size="large"] {
    font-size: 0.9rem;
    padding: 0.4rem 0.9rem;
    font-weight: 500;
}

.stats-tag[data-size="medium"] {
    font-size: 0.8rem;
}

/* ========== FUN FACTS ========== */
.fun-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
}

.fun-fact {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.fun-fact-icon {
    font-size: 1.5rem;
}

.fun-fact-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.fun-fact-highlight {
    color: var(--text-primary);
    font-weight: 600;
}

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

@media (max-width: 768px) {
    .stats-container {
        padding: 1rem 1rem 5rem;
    }
    
    .insight-featured {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }
    
    .insight-headline {
        font-size: 1.25rem;
    }
    
    .stats-grid-insights {
        grid-template-columns: 1fr;
    }
    
    .stats-grid-bottom {
        grid-template-columns: 1fr;
    }
    
    .race-podium {
        min-height: 120px;
        flex-wrap: wrap;
        gap: 0.4rem;
        padding-top: 0.75rem;
    }
    
    .podium-item {
        flex: 1 1 70px;
    }
    
    .podium-bar {
        width: 40px;
    }
    
    .pulse-row {
        grid-template-columns: 35px repeat(12, 1fr);
    }
}

@media (max-width: 480px) {

    
    .insight-headline {
        font-size: 1.15rem;
    }
    
    .streak-number,
    .sleeper-days {
        font-size: 2rem;
    }
    
    .race-podium {
        gap: 0.35rem;
        padding-top: 0.5rem;
    }
    
    .podium-item {
        flex: 1 1 60px;
    }
    
    .podium-bar {
        width: 36px;
        padding: 0.4rem;
    }
    
    .podium-label {
        max-width: 72px;
        font-size: 0.6rem;
    }
    
    .pulse-cell {
        border-radius: 2px;
    }
    
    .fun-facts {
        flex-direction: column;
    }
    
    .fun-fact {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .stats-hero {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-sm);
    }
    
    .stats-hero-number {
        font-size: 1.5rem;
    }
    
    .stats-hero-label {
        font-size: 0.625rem;
    }
}

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

@media (max-width: 768px) {
    .header {
        padding: var(--space-sm) var(--space-md);
        height: 48px;
        overflow: hidden;
    }
    
    .header-left {
        min-width: auto;
    }
    
    .logo-text {
        display: none;
    }
    
    .header-center {
        flex: 1;
        justify-content: center;
    }
    
    .header-right {
        min-width: auto;
        gap: var(--space-sm);
    }
    
    .credit {
        display: none;
    }
    
    .view-btn {
        padding: var(--space-xs) var(--space-sm);
        font-size: 0.75rem;
    }
    
    /* Grid */
    .grid-container {
        padding: var(--space-md);
    }
    
    .grid-events {
        grid-template-columns: 1fr;
    }
    
    /* Timeline */
    .timeline-hint {
        font-size: 0.6875rem;
        padding: var(--space-xs) var(--space-sm);
    }
    
    .timeline-event-card {
        min-width: 120px;
        max-width: 150px;
        padding: var(--space-xs) var(--space-sm);
    }
    
    .timeline-event-title {
        font-size: 0.75rem;
    }
    
    /* Panel */
    .event-panel {
        width: 100%;
    }
    
    .panel-content {
        padding: var(--space-lg);
    }
    
    .panel-title {
        font-size: 1.25rem;
    }
    
    /* Filter Bar - Collapsible on mobile */
    .filter-bar {
        position: relative !important;
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        overflow-x: hidden;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 100 !important;
        background: var(--bg-secondary) !important;
        border-top: 1px solid var(--border-primary) !important;
    }
    
    .filter-toggle {
        display: flex !important;
        visibility: visible !important;
        width: 100% !important;
        padding: var(--space-md) !important;
        border-bottom: 1px solid var(--border-primary) !important;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        touch-action: manipulation;
        min-height: 44px; /* iOS recommended touch target */
        cursor: pointer;
    }
    
    .filter-panel {
        display: none !important;
        flex-direction: column !important;
        padding: var(--space-md) !important;
        width: 100% !important;
        max-height: none !important;
    }
    
    .filter-bar.open .filter-panel {
        display: flex !important;
    }
    
    .filter-buttons {
        max-height: 120px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Filter Groups stack vertically on mobile */
    .filter-groups {
        flex-direction: column;
        gap: var(--space-md);
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .filter-buttons {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .header {
        padding: var(--space-xs) var(--space-sm);
    }
    
    .theme-toggle {
        width: 2rem;
        height: 2rem;
    }
    
    .grid-card {
        padding: var(--space-sm);
    }
    
    .grid-card-title {
        font-size: 0.875rem;
    }
    
    .panel-content {
        padding: var(--space-md);
    }
    
    /* Ensure filter bar is always visible on small screens */
    .filter-bar {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .filter-toggle {
        min-height: 44px; /* Better touch target */
    }
}

/* Additional mobile-specific fixes for touch devices */
@media (max-width: 768px) and (pointer: coarse) {
    .filter-bar {
        display: flex !important;
        visibility: visible !important;
    }
    
    .filter-toggle {
        display: flex !important;
        visibility: visible !important;
        min-height: 44px;
    }
}

/* ========== SCROLLBAR STYLING ========== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-secondary) var(--bg-tertiary);
}

/* ========== UTILITIES ========== */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}