/* ─────────────────────────────────────────────────────────────
   Blog — /blog index and /blog/<slug> article pages
   Tokens mirror main.css so the blog inherits the site palette.
   ───────────────────────────────────────────────────────────── */

.blog * { box-sizing: border-box; }

.blog-wrap {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 32px;
}

/* ── Index hero ─────────────────────────────────────────────── */
.blog-hero {
    background: radial-gradient(120% 140% at 75% 20%, var(--ocean-blue) 0%, var(--slate-blue) 45%, #14243D 100%);
    color: #fff;
    padding: 56px 32px 62px;
    text-align: center;
}

.blog-hero h1 {
    font-family: var(--font-title);
    font-size: 34px;
    line-height: 1.5;
    /* explicit: main.css sets a colour on every h1, which would otherwise
       beat the inherited white and leave this heading 1.3:1 on the hero */
    color: #fff;
    margin-bottom: 14px;
}

.blog-hero p {
    max-width: 640px;
    margin: 0 auto;
    font-size: 15px;
    line-height: 2;
    color: #C3D3E4;
}

/* ── Category filter ────────────────────────────────────────── */
.blog-filters {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 40px auto 0;
}

.blog-filters a {
    font-size: 13.5px;
    color: var(--slate-blue);
    background: #fff;
    border: 1px solid var(--border);
    padding: 7px 16px;
    border-radius: 20px;
    text-decoration: none;
    transition: border-color .15s, color .15s;
}

.blog-filters a:hover { border-color: var(--ocean-blue); color: var(--ocean-blue); }

.blog-filters a.active {
    background: var(--ocean-blue);
    border-color: var(--ocean-blue);
    color: #fff;
    font-weight: 700;
}

.blog-filters a .count {
    opacity: .65;
    font-size: 11.5px;
    margin-inline-start: 4px;
}

/* ── Card grid ──────────────────────────────────────────────── */
.blog-listing { padding: 48px 0 72px; background: var(--arctic-white); }

.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.blog-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    transition: transform .18s, box-shadow .18s;
}

.blog-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.blog-card .thumb {
    aspect-ratio: 1200 / 630;
    background: linear-gradient(135deg, var(--ocean-blue), var(--slate-blue));
    overflow: hidden;
}

.blog-card .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.blog-card .body {
    padding: 20px 22px 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.blog-card .meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.blog-card .cat {
    color: var(--sage-teal);
    font-weight: 700;
}

.blog-card .sep { opacity: .5; }

.blog-card h3 {
    font-family: var(--font-title);
    font-size: 17px;
    line-height: 1.7;
    color: #14243D;
    margin-bottom: 10px;
}

.blog-card p {
    font-size: 13.5px;
    line-height: 2;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.blog-card .more {
    margin-top: auto;
    font-size: 13px;
    font-weight: 700;
    color: var(--ocean-blue);
}

.blog-empty {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-muted);
    font-size: 14.5px;
    line-height: 2;
}

/* ── Pagination ─────────────────────────────────────────────── */
.blog-pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 44px;
}

.blog-pagination a,
.blog-pagination span {
    min-width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    font-size: 13.5px;
    color: var(--slate-blue);
    text-decoration: none;
}

.blog-pagination a:hover { border-color: var(--ocean-blue); color: var(--ocean-blue); }

.blog-pagination .current {
    background: var(--ocean-blue);
    border-color: var(--ocean-blue);
    color: #fff;
    font-weight: 700;
}

.blog-pagination .disabled { opacity: .4; }

/* ── Article header ─────────────────────────────────────────── */
.post-hero {
    background: radial-gradient(120% 150% at 78% 15%, var(--ocean-blue) 0%, var(--slate-blue) 48%, #14243D 100%);
    color: #fff;
    padding: 44px 32px 52px;
}

.post-hero .inner { max-width: 860px; margin: 0 auto; }

.post-hero .crumbs {
    font-size: 12.5px;
    color: #90A8C2;
    margin-bottom: 20px;
}

.post-hero .crumbs a { color: #C3D3E4; text-decoration: none; }
.post-hero .crumbs a:hover { color: #fff; }

.post-hero .cat {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    color: #9FD9CB;
    border: 1px solid rgba(159, 217, 203, .4);
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 16px;
}

.post-hero h1 {
    font-family: var(--font-title);
    font-size: 32px;
    line-height: 1.6;
    color: #fff;
    margin-bottom: 16px;
}

.post-hero .subtitle {
    font-size: 16px;
    line-height: 2;
    color: #C3D3E4;
    margin-bottom: 24px;
}

.post-meta {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    font-size: 12.5px;
    color: #A8BDD4;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, .12);
}

.post-meta .author { color: #fff; font-weight: 700; }

/* ── Article layout ─────────────────────────────────────────── */
.post-layout {
    max-width: 1120px;
    margin: 0 auto;
    padding: 48px 32px 72px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 268px;
    gap: 48px;
    align-items: start;
}

.post-cover {
    width: 100%;
    /* width:100% alone does not stop the image contributing its intrinsic
       1408px to min-content sizing, which widens the grid track past the
       viewport. max-width is what actually caps it. */
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    margin-bottom: 36px;
    display: block;
    }

.post-main { min-width: 0; }

.post-body { font-size: 15.5px; line-height: 2.15; color: #2E3E52; min-width: 0; overflow-wrap: break-word; }

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

.post-body h2 {
    font-family: var(--font-title);
    font-size: 22px;
    line-height: 1.7;
    color: #14243D;
    margin: 48px 0 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    scroll-margin-top: 24px;
}

.post-body h3 {
    font-family: var(--font-title);
    font-size: 17.5px;
    line-height: 1.8;
    color: var(--slate-blue);
    margin: 34px 0 14px;
    scroll-margin-top: 24px;
}

.post-body h4 {
    font-family: var(--font-title);
    font-size: 15.5px;
    color: var(--slate-blue);
    margin: 26px 0 12px;
}

.post-body p { margin: 0 0 18px; }

.post-body ul,
.post-body ol { margin: 0 0 22px; padding-inline-start: 24px; }

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

.post-body li::marker { color: var(--sage-teal); font-weight: 700; }

.post-body strong { color: #14243D; font-weight: 700; }

.post-body em { font-style: normal; color: var(--ocean-blue); }

.post-body a {
    color: var(--ocean-blue);
    text-decoration: none;
    border-bottom: 1px solid rgba(29, 95, 166, .3);
    padding-bottom: 1px;
}

.post-body a:hover { border-bottom-color: var(--ocean-blue); }

.post-body code {
    font-family: Consolas, 'Courier New', monospace;
    font-size: 13px;
    background: var(--cloud-blue);
    color: #14243D;
    padding: 2px 6px;
    border-radius: 5px;
    direction: ltr;
    display: inline-block;
}

.post-body blockquote {
    margin: 0 0 24px;
    padding: 18px 22px;
    background: var(--mint-mist);
    border-inline-start: 4px solid var(--sage-teal);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.post-body blockquote p { margin: 0; color: #1F5F52; font-weight: 700; }

.post-body hr { border: 0; border-top: 1px solid var(--border); margin: 40px 0; }

.post-body .article-figure { margin: 30px 0; }

.post-body .article-figure img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--arctic);
}

.post-body .article-figure figcaption {
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.9;
    color: var(--slate);
    text-align: center;
}

/* Portrait diagrams are several times taller than the text column. Cap them to
   a single screen and let object-fit letterbox the remainder; readers tap the
   image to open the full-resolution file. Scoped by filename so the landscape
   figures keep their natural aspect ratio. */
.post-body .article-figure img[src$="act-decision-making-model-managers.jpg"] {
    max-height: 78vh;
    object-fit: contain;
    object-position: center top;
    cursor: zoom-in;
}

.post-body .md-source {
    font-size: 13px;
    color: var(--text-muted);
    background: var(--arctic-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
}

.post-body .md-table-wrap {
    overflow-x: auto;
    margin: 0 0 26px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    -webkit-overflow-scrolling: touch;
}

.post-body a { overflow-wrap: break-word; }
.post-body code { overflow-wrap: break-word; }

.post-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    line-height: 1.9;
    min-width: 520px;
}

.post-body th {
    background: var(--cloud-blue);
    color: #14243D;
    font-weight: 700;
    text-align: right;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.post-body td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    color: #2E3E52;
}

.post-body tbody tr:last-child td { border-bottom: 0; }
.post-body tbody tr:nth-child(even) { background: #FBFCFE; }

/* ── Table of contents ──────────────────────────────────────── */
.post-toc {
    position: sticky;
    top: 24px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 20px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
}

.post-toc .toc-summary {
    font-family: var(--font-title);
    font-size: 14px;
    /* <summary> gets no bold from the browser the way <h4> did */
    font-weight: 700;
    color: #14243D;
    margin-bottom: 14px;
    cursor: default;
    list-style: none;
}

.post-toc .toc-summary::-webkit-details-marker { display: none; }

.post-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }

.post-toc li { counter-increment: toc; margin-bottom: 9px; }

.post-toc li.depth-3 { padding-inline-start: 14px; }

.post-toc a {
    font-size: 13px;
    line-height: 1.85;
    color: var(--text-muted);
    text-decoration: none;
    display: block;
}

.post-toc a:hover { color: var(--ocean-blue); }

.post-toc .toc-progress {
    height: 3px;
    background: var(--border);
    border-radius: 3px;
    margin-top: 16px;
    overflow: hidden;
}

.post-toc .toc-progress span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--sage-teal);
    transition: width .2s;
}

/* ── Author box ─────────────────────────────────────────────── */
.post-author {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin: 44px 0 0;
}

.post-author img {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.post-author h4 {
    font-family: var(--font-title);
    font-size: 15.5px;
    color: #14243D;
    margin-bottom: 8px;
}

.post-author p { font-size: 13.5px; line-height: 2; color: var(--text-muted); margin-bottom: 10px; }

.post-author .links { display: flex; gap: 14px; flex-wrap: wrap; }

.post-author .links a {
    font-size: 12px;
    color: var(--ocean-blue);
    text-decoration: none;
    border: 1px solid var(--border);
    padding: 4px 11px;
    border-radius: 16px;
}

.post-author .links a:hover { border-color: var(--ocean-blue); }

/* ── CTA + related ──────────────────────────────────────────── */
.post-cta {
    background: linear-gradient(135deg, var(--ocean-blue), #14243D);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 34px 30px;
    margin: 40px 0 0;
    text-align: center;
}

.post-cta h3 {
    font-family: var(--font-title);
    font-size: 19px;
    color: #fff;
    margin-bottom: 10px;
}

.post-cta p { font-size: 14px; line-height: 2; color: #C3D3E4; margin-bottom: 22px; }

.post-related { margin-top: 56px; }

.post-related h3 {
    font-family: var(--font-title);
    font-size: 19px;
    color: #14243D;
    margin-bottom: 22px;
}

.post-related .grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
    .blog-grid,
    .post-related .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 821px) {
    /* Desktop keeps the always-expanded panel; the header is a label, not a
       toggle, so it must not look or behave clickable. */
    .post-toc .toc-summary {
        pointer-events: none;
        user-select: none;
    }
}

@media (max-width: 820px) {
    .post-layout { grid-template-columns: minmax(0, 1fr); gap: 32px; padding: 32px 20px 56px; }

    .post-toc {
        position: static;
        max-height: none;
        overflow-y: visible;
        order: -1;
        padding: 0 20px;
    }

    /* On phones the summary becomes the tap target that opens the list. */
    .post-toc .toc-summary {
        cursor: pointer;
        margin: 0;
        padding: 16px 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        font-size: 16px;
        font-weight: 700;
        gap: 12px;
    }

    .post-toc .toc-summary::after {
        content: '▾';
        font-size: 13px;
        color: var(--ocean-blue);
        transition: transform .15s;
    }

    .post-toc:not([open]) .toc-summary::after { transform: rotate(-90deg); }
    .post-toc:not([open]) .toc-summary { border-bottom: 1px solid var(--border); }
    .post-toc[open] .toc-summary { border-bottom: 1px solid var(--border); margin-bottom: 16px; }
    .post-toc ol { padding-bottom: 18px; }

    .post-hero h1 { font-size: 25px; }
    .blog-hero h1 { font-size: 27px; }
    .blog-wrap { padding: 0 20px; }
}

@media (max-width: 600px) {
    .blog-grid,
    .post-related .grid { grid-template-columns: minmax(0, 1fr); }

    .post-body { font-size: 15px; }
    .post-author { flex-direction: column; }
}
