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

html {
    font-size: 17px;
    line-height: 1.7;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1a1a1a;
    background: #fff;
}

a {
    color: #0056b3;
    text-decoration: none;
}
a:hover { text-decoration: underline; }

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

/* --- Layout --- */
header, main, footer {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

header {
    padding-top: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e8e8e8;
}

main {
    padding-top: 2rem;
    padding-bottom: 3rem;
    min-height: 60vh;
}

footer {
    padding: 1.5rem 0;
    border-top: 1px solid #e8e8e8;
    color: #888;
    font-size: 0.85rem;
}

/* --- Header --- */
.site-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: #1a1a1a;
    letter-spacing: -0.01em;
}

/* --- Post cards (index page) --- */
.post-card {
    margin-bottom: 2.5rem;
}

.post-card__title {
    font-size: 1.35rem;
    line-height: 1.3;
    margin-bottom: 0.15rem;
}

.post-card__title a {
    color: #1a1a1a;
}
.post-card__title a:hover {
    color: #0056b3;
}

.post-card__date {
    display: block;
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.post-card__preview {
    color: #444;
    font-size: 0.95rem;
    line-height: 1.6;
}

.post-card__link {
    display: inline-block;
    margin-top: 0.4rem;
    font-size: 0.9rem;
}

/* --- Full post --- */
.post__header {
    margin-bottom: 2rem;
}

.post__title {
    font-size: 2rem;
    line-height: 1.25;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.post__date {
    display: block;
    font-size: 0.85rem;
    color: #888;
}

.post__content {
    font-size: 1.05rem;
    line-height: 1.8;
}

/* --- Typography inside post content --- */
.post__content h1 { font-size: 1.7rem; margin: 2rem 0 0.75rem; }
.post__content h2 { font-size: 1.45rem; margin: 1.8rem 0 0.6rem; }
.post__content h3 { font-size: 1.25rem; margin: 1.5rem 0 0.5rem; }
.post__content h4 { font-size: 1.1rem; margin: 1.3rem 0 0.4rem; }

.post__content p {
    margin-bottom: 1rem;
}

.post__content ul, .post__content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.post__content li {
    margin-bottom: 0.25rem;
}

.post__content blockquote {
    border-left: 3px solid #ddd;
    padding-left: 1rem;
    margin: 1rem 0;
    color: #555;
    font-style: italic;
}

.post__content code {
    background: #f4f4f4;
    padding: 0.15em 0.35em;
    border-radius: 3px;
    font-size: 0.9em;
}

.post__content pre {
    background: #f4f4f4;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin-bottom: 1rem;
    font-size: 0.9em;
    line-height: 1.5;
}

.post__content pre code {
    background: none;
    padding: 0;
}

.post__content img {
    display: block;
    margin: 1.5rem 0;
    border-radius: 4px;
}

.post__content hr {
    border: none;
    border-top: 1px solid #e8e8e8;
    margin: 2rem 0;
}

.post__content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.post__content th, .post__content td {
    border: 1px solid #ddd;
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.post__content th {
    background: #f4f4f4;
    font-weight: 600;
}

/* --- TOC (Table of Contents) --- */
.toc {
    background: #f8f8f8;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin-bottom: 2rem;
}

.toc__title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.toc ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.toc ul ul {
    padding-left: 1.25rem;
}

.toc li {
    margin-bottom: 0.2rem;
}

.toc a {
    color: #0056b3;
    font-size: 0.9rem;
    line-height: 1.5;
}

.toc a:hover {
    text-decoration: underline;
}

/* --- Footnotes --- */
.footnote-ref {
    font-size: 0.8em;
    vertical-align: super;
    line-height: 0;
}

.footnote-ref a {
    color: #0056b3;
    text-decoration: none;
    font-weight: 600;
}

.footnote-ref a:hover {
    text-decoration: underline;
}

section.footnotes {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e8e8e8;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #444;
}

section.footnotes ol {
    padding-left: 1.5rem;
    list-style: decimal;
}

section.footnotes li {
    margin-bottom: 0.6rem;
}

section.footnotes li p {
    display: inline;
    margin: 0;
}

section.footnotes .footnote {
    font-size: 0.75em;
    color: #888;
    text-decoration: none;
    margin-left: 0.3em;
}

section.footnotes .footnote:hover {
    color: #0056b3;
}

/* Scroll margin so anchored headings don't hide under fixed elements */
.post__content [id] {
    scroll-margin-top: 1.5rem;
}

/* --- Post navigation --- */
.post-nav {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e8e8e8;
}

/* --- Error / Empty states --- */
.error, .empty {
    text-align: center;
    padding: 3rem 0;
    color: #888;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    html { font-size: 15px; }
    .post__title { font-size: 1.6rem; }
}
