/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-mono: ui-monospace, 'Cascadia Code', 'Fira Code', monospace;
    
    color-scheme: light dark;
    
    /* Light theme */
    --bg: #ffffff;
    --bg-alt: #f5f6f8;
    --bg-card: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #555770;
    --text-muted: #7a7b92;
    --border: #dcdde5;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: #dbeafe;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --radius: 8px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #111318;
        --bg-alt: #191c24;
        --bg-card: #1e2130;
        --text: #e8e9f0;
        --text-secondary: #b0b2c0;
        --text-muted: #7e8095;
        --border: #2a2d3a;
        --accent: #60a5fa;
        --accent-hover: #93bbfd;
        --accent-light: #1e293b;
        --shadow: 0 1px 3px rgba(0,0,0,0.3);
    }
}

html {
    font-size: 17px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Skip link === */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--accent);
    color: white;
    padding: 0.5rem 1rem;
    z-index: 100;
    border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus {
    top: 0;
}

/* === Container === */
.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
}

/* === Header === */
.site-header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 1.1rem;
}
.logo svg {
    flex-shrink: 0;
}

/* === Navigation === */
.main-nav {
    position: relative;
}

.nav-list {
    list-style: none;
    display: flex;
    gap: 0.3rem;
}
.nav-list a {
    display: block;
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.95rem;
    transition: background 0.15s, color 0.15s;
}
.nav-list a:hover,
.nav-list a:focus-visible {
    background: var(--accent-light);
    color: var(--accent);
}
.nav-list a[aria-current="page"] {
    color: var(--accent);
    font-weight: 600;
    background: var(--accent-light);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text);
}

.hamburger {
    display: block;
    width: 24px;
    height: 2px;
    background: currentColor;
    position: relative;
    transition: 0.2s;
}
.hamburger::before,
.hamburger::after {
    content: '';
    display: block;
    width: 24px;
    height: 2px;
    background: currentColor;
    position: absolute;
    left: 0;
    transition: 0.2s;
}
.hamburger::before { top: -7px; }
.hamburger::after  { top: 7px; }

.nav-toggle[aria-expanded="true"] .hamburger {
    background: transparent;
}
.nav-toggle[aria-expanded="true"] .hamburger::before {
    top: 0;
    transform: rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .hamburger::after {
    top: 0;
    transform: rotate(-45deg);
}

/* === Hero === */
.hero {
    padding: 3rem 0 2rem;
    text-align: center;
}
.hero h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.25;
    margin-bottom: 1rem;
}
.hero-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* === Featured articles grid === */
.featured-articles {
    padding: 1rem 0 3rem;
}
.featured-articles h2 {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.25rem;
}

.article-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: transform 0.15s, box-shadow 0.15s;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.card-icon {
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.article-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
}
.article-card h3 a {
    text-decoration: none;
    color: var(--text);
}
.article-card h3 a:hover {
    color: var(--accent);
}
.article-card p {
    font-size: 0.92rem;
    color: var(--text-secondary);
    flex-grow: 1;
}
.article-card time {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: auto;
}
.card-link {
    font-size: 0.9rem;
    color: var(--accent);
    font-weight: 600;
}

/* === Articles list page === */
.articles-list {
    padding: 1.5rem 0 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.list-article {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    background: var(--bg-card);
    box-shadow: var(--shadow);
}
.list-article .article-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}
.list-article time {
    color: var(--text-muted);
}
.tag {
    display: inline-block;
    background: var(--accent-light);
    color: var(--accent);
    padding: 0.15rem 0.6rem;
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.78rem;
}
.list-article h2 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}
.list-article h2 a {
    text-decoration: none;
    color: var(--text);
}
.list-article h2 a:hover {
    color: var(--accent);
}
.list-article p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* === Full article === */
.article-full {
    padding: 2rem 0 3rem;
}
.article-header {
    margin-bottom: 2rem;
}
.article-header .article-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.88rem;
}
.article-header time {
    color: var(--text-muted);
}
.article-header h1 {
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.article-content h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 2rem 0 0.75rem;
    color: var(--text);
}
.article-content p {
    margin-bottom: 1.1rem;
    color: var(--text-secondary);
}

/* === About page === */
.about-content {
    padding: 2rem 0 3rem;
}
.about-content h1 {
    font-size: 1.85rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
}
.about-content section {
    margin-bottom: 2rem;
}
.about-content h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}
.about-content p {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.7;
}

/* === Page headings (generic) === */
main h1 {
    font-size: 1.85rem;
    font-weight: 800;
    margin: 2rem 0 1rem;
}

/* === Footer === */
.site-footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    background: var(--bg-alt);
    padding: 2rem 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.site-footer p + p {
    margin-top: 0.25rem;
}

/* === Responsive === */
@media (max-width: 640px) {
    html {
        font-size: 16px;
    }

    .nav-toggle {
        display: block;
    }

    .nav-list {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        flex-direction: column;
        min-width: 180px;
        padding: 0.5rem;
        z-index: 60;
    }
    .nav-list.open {
        display: flex;
    }

    .hero h1 {
        font-size: 1.5rem;
    }
    .hero-text {
        font-size: 1rem;
    }

    .articles-grid {
        grid-template-columns: 1fr;
    }

    .article-header h1 {
        font-size: 1.45rem;
    }
}

/* === Focus styles === */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}