/* Blog-specific styles - layered on top of assets/stylesheet.css
   Reuses .blog-wrapper, .blog-content, .blog-sidebar, .widget, .widget-title
   from the main stylesheet for the two-column layout. */

/* ---- Sticky sidebar fix ----
   The main stylesheet sets `overflow-x: hidden` on #body-wrapper, which silently
   disables `position: sticky` on all descendants. `overflow-x: clip` produces the
   same visual clipping but does NOT create a scroll container, so sticky works. */
#body-wrapper {
    overflow-x: clip;
}

/* ---- Two-column layout overrides ---- */
.blog-wrapper {
    align-items: flex-start;
    gap: 1.5em;
    padding: 0 10px;
    box-sizing: border-box;
}

.blog-content {
    width: 70%;
    min-width: 0;
}

.blog-sidebar {
    width: 28%;
    min-width: 0;
    position: sticky;
    top: 1em;
    align-self: flex-start;
    max-height: calc(100vh - 2em);
    overflow-y: auto;
}

/* ---- Filter banner ---- */
.filter-banner {
    background-color: var(--bg-primary, #fefeee);
    border: var(--theme-primary, #cc0000) solid 2px;
    border-radius: 15px;
    padding: 0.6em 1em;
    margin-bottom: 1em;
    font-size: 0.95em;
    color: var(--text-primary, #000);
    line-height: 1.4;
}

.filter-banner a {
    color: var(--theme-primary, #cc0000);
    text-decoration: none;
    font-weight: 700;
    margin-left: 0.4em;
}

.filter-banner a:hover {
    text-decoration: underline;
}

/* ---- Featured image (tile) ---- */
.post-tile-image-link {
    display: block;
    margin: -1.25em -1.5em 1em -1.5em;
    overflow: hidden;
    border-radius: 15px 15px 0 0;
    line-height: 0;
}

.post-tile-image {
    display: block;
    width: 100%;
    max-height: 220px;
    object-fit: cover;
}

/* ---- Featured image (single post) ---- */
.featured-image {
    display: block;
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1.5em;
}

/* ---- Post tile (summary card) ---- */
.post-tile {
    padding: 1.25em 1.5em;
    margin-bottom: 1.25em;
}

.post-tile-title {
    font-family: Georgia, serif;
    font-size: 1.8em;
    line-height: 1.15;
    margin-bottom: 0.25em;
    -webkit-text-fill-color: var(--theme-primary-light, #ee0000);
    -webkit-text-stroke: var(--text-stroke, #000000) 1px;
}

.post-tile-title a {
    color: inherit;
    text-decoration: none;
    -webkit-text-fill-color: inherit;
    -webkit-text-stroke: inherit;
}

.post-tile-title a:hover {
    text-decoration: underline;
}

.post-tile-meta {
    color: var(--text-secondary, #666);
    font-size: 0.9em;
    margin-bottom: 0.5em;
}

.post-tile-tags {
    margin-bottom: 0.5em;
}

.post-tile-preview {
    line-height: 1.6;
    margin-bottom: 0.75em;
}

.post-tile-preview p {
    margin: 0;
}

.read-more-wrap {
    margin: 0;
    text-align: right;
}

.read-more {
    font-weight: 700;
    color: var(--theme-primary, #cc0000);
    text-decoration: none;
}

.read-more:hover {
    text-decoration: underline;
}

/* ---- Tag chip (used in tiles and inside posts) ---- */
.tag {
    display: inline-block;
    margin: 0 0.35em 0.25em 0;
    padding: 2px 9px;
    border-radius: 10px;
    background-color: rgba(204, 0, 0, 0.15);
    color: var(--theme-primary, #cc0000);
    font-weight: 600;
    font-size: 0.85em;
    text-decoration: none;
}

.tag:hover {
    background-color: rgba(204, 0, 0, 0.3);
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1em;
    margin-bottom: 1em;
}

.pagination .page-link {
    color: var(--theme-primary, #cc0000);
    background-color: var(--bg-primary, #fefeee);
    border: var(--theme-primary, #cc0000) solid 2px;
    border-radius: 15px;
    padding: 6px 14px;
    text-decoration: none;
    font-weight: 700;
}

.pagination .page-link:hover {
    background-color: var(--theme-primary, #cc0000);
    color: white;
}

.pagination .page-link.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination .page-indicator {
    color: white;
    font-weight: 600;
    text-shadow: 1px 1px 2px black;
}

/* ---- Sidebar widgets ---- */
.blog-sidebar .widget {
    padding: 1em 1.2em;
    margin-bottom: 1.2em;
    background-color: var(--bg-primary, #fefeee);
    border: var(--theme-primary, #cc0000) solid 2px;
    border-radius: 15px;
}

.blog-sidebar .widget-title {
    font-family: Georgia, serif;
    color: var(--theme-primary, #cc0000);
    font-size: 1.4em;
    margin-bottom: 0.5em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid rgba(204, 0, 0, 0.3);
}

.sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-list li {
    padding: 4px 0;
    line-height: 1.4;
}

.sidebar-list a {
    color: var(--theme-primary, #cc0000);
    text-decoration: none;
    font-weight: 600;
}

.sidebar-list a:hover {
    text-decoration: underline;
}

.sidebar-list .count {
    color: var(--text-secondary, #888);
    font-size: 0.85em;
    font-weight: 400;
}

.archive-list .archive-year {
    padding: 6px 0;
    border-bottom: 1px dashed rgba(204, 0, 0, 0.2);
}

.archive-list .archive-year:last-child {
    border-bottom: none;
}

.archive-list .archive-year > strong {
    display: block;
    font-family: Georgia, serif;
    color: var(--text-primary, #000);
    font-size: 1.05em;
    margin-bottom: 0.2em;
}

.archive-months {
    list-style: none;
    margin: 0 0 0 0.6em;
    padding: 0;
}

.archive-months li {
    padding: 2px 0;
    font-size: 0.95em;
}

/* ---- Single post ---- */
.single-post {
    padding: 1.5em 1.75em;
}

.single-post-header {
    margin-bottom: 1.25em;
    padding-bottom: 0.75em;
    border-bottom: 1px solid rgba(204, 0, 0, 0.3);
}

.single-post-title {
    font-family: Georgia, serif;
    font-size: 2.4em;
    line-height: 1.15;
    margin-bottom: 0.3em;
    -webkit-text-fill-color: var(--theme-primary-light, #ee0000);
    -webkit-text-stroke: var(--text-stroke, #000000) 1px;
}

.single-post-meta {
    color: var(--text-secondary, #666);
    font-size: 0.95em;
    margin-bottom: 0.4em;
}

.single-post-tags {
    margin-bottom: 0.25em;
}

.back-link {
    margin-top: 1.5em;
    padding-top: 1em;
    border-top: 1px solid rgba(204, 0, 0, 0.2);
    text-align: center;
}

.back-link a {
    color: var(--theme-primary, #cc0000);
    font-weight: 700;
    text-decoration: none;
}

.back-link a:hover {
    text-decoration: underline;
}

/* ---- Post body typography (markdown-rendered) ---- */
.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4 {
    font-family: Georgia, serif;
    color: var(--theme-primary, #cc0000);
    margin-top: 1.25em;
    margin-bottom: 0.4em;
    line-height: 1.2;
}

.post-body h1 { font-size: 1.9em; }
.post-body h2 { font-size: 1.55em; }
.post-body h3 { font-size: 1.25em; }
.post-body h4 { font-size: 1.1em; }

.post-body p {
    line-height: 1.65;
    margin-bottom: 1em;
}

.post-body ul,
.post-body ol {
    margin: 0.75em 0 1em 1.5em;
    line-height: 1.65;
}

.post-body li {
    margin: 0.3em 0;
}

.post-body blockquote {
    border-left: 4px solid var(--theme-primary, #cc0000);
    margin: 1em 0;
    padding: 0.25em 1em;
    color: var(--text-secondary, #555);
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: 0 8px 8px 0;
}

.post-body code {
    font-family: Consolas, "Courier New", monospace;
    background-color: rgba(0, 0, 0, 0.06);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.95em;
}

.post-body pre {
    background-color: rgba(0, 0, 0, 0.06);
    padding: 1em;
    border-radius: 8px;
    overflow-x: auto;
}

.post-body pre code {
    background: transparent;
    padding: 0;
}

.post-body hr {
    margin: 1.5em 0;
    border-top: 1px solid var(--theme-primary, #cc0000);
    border-bottom: none;
    opacity: 0.4;
}

.post-body a {
    color: var(--theme-primary, #cc0000);
    text-decoration: underline;
}

.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1em 0;
}

/* Override global dice-roller table styles inside blog content */
.post-body table {
    display: table;
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0 1.5em 0;
    font-family: Georgia, serif;
    font-size: 1em;
}

.post-body tr {
    display: table-row;
    flex-direction: unset;
}

.post-body th {
    display: table-cell;
    font-family: Georgia, serif;
    font-size: 1em;
    font-weight: 700;
    height: auto;
    padding: 0.5em 0.75em;
    text-align: left;
    background-color: rgba(204, 0, 0, 0.08);
    border: 1px solid rgba(204, 0, 0, 0.3);
    border-bottom: 2px solid var(--theme-primary, #cc0000);
    color: var(--text-primary, #000);
}

.post-body td {
    display: table-cell;
    font-family: Georgia, serif;
    padding: 0.5em 0.75em;
    border: 1px solid rgba(204, 0, 0, 0.2);
    vertical-align: top;
    line-height: 1.5;
}

.post-body tr:nth-child(even) td {
    background-color: rgba(0, 0, 0, 0.03);
}

.post-body strong {
    color: var(--theme-primary, #cc0000);
}

/* ---- Responsive: stack on small screens ---- */
@media screen and (max-width: 700px) {
    .blog-wrapper {
        flex-direction: column;
        padding: 0 5px;
    }
    .blog-content,
    .blog-sidebar {
        width: 100%;
    }
    /* Disable sticky when the sidebar is stacked below the main content */
    .blog-sidebar {
        position: static;
        max-height: none;
        overflow-y: visible;
    }
    .post-tile {
        padding: 1em;
    }
    .post-tile-title {
        font-size: 1.5em;
    }
    .single-post {
        padding: 1em;
    }
    .single-post-title {
        font-size: 1.8em;
    }
    .pagination {
        flex-wrap: wrap;
        gap: 0.5em;
        justify-content: center;
    }
}
