:root {
    --bg-color: #ffffff;
    --surface-color: #f3f8ff;
    --surface-hover: #e5ebfa;
    --text-primary: #000000;
    --text-secondary: #43454e;
    --border-color: #e3e6e8;
    
    --lane-vision: #972982;
    --lane-nlp: #5a56a1;
    --lane-coding: #1a76c2;
    --lane-impact: #6b98be;
    
    --region-us: #5a56a1;
    --region-china: #972982;
    --region-europe: #1a76c2;
    --region-canada: #6b98be;
    --region-multiple: #3d3a6f;
    --region-global: #43454e;
    
    --font-sans: 'Poppins', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --timeline-width: 4000px;
    --timeline-height: 600px;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Typography */
h1 { font-size: 2.5rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 0.5rem; }
h2 { font-size: 1.25rem; font-weight: 400; color: var(--text-secondary); margin-bottom: 1.5rem; }
h3 { font-size: 1.5rem; font-weight: 600; margin-bottom: 1rem; }

/* Header & Controls */
.hero {
    padding: 3rem 2rem 2rem;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.hero-content {
    max-width: 1200px;
    margin: 0 auto;
}

.controls {
    max-width: 1200px;
    margin: 2rem auto 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
}

.search-box {
    position: relative;
    flex-grow: 1;
    max-width: 300px;
}

.search-box svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-box input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: var(--lane-vision);
}

.size-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.size-control select {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    outline: none;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: border-color 0.2s;
}

.size-control select:focus {
    border-color: var(--lane-vision);
}

.region-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    background: var(--surface-color);
    padding: 0.4rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.region-legend.hidden {
    display: none !important;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.action-btn {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.view-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.action-btn:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.hidden { display: none !important; }

/* Timeline Container */
.timeline-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    background-color: var(--bg-color);
    cursor: grab;
    /* Hide scrollbar for cleaner look but keep functionality */
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-color);
}

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

.zoom-selection {
    position: absolute;
    top: 0;
    height: 100%;
    background: rgba(26, 118, 194, 0.2);
    border: 1px solid rgba(26, 118, 194, 0.5);
    pointer-events: none;
    z-index: 10;
}

.timeline-scroll-area {
    width: var(--timeline-width);
    height: var(--timeline-height);
    position: relative;
    margin: 2rem 0;
}

.timeline-scroll-area.smooth-zoom {
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Phases Background */
.timeline-phases {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.phase-bg {
    position: absolute;
    top: 0;
    height: 100%;
    border-left: 1px dashed rgba(0,0,0,0.1);
}

.phase-label {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(0,0,0,0.5);
    white-space: nowrap;
}

/* Grid & Lanes */
.timeline-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.timeline-years {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.year-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    border-left: 1px solid var(--border-color);
}

.year-label {
    position: absolute;
    top: -20px;
    left: 5px;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.timeline-lanes {
    position: absolute;
    top: 40px; /* Below year labels */
    left: 0;
    width: 100%;
    height: calc(100% - 40px);
    pointer-events: none;
}

.lane-divider {
    position: absolute;
    left: 0;
    width: 100%;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.lane-label {
    position: sticky;
    left: 1rem;
    display: inline-block;
    transform: translateY(-50%);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(0,0,0,0.3);
    z-index: 2;
}

/* Milestones */
.milestones-layer {
    position: absolute;
    top: 40px;
    left: 0;
    width: 100%;
    height: calc(100% - 40px);
    z-index: 10;
}

.milestone {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    width: var(--node-size, 14px);
    height: var(--node-size, 14px);
    z-index: 10;
    transition: width 0.3s ease, height 0.3s ease, opacity 0.3s ease;
}

.milestone:hover {
    z-index: 20;
}

.milestone.filtered-out {
    opacity: 0.1;
    pointer-events: none;
}

.node {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: currentColor;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease-out;
}

.milestone:hover .node {
    transform: scale(1.2);
    box-shadow: 
        0 0 0 3px var(--bg-color), 
        0 0 0 5px currentColor, 
        0 0 15px 5px currentColor;
}

/* Breakthrough milestone highlight */
@keyframes breakthroughPulse {
    0%, 100% { box-shadow: 0 0 0 3px var(--bg-color), 0 0 0 5px #f59e0b, 0 0 12px 2px rgba(245, 158, 11, 0.4); }
    50% { box-shadow: 0 0 0 3px var(--bg-color), 0 0 0 6px #f59e0b, 0 0 20px 6px rgba(245, 158, 11, 0.6); }
}

.milestone.breakthrough .node {
    animation: breakthroughPulse 2.5s ease-in-out infinite;
}

.milestone.breakthrough:hover .node {
    animation: none;
}

/* Tooltip */
.timeline-tooltip {
    position: absolute;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-primary);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, transform 0.2s;
    transform: translate(-50%, calc(-100% - var(--tooltip-offset, 10px)));
    z-index: 100;
    width: max-content;
    max-width: 300px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.timeline-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, calc(-100% - var(--tooltip-offset, 24px)));
}

.tooltip-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.3;
}

.tooltip-meta {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    gap: 8px;
    align-items: center;
}

.tooltip-metric {
    margin-top: 8px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

.tooltip-metric-label {
    color: var(--text-secondary);
    margin-right: 4px;
}

/* Lane Colors */
.lane-vision .node { color: var(--lane-vision); }
.lane-nlp .node { color: var(--lane-nlp); }
.lane-coding .node { color: var(--lane-coding); }
.lane-impact .node { color: var(--lane-impact); }

/* Region Colors */
.region-us .node { color: var(--region-us); }
.region-china .node { color: var(--region-china); }
.region-europe .node { color: var(--region-europe); }
.region-canada .node { color: var(--region-canada); }
.region-multiple .node { color: var(--region-multiple); }
.region-global .node { color: var(--region-global); }

/* Methodology Note */
.methodology-note {
    max-width: 1200px;
    margin: 1rem auto 3rem;
    padding: 0 2rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.5;
}

.methodology-note strong {
    color: var(--text-primary);
}

/* Side Panel (formerly Modal) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: #ffffff;
    border-left: 1px solid var(--border-color);
    border-radius: 0;
    width: 100%;
    max-width: 480px;
    height: 100vh;
    max-height: 100vh;
    overflow-y: auto;
    position: relative;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal {
    transform: translateX(0);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.modal-close:hover {
    color: var(--text-primary);
    background: rgba(0,0,0,0.05);
}

.modal-content {
    padding: 3rem 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.panel-top-bar {
    height: 4px;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.modal-header {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.modal-meta-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.modal-meta {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--lane-vision); /* Default, will be overridden by JS */
    font-weight: 600;
}

.modal-title {
    font-family: 'Georgia', serif;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0;
    line-height: 1.1;
    color: var(--text-primary);
}

.modal-org {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.tag.breakthrough-tag { border-color: #f59e0b; color: #92400e; background: rgba(245, 158, 11, 0.1); font-weight: 600; }
.tag.proprietary { border-color: var(--border-color); color: var(--text-secondary); }
.tag.open { border-color: var(--lane-nlp); color: var(--lane-nlp); }
.tag.industry { border-color: var(--lane-impact); color: var(--lane-impact); }
.tag.coding { border-color: var(--lane-coding); color: var(--lane-coding); }

.param-box {
    background: var(--surface-hover);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--lane-coding);
    margin-top: 1rem;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.section-block {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.section-block h4 {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin: 0;
}

.section-block p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.paper-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--lane-coding);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
    margin-top: 0.5rem;
}

.paper-link:hover {
    color: var(--lane-vision);
    text-decoration: underline;
}

.related-milestones {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.related-tag {
    background: var(--surface-hover);
    border: 1px solid var(--border-color);
    color: var(--lane-coding);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.related-tag:hover {
    background: rgba(26, 118, 194, 0.2);
}

/* Conclusion */
.conclusion {
    padding: 4rem 2rem;
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
}

.conclusion-content {
    max-width: 800px;
    margin: 0 auto;
}

.conclusion-content p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.conclusion-content strong {
    color: var(--text-primary);
}

/* Disclaimer */
.disclaimer {
    padding: 2rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
}

.disclaimer-content {
    max-width: 800px;
    margin: 0 auto;
}

.disclaimer-content p {
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.disclaimer-content strong {
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .hero { padding: 2rem 1rem 1rem; }
    h1 { font-size: 1.8rem; }
    .controls { flex-direction: column; align-items: stretch; }
    .search-box { max-width: 100%; }
    .modal-content { padding: 1.5rem; }
    .modal-grid { grid-template-columns: 1fr; }
}
