:root {
    --color-text: #111;
    --color-heading: #050505;
    --color-muted: #666;
    --color-border: #e6e6e6;
    --color-bg: #fff;
    --color-surface: #f3f3f3;
    --space-1: 0.5rem;
    --space-2: 1rem;
    --space-3: 1.5rem;
    --space-4: 2rem;
    --space-5: 3rem;
    --space-6: 4.5rem;
    --container: 1120px;
    --article: 700px;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    color: var(--color-text);
    background: var(--color-bg);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 1rem;
    line-height: 1.6;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    transition: color 160ms ease, opacity 160ms ease, transform 160ms ease;
}

a:hover {
    color: var(--color-muted);
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3 {
    color: var(--color-heading);
    line-height: 1.1;
    letter-spacing: 0;
}

h1 {
    margin-bottom: var(--space-2);
    font-size: clamp(2.25rem, 7vw, 5rem);
    font-weight: 700;
}

h2 {
    margin-bottom: var(--space-2);
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 650;
}

p {
    margin-bottom: var(--space-2);
}

.container {
    width: min(100% - 2rem, var(--container));
    margin-inline: auto;
}

.site-header {
    border-bottom: 1px solid var(--color-border);
}

.header-inner,
.footer-inner {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding-block: var(--space-3);
}

.site-title {
    font-weight: 700;
    text-decoration: none;
}

.header-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.site-nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-nav a {
    color: var(--color-muted);
    font-size: 0.95rem;
    text-decoration: none;
}

.site-nav a:hover {
    color: var(--color-text);
}

.theme-toggle {
    width: max-content;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.25rem;
    color: var(--color-text);
    background: transparent;
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
}

.theme-toggle span {
    display: inline-block;
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
}

.theme-toggle-light,
[data-theme="dark"] .theme-toggle-dark {
    color: var(--color-bg);
    background: var(--color-text);
}

[data-theme="dark"] .theme-toggle-light {
    color: var(--color-muted);
    background: transparent;
}

.site-main {
    min-height: 60vh;
}

.site-hero {
    padding-block: var(--space-6) var(--space-5);
    border-bottom: 1px solid var(--color-border);
}

.site-description {
    max-width: 680px;
    color: var(--color-muted);
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
}

.eyebrow {
    margin-bottom: var(--space-1);
    color: var(--color-muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.featured-section,
.post-list-section {
    padding-block: var(--space-5);
}

.featured-post {
    display: grid;
    gap: var(--space-3);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--color-border);
}

.featured-image,
.post-card-image {
    width: 100%;
    background: var(--color-surface);
    object-fit: cover;
}

.featured-image {
    aspect-ratio: 16 / 10;
}

.featured-content {
    max-width: 640px;
}

.featured-content p:not(.eyebrow) {
    color: var(--color-muted);
    font-size: 1.05rem;
}

.post-author {
    margin-bottom: var(--space-1);
    color: var(--color-muted);
    font-size: 0.95rem;
}

.post-author a {
    font-weight: 700;
    text-decoration: none;
}

.read-more {
    display: inline-block;
    margin-top: var(--space-1);
    font-weight: 700;
}

.post-grid {
    display: grid;
    gap: var(--space-4);
}

.post-card {
    transition: opacity 160ms ease, transform 160ms ease;
}

.post-card:hover {
    opacity: 0.82;
    transform: translateY(-2px);
}

.post-card-image {
    margin-bottom: var(--space-2);
    aspect-ratio: 16 / 9;
}

.post-card time,
.article-header time {
    display: block;
    margin-bottom: var(--space-1);
    color: var(--color-muted);
    font-size: 0.85rem;
}

.post-card h2 {
    margin-bottom: 0;
    font-size: 1.35rem;
}

.post-card a,
.featured-post h2 a {
    text-decoration: none;
}

.article {
    width: min(100% - 2rem, var(--article));
    margin-inline: auto;
    padding-block: var(--space-5);
}

.article-header {
    margin-bottom: var(--space-4);
}

.article-header h1 {
    font-size: clamp(2.25rem, 6vw, 4rem);
}

.article-author {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

.article-author-image,
.author-image {
    border-radius: 50%;
    object-fit: cover;
}

.article-author-image {
    width: 3rem;
    height: 3rem;
}

.article-author .post-author,
.article-author-bio {
    margin-bottom: 0;
}

.article-author-bio {
    color: var(--color-muted);
    font-size: 0.95rem;
}

.article-image {
    margin: 0 0 var(--space-4);
}

.article-image img {
    width: 100%;
}

.article-image figcaption {
    margin-top: var(--space-1);
    color: var(--color-muted);
    font-size: 0.85rem;
}

.article-content {
    font-size: 1.05rem;
}

.article-content > * + * {
    margin-top: var(--space-3);
}

.article-excerpt,
.article-content p,
.article-content ul,
.article-content ol {
    color: var(--color-text);
}

.article-content p,
.article-content ul,
.article-content ol,
.article-content blockquote,
.article-content hr,
.article-content .kg-card {
    margin-bottom: var(--space-3);
}

.article-content ul,
.article-content ol {
    padding-left: 1.35rem;
}

.article-content li + li {
    margin-top: 0.35rem;
}

.article-content hr {
    border: 0;
    border-top: 1px solid var(--color-border);
}

.article-content h2,
.article-content h3 {
    margin-top: var(--space-4);
    margin-bottom: var(--space-2);
}

.article-content a {
    font-weight: 600;
}

.author-header {
    padding-block: var(--space-6) var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.author-header p {
    max-width: 680px;
    color: var(--color-muted);
    font-size: 1.1rem;
}

.author-image {
    width: 5rem;
    height: 5rem;
    margin-bottom: var(--space-2);
}

.site-footer {
    margin-top: var(--space-5);
    border-top: 1px solid var(--color-border);
    color: var(--color-muted);
    font-size: 0.9rem;
}

.site-footer p {
    margin-bottom: 0;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-text: #e8e8e8;
        --color-heading: #fff;
        --color-muted: #a8a8a8;
        --color-border: #2b2b2b;
        --color-bg: #111;
        --color-surface: #1b1b1b;
    }

    img {
        opacity: 0.92;
    }
}

[data-theme="light"] {
    --color-text: #111;
    --color-heading: #050505;
    --color-muted: #666;
    --color-border: #e6e6e6;
    --color-bg: #fff;
    --color-surface: #f3f3f3;
}

[data-theme="dark"] {
    --color-text: #e8e8e8;
    --color-heading: #fff;
    --color-muted: #a8a8a8;
    --color-border: #2b2b2b;
    --color-bg: #111;
    --color-surface: #1b1b1b;
}

[data-theme="light"] img {
    opacity: 1;
}

[data-theme="dark"] img {
    opacity: 0.92;
}

@media (min-width: 720px) {
    .header-inner,
    .footer-inner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .header-actions {
        flex-direction: row;
        align-items: center;
        gap: var(--space-3);
    }

    .featured-post {
        grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
        align-items: center;
        gap: var(--space-5);
    }

    .post-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
