/* Light is the default; [data-theme="dark"] on <html> switches palettes. */
:root {
    --bg: #faf8f4;
    --surface: #ffffff;
    --text: #1f2328;
    --text-muted: #636c76;
    --border: #e6e1d8;
    --accent: #c2410c;
    --accent-soft: #fff1e6;
    --wrong-bg: #fde8e4;
    --right-bg: #e4f5e9;
    --sev-low: #57606a;
    --sev-medium: #9a6700;
    --sev-high: #cf222e;
    --sev-critical-bg: #cf222e;
    --sev-critical-text: #ffffff;
    --shadow: 0 1px 3px rgba(31, 35, 40, 0.06), 0 4px 16px rgba(31, 35, 40, 0.04);
    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #15171a;
    --surface: #1d2024;
    --text: #e8e6e3;
    --text-muted: #9aa1a9;
    --border: #30343a;
    --accent: #ff9f5a;
    --accent-soft: #2c221b;
    --wrong-bg: #3a2523;
    --right-bg: #1f3326;
    --sev-low: #9aa1a9;
    --sev-medium: #e3b341;
    --sev-high: #ff7b72;
    --sev-critical-bg: #ff7b72;
    --sev-critical-text: #15171a;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
}

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

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

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

/* Header */
.site-header {
    border-bottom: 1px solid var(--border);
    background-color: var(--surface);
}

.site-header .container {
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: 60px;
    flex-wrap: wrap;
}

.brand {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background-color: var(--accent);
    color: var(--surface);
    font-size: 16px;
}

.nav {
    display: flex;
    gap: 18px;
    margin-left: auto;
    font-size: 0.95rem;
}

.nav a {
    color: var(--text-muted);
    text-decoration: none;
}

.nav a:hover,
.nav a[aria-current="page"] {
    color: var(--text);
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    cursor: pointer;
    width: 36px;
    height: 36px;
    font-size: 16px;
    line-height: 1;
}

.theme-toggle:hover {
    background-color: var(--accent-soft);
}

.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

main {
    padding: 36px 0 56px;
}

/* Hero */
.hero h1 {
    font-size: 2rem;
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
}

.hero > p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 36em;
}

/* "This week's catch" card */
.catch-card {
    margin-top: 24px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 16px 18px;
}

.catch-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 10px;
}

.catch-row {
    display: grid;
    grid-template-columns: 7.5em 1fr;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
}

.catch-row + .catch-row {
    margin-top: 6px;
}

.catch-row dt {
    font-weight: 600;
    font-size: 0.9rem;
}

.catch-row dd {
    margin: 0;
}

.catch-row.said {
    background-color: var(--wrong-bg);
}

.catch-row.actually {
    background-color: var(--right-bg);
}

.catch-foot {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.catch-foot .meta {
    margin-top: 0;
}

.catch-link {
    font-weight: 600;
    font-size: 0.9rem;
}

/* Section headings */
.section {
    margin-top: 44px;
}

.section-title {
    font-size: 1.25rem;
    margin-bottom: 4px;
}

.section-intro {
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Feed (HN-style numbered list) */
.feed {
    list-style: none;
    counter-reset: feed var(--feed-start, 0);
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.feed-item {
    counter-increment: feed;
    display: grid;
    grid-template-columns: 2.4em 1fr;
    padding: 14px 18px 14px 8px;
}

.feed-item + .feed-item {
    border-top: 1px solid var(--border);
}

.feed-item::before {
    content: counter(feed);
    color: var(--text-muted);
    text-align: right;
    padding-right: 0.8em;
    font-variant-numeric: tabular-nums;
}

.feed.plain .feed-item::before {
    content: '';
}

.feed-title {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    line-height: 1.4;
}

.feed-title:hover {
    color: var(--accent);
}

.feed-domain {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.meta {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 4px;
}

.meta a {
    color: var(--text-muted);
}

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

.sep::before {
    content: ' · ';
}

.pill {
    display: inline-block;
    border: 1px solid currentColor;
    border-radius: 999px;
    padding: 0 8px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.5;
}

.sev-low { color: var(--sev-low); }
.sev-medium { color: var(--sev-medium); }
.sev-high { color: var(--sev-high); }
.sev-critical {
    color: var(--sev-critical-text);
    background-color: var(--sev-critical-bg);
    border-color: var(--sev-critical-bg);
}

.empty {
    color: var(--text-muted);
    padding: 18px;
}

.more {
    margin-top: 14px;
}

.week-heading {
    font-size: 1rem;
    margin: 28px 0 10px;
}

.pager {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
}

/* Article */
.page-title {
    font-size: 1.9rem;
    line-height: 1.25;
    letter-spacing: -0.01em;
    margin-bottom: 8px;
}

.post-summary {
    font-size: 1.15rem;
    color: var(--text-muted);
    margin-top: 14px;
    padding-left: 14px;
    border-left: 3px solid var(--accent);
}

.post-body {
    margin-top: 28px;
}

.post-body h2 {
    font-size: 1.3rem;
    margin: 32px 0 10px;
}

.post-body > h2:first-child {
    margin-top: 0;
}

.post-body p,
.post-body ul,
.post-body ol {
    margin-bottom: 14px;
}

.post-body ul,
.post-body ol {
    padding-left: 1.4em;
}

.post-body li {
    margin-bottom: 6px;
}

.post-body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9em;
    background-color: var(--accent-soft);
    padding: 1px 5px;
    border-radius: 4px;
}

.tags {
    margin-top: 24px;
}

.tag {
    display: inline-block;
    margin: 0 6px 6px 0;
    padding: 2px 10px;
    border-radius: 999px;
    background-color: var(--accent-soft);
    color: var(--text);
    text-decoration: none;
    font-size: 0.85rem;
}

.tag:hover {
    color: var(--accent);
}

.discussion {
    margin-top: 44px;
    padding-top: 28px;
    border-top: 1px solid var(--border);
}

.discussion h2 {
    font-size: 1.3rem;
}

.discussion .section-intro {
    font-size: 0.95rem;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 24px 0 40px;
}

.site-footer a {
    color: var(--text-muted);
}

@media (max-width: 560px) {
    .catch-row {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    body {
        font-size: 16px;
    }

    .hero h1 {
        font-size: 1.6rem;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .nav {
        order: 3;
        width: 100%;
        margin-left: 0;
        padding-bottom: 10px;
    }

    .theme-toggle {
        margin-left: auto;
    }
}
