/* post-wide-13 — Magazine article styles (Ghost) */
/* =========================================================
   MAGAZINE ARTICLE — Ghost CMS
   ========================================================= */

:root {
    --text-main: #111827;
    --text-muted: #6b7280;
    --accent-blue: #3b82f6;
    --border: #e5e7eb;
    --border-light: #eeeeee;
    --soft-bg: #f9fafb;
    --radius: 12px;

    /* One font stack for hero, article, sidebar and Related Articles */
    --font: "SF Pro Display", "SF Pro Icons", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* ---------- Global ---------- */

html { scroll-behavior: smooth; }
body { background: #ffffff !important; overflow-x: hidden; }
*, *::before, *::after { box-sizing: border-box; }
img { max-width: 100%; }
button, input { font: inherit; }

/* ---------- Typography base ---------- */

.magazine-container,
.related-posts-bottom-section {
    font-family: var(--font);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Keep theme heading/paragraph fonts from overriding the system stack */
.magazine-container :is(h1, h2, h3, h4, p, li, blockquote, figcaption),
.related-posts-bottom-section :is(h2, h3, h4) {
    font-family: inherit;
}

/* ---------- Layout shell ---------- */

.magazine-container {
    width: 100%;
    max-width: 1500px;
    margin: 40px auto;
    padding: 0 24px;
}

.content-card {
    background: #ffffff;
    border-radius: var(--radius);
    box-shadow: 0 2px 25px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

/* Stop Ghost content from forcing the grid wider than the viewport */
.post-content,
.post-content > *,
.article-column,
.hero-card,
.hero-left,
.hero-right,
.sidebar,
.toc-sidebar {
    max-width: 100%;
    min-width: 0;
}

.article-column,
.toc-sidebar,
.sidebar { width: 100%; }

/* =========================================================
   HERO
   ========================================================= */

.hero-card {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 48px;
    padding: 60px;
    margin-bottom: 40px;
    align-items: center;
}

.post-title-large {
    font-size: clamp(1.75rem, 1.1rem + 1.6vw, 2.5rem);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.022em;
    color: var(--text-main);
    margin: 0 0 24px;
    overflow-wrap: break-word;
}

.post-excerpt-muted {
    font-size: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
    line-height: 1.6;
    color: var(--text-muted);
    margin: 0 0 30px;
    overflow-wrap: break-word;

    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.author-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    font-size: 14px;
    line-height: 1.5;
    color: #4b5563;
    margin-bottom: 28px;
}

.author-meta-row a { color: inherit; }
.dot-sep { color: #9ca3af; }

.share-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 22px;
    border: 0;
    border-radius: 22px;
    background: #e5e7eb;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    text-decoration: none;
    cursor: pointer;
    transition: background .2s ease, transform .2s ease;
}

.share-pill:hover {
    background: #d1d5db;
    transform: translateY(-1px);
}

.hero-right img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--radius);
}

/* =========================================================
   MAIN 3-COLUMN LAYOUT  (TOC | ARTICLE | SIDEBAR)
   ========================================================= */

.main-content-layout {
    --toc-w: 220px;
    --side-w: 280px;

    display: grid !important;
    grid-template-columns: var(--toc-w) minmax(0, 1fr) var(--side-w);
    gap: 40px;
    width: 100%;
    align-items: start;
}

.article-body-card {
    width: 100%;
    min-width: 0;
    padding: 60px;
}

/* =========================================================
   TABLE OF CONTENTS
   ========================================================= */

.toc-sidebar,
.sidebar {
    position: sticky;
    top: 100px;
    align-self: start;
}

.toc-card {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 22px;
}

.toc-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-main);
    margin: 0 0 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.js-toc {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
}

.js-toc a {
    display: block;
    width: 100%;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-muted);
    text-decoration: none;
    padding: 7px 0 7px 10px;
    border-left: 2px solid transparent;
    overflow-wrap: anywhere;
    transition: color .2s ease, border-color .2s ease, padding-left .2s ease;
}

.js-toc a:hover { color: var(--accent-blue); }

.js-toc a.active {
    color: var(--accent-blue);
    font-weight: 600;
    border-left-color: var(--accent-blue);
    padding-left: 12px;
}

.js-toc a.toc-h3 { padding-left: 20px; font-size: 13px; }
.js-toc a.toc-h3.active { padding-left: 24px; }

/* =========================================================
   ARTICLE TYPOGRAPHY  (Apple Newsroom–inspired, system fonts)
   Scale: body 17–18 · lead 18–21 · H2 24–32 · H3 21–24 · H4 17–20
   Sizes are fluid, so no per-breakpoint font overrides are needed.
   ========================================================= */

.magazine-container .post-content {
    --pc-text: #1d1d1f;
    --pc-soft: #0a0a0a;
    --pc-muted: #050505;
    --pc-font: var(--font);
    --pc-body: clamp(1.125rem, 1rem + 0.5vw, 1.25rem);       /* 18px mobile → 20px desktop */
    --pc-lead: clamp(1.125rem, 1rem + 0.5vw, 1.25rem);    /* 20px → 23px */
    --pc-h2: clamp(1.625rem, 1.35rem + 1vw, 2rem);           /* 26px → 32px */
    --pc-h3: clamp(1.375rem, 1.2rem + 0.6vw, 1.625rem);      /* 22px → 26px */
    --pc-h4: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
    --pc-quote: clamp(1.1875rem, 1.05rem + 0.6vw, 1.5rem);

    width: 100%;
    color: var(--pc-text);
    font-kerning: normal;
    overflow-wrap: break-word;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.magazine-container .post-content :is(p, li) {
    font-size: var(--pc-body);
    font-family: var(--pc-font);
    font-weight: 400;
    line-height: 1.6;
    letter-spacing: 0;
    color: var(--pc-text);
}

.magazine-container .post-content p { margin: 0 0 1.5em; }

.magazine-container .post-content > p:first-of-type {
    font-size: var(--pc-lead);
    line-height: 1.55;
    letter-spacing: 0;
    color: var(--pc-soft);
    margin: 0 0 1.6em;
}

.magazine-container .post-content :is(strong, b) { font-weight: 600; }

.magazine-container .post-content :is(h2, h3, h4) {
    font-family: var(--pc-font);
    font-weight: 600;
    color: var(--pc-text);
    text-wrap: balance;
    scroll-margin-top: 100px;
}

.magazine-container .post-content h2 { font-size: var(--pc-h2); line-height: 1.25; letter-spacing: -0.01em; margin: 2em 0 0.65em; }
.magazine-container .post-content h3 { font-size: var(--pc-h3); line-height: 1.3;  letter-spacing: -0.005em; margin: 1.7em 0 0.55em; }
.magazine-container .post-content h4 { font-size: var(--pc-h4); line-height: 1.35; letter-spacing: 0;        margin: 1.5em 0 0.45em; }

.magazine-container .post-content > :is(h2, h3, h4):first-child { margin-top: 0; }

/* Blockquote + captions use the same Georgia stack */
.magazine-container .post-content :is(blockquote, blockquote p, figcaption) { font-family: var(--pc-font); }

/* ---------- Blockquote ---------- */

.magazine-container .post-content blockquote {
    font-size: var(--pc-quote);
    font-weight: 500;
    font-style: normal;
    line-height: 1.4;
    letter-spacing: -0.018em;
    color: var(--pc-text);
    background: #f8fafc;
    border: 0;
    border-left: 4px solid var(--accent-blue) !important;
    padding: 28px 34px;
    margin: 40px 0;
}

.magazine-container .post-content blockquote p {
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    letter-spacing: inherit;
    color: inherit;
    margin: 0 0 0.75em;
}

.magazine-container .post-content blockquote p:last-child { margin-bottom: 0; }

.magazine-container .post-content blockquote :is(cite, footer) {
    display: block;
    margin-top: 1em;
    font-size: 0.6em;
    font-style: normal;
    font-weight: 400;
    letter-spacing: -0.005em;
    color: var(--pc-muted);
}

/* ---------- Lists ---------- */

.magazine-container .post-content :is(ul, ol) { margin: 1.4em 0 1.6em; }
.magazine-container .post-content li { margin-bottom: 0.65em; }
.magazine-container .post-content li:last-child { margin-bottom: 0; }
.magazine-container .post-content li > :is(ul, ol) { margin: 0.55em 0 0; }

.magazine-container .post-content ul { list-style: none; padding-left: 0; }

.magazine-container .post-content ul li {
    position: relative;
    padding-left: 1.65em;
}

.magazine-container .post-content ul li::before {
    content: "";
    position: absolute;
    left: 0;
    top: calc((1.6em - 6px) / 2);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--pc-text);
}

.magazine-container .post-content ol { list-style: decimal outside; padding-left: 1.6em; }
.magazine-container .post-content ol li { padding-left: 0.25em; }
.magazine-container .post-content ol li::marker { font-weight: 600; }

/* ---------- Captions & inline safety ---------- */

.magazine-container .post-content figcaption {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.45;
    letter-spacing: -0.003em;
    color: var(--pc-muted);
    text-align: center;
    margin: 12px 0 0;
    padding: 0 4px;
}

.magazine-container .post-content figcaption a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.magazine-container .post-content :is(a, :not(pre) > code) { overflow-wrap: anywhere; }
.magazine-container .post-content :where(p, li) img { max-width: 100%; height: auto; }

.post-content pre { overflow-x: auto; }
.post-content table { display: block; overflow-x: auto; }
.post-content :is(iframe, video) { max-width: 100%; }

/* =========================================================
   GHOST IMAGES, GALLERY, SLIDESHOW, GRID
   ========================================================= */

.kg-image-card,
.kg-gallery-card,
.ghost-injected-slideshow,
.ghost-injected-grid {
    width: 100%;
    margin: 40px 0;
}

.kg-image-card img,
.kg-gallery-image img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 12px !important;
}

/* Native gallery is converted by the script; this only avoids a flash before it runs */
.kg-gallery-row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 20px !important;
}

.kg-gallery-image img { object-fit: cover; }

/* 3 images → slideshow */

.ghost-injected-slideshow {
    position: relative;
    z-index: 0;
    isolation: isolate; /* keeps arrows/counter/dots below the sticky site header */
}

.slideshow-viewport {
    position: relative;
    z-index: 0;
    isolation: isolate;
    width: 100%;
    overflow: hidden;
    border-radius: 12px;
    background: #f3f4f6;
}

.slideshow-track {
    display: flex;
    width: 100%;
    transition: transform .45s ease;
}

.slideshow-slide {
    flex: 0 0 100%;
    width: 100%;
    cursor: pointer;
}

.slideshow-slide img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

.slideshow-counter {
    position: absolute;
    /* bottom-right: keeps clear of the vertically-centred arrows */
    bottom: 14px;
    right: 15px;
    top: auto;
    z-index: 2;
    pointer-events: none;
    line-height: 1;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(0, 0, 0, .65);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
}

/* Round overlay buttons (slideshow + lightbox) */
.slideshow-arrow,
.lightbox-arrow,
.lightbox-close {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2;
}

.slideshow-arrow,
.lightbox-arrow { top: 50%; transform: translateY(-50%); }

.slideshow-arrow {
    width: 46px;
    height: 46px;
    z-index: 3;
    background: rgba(255, 255, 255, .92);
    color: #111827;
    box-shadow: 0 5px 20px rgba(0, 0, 0, .15);
}

.slideshow-arrow:hover {
    transform: translateY(-50%) scale(1.08);
    background: #ffffff;
}

.slideshow-arrow svg { width: 22px; height: 22px; }
.slideshow-arrow-prev { left: 18px; }
.slideshow-arrow-next { right: 18px; }

.slideshow-dots {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 2;
}

.slideshow-dot {
    width: 9px;
    height: 9px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .55);
    cursor: pointer;
}

.slideshow-dot.active {
    background: #ffffff;
    transform: scale(1.35);
}

/* 4+ images → grid */

.ghost-injected-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.grid-gallery-item {
    min-width: 0;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
}

.grid-gallery-item img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 260px;
    object-fit: cover;
    transition: transform .35s ease;
}

.grid-gallery-item:hover img { transform: scale(1.03); }

/* =========================================================
   RIGHT SIDEBAR — RECOMMENDED ARTICLES
   ========================================================= */

.sidebar-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin: 0 0 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}

.recommend-posts-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
}

.recommend-post-card {
    --thumb: 95px;

    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 14px;
    overflow: hidden;
    transition: transform .25s ease, box-shadow .25s ease;
}

.recommend-post-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .08);
}

.recommend-post-link {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
    padding: 12px;
    text-decoration: none;
    color: inherit;
}

.recommend-image-wrap { flex: 0 0 var(--thumb); width: var(--thumb); }

.recommend-thumb {
    display: block;
    width: var(--thumb);
    height: var(--thumb);
    object-fit: cover;
    border-radius: 10px;
    background: #e5e7eb;
}

.recommend-info { flex: 1; min-width: 0; }

/* Shared by the sidebar and the Related Articles cards */
.recommend-tag,
.related-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--accent-blue);
    margin-bottom: 5px;
}

.recommend-title,
.related-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-main);
    margin: 0 0 7px;
}

.recommend-title {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.meta-dot { opacity: .5; }

/* =========================================================
   ARTICLE FOOTER, TAGS, AUTHOR BOXES (rendered by the footer partial)
   ========================================================= */

.article-footer-area {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid #f3f4f6;
}

.article-footer-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.tag-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    margin: 0;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    border-radius: 20px;
    background: #f3f4f6;
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
    text-decoration: none;
    transition: background .2s ease, color .2s ease;
}

.tag-pill:hover { background: #e5e7eb; color: var(--text-main); }

.author-box {
    display: flex;
    align-items: center;
    gap: 24px;
    width: 100%;
    padding: 36px;
    margin-top: 60px;
    border-radius: 12px;
    background: var(--soft-bg);
}

.author-box-avatar-link { flex: 0 0 auto; }

.author-box-avatar {
    display: block;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    background: #e5e7eb;
}

.author-box-info { flex: 1; min-width: 0; }

.author-box-name {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-main);
    margin: 0 0 6px;
}

.author-box-bio {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-muted);
    margin: 0 0 16px;
}

.author-name-link,
.author-link { color: inherit; text-decoration: none; }
.author-name-link:hover,
.author-link:hover { color: var(--accent-blue); }

.social-icons { display: flex; gap: 12px; }

.social-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #4b5563;
    text-decoration: none;
    transition: background .2s ease, color .2s ease;
}

.social-icon-btn:hover { background: #d1d5db; color: var(--text-main); }

/* Author boxes: single vs multiple */

.author-boxes { margin-top: 60px; }
.author-boxes .author-box { margin-top: 0; }

.author-boxes.is-multiple {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.author-boxes.is-multiple .author-box { padding: 20px; gap: 16px; align-items: flex-start; }
.author-boxes.is-multiple .author-box-avatar { width: 48px; height: 48px; }
.author-boxes.is-multiple .author-box-name { font-size: 17px; margin-bottom: 4px; }

.author-boxes.is-multiple .author-box-bio {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* =========================================================
   LIGHTBOX
   ========================================================= */

.premium-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .92);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}

.premium-lightbox.active { opacity: 1; visibility: visible; }

.lightbox-content-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 70px 90px;
}

.lightbox-image-viewport {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image-viewport img {
    display: block;
    max-width: 90vw;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    user-select: none;
}

.lightbox-close,
.lightbox-arrow { color: #ffffff; }

.lightbox-close {
    top: 25px;
    right: 30px;
    width: 46px;
    height: 46px;
    background: rgba(255, 255, 255, .12);
}

.lightbox-arrow {
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, .14);
}

.lightbox-close:hover { background: rgba(255, 255, 255, .25); }

.lightbox-arrow:hover {
    background: rgba(255, 255, 255, .25);
    transform: translateY(-50%) scale(1.08);
}

.lightbox-arrow svg { width: 25px; height: 25px; }
.lightbox-arrow-prev { left: 25px; }
.lightbox-arrow-next { right: 25px; }

.lightbox-counter {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    padding: 7px 14px;
    border-radius: 20px;
    background: rgba(0, 0, 0, .55);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
}

/* =========================================================
   SHARE MODAL (markup comes from the share-modal partial)
   ========================================================= */

.share-modal-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, .5);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .3s ease, visibility .3s ease;
}

.share-modal-overlay.active { opacity: 1; visibility: visible; pointer-events: auto; }

.share-modal-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    padding: 24px;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 20px 40px rgba(0, 0, 0, .1);
    transform: translateY(20px);
    transition: transform .3s ease;
}

.share-modal-overlay.active .share-modal-card { transform: translateY(0); }

.share-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 24px;
}

.share-modal-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    color: #111827;
    margin: 0;
}

.share-modal-close {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f3f4f6;
    color: #6b7280;
    cursor: pointer;
}

.share-modal-close:hover { background: #e5e7eb; color: #111827; }

.share-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.share-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.share-item:hover { transform: translateY(-3px); }

.share-icon-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: #ffffff;
}

.share-label {
    width: 100%;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    color: #4b5563;
    word-break: break-word;
}

.bg-facebook { background: #1877F2; }
.bg-x,
.bg-threads { background: #000000; }
.bg-linkedin { background: #0A66C2; }
.bg-email { background: #EA4335; }
.bg-whatsapp { background: #25D366; }
.bg-telegram { background: #0088CC; }
.bg-more { background: #9ca3af; }

.share-divider { height: 1px; background: #f3f4f6; margin: 24px 0; }

.share-link-section { display: flex; flex-direction: column; gap: 8px; }
.share-link-label { font-size: 13px; font-weight: 600; color: #6b7280; }
.share-link-input-group { display: flex; gap: 8px; width: 100%; }

.share-link-input {
    flex: 1;
    min-width: 0;
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
    font-size: 13px;
    color: #4b5563;
    outline: none;
}

.share-copy-btn {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 16px;
    border: 0;
    border-radius: 10px;
    background: #111827;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

/* =========================================================
   RELATED ARTICLES (bottom section)
   ========================================================= */

.related-posts-bottom-section {
    width: 100%;
    max-width: 1078px;          /* was 980px (+10%) */
    margin: 30px auto 0;
    padding: 0 20px;
}

.related-posts-bottom-title {
    font-size: clamp(1.5rem, 1.32rem + 0.66vw, 1.925rem);   /* +10% */
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.018em;
    text-align: center;
    color: var(--text-main);
    margin: 0 0 33px;
}

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

.related-post-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    overflow: hidden;
    transition: transform .3s ease, box-shadow .3s ease;
}

.related-post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .06);
}

.related-post-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.related-image-wrap { width: 100%; overflow: hidden; }

.related-thumb {
    display: block;
    width: 100%;
    height: 154px;              /* was 140px (+10%) */
    object-fit: cover;
    border-radius: 10px 10px 0 0;
}

.related-info { display: flex; flex-direction: column; flex: 1; padding: 16.5px; }

/* Related Articles card text +10% (sidebar keeps its own sizes) */
.related-post-card .related-tag { font-size: 12.1px; margin-bottom: 5.5px; }
.related-post-card .related-title { font-size: 16.5px; margin-bottom: 8px; }

.related-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: auto;
    font-size: 13.2px;
    color: var(--text-muted);
}

/* =========================================================
   PER-POST VISIBILITY VIA GHOST INTERNAL TAGS
   ---------------------------------------------------------
   #hiddentoc table of contents      #nosidebar  recommended sidebar (not rendered)
   #nonauthor author names + boxes   #nodate     publication date
   #noreadingtime reading time       #notags     tag pills
   #noshare share button             #norelated  bottom Related Articles
   Hidden items keep their space (visibility) so nothing shifts.
   ========================================================= */

.magazine-container .meta-date,
.magazine-container .meta-reading,
.related-posts-visibility { display: contents; }

.magazine-container.is-no-toc .toc-sidebar,
.magazine-container.is-no-date .meta-date,
.magazine-container.is-no-reading .meta-reading,
.magazine-container.is-no-tags .tag-pills,
.magazine-container.is-no-share .share-pill,
.related-posts-visibility.is-hidden { visibility: hidden; }

/* Multi-author posts: tighter spacing under the author cards */
.magazine-container.has-multi-authors { margin-bottom: 8px; }
.magazine-container.has-multi-authors + .related-posts-visibility .related-posts-bottom-section { margin-top: 0; }

/* =========================================================
   RESPONSIVE
   ========================================================= */

/* ---------- ≤ 1200px ---------- */
@media (max-width: 1200px) {
    .magazine-container { padding: 0 20px; }
    .main-content-layout { --toc-w: 190px; --side-w: 240px; gap: 28px; }
    .hero-card { padding: 45px; gap: 35px; }
    .article-body-card { padding: 45px; }
    .recommend-post-card { --thumb: 75px; }
    .recommend-post-link { gap: 10px; padding: 10px; }
    .recommend-title { font-size: 14px; }
}

/* ---------- ≥ 992px: no TOC (fewer than 2 headings) → article uses its column ---------- */
@media (min-width: 992px) {
    .is-toc-empty .main-content-layout { grid-template-columns: minmax(0, 1fr) var(--side-w); }
}

/* ---------- No manual Recommended Articles: hide the content but keep the column space (layout unchanged) ---------- */
.magazine-container.is-no-recommend .sidebar { visibility: hidden; }

/* Tablet / mobile: the sidebar sits under the article, so remove it fully (no blank gap) */
@media (max-width: 991px) {
    .magazine-container.is-no-recommend .sidebar { display: none; }
}

/* ---------- ≥ 769px: multi-author posts, tighter space under the author cards ---------- */
@media (min-width: 769px) {
    .magazine-container.has-multi-authors .article-body-card { padding-bottom: 28px; }
}

/* ---------- ≤ 991px: TOC + sidebar sit under the article ---------- */
@media (max-width: 991px) {
    .main-content-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px; }
    .magazine-container.has-multi-authors .main-content-layout { gap: 20px; }
    .article-column { grid-column: 1 / -1; grid-row: 1; }
    .toc-sidebar { grid-column: 1; grid-row: 2; position: static; }
    .sidebar { grid-column: 2; grid-row: 2; position: static; }
    .hero-card { padding: 40px; gap: 30px; }
    .article-body-card { padding: 40px; }

    /* Wide / full-bleed Ghost cards must not break out of the card */
    .magazine-container .post-content :is(.kg-width-wide, .kg-width-full) {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        left: auto;
        right: auto;
        transform: none;
    }
}

/* ---------- ≤ 768px: single column ---------- */
@media (max-width: 768px) {
    .magazine-container { margin: 20px auto; padding: 0 16px; }

    /* Hero */
    .hero-card { display: flex; flex-direction: column; gap: 24px; padding: 20px; margin-bottom: 24px; }
    .hero-right { order: -1; width: 100%; }
    .hero-right img { aspect-ratio: 16 / 10; border-radius: 10px; }
    .post-title-large { margin-bottom: 18px; }
    .post-excerpt-muted { margin-bottom: 22px; }
    .author-meta-row { font-size: 13px; gap: 7px; margin-bottom: 22px; }
    .share-pill { padding: 8px 18px; }

    /* Layout: TOC → article → recommended */
    .main-content-layout { display: flex !important; flex-direction: column; gap: 24px; }
    .article-column, .toc-sidebar { margin: 0; }
    .toc-sidebar { order: 1; }
    .article-column { order: 2; }
    .sidebar { order: 3; margin: 10px 0 0; }

    .article-body-card { padding: 22px 18px; }

    /* Article */
    .magazine-container .post-content blockquote { padding: 22px 20px; margin: 32px 0; }
    .magazine-container .post-content .kg-embed-card { max-width: 100%; }
    .magazine-container .post-content :is(iframe[src*="youtube"], iframe[src*="youtu.be"], iframe[src*="vimeo"]) {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }
    .post-content pre { font-size: 13px; line-height: 1.55; }

    /* TOC */
    .toc-card { padding: 18px; border-radius: 12px; }
    .js-toc a { padding: 8px 0 8px 9px; }
    .js-toc a.toc-h3 { padding-left: 18px; }
    .js-toc a.toc-h3.active { padding-left: 22px; }

    /* Images */
    .kg-image-card,
    .kg-gallery-card,
    .ghost-injected-slideshow,
    .ghost-injected-grid { margin: 30px 0; }
    .kg-image-card img,
    .kg-gallery-image img { border-radius: 10px !important; }
    .kg-gallery-row { grid-template-columns: 1fr !important; gap: 14px !important; }

    .slideshow-slide img { aspect-ratio: 4 / 3; }
    .slideshow-arrow { width: 38px; height: 38px; }
    .slideshow-arrow-prev { left: 9px; }
    .slideshow-arrow-next { right: 9px; }
    .slideshow-arrow svg { width: 18px; height: 18px; }
    .slideshow-counter { top: auto; bottom: 10px; right: 10px; padding: 5px 10px; font-size: 12px; }
    .slideshow-dots { bottom: 12px; gap: 7px; }
    .slideshow-dot { width: 8px; height: 8px; }

    .ghost-injected-grid { grid-template-columns: 1fr; gap: 14px; }
    .grid-gallery-item img { min-height: 0; aspect-ratio: 4 / 3; }

    /* Sidebar */
    .sidebar-title { margin-bottom: 16px; }
    .recommend-posts-list { gap: 12px; }
    .recommend-post-card { --thumb: 82px; border-radius: 12px; }
    .recommend-post-link { gap: 12px; padding: 10px; }
    .recommend-thumb { border-radius: 8px; }
    .recommend-tag { margin-bottom: 4px; }
    .recommend-title { line-height: 1.35; margin-bottom: 5px; }

    /* Footer + authors */
    .article-footer-area { margin-top: 40px; padding-top: 30px; }
    .article-footer-top { flex-direction: column; align-items: flex-start; }
    .tag-pills { justify-content: flex-start; width: 100%; gap: 7px; }
    .tag-pill { font-size: 12px; padding: 6px 13px; }

    .author-boxes { margin-top: 40px; }
    .author-box { flex-direction: column; text-align: center; gap: 16px; padding: 25px 20px; margin-top: 40px; }
    .author-box-info { width: 100%; }
    .author-box-name { font-size: 19px; }
    .author-box-bio { font-size: 14px; line-height: 1.55; }
    .social-icons { justify-content: center; }

    .author-boxes.is-multiple { grid-template-columns: 1fr; }
    .author-boxes.is-multiple .author-box { flex-direction: row; text-align: left; padding: 18px; }
    .author-boxes.is-multiple .social-icons { justify-content: flex-start; }

    /* Lightbox */
    .lightbox-content-wrapper { padding: 60px 12px; }
    .lightbox-image-viewport img { max-width: 94vw; max-height: 78vh; max-height: 78dvh; border-radius: 5px; }
    .lightbox-close { top: 12px; right: 12px; width: 40px; height: 40px; }
    .lightbox-arrow { width: 40px; height: 40px; }
    .lightbox-arrow-prev { left: 8px; }
    .lightbox-arrow-next { right: 8px; }
    .lightbox-arrow svg { width: 20px; height: 20px; }
    .lightbox-counter { bottom: 15px; padding: 6px 12px; font-size: 12px; }

    /* Share modal */
    .share-modal-overlay { padding: 12px; }
    .share-modal-card { max-width: 100%; padding: 20px; border-radius: 14px; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
    .share-modal-header { margin-bottom: 20px; }
    .share-grid { gap: 14px 8px; }
    .share-icon-wrap { width: 44px; height: 44px; }
    .share-label { font-size: 10px; }
    .share-link-input-group { gap: 6px; }
    .share-link-input { padding: 9px 10px; font-size: 11px; }
    .share-copy-btn { padding: 0 12px; font-size: 12px; }

    /* Related Articles */
    .related-posts-bottom-section { max-width: none; margin-top: 24px; padding: 0 16px; }
    .related-posts-grid { grid-template-columns: 1fr; gap: 14px; }
    .related-thumb { height: auto; aspect-ratio: 16 / 9; }

    /* Tag-based tweaks */
    .magazine-container.is-no-sidebar { margin-bottom: 12px; }
    .magazine-container.is-no-sidebar + .related-posts-visibility .related-posts-bottom-section { margin-top: 8px; }

    /* Multi-author posts: compact spacing */
    .magazine-container.has-multi-authors { margin-bottom: 4px; }
    .magazine-container.has-multi-authors .article-body-card { padding-bottom: 14px; }
    .magazine-container.has-multi-authors .main-content-layout { gap: 14px; }
    .magazine-container.has-multi-authors .article-footer-area { margin-top: 28px; padding-top: 22px; }
    .magazine-container.has-multi-authors .author-boxes { margin-top: 24px; }
    .magazine-container.has-multi-authors .sidebar { margin-top: 0; }
    .magazine-container.has-multi-authors + .related-posts-visibility .related-posts-bottom-section { margin-top: 4px; }
    .magazine-container.has-multi-authors + .related-posts-visibility .related-posts-grid { padding-bottom: 8px; }

    /* Collapsible "On this page" (activated by the script) */
    .toc-card.toc-collapsible { padding-top: 6px; padding-bottom: 6px; }
    .toc-card.toc-collapsible .toc-title { margin: 0; padding: 0; border-bottom: 0; }
    .toc-card.toc-collapsible.is-open .toc-title { margin-bottom: 8px; padding-bottom: 4px; border-bottom: 2px solid var(--border); }
    .toc-card.toc-collapsible:not(.is-open) .js-toc { display: none; }

    .toc-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        width: 100%;
        min-height: 44px;
        margin: 0;
        padding: 0;
        background: none;
        border: 0;
        font: inherit;
        color: inherit;
        text-align: left;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .toc-toggle:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 2px; border-radius: 6px; }

    .toc-toggle::after {
        content: "";
        flex: 0 0 auto;
        width: 8px;
        height: 8px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg);
        margin-top: -4px;
        transition: transform .2s ease, margin .2s ease;
    }

    .toc-card.is-open .toc-toggle::after { transform: rotate(-135deg); margin-top: 4px; }
}
/* #toc tag: empty column that holds the TOC's space on desktop */
.toc-placeholder { visibility: hidden; }

/* Tablet / mobile: the TOC sits under the article, so remove the blank gap */
@media (max-width: 991px) {
    .toc-placeholder { display: none; }
}

/* ---------- ≤ 480px ---------- */
@media (max-width: 480px) {
    .magazine-container { padding: 0 12px; margin-top: 12px; margin-bottom: 12px; }
    .hero-card { padding: 16px; gap: 20px; }
    .hero-right img { aspect-ratio: 4 / 3; }
    .article-body-card { padding: 20px 16px; }
    .magazine-container .post-content blockquote { padding: 18px 16px; }
    .toc-card { padding: 16px; }
    .recommend-post-card { --thumb: 76px; }
    .share-grid { gap: 14px 4px; }
    .share-icon-wrap { width: 42px; height: 42px; }
    .share-link-input-group { flex-direction: column; }
    .share-link-input,
    .share-copy-btn { width: 100%; height: 42px; }
    .related-posts-bottom-section { padding: 0 12px; }
}

/* ---------- ≤ 360px ---------- */
@media (max-width: 360px) {
    .magazine-container { padding: 0 10px; }
    .hero-card { padding: 14px; }
    .article-body-card { padding: 18px 14px; }
    .share-modal-card { padding: 16px; }
    .share-grid { gap: 12px 2px; }
    .share-icon-wrap { width: 40px; height: 40px; }
    .recommend-post-card { --thumb: 70px; }
    .related-posts-bottom-section { padding: 0 10px; }
}