/* =========================================================
   SINGLE POST (loaded only on single posts)
   ========================================================= */
.single-article { min-width: 0; }

.single-header { margin-bottom: 18px; }
.single-cats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.single-cats .cat-badge { color: #fff; }
.single-cats .cat-badge:hover { background: var(--red); color: #fff; }

.single-title {
    margin: 0 0 14px;
    font-size: 38px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -.3px;
}

.single-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    font-size: 13.5px;
    color: var(--muted);
}
.single-meta a { color: var(--ink); font-weight: 600; }
.single-meta a:hover { color: var(--red); }
.single-meta .icon { width: 15px; height: 15px; color: var(--red); }

.single-thumb { margin: 0 0 24px; border-radius: var(--radius); overflow: hidden; background: var(--navy) url('assets/ajrak-pattern.svg') center / 56px repeat; position: relative; min-height: 180px; }
.single-thumb img { display: block; width: 100%; height: auto; max-width: 100%; object-fit: contain; }
.single-thumb figcaption { padding: 8px 14px; font-size: 12.5px; color: #cbd5e1; background: var(--navy-deep); }

/* ----- Article typography ----- */
.post-content {
    font-size: 17.5px;
    line-height: 1.85;
    color: var(--text-body);
    overflow-wrap: break-word;
}
.post-content > * { max-width: 100%; }
.post-content p { margin: 0 0 1.25em; }
.post-content h2, .post-content h3, .post-content h4 { margin: 1.6em 0 .6em; }
.post-content h2 { font-size: 28px; padding-left: 14px; border-left: 5px solid var(--red); }
.post-content h3 { font-size: 23px; }
.post-content h4 { font-size: 19px; }
.post-content a { color: var(--red); text-decoration: underline; text-underline-offset: 3px; }
.post-content a:hover { color: var(--ink); }
.post-content img, .post-content video, .post-content iframe { max-width: 100%; height: auto; border-radius: 6px; }
.post-content figure { margin: 1.5em 0; }
.post-content figcaption { font-size: 13px; color: var(--muted); text-align: center; margin-top: 6px; }
.post-content ul, .post-content ol { margin: 0 0 1.25em; padding-left: 1.4em; }
.post-content li { margin-bottom: .4em; }
.post-content blockquote {
    margin: 1.6em 0;
    padding: 14px 22px;
    background: var(--card);
    border-left: 5px solid var(--green);
    border-radius: 0 8px 8px 0;
    font-family: var(--font-serif);
    font-size: 1.1em;
    font-style: italic;
    color: var(--ink);
}
.post-content blockquote p:last-child { margin-bottom: 0; }
.post-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 0 0 1.4em; font-size: 15px; }
.post-content th, .post-content td { border: 1px solid var(--line); padding: 8px 12px; }
.post-content th { background: var(--navy); color: #fff; text-align: left; }
.post-content pre { overflow-x: auto; background: var(--navy-deep); color: #e5e7eb; padding: 14px; border-radius: 8px; font-size: 14px; }
.page-links { margin: 18px 0; font-weight: 600; }
.page-links a { display: inline-block; padding: 2px 10px; margin: 0 2px; border: 1px solid var(--line); border-radius: 4px; background: var(--card); }

/* ----- Tags ----- */
.post-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 26px 0 8px; }
.post-tags-label { font-weight: 700; color: var(--ink); font-size: 14px; }
.post-tags a {
    padding: 4px 12px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 13px;
    color: var(--ink);
}
.post-tags a:hover { background: var(--red); border-color: var(--red); color: #fff; }

/* ----- Share ----- */
.post-share {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 22px 0;
    padding: 16px 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.share-label { font-weight: 700; color: var(--ink); margin-right: 6px; }
.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: 999px;
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
}
.share-btn .icon { width: 16px; height: 16px; }
.share-btn:hover { color: #fff; opacity: .88; }
.share-btn.wa { background: #1fa855; }
.share-btn.fb { background: #1877f2; }
.share-btn.tw { background: #111827; }

/* ----- Author box ----- */
.author-box {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-left: 5px solid var(--red);
    border-radius: var(--radius);
    margin-bottom: 22px;
}
.author-box img { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.author-box-label { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.author-box-name { font-family: var(--font-serif); font-size: 19px; font-weight: 700; color: var(--ink); }
.author-box p { margin: 4px 0 0; font-size: 14px; color: var(--text-soft); }

/* ----- Prev / Next ----- */
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 26px; }
.post-nav a {
    display: block;
    padding: 14px 16px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-family: var(--font-serif);
    font-weight: 700;
    line-height: 1.3;
    color: var(--ink);
}
.post-nav a span { display: block; font-family: var(--font-sans); font-size: 12px; font-weight: 600; color: var(--red); margin-bottom: 4px; }
.post-nav a:hover { border-color: var(--red); }
.post-nav-next { text-align: right; grid-column: 2; }
.post-nav-prev:only-child { grid-column: 1; }

/* ----- Related ----- */
.related-section { margin-top: 36px; }

@media (max-width: 900px) {
    .single-title { font-size: 29px; }
    .post-content { font-size: 16.5px; }
    .post-content h2 { font-size: 24px; }
}
@media (max-width: 600px) {
    .single-title { font-size: 25px; }
    .post-nav { grid-template-columns: 1fr; }
    .post-nav-next { grid-column: 1; text-align: left; }
}

/* ----- Table of contents ----- */
.toc {
    margin: 1.6em 0;
    padding: 0;
    background: var(--card);
    border: 1px solid var(--line);
    border-left: 5px solid var(--green);
    border-radius: var(--radius);
    font-size: 15px;
}
.toc summary {
    padding: 12px 18px;
    cursor: pointer;
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
    list-style: none;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: '+'; float: right; color: var(--red); font-weight: 700; }
.toc[open] summary::after { content: '\2212'; }
.toc ol { list-style: none; margin: 0; padding: 0 18px 14px; counter-reset: toc; max-height: 340px; overflow-y: auto; }
.toc li { counter-increment: toc; padding: 4px 0; line-height: 1.45; }
.toc li::before { content: counter(toc) '.'; display: inline-block; min-width: 26px; color: var(--red); font-weight: 700; }
.toc li.toc-l3 { padding-left: 26px; font-size: 14px; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--red); }
.post-content h2[id], .post-content h3[id] { scroll-margin-top: 80px; }

/* ----- Content must never overflow or crop on any screen ----- */
.single-article, .page-content { min-width: 0; max-width: 100%; }
.post-content { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.post-content img,
.post-content picture,
.post-content figure,
.post-content .wp-caption,
.post-content .wp-block-image,
.post-content .wp-block-gallery,
.post-content .wp-block-embed,
.post-content .wp-block-video,
.post-content .wp-block-table {
    max-width: 100% !important;
    box-sizing: border-box;
}
.post-content figure,
.post-content .wp-caption {
    width: auto !important;
    margin-left: auto;
    margin-right: auto;
}
.post-content figure img,
.post-content .wp-caption img,
.post-content a > img,
.post-content p > img {
    display: block;
    width: auto;
    max-width: 100% !important;
    height: auto !important;
    margin-left: auto;
    margin-right: auto;
    object-fit: contain !important;
}
.post-content .wp-block-image .alignleft,
.post-content .wp-block-image .alignright,
.post-content img.alignleft,
.post-content img.alignright { max-width: 50% !important; }
.post-content .alignwide, .post-content .alignfull { width: auto !important; max-width: 100% !important; margin-left: 0; margin-right: 0; }
.post-content iframe, .post-content video, .post-content embed, .post-content object { max-width: 100% !important; }
.post-content iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; }
.post-content pre, .post-content code { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
.post-content figcaption { overflow-wrap: anywhere; }

@media (max-width: 600px) {
    .post-content .wp-block-image .alignleft,
    .post-content .wp-block-image .alignright,
    .post-content img.alignleft,
    .post-content img.alignright { float: none; display: block; margin: 0 auto 1em; max-width: 100% !important; }
    .post-content blockquote { padding: 12px 16px; }
    .post-content h2 { font-size: 22px; }
    .post-content h3 { font-size: 19px; }
    .single-meta { gap: 6px 14px; }
    .post-share { padding: 14px; }
    .share-btn { padding: 8px 12px; }
}

/* Tables scroll inside their own box instead of squeezing words apart */
.post-content table { display: block; width: max-content; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.post-content th, .post-content td { min-width: 110px; overflow-wrap: normal; word-break: normal; vertical-align: top; }
