:root {
    --bg: #ffffff;
    --text: #111111;
    --muted: #666666;
    --link: #0a66c2;
    --sep: #eaeaea;
}
[data-theme="dark"] {
    --bg: #1a1a1e;
    --text: #cfcfd4;
    --muted: #7a7a82;
    --link: #7eb0e8;
    --sep: #2c2c33;
}

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

html { background: var(--bg); color: var(--text); }
body {
    font-family: 'Inter', -apple-system, system-ui, 'Segoe UI', sans-serif;
    font-size: 18px;
    line-height: 1.65;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.masthead {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--sep);
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 10;
}
.masthead-brand {
    font-size: 13px;
    color: var(--muted);
    justify-self: start;
}
.masthead-brand:hover { color: var(--text); text-decoration: none; }
.masthead-title {
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
    font-size: 16px;
}
a.masthead-title:hover { text-decoration: none; opacity: 0.7; }
.theme-toggle {
    justify-self: end;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    color: var(--text);
    line-height: 1;
}
.theme-toggle:hover { opacity: 0.7; }

.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 48px 24px 80px;
}

.cover {
    text-align: center;
    padding: 24px 0 48px;
}
.cover-date {
    font-size: 44px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 20px;
}
.cover-tldr {
    font-size: 19px;
    color: var(--muted);
    line-height: 1.5;
    margin: 0 auto 36px;
    max-width: 560px;
}
.cover-cta {
    display: inline-block;
    font-weight: 600;
    font-size: 16px;
    padding: 12px 28px;
    border: 1px solid var(--text);
    color: var(--text);
    border-radius: 100px;
    transition: background 0.15s ease, color 0.15s ease;
}
.cover-cta:hover {
    background: var(--text);
    color: var(--bg);
    text-decoration: none;
}

.sep { border: none; border-top: 1px solid var(--sep); margin: 48px 0; }

.archive-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 16px;
}
.archive-list { list-style: none; }
.archive-list li { border-bottom: 1px solid var(--sep); }
.archive-list li:last-child { border-bottom: none; }
.archive-list a {
    display: block;
    padding: 20px 0;
    color: var(--text);
}
.archive-list a:hover { text-decoration: none; opacity: 0.65; }
.archive-tldr { font-size: 17px; line-height: 1.5; margin-bottom: 6px; }
.archive-date { font-size: 13px; color: var(--muted); }

.empty { text-align: center; padding: 48px 0; color: var(--muted); }
.empty h1 { font-size: 28px; color: var(--text); margin-bottom: 12px; }

/* article */
.article-head { padding: 24px 0 32px; text-align: center; }
.article-date {
    font-size: 38px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 16px;
}
.article-tldr {
    font-size: 18px;
    color: var(--muted);
    line-height: 1.55;
    max-width: 560px;
    margin: 0 auto;
}

.article-body h2 {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin: 48px 0 12px;
}
.article-body h3 { font-size: 19px; font-weight: 700; margin: 28px 0 8px; }
.article-body p { margin: 12px 0; }
.article-body a { color: var(--link); word-break: break-word; }
.article-body strong { font-weight: 600; color: var(--text); }
.article-body ul, .article-body ol { margin: 12px 0; padding-left: 24px; }
.article-body li { margin: 8px 0; }
.article-body hr { border: none; border-top: 1px solid var(--sep); margin: 40px 0; }
.article-body p.source {
    font-size: 14px;
    color: var(--muted);
    margin-top: 20px;
}
.article-body p.source a { color: var(--link); }
.article-body p.source a:hover { text-decoration: underline; }
.article-body blockquote {
    border-left: 3px solid var(--sep);
    padding-left: 16px;
    color: var(--muted);
    margin: 16px 0;
    font-style: italic;
}
.article-body code {
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: 0.9em;
    padding: 2px 5px;
    background: var(--sep);
    border-radius: 4px;
}

.article-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 56px;
    padding-top: 24px;
    border-top: 1px solid var(--sep);
    font-size: 14px;
    gap: 16px;
    flex-wrap: wrap;
}
.article-nav-adjacent { display: flex; gap: 20px; }

@media (max-width: 600px) {
    body { font-size: 16px; }
    .masthead { padding: 12px 16px; }
    .masthead-brand { font-size: 12px; }
    .container { padding: 32px 16px 56px; }
    .cover-date, .article-date { font-size: 30px; }
    .cover-tldr, .article-tldr { font-size: 16px; }
    .archive-tldr { font-size: 16px; }
    .article-body h2 { font-size: 21px; }
    .article-nav { flex-direction: column; align-items: flex-start; }
}
