:root {
    --bg-dark: #0a0a0c;
    --accent-cyan: #3bc7c7;
    --accent-purple: #8b5cf6;
    --accent-orange: #f0a33b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.08);
    --font-serif: 'Playfair Display', serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-mono);
    line-height: 1.6;
    margin: 0;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Noise overlay */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.05;
    z-index: 1000;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 4rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

/* Hero Section */
.hero {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    /* Reduced gap to accommodate badge */
}

.author-badge {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 9999px;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    opacity: 0.6;
    transition: all 0.3s ease;
    cursor: default;
}

.author-badge:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.title {
    font-family: var(--font-serif);
    font-size: 4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
    background: linear-gradient(to bottom, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
}


/* Selector Pill */
.selector-pill {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 9999px;
    backdrop-filter: blur(8px);
}

.controls-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

.settings-row {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.settings-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.control-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    opacity: 0.8;
}

.selector-pill.small {
    padding: 0.25rem;
    gap: 0.25rem;
    border-radius: 0.75rem;
}

.repo-btn,
.mode-btn,
.scale-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.6;
}

.mode-btn,
.scale-btn {
    padding: 0.4rem 1rem;
    font-size: 0.75rem;
    border-radius: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.repo-btn:hover,
.mode-btn:hover,
.scale-btn:hover {
    opacity: 1;
    color: var(--text-primary);
}

.repo-btn.active,
.mode-btn.active,
.scale-btn.active {
    background: var(--accent-cyan);
    color: var(--bg-dark);
    font-weight: 600;
    box-shadow: 0 0 15px rgba(59, 199, 199, 0.3);
}

.repo-description {
    font-style: italic;
    font-size: 0.9rem;
    color: var(--text-secondary);
    opacity: 0.7;
    margin-top: 0.5rem;
}

/* Visualization Canvas */
.glass-panel {
    background: rgba(17, 19, 25, 0.7);
    border: 1px solid var(--glass-border);
    border-radius: 2rem;
    backdrop-filter: blur(20px);
    overflow: hidden;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.insight-card {
    padding: 2.5rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: visible;
}

.visualization-canvas {
    min-height: 700px;
    display: flex;
    flex-direction: column;
    padding-bottom: 3rem;
    position: relative;
}

/* ─── Skeleton Loader ─────────────────────────────────────────────────────── */
@keyframes shimmer {
    0%   { background-position: -1000px 0; }
    100% { background-position:  1000px 0; }
}

.skeleton-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.5rem 1rem 1rem;
    background: transparent;
    pointer-events: auto;
}

.skeleton-loading-overlay > * {
    pointer-events: none;
}

/* Shimmer base — applied to every skeleton element */
.skeleton-pill,
.skeleton-tick,
.skeleton-wave {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.04) 0%,
        rgba(255, 255, 255, 0.10) 40%,
        rgba(59, 199, 199, 0.08) 55%,
        rgba(255, 255, 255, 0.04) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 1.8s infinite linear;
    border-radius: 9999px;
}

/* Legend row */
.skeleton-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.skeleton-pill {
    height: 14px;
    border-radius: 9999px;
}
.skeleton-pill:nth-child(1) { width: 60px; animation-delay: 0s; }
.skeleton-pill:nth-child(2) { width: 80px; animation-delay: 0.15s; }
.skeleton-pill:nth-child(3) { width: 70px; animation-delay: 0.3s; }
.skeleton-pill:nth-child(4) { width: 65px; animation-delay: 0.45s; }

/* Chart body */
.skeleton-chart {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.skeleton-chart-inner {
    flex: 1;
    display: flex;
    gap: 0.75rem;
    min-height: 400px;
}

/* Y-axis ticks */
.skeleton-y-axis {
    width: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0.25rem 0;
}

.skeleton-tick {
    height: 10px;
    border-radius: 4px;
}
.skeleton-y-axis .skeleton-tick { width: 32px; }
.skeleton-y-axis .skeleton-tick:nth-child(1) { animation-delay: 0.0s; }
.skeleton-y-axis .skeleton-tick:nth-child(2) { animation-delay: 0.1s; }
.skeleton-y-axis .skeleton-tick:nth-child(3) { animation-delay: 0.2s; }
.skeleton-y-axis .skeleton-tick:nth-child(4) { animation-delay: 0.3s; }
.skeleton-y-axis .skeleton-tick:nth-child(5) { animation-delay: 0.4s; }

/* Stacked area mock */
.skeleton-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0;
    border-radius: 0.75rem;
    overflow: hidden;
    position: relative;
}

.skeleton-wave {
    border-radius: 0;
    animation-timing-function: ease-in-out;
}
.skeleton-wave.wave-1 { flex: 2; animation-delay: 0.05s; opacity: 0.5; }
.skeleton-wave.wave-2 { flex: 3; animation-delay: 0.2s;  opacity: 0.7; }
.skeleton-wave.wave-3 { flex: 4; animation-delay: 0.35s; opacity: 1;   }

/* X-axis ticks */
.skeleton-x-axis {
    display: flex;
    justify-content: space-between;
    padding: 0 44px 0 48px;
}
.skeleton-x-axis .skeleton-tick.short {
    width: 30px;
    height: 10px;
}
.skeleton-x-axis .skeleton-tick:nth-child(1) { animation-delay: 0.0s; }
.skeleton-x-axis .skeleton-tick:nth-child(2) { animation-delay: 0.1s; }
.skeleton-x-axis .skeleton-tick:nth-child(3) { animation-delay: 0.2s; }
.skeleton-x-axis .skeleton-tick:nth-child(4) { animation-delay: 0.3s; }
.skeleton-x-axis .skeleton-tick:nth-child(5) { animation-delay: 0.4s; }
.skeleton-x-axis .skeleton-tick:nth-child(6) { animation-delay: 0.5s; }

/* Keep pulse for any legacy use */
@keyframes pulse {
    0%   { opacity: 0.3; }
    50%  { opacity: 0.8; }
    100% { opacity: 0.3; }
}


.error-banner {
    background: rgba(153, 27, 27, 0.2);
    color: #f87171;
    border: 1px solid rgba(153, 27, 27, 0.4);
    padding: 1rem;
    border-radius: 1rem;
    margin-bottom: 1rem;
    text-align: center;
}

.hidden {
    display: none !important;
}

/* Chart Canvas */
.chart-wrapper {
    flex: 1;
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

svg#main-chart {
    width: 100%;
    flex: 1;
    min-height: 550px;
}

.custom-tooltip {
    position: absolute;
    pointer-events: none;
    background: rgba(10, 10, 12, 0.98);
    border: 1px solid var(--glass-border);
    padding: 1.75rem;
    border-radius: 1.25rem;
    backdrop-filter: blur(16px);
    z-index: 100;
    min-width: 340px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8);
    transition: opacity 0.2s ease;
}

.tooltip-header {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
}

.tooltip-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    padding: 0.35rem 0;
}

.label-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.value-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.percent-tag {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.7;
    font-family: var(--font-mono);
}

.tooltip-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 1.25rem 0;
}

/* Legend Styling */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2.5rem;
    padding: 1.5rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Insights Cards */
.insights-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    position: relative;
}

@media (min-width: 992px) {
    .insights-grid {
        grid-template-columns: repeat(3, 1fr);
        z-index: 1;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .insights-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.insight-card {
    padding: 2.5rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.insight-card:hover {
    transform: translateY(-8px);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.6);
}

.card-title {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    cursor: help;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s ease;
    z-index: 10;
}

.help-icon:hover {
    background: var(--accent-cyan);
    color: var(--bg-dark);
    border-color: var(--accent-cyan);
}

.help-icon::after {
    content: attr(data-tooltip);
    position: fixed;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.98);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.7rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 9999;
    width: max-content;
    max-width: 300px;
    min-width: 180px;
    line-height: 1.4;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    text-align: center;
    left: 50%;
    top: 50%;
    margin-top: -100px;
}

.help-icon:hover::after {
    opacity: 1;
}

.help-icon:hover {
    background: var(--accent-cyan);
    color: var(--bg-dark);
    border-color: var(--accent-cyan);
}

.help-icon::after {
    content: attr(data-tooltip);
    position: fixed;
    bottom: auto;
    top: auto;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.7rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 10000;
    width: max-content;
    max-width: 300px;
    min-width: 180px;
    line-height: 1.4;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.help-icon:hover::after {
    opacity: 1;
}

.metric-value {
    font-family: var(--font-serif);
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.5rem;
    color: var(--accent-cyan);
}

.metric-value.small {
    font-size: 2.2rem;
}

.card-content-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: end;
}

.metric-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.info-card {
    padding: 1.5rem;
    font-size: 0.9rem;
}

.info-card .card-title {
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
}

.card-text {
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Footer */
.footer {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--glass-border);
}

.footer-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.5;
}

/* Personal Narrative Section */
.personal-narrative {
    width: 100%;
    margin: 4rem 0 6rem;
    padding: 4rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 2rem;
    border: 1px solid var(--glass-border);
    text-align: center;
}

.narrative-title {
    font-family: var(--font-serif);
    font-size: 2.2rem;
    margin-bottom: 2.5rem;
    color: var(--text-primary);
}

.narrative-content {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.narrative-content p {
    margin: 0;
}

.philosophy-link {
    color: var(--accent-cyan);
    text-decoration: none;
    border-bottom: 1px solid rgba(59, 199, 199, 0.3);
    transition: all 0.3s ease;
}

.philosophy-link:hover {
    border-bottom-color: var(--accent-cyan);
    background: rgba(59, 199, 199, 0.05);
}

.signature {
    margin-top: 3.5rem;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.4rem;
    color: var(--text-primary);
    opacity: 0.9;
    line-height: 1.4;
}

.signature-subtitle {
    font-style: normal;
    font-size: 0.85rem;
    color: var(--text-secondary);
    opacity: 0.7;
    display: block;
    margin-top: 0.5rem;
    letter-spacing: 0.05em;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Hall of Fossils Section */
.fossil-finder {
    padding: 3rem;
}

.section-title {
    font-family: var(--font-serif);
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
    text-align: center;
}

.fossil-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .fossil-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.fossil-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    padding: 1.25rem 1.5rem;
    position: relative;
    overflow: hidden;
    text-align: left;
}

.fossil-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at top left, rgba(59, 199, 199, 0.08), transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(240, 163, 59, 0.08), transparent 50%);
    pointer-events: none;
    opacity: 0.6;
}

.fossil-card:hover {
    border-color: rgba(59, 199, 199, 0.3);
    box-shadow: 0 0 40px rgba(59, 199, 199, 0.1);
}

.fossil-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.fossil-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-cyan);
}

.fossil-year {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    opacity: 0.8;
}

.fossil-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    opacity: 0.6;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.fossil-commit {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--accent-orange);
    background: rgba(240, 163, 59, 0.1);
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
}

.fossil-code {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.75rem;
    padding: 0.6rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-primary);
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-align: left;
}

.fossil-code::before {
    content: '>';
    color: var(--accent-cyan);
    opacity: 0.5;
    flex-shrink: 0;
    display: inline;
}
