/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-red: #ff1744;
    --primary-red-dark: #d50000;
    --canada-red: #ff0000;
    --background: #0a0a0a;
    --surface: #1a1a1a;
    --surface-light: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #666666;
    --border: #333333;
    --accent: #4fc3f7;
    --success: #4caf50;
    --warning: #ff9800;
    --error: #f44336;
    --shadow: rgba(0, 0, 0, 0.3);
    --gradient-bg: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    transition: all 0.3s ease;
}

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

.nav-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--accent);
}

/* Hero Section - Debt Clock */
.hero {
    background: var(--gradient-bg);
    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(circle at 30% 70%, rgba(255, 23, 68, 0.1) 0%, transparent 50%);
}

.debt-clock-container {
    text-align: center;
    position: relative;
    z-index: 2;
    margin-top: 80px;
}

.debt-title {
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
}

.debt-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.currency-symbol {
    font-size: 3rem;
    font-weight: 300;
    color: var(--primary-red);
    margin-top: -1rem;
}

.debt-amount {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 700;
    color: var(--primary-red);
    letter-spacing: -0.02em;
    font-feature-settings: 'tnum';
    min-height: 1.2em;
    text-shadow: 0 0 30px rgba(255, 23, 68, 0.3);
}

.currency-label {
    font-size: 2rem;
    font-weight: 300;
    color: var(--text-secondary);
    margin-top: -1rem;
}

.debt-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.stat-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    border-color: var(--accent);
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    font-feature-settings: 'tnum';
}

.last-updated {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Chart Section */
.chart-section {
    background: var(--surface);
    padding: 5rem 0;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-primary);
}

.chart-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.time-range-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.time-btn {
    background: var(--surface-light);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

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

.time-btn.active {
    background: var(--accent);
    color: var(--background);
    border-color: var(--accent);
}

.chart-options {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chart-options label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
}

.chart-options input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.chart-container {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 2rem;
    min-height: 500px;
}

/* Prime Minister Timeline */
.pm-timeline {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    backdrop-filter: blur(10px);
}

.pm-timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.pm-timeline-header h4 {
    color: var(--text-primary);
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.pm-legend {
    display: flex;
    gap: 1rem;
}

.pm-legend-item {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.pm-legend-item.liberal {
    background: rgba(220, 53, 69, 0.3);
    color: #dc3545;
    border: 1px solid #dc3545;
}

.pm-legend-item.conservative {
    background: rgba(0, 123, 255, 0.3);
    color: #007bff;
    border: 1px solid #007bff;
}

.pm-timeline-content {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: stretch;
}

.pm-period {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    padding: 0.75rem 0.5rem;
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-grow: 1;
    border: 1px solid transparent;
}

.pm-period:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.pm-period.liberal {
    background: rgba(220, 53, 69, 0.2);
    border-color: rgba(220, 53, 69, 0.4);
}

.pm-period.conservative {
    background: rgba(0, 123, 255, 0.2);
    border-color: rgba(0, 123, 255, 0.4);
}

.pm-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    display: block;
}

.pm-years {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Integrated Prime Minister Timeline (Andex-style) */
.pm-timeline-integrated {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
    backdrop-filter: blur(10px);
}

.pm-timeline-integrated .pm-timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.pm-title {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.pm-timeline-integrated .pm-legend {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-right: 0.3rem;
}

.legend-dot.liberal {
    background: #dc3545;
}

.legend-dot.conservative {
    background: #007bff;
}

.pm-timeline-track {
    position: relative;
    height: 60px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    overflow: hidden;
}

.pm-bar {
    position: absolute;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0.25rem 0.5rem;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
}

.pm-bar:hover {
    transform: scaleY(1.1);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.pm-bar.liberal {
    background: linear-gradient(135deg, 
        rgba(220, 53, 69, 0.7) 0%, 
        rgba(220, 53, 69, 0.5) 100%);
    border-top: 2px solid #dc3545;
}

.pm-bar.conservative {
    background: linear-gradient(135deg, 
        rgba(0, 123, 255, 0.7) 0%, 
        rgba(0, 123, 255, 0.5) 100%);
    border-top: 2px solid #007bff;
}

.pm-label {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-primary);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.pm-period-years {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    white-space: nowrap;
    opacity: 0.9;
}

/* Chart Legend */
.chart-legend {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
}

.chart-legend h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.legend-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

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

.legend-area {
    width: 20px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
    opacity: 0.6;
}

.legend-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-style: italic;
}

.legend-item.covid .legend-area {
    background: rgba(255, 107, 107, 0.6);
    border: 1px solid #ff6b6b;
}

.legend-item.crisis .legend-area {
    background: rgba(255, 217, 61, 0.6);
    border: 1px solid #ffd93d;
}

.legend-item.oil-crisis .legend-area {
    background: rgba(255, 217, 61, 0.6);
    border: 1px solid #ffd93d;
}

.legend-item.war .legend-area {
    background: rgba(142, 36, 170, 0.6);
    border: 1px solid #8e24aa;
}

.legend-item.depression .legend-area {
    background: rgba(255, 140, 66, 0.6);
    border: 1px solid #ff8c42;
}

/* Info Cards */
.info-cards {
    padding: 5rem 0;
    background: var(--gradient-bg);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.info-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.info-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-4px);
    border-color: var(--accent);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

.info-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

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

/* About Section */
.about-section {
    background: var(--surface);
    padding: 5rem 0;
}

.about-content h2 {
    font-size: 2.5rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-primary);
}

.about-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    align-items: start;
}

.about-text p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.7;
}

.about-text h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    margin: 2rem 0 1rem 0;
    font-weight: 600;
}

.about-text ul {
    list-style: none;
    margin-left: 0;
}

.about-text li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.about-text li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: bold;
}

.about-stats {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.stat-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    backdrop-filter: blur(10px);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    display: block;
    margin-bottom: 0.5rem;
}

.stat-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Data Sources Section */
.data-sources-section {
    background: var(--background);
    padding: 5rem 0;
}

.data-sources-section h2 {
    font-size: 2.5rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-primary);
}

.sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.source-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    backdrop-filter: blur(10px);
}

.source-card h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.source-card ul {
    list-style: none;
}

.source-card li {
    margin-bottom: 0.5rem;
}

.source-card a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s ease;
}

.source-card a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.methodology {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    backdrop-filter: blur(10px);
}

.methodology h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-bottom: 2rem;
    font-weight: 600;
}

.method-item {
    margin-bottom: 2rem;
}

.method-item h4 {
    color: var(--accent);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.method-item p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Footer */
footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 3rem 0 1rem 0;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    margin-bottom: 2rem;
}

.footer-info h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.footer-info p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 2rem;
}

.link-group h4 {
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.link-group a {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.link-group a:hover {
    color: var(--accent);
}

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

.footer-bottom p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav-links {
        gap: 1rem;
    }
    
    .debt-title {
        font-size: 2rem;
    }
    
    .debt-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .chart-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .time-range-buttons {
        justify-content: center;
    }
    
    .pm-timeline-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .pm-timeline-content {
        flex-direction: column;
    }
    
    .pm-period {
        min-width: auto;
        flex-direction: row;
        justify-content: space-between;
    }
    
    .about-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .about-stats {
        flex-direction: row;
        justify-content: space-around;
    }
    
    .sources-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .legend-items {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .debt-display {
        flex-direction: column;
        gap: 0;
    }
    
    .currency-symbol,
    .currency-label {
        font-size: 1.5rem;
        margin-top: 0;
    }
    
    .about-stats {
        flex-direction: column;
    }
}

/* Loading Animation */
.loading {
    opacity: 0.5;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus Styles */
button:focus,
a:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .navbar,
    .chart-controls,
    footer {
        display: none;
    }
    
    .hero {
        min-height: auto;
        padding: 2rem 0;
    }
    
    body {
        background: white;
        color: black;
    }
}