:root {
    --ink: #1c1c1c;
    --ink-faint: #6b6b6b;
    --accent: #b8860b;
    --accent-soft: #f5ecd8;
    --border: #e6e2da;
    --bg: #fdfcfa;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Public Sans', -apple-system, Helvetica, Arial, sans-serif;
    font-size: 14px;
    /* Belt-and-suspenders against anything (a long unbroken URL, an over-wide embedded
       element in markdown content) forcing a horizontal scrollbar on the whole page. */
    overflow-x: hidden;
}

img, svg, video {
    max-width: 100%;
    height: auto;
}

::selection {
    background: var(--accent);
    color: #fff;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

h1, h2, .blog-brand {
    font-family: 'Fraunces', Georgia, serif;
}

a {
    color: var(--accent);
    text-decoration: none;
}

.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 1.1em;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    vertical-align: -0.2em;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: 'liga';
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
    user-select: none;
}

.blog-header {
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
}

.blog-header-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
}

.blog-brand {
    font-size: 20.5px;
    font-weight: 600;
    color: var(--ink);
}

.blog-back-link {
    color: var(--ink-faint);
    font-size: 13.5px;
}

.blog-shell {
    max-width: 880px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

.blog-layout {
    max-width: 1120px;
    margin: 0 auto;
    padding: 40px 24px 80px;
    display: flex;
    gap: 48px;
    align-items: flex-start;
}

.blog-main {
    flex: 1;
    min-width: 0;
}

.blog-aside {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: sticky;
    top: 24px;
}

@media (max-width: 860px) {
    .blog-layout {
        flex-direction: column;
        /* align-items: flex-start (set above for the desktop row layout, so the sidebar
           doesn't stretch to the article's height) becomes shrink-to-fit on the cross axis
           once the container is column-direction here — .blog-main would size itself to its
           widest unwrapped content (e.g. a long code line) instead of the viewport, blowing
           out the whole page horizontally. Stretch keeps children at the container's width. */
        align-items: stretch;
    }

    .blog-aside {
        width: 100%;
        position: static;
    }
}

@media (max-width: 600px) {
    .blog-header-inner {
        padding: 0 16px;
    }

    .blog-shell,
    .blog-layout {
        padding: 24px 16px 56px;
        gap: 32px;
    }

    .blog-brand {
        font-size: 18px;
    }

    .post-detail h1 {
        font-size: 27px;
    }

    .post-card h2 {
        font-size: 20px;
    }

    .post-detail-content {
        font-size: 15px;
    }

    .post-detail-content h1 { font-size: 24px; }
    .post-detail-content h2 { font-size: 20px; }
    .post-detail-content h3 { font-size: 17.5px; }

    .post-card-cover {
        max-height: 220px;
    }

    .post-detail-cover {
        max-height: 260px;
    }
}

@media (max-width: 420px) {
    .post-detail h1 {
        font-size: 23px;
    }

    .post-card h2 {
        font-size: 19px;
    }

    .btn-share {
        width: 32px;
        height: 32px;
    }

    .post-reactions,
    .post-share {
        gap: 8px;
    }

    .btn-reaction {
        padding: 7px 12px;
        font-size: 12.5px;
    }
}

.widget {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    background: #fff;
}

.widget h3 {
    font-size: 13.5px;
    margin: 0 0 14px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.widget-sub {
    font-size: 12.5px;
    color: var(--ink-faint);
    margin: 0 0 12px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
    font-size: 12px;
}

.calendar-dow {
    color: var(--ink-faint);
    font-weight: 600;
    padding-bottom: 6px;
}

.calendar-day {
    padding: 6px 0;
    border-radius: 4px;
    color: var(--ink-faint);
}

.calendar-day.has-posts {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
}

.calendar-day.is-today {
    outline: 1.5px solid var(--accent);
    outline-offset: -1.5px;
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.newsletter-form input {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 9px 10px;
    font-size: 13.5px;
    font-family: inherit;
}

.newsletter-form button {
    border: none;
    border-radius: 6px;
    padding: 9px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
}

.newsletter-form button:disabled {
    opacity: .6;
    cursor: default;
}

.newsletter-success {
    background: #eef7ee;
    border: 1px solid #cfe8cf;
    border-radius: 6px;
    padding: 10px 12px;
    color: #2a6b2a;
    font-size: 13px;
}

.newsletter-error {
    color: #b3261e;
    font-size: 12px;
    margin-top: 6px;
}

.category-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.category-list a {
    color: var(--ink);
    font-size: 13.5px;
}

.category-list a:hover {
    color: var(--accent);
}

.blog-loading, .blog-empty {
    text-align: center;
    color: var(--ink-faint);
    padding: 80px 0;
}

.post-grid {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.post-card {
    border-bottom: 1px solid var(--border);
    padding-bottom: 32px;
}

.post-card-cover {
    width: 100%;
    height: auto;
    max-height: 320px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 16px;
}

.post-card-category, .post-tag {
    display: inline-block;
    font-size: 11.5px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--accent);
}

.post-card h2 {
    margin: 8px 0;
    font-size: 24px;
    overflow-wrap: break-word;
}

.post-card h2 a {
    color: var(--ink);
}

.post-card-excerpt {
    color: var(--ink-faint);
    line-height: 1.6;
    overflow-wrap: break-word;
}

.post-card-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12.5px;
    color: var(--ink-faint);
    margin-top: 8px;
}

.post-tag {
    color: var(--ink-faint);
    text-transform: none;
}

.post-read-more {
    display: inline-block;
    margin-top: 14px;
    font-size: 13px;
}

.category-heading {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.category-heading h1 {
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    margin: 0;
}

.scroll-sentinel {
    display: flex;
    justify-content: center;
    padding: 32px 0 8px;
    min-height: 1px;
}

.breadcrumbs {
    font-size: 13px;
    color: var(--ink-faint, #8B96A0);
    margin-bottom: 16px;
}

.breadcrumbs a {
    color: var(--ink-faint, #8B96A0);
}

.related-posts {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border, #e0e0e0);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px 0 32px;
    color: var(--ink-faint, #8B96A0);
    font-size: 14px;
}

.pagination a {
    color: var(--ink);
    text-decoration: underline;
}

.blog-end {
    color: var(--ink-faint);
    font-size: 12.5px;
}

.btn-line {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 16px;
    color: var(--ink);
}

.post-detail-cover {
    width: 100%;
    height: auto;
    max-height: 420px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 20px;
}

.post-detail h1 {
    font-size: 35px;
    margin: 8px 0 12px;
    overflow-wrap: break-word;
}

.post-detail-content {
    margin-top: 24px;
    line-height: 1.8;
    font-size: 16px;
    overflow-wrap: break-word;
}

.post-detail-content p {
    margin: 0 0 1.2em;
}

.post-detail-content h1,
.post-detail-content h2,
.post-detail-content h3,
.post-detail-content h4 {
    font-family: 'Fraunces', Georgia, serif;
    margin: 1.4em 0 .5em;
    line-height: 1.3;
}

.post-detail-content h1 { font-size: 28px; }
.post-detail-content h2 { font-size: 23px; }
.post-detail-content h3 { font-size: 19.5px; }
.post-detail-content h4 { font-size: 17px; }

.post-detail-content ul,
.post-detail-content ol {
    margin: 0 0 1.2em;
    padding-left: 1.4em;
}

.post-detail-content li {
    margin-bottom: .4em;
}

.post-detail-content blockquote {
    margin: 0 0 1.2em;
    padding: 4px 20px;
    border-left: 3px solid var(--accent);
    color: var(--ink-faint);
    font-style: italic;
}

.post-detail-content code {
    background: var(--accent-soft);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: .9em;
}

.post-detail-content pre {
    background: #1c1c1c;
    color: #f3f0e8;
    border-radius: 8px;
    padding: 16px 18px;
    overflow-x: auto;
    margin: 0 0 1.2em;
}

.post-detail-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.post-detail-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* display:block turns the table itself into its own horizontal-scroll container, so a wide
   table in a post can't force the whole page to scroll sideways on a narrow screen. */
.post-detail-content table {
    display: block;
    overflow-x: auto;
    border-collapse: collapse;
    width: 100%;
    margin: 0 0 1.2em;
    font-size: .95em;
}

.post-detail-content th,
.post-detail-content td {
    border: 1px solid var(--border);
    padding: 8px 10px;
    text-align: left;
}

.post-detail-content a {
    text-decoration: underline;
}

.post-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
    margin-bottom: 28px;
}

.btn-reaction {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 16px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    font-size: 13.5px;
    white-space: nowrap;
}

.btn-reaction:disabled {
    cursor: default;
    opacity: .65;
}

.post-reactions + .btn-line {
    display: inline-block;
}

.post-share {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 28px;
}

.post-share-label {
    color: var(--ink-faint);
    font-size: 13.5px;
    margin-right: 2px;
}

.btn-share {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.btn-share:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.post-comments {
    margin-top: 56px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.post-comments h2 {
    font-size: 20.5px;
    margin-bottom: 20px;
}

.field {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 12.5px;
    color: var(--ink-faint);
}

.field input, .field textarea {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 14px;
}

.contact-success {
    background: #eef7ee;
    border: 1px solid #cfe8cf;
    border-radius: 6px;
    padding: 16px;
    color: #2a6b2a;
}

.comment-list {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment-item {
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
}

.comment-meta {
    display: flex;
    gap: 12px;
    align-items: baseline;
    margin-bottom: 6px;
}

.comment-author {
    font-weight: 600;
}

.comment-date {
    font-size: 11.5px;
    color: var(--ink-faint);
}
