/*
 * Single blog post: reading progress, byline, table of contents, share,
 * author card, end-of-article CTA and related posts.
 *
 * Loaded only on single posts.
 */

/* ─── Article body typography ─── */
.mx-blog-single {
    --mx-blog-body-size: 18px;
    --mx-blog-body-lh: 26px;
}

/* Also overrides the 19px/30px small-screen bump in miroseo.css. */
.mx-blog-single .mx-entry-content,
.mx-blog-single .mx-entry-content p,
.mx-blog-single .mx-entry-content li,
.mx-blog-single .mx-entry-content blockquote {
    font-family: var(--mx-font);
    font-size: 18px;
    line-height: 26px;
    font-weight: 400;
    color: #000;
}

/* The site header is sticky everywhere else; long-form reading wants the room. */
body.single-post .mx-site-header {
    position: static;
}

/* ─── Single article: reading experience ─── */
.mx-reading-progress {
    position: fixed;
    inset: 0 0 auto 0;
    height: 3px;
    z-index: 999;
    pointer-events: none;
    background: transparent;
}

.mx-reading-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #fbbf24 0%, #d97706 100%);
    transition: width 0.12s linear;
}

.mx-blog-eyebrow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--mx-blog-muted);
}

.mx-blog-readtime {
    color: var(--mx-gold-dark);
}

.mx-blog-eyebrow-sep {
    opacity: 0.5;
}

/* Author byline + bio card */
.mx-author-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 22px;
}

.mx-author-row .mx-author-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mx-author-row-body {
    display: flex;
    flex-direction: column;
    line-height: 1.35;
}

.mx-author-row .mx-author-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--mx-blog-heading);
}

.mx-author-row .mx-author-role {
    font-size: 0.82rem;
    color: var(--mx-blog-muted);
}

.mx-author-card {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin: 40px 0 0;
    padding: 24px;
    border: 1px solid var(--mx-blog-border);
    border-radius: 16px;
    background: #f8fafc;
}

.mx-author-card .mx-author-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mx-author-card-body {
    min-width: 0;
}

.mx-author-kicker {
    margin: 0 0 4px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mx-gold-dark);
}

.mx-author-card .mx-author-name {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--mx-blog-heading);
}

.mx-author-card .mx-author-role {
    margin: 2px 0 0;
    font-size: 0.88rem;
    color: var(--mx-blog-muted);
}

.mx-author-bio {
    margin: 10px 0 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--mx-blog-text);
}

/* Article + sidebar layout */
.mx-blog-single .mx-blog-article-inner {
    max-width: 1180px;
}

.mx-blog-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 36px;
}

.mx-blog-layout-solo .mx-blog-main {
    max-width: var(--mx-blog-read);
    margin-inline: auto;
}

@media (min-width: 1080px) {
    .mx-blog-layout:not(.mx-blog-layout-solo) {
        grid-template-columns: minmax(0, 1fr) 296px;
        gap: 56px;
        align-items: start;
    }

    .mx-blog-layout:not(.mx-blog-layout-solo) .mx-blog-main {
        order: 1;
        min-width: 0;
    }

    .mx-blog-aside {
        order: 2;
    }
}

.mx-blog-aside-inner {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Table of contents */
.mx-toc {
    border: 1px solid var(--mx-blog-border);
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
}

.mx-toc-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 14px 18px;
    border: 0;
    background: #f8fafc;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.mx-toc-title {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mx-blog-heading);
}

.mx-toc-chevron {
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--mx-blog-muted);
    border-bottom: 2px solid var(--mx-blog-muted);
    transform: rotate(45deg);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.mx-toc-toggle[aria-expanded="true"] .mx-toc-chevron {
    transform: rotate(-135deg);
}

.mx-toc-list {
    list-style: none;
    margin: 0;
    padding: 12px 8px 14px;
    max-height: min(58vh, 520px);
    overflow-y: auto;
}

.mx-toc-item {
    margin: 0;
}

.mx-toc-item a {
    display: block;
    padding: 6px 12px;
    border-left: 2px solid transparent;
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--mx-blog-muted);
    text-decoration: none;
    transition: color 0.15s, border-color 0.15s;
}

.mx-toc-item a:hover {
    color: var(--mx-blog-heading);
}

.mx-toc-level-3 a {
    padding-left: 26px;
    font-size: 0.83rem;
}

.mx-toc-item a.is-active {
    color: var(--mx-gold-dark);
    border-left-color: var(--mx-gold);
    font-weight: 700;
}

@media (max-width: 1079px) {
    .mx-toc-list {
        display: none;
    }

    .mx-toc.is-open .mx-toc-list {
        display: block;
    }
}

@media (min-width: 1080px) {
    .mx-toc-toggle {
        pointer-events: none;
    }

    .mx-toc-chevron {
        display: none;
    }
}

/* Share */
.mx-share {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.mx-blog-main > .mx-share {
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px solid var(--mx-blog-border);
}

.mx-share-label {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mx-blog-muted);
}

.mx-share-list {
    display: flex;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.mx-share-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--mx-blog-border);
    background: #fff;
    color: var(--mx-blog-heading);
    transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.18s;
}

.mx-share-link:hover {
    transform: translateY(-2px);
    color: #fff;
    border-color: transparent;
    background: #0f172a;
}

.mx-share-linkedin:hover { background: #0a66c2; }
.mx-share-facebook:hover { background: #1877f2; }

/* End-of-article CTA */
.mx-blog-cta {
    margin-top: 40px;
    padding: 34px 32px;
    border-radius: 18px;
    background: linear-gradient(165deg, #020617 0%, #0f172a 60%, #1e293b 100%);
    color: #e2e8f0;
    box-shadow: 0 18px 44px rgba(2, 6, 23, 0.28);
}

.mx-blog-cta-kicker {
    margin: 0 0 8px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--mx-gold);
}

.mx-blog-cta-title {
    margin: 0 0 10px;
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: #f8fafc;
}

.mx-blog-cta-text {
    margin: 0 0 22px;
    font-size: 1rem;
    line-height: 1.65;
    color: #cbd5e1;
}

.mx-blog-cta-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 22px;
}

.mx-blog-cta-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.92rem;
    font-weight: 700;
    color: #fde68a;
    text-decoration: none;
}

.mx-blog-cta-link:hover {
    text-decoration: underline;
}

/* Related posts */
.mx-related {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--mx-blog-border);
}

.mx-related-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.mx-related-head h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--mx-blog-heading);
}

.mx-related-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    font-weight: 700;
    color: #4338ca;
    text-decoration: none;
    white-space: nowrap;
}

.mx-related-all:hover {
    text-decoration: underline;
}

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

.mx-related-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--mx-blog-border);
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.22s, transform 0.22s;
}

.mx-related-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.1);
}

.mx-related-media {
    display: block;
    line-height: 0;
    background: #f1f5f9;
}

.mx-related-img {
    display: block;
    width: 100%;
    height: 148px;
    object-fit: cover;
}

.mx-related-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 148px;
    font-size: 1.75rem;
    background: linear-gradient(145deg, #eef2ff, #e8edf2);
}

.mx-related-body {
    padding: 14px 16px 18px;
}

.mx-related-meta {
    margin: 0 0 6px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--mx-gold-dark);
}

.mx-related-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
}

.mx-related-title a {
    color: var(--mx-blog-heading);
    text-decoration: none;
}

.mx-related-title a:hover {
    color: #4338ca;
}

/* Long-form content tables */
.mx-entry-content table {
    width: 100%;
    margin: 1.75em 0;
    border-collapse: collapse;
    font-size: 0.95rem;
    line-height: 1.55;
    background: #fff;
    border: 1px solid var(--mx-blog-border);
    border-radius: 12px;
    overflow: hidden;
}

.mx-entry-content thead th {
    background: #f8fafc;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--mx-blog-heading);
}

.mx-entry-content th,
.mx-entry-content td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--mx-blog-border);
    color: var(--mx-blog-text);
}

.mx-entry-content tbody tr:last-child th,
.mx-entry-content tbody tr:last-child td {
    border-bottom: 0;
}

.mx-entry-content .mx-table-scroll {
    overflow-x: auto;
    margin: 1.75em 0;
}

.mx-entry-content .mx-table-scroll table {
    margin: 0;
    min-width: 560px;
}

/* Nothing is pinned on single posts, so jump links only need breathing room */
.mx-blog-single .mx-entry-content h2[id],
.mx-blog-single .mx-entry-content h3[id] {
    scroll-margin-top: 24px;
}

@media (max-width: 900px) {
    .mx-related-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .mx-related-grid {
        grid-template-columns: 1fr;
    }

    .mx-author-card {
        flex-direction: column;
        gap: 14px;
        padding: 20px;
    }

    .mx-blog-cta {
        padding: 26px 20px;
    }

    .mx-blog-cta-title {
        font-size: 1.25rem;
    }

    .mx-blog-cta-actions .mx-btn {
        width: 100%;
        justify-content: center;
    }
}
