/* CSS Variables */
:root {
    --background: hsl(0 0% 98%);
    --foreground: hsl(0 0% 10%);
    --card: hsl(0 0% 100%);
    --card-foreground: hsl(0 0% 10%);
    --primary: hsl(214 84% 56%);
    --primary-foreground: hsl(0 0% 98%);
    --secondary: hsl(0 0% 96%);
    --secondary-foreground: hsl(0 0% 25%);
    --muted: hsl(0 0% 96%);
    --muted-foreground: hsl(0 0% 45%);
    --accent: hsl(214 84% 56%);
    --accent-foreground: hsl(0 0% 98%);
    --border: hsl(0 0% 90%);
    --ring: hsl(214 84% 56%);
    --radius: 0.5rem;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    font-size: 14px;
}

/* Navigation */
.nav-header {
    border-bottom: 1px solid var(--border);
    background-color: var(--card);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.nav-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 0.75rem 0;
}

.nav-link {
    text-decoration: none;
    color: var(--muted-foreground);
    font-weight: 500;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: color 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
}

.nav-link:focus {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Main Container */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Masthead */
.masthead {
    text-align: center;
    margin-bottom: 3rem;
}

.site-title {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--foreground);
    margin-bottom: 0.5rem;
}

.current-date {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Section Headers */
.section-header {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-align: center;
    text-transform: uppercase;
    color: var(--foreground);
    margin-bottom: 1.5rem;
}

/* News Grid */
.news-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 4rem;
}

@media (min-width: 769px) and (max-width: 900px) {
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
}

@media (min-width: 901px) and (max-width: 1200px) {
    .news-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5rem;
    }
}

@media (min-width: 1201px) {
    .news-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
}

/* News Column */
.news-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.column-title {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--foreground);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

/* Article List */
.article-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.article-item {
    transition: transform 0.1s ease;
}

.article-link {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 0.5rem;
    margin: -0.5rem;
    border-radius: var(--radius);
    transition: background-color 0.2s ease;
}

.article-link:hover {
    background-color: var(--muted);
}

.article-link:focus {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.article-title {
    color: var(--primary);
    font-weight: 500;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 0.25rem;
    transition: color 0.2s ease;
}

.article-link:hover .article-title {
    color: hsl(214 84% 48%);
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.source-tag {
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.meta-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timestamp {
    white-space: nowrap;
}

.click-count {
    background-color: var(--secondary);
    color: var(--secondary-foreground);
    padding: 0.125rem 0.375rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 500;
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.2s ease;
}

.article-link:hover .click-count,
.article-link:focus .click-count {
    opacity: 1;
    transform: scale(1);
}

/* No Articles State */
.no-articles {
    color: var(--muted-foreground);
    font-style: italic;
    text-align: center;
    padding: 2rem 0;
}

/* Archive Preview */
.archive-preview {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.archive-title {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--foreground);
    text-align: center;
    margin-bottom: 1rem;
}

.archive-title-link {
    color: var(--foreground);
    text-decoration: none;
    transition: color 0.2s ease;
}

.archive-title-link:hover {
    color: var(--primary);
}

.archive-title-link:focus {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
    border-radius: 2px;
}

.archive-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    font-size: 0.875rem;
}

.archive-link {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.archive-link:hover {
    color: hsl(214 84% 48%);
}

.archive-link:focus {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Archive Page Specific */
.archive-selection {
    text-align: center;
    padding: 2rem 0;
}

.archive-subtitle {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 2rem;
}

.archive-dates {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.archive-date-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.archive-date-link:hover {
    background-color: var(--muted);
    color: hsl(214 84% 48%);
}

.archive-date-link:focus {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.no-archives {
    color: var(--muted-foreground);
    font-style: italic;
    padding: 2rem;
}

/* Status Page */
.status-overview {
    margin-bottom: 3rem;
}

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

.status-card {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}

.status-card-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.status-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--foreground);
}

.status-operational {
    color: hsl(142 76% 36%);
}

.status-error {
    color: hsl(0 84% 60%);
}

.status-success {
    color: hsl(142 76% 36%);
}

/* Sources Status */
.sources-status {
    margin-bottom: 3rem;
}

.sources-title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--foreground);
    text-align: center;
    margin-bottom: 2rem;
}

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

.source-status-card {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.source-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 1rem;
    letter-spacing: 0.5px;
}

.source-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.source-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.detail-label {
    color: var(--muted-foreground);
    font-weight: 500;
}

.detail-value {
    color: var(--foreground);
}

.no-sources {
    text-align: center;
    color: var(--muted-foreground);
    font-style: italic;
    padding: 2rem;
}

/* System Information */
.system-info {
    margin-bottom: 3rem;
}

.system-info-title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--foreground);
    text-align: center;
    margin-bottom: 2rem;
}

.system-details {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.system-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.system-detail:last-child {
    border-bottom: none;
}

/* Recent Errors */
.recent-errors {
    margin-bottom: 3rem;
}

.errors-title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--foreground);
    text-align: center;
    margin-bottom: 2rem;
}

.errors-list {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.error-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem;
    background-color: hsl(0 84% 96%);
    border-radius: calc(var(--radius) - 2px);
}

.error-time {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    font-weight: 500;
}

.error-message {
    font-size: 0.875rem;
    color: hsl(0 84% 60%);
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    background-color: var(--card);
    margin-top: 4rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.footer-content {
    text-align: center;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-content a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-content a:hover {
    color: hsl(214 84% 48%);
}

.footer-content a:focus {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Responsive Typography */
@media (min-width: 768px) {
    .site-title {
        font-size: 3rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    body {
        font-size: 15px;
    }
}

/* Focus and Accessibility */
*:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .nav-header,
    .footer,
    .archive-preview {
        display: none;
    }
    
    .news-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .article-link {
        color: var(--foreground) !important;
        text-decoration: underline;
    }
    
    .click-count {
        display: none;
    }
}
