/* ==========================================================================
   Blog (Thanyh, 2026-11) — single post, /blog/, category + tag archives.
   Loaded only in blog contexts (inc/blog.php). Mobile first, RTL.
   Tokens: design-system.css (--f-blue = the orange accent).
   ========================================================================== */

.th-bl {
    --bl-col: 720px;
    --bl-wide: 1140px;
    --bl-gut: max(16px, env(safe-area-inset-right, 0px));
    --bl-card: var(--f-card-2, #141d31);
    --bl-line: var(--f-line, #1b2740);
    --bl-link: var(--f-blue-hi, #ffb04a);

    color: var(--f-text);
    font-family: var(--f-font);
    padding-bottom: clamp(40px, 6vw, 80px);
}

.th-bl-col,
.th-bl-wide {
    width: 100%;
    margin-inline: auto;
    padding-inline: var(--bl-gut);
    box-sizing: border-box;
}

.th-bl-col  { max-width: calc(var(--bl-col) + 2 * 16px); }
.th-bl-wide { max-width: calc(var(--bl-wide) + 2 * 16px); }

/* ---------- Reading progress ---------- */

.th-bl-progress {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 10000;
    height: 3px;
    pointer-events: none;
}

.th-bl-progress span {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--f-cta, var(--f-blue));
    transform: scaleX(0);
    transform-origin: right center;
    will-change: transform;
}

/* ---------- Breadcrumb ---------- */

.th-bl-crumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    margin: 18px 0 0;
    color: var(--f-muted);
    font-size: 13px;
    line-height: 1.6;
}

.th-bl-crumb a {
    color: var(--f-muted);
    text-decoration: none;
}

.th-bl-crumb a:hover { color: var(--f-text); }

.th-bl-crumb i {
    font-style: normal;
    opacity: .6;
}

.th-bl-crumb span {
    min-width: 0;
    overflow: hidden;
    color: var(--f-text);
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* ---------- Shared bits ---------- */

.th-bl-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border: 1px solid rgba(249, 115, 22, .35);
    border-radius: 999px;
    background: var(--f-blue-soft, rgba(249, 115, 22, .14));
    color: var(--f-blue-hi, #ffb04a);
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.5;
    text-decoration: none;
}

.th-bl-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin: 0;
    color: var(--f-muted);
    font-size: 13.5px;
}

.th-bl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 22px;
    border-radius: 999px;
    background: var(--f-cta, var(--f-blue));
    box-shadow: var(--f-cta-shadow, none);
    color: var(--f-on-accent, #1a0f04);
    font-weight: 800;
    font-size: 15px;
    text-decoration: none;
    transition: transform var(--f-t1, .28s) var(--f-ease, ease), filter var(--f-t1, .28s);
}

.th-bl-btn:hover { transform: translateY(-1px); filter: brightness(1.05); color: var(--f-on-accent, #1a0f04); }

/* ==========================================================================
   Single post
   ========================================================================== */

.th-bl-head {
    display: grid;
    justify-items: start;
    gap: 14px;
    margin: 22px 0 22px;
}

.th-bl-title {
    margin: 0;
    color: var(--f-text);
    font-family: var(--f-font-display);
    font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.6rem);
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: normal;
    text-wrap: balance;
}

.th-bl-cover {
    margin: 0 0 24px;
    overflow: hidden;
    border: 1px solid var(--bl-line);
    border-radius: var(--f-r-lg, 22px);
    background: var(--bl-card);
    aspect-ratio: 1200 / 630;
}

.th-bl-cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---------- TOC ---------- */

.th-bl-toc {
    margin: 0 0 28px;
    border: 1px solid var(--bl-line);
    border-radius: var(--f-r, 18px);
    background: var(--bl-card);
}

.th-bl-toc summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    cursor: pointer;
    font-weight: 800;
    font-size: 16px;
    list-style: none;
}

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

.th-bl-toc summary::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--f-blue);
    box-shadow: 0 0 0 4px var(--f-blue-soft);
    flex: none;
}

.th-bl-toc summary small {
    margin-inline-start: auto;
    color: var(--f-muted);
    font-weight: 500;
    font-size: 12.5px;
}

.th-bl-toc summary::after {
    content: "";
    width: 9px;
    height: 9px;
    border-inline-start: 2px solid var(--f-muted);
    border-bottom: 2px solid var(--f-muted);
    transform: rotate(-45deg) translateY(-2px);
    transition: transform var(--f-t1, .28s) var(--f-ease, ease);
    flex: none;
}

.th-bl-toc[open] summary::after { transform: rotate(135deg) translateY(-2px); }

.th-bl-toc ol {
    margin: 0;
    padding: 4px 18px 16px;
    list-style: none;
    counter-reset: toc;
    border-top: 1px solid var(--bl-line);
}

.th-bl-toc li {
    counter-increment: toc;
    display: flex;
    gap: 10px;
    padding: 9px 0 0;
    font-size: 15px;
    line-height: 1.6;
}

.th-bl-toc li::before {
    content: counter(toc);
    flex: none;
    width: 22px;
    color: var(--f-blue);
    font-weight: 800;
}

.th-bl-toc a {
    color: var(--f-text);
    text-decoration: none;
}

.th-bl-toc a:hover { color: var(--bl-link); }

/* ---------- Article body ---------- */

.th-bl-content {
    font-size: 17px;
    line-height: 1.9;
    color: rgba(243, 246, 251, .92);
    overflow-wrap: break-word;
}

.th-bl-content > * {
    margin-block: 0 1.15em;
}

.th-bl-content p { margin-block: 0 1.15em; }

.th-bl-content strong { color: var(--f-text); font-weight: 700; }

.th-bl-content a {
    color: var(--bl-link);
    text-decoration: underline;
    text-decoration-color: rgba(255, 176, 74, .45);
    text-underline-offset: 4px;
    text-decoration-thickness: 1.5px;
    transition: text-decoration-color var(--f-t1, .28s);
}

.th-bl-content a:hover { text-decoration-color: currentColor; }

.th-bl-content h2,
.th-bl-content h3 {
    color: var(--f-text);
    font-family: var(--f-font);
    letter-spacing: normal;
    scroll-margin-top: 96px;
}

.th-bl-content h2 {
    position: relative;
    margin: 1.9em 0 .7em;
    padding-inline-start: 16px;
    font-size: clamp(1.3rem, 1.1rem + .8vw, 1.6rem);
    font-weight: 800;
    line-height: 1.5;
}

.th-bl-content h2::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: .3em;
    bottom: .3em;
    width: 4px;
    border-radius: 4px;
    background: var(--f-cta, var(--f-blue));
}

.th-bl-content h3 {
    margin: 1.5em 0 .5em;
    font-size: 1.12rem;
    font-weight: 800;
    line-height: 1.6;
}

/* Lists */
.th-bl-content ul,
.th-bl-content ol {
    padding: 0;
    list-style: none;
}

.th-bl-content li { position: relative; margin: 0 0 .55em; }

.th-bl-content ul > li { padding-inline-start: 22px; }

.th-bl-content ul > li::before {
    content: "";
    position: absolute;
    inset-inline-start: 2px;
    top: .78em;
    width: 7px;
    height: 7px;
    border-radius: 2px;
    background: var(--f-blue);
    transform: rotate(45deg);
}

.th-bl-content ol { counter-reset: step; }

.th-bl-content ol > li {
    counter-increment: step;
    padding: 14px 16px;
    padding-inline-start: 56px;
    border: 1px solid var(--bl-line);
    border-radius: var(--f-r, 18px);
    background: var(--bl-card);
    margin-bottom: 12px;
}

.th-bl-content ol > li::before {
    content: counter(step);
    position: absolute;
    inset-inline-start: 14px;
    top: 14px;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--f-cta, var(--f-blue));
    color: var(--f-on-accent, #1a0f04);
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
}

/* Tables: coloured head, zebra rows, horizontal scroll on phones */
.th-bl-content .wp-block-table,
.th-bl-content figure:has(> table) {
    margin: 0 0 1.4em;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--bl-line);
    border-radius: var(--f-r, 18px);
    background: var(--bl-card);
}

.th-bl-content table {
    width: 100%;
    min-width: 560px;
    margin: 0;
    border-collapse: collapse;
    font-size: 15px;
    line-height: 1.7;
}

.th-bl-content th,
.th-bl-content td {
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid var(--bl-line);
    text-align: start;
    vertical-align: top;
}

.th-bl-content thead th {
    background: var(--f-blue);
    color: var(--f-on-accent, #1a0f04);
    font-weight: 800;
    white-space: nowrap;
}

.th-bl-content tbody tr:nth-child(even) td { background: rgba(255, 255, 255, .035); }
.th-bl-content tbody tr:last-child td { border-bottom: 0; }
.th-bl-content tbody td:first-child { color: var(--f-text); font-weight: 700; }

/* Phones: the table is wider than the screen; say so. */
@media (max-width: 600px) {
    .th-bl-content .wp-block-table::before {
        content: "اسحب الجدول لعرض باقي الأعمدة ←";
        display: block;
        padding: 8px 14px 6px;
        text-align: start;
        color: var(--f-muted);
        font-size: 12.5px;
        line-height: 1.4;
    }
}

.th-bl-content .wp-block-table figcaption {
    padding: 8px 14px;
    color: var(--f-muted);
    font-size: 13px;
}

/* Media + quotes */
.th-bl-content img { max-width: 100%; height: auto; border-radius: var(--f-r, 18px); }

.th-bl-content blockquote {
    margin-inline: 0;
    padding: 14px 18px;
    border-inline-start: 4px solid var(--f-blue);
    border-radius: var(--f-r-sm, 10px);
    background: var(--f-blue-soft);
    color: var(--f-text);
}

/* ---------- FAQ (Rank Math block → details) ---------- */

.th-faq { display: grid; gap: 10px; margin: 0 0 1.4em; }

.th-faq-item {
    border: 1px solid var(--bl-line);
    border-radius: var(--f-r, 18px);
    background: var(--bl-card);
    scroll-margin-top: 96px;
    transition: border-color var(--f-t1, .28s);
}

.th-faq-item[open] { border-color: rgba(249, 115, 22, .45); }

.th-faq-item summary {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px 18px;
    color: var(--f-text);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.65;
    cursor: pointer;
    list-style: none;
}

.th-faq-item summary::-webkit-details-marker { display: none; }

.th-faq-item summary span { flex: 1; }

.th-faq-item summary::after {
    content: "+";
    display: grid;
    place-items: center;
    flex: none;
    width: 26px;
    height: 26px;
    margin-top: 1px;
    border-radius: 50%;
    background: var(--f-blue-soft);
    color: var(--f-blue-hi, #ffb04a);
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    transition: transform var(--f-t1, .28s) var(--f-ease, ease);
}

.th-faq-item[open] summary::after { transform: rotate(45deg); }

.th-faq-a {
    padding: 0 18px 16px;
    color: rgba(243, 246, 251, .85);
    font-size: 16px;
    line-height: 1.85;
}

.th-faq-a p:last-child { margin-bottom: 0; }

/* ---------- Product CTA card [thanyh_product] ---------- */

.th-bl-product {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 16px;
    align-items: center;
    margin: 1.6em 0;
    padding: 16px;
    border: 1px solid rgba(249, 115, 22, .4);
    border-radius: var(--f-r-lg, 22px);
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(249, 115, 22, .16), transparent 60%),
        var(--bl-card);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .25);
}

.th-bl-product-media {
    display: block;
    align-self: start;
    overflow: hidden;
    border-radius: 16px;
    background: #fff;
    aspect-ratio: 1;
}

.th-bl-product-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
}

.th-bl-product-body { display: grid; gap: 6px; justify-items: start; min-width: 0; }

.th-bl-product-kicker {
    color: var(--f-blue-hi, #ffb04a);
    font-size: 12px;
    font-weight: 700;
}

.th-bl-content .th-bl-product-name,
.th-bl-product-name {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.55;
}

.th-bl-content .th-bl-product-name a {
    color: var(--f-text);
    text-decoration: none;
}

.th-bl-content .th-bl-product-desc {
    margin: 0 0 6px;
    color: var(--f-muted);
    font-size: 14.5px;
    line-height: 1.75;
}

.th-bl-content .th-bl-product .th-bl-btn {
    color: var(--f-on-accent, #1a0f04);
    text-decoration: none;
}

.th-bl-product-missing {
    padding: 10px 14px;
    border: 1px dashed var(--f-danger, #d92d20);
    border-radius: 10px;
    color: var(--f-danger, #d92d20);
    font-size: 14px;
}

/* ---------- Tags + share ---------- */

.th-bl-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 28px 0 0;
}

.th-bl-tags a {
    padding: 5px 12px;
    border: 1px solid var(--bl-line);
    border-radius: 999px;
    color: var(--f-muted);
    font-size: 13px;
    text-decoration: none;
}

.th-bl-tags a:hover { color: var(--f-text); border-color: var(--f-muted); }

.th-bl-share {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 22px 0 0;
    padding: 16px 18px;
    border: 1px solid var(--bl-line);
    border-radius: var(--f-r, 18px);
    background: var(--bl-card);
}

.th-bl-share b { font-size: 15px; }

.th-bl-share > div { display: flex; flex-wrap: wrap; gap: 8px; }

.th-bl-share a,
.th-bl-share button {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    margin: 0;
    padding: 8px 16px;
    border: 1px solid var(--bl-line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .04);
    color: var(--f-text);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: border-color var(--f-t1, .28s), background var(--f-t1, .28s);
}

.th-bl-share a:hover,
.th-bl-share button:hover { border-color: var(--f-blue); background: var(--f-blue-soft); }

.th-bl-share-wa::before,
.th-bl-share-x::before,
.th-bl-share-copy::before {
    content: "";
    width: 8px;
    height: 8px;
    margin-inline-end: 8px;
    border-radius: 50%;
    background: #25d366;
}

.th-bl-share-x::before { background: #e7e9ea; }
.th-bl-share-copy::before { background: var(--f-blue); }
.th-bl-share-copy.is-done { border-color: var(--f-success, #12b76a); }

/* ---------- Related ---------- */

.th-bl-related { margin-top: clamp(44px, 6vw, 72px); }

.th-bl-related > h2 {
    margin: 0 0 18px;
    color: var(--f-text);
    font-family: var(--f-font);
    font-size: clamp(1.3rem, 1.1rem + .8vw, 1.6rem);
    font-weight: 800;
    letter-spacing: normal;
}

/* ==========================================================================
   Archive: /blog/, category, tag
   ========================================================================== */

.th-bl-arch-head {
    display: grid;
    gap: 10px;
    margin: 22px 0 22px;
    max-width: 680px;
}

.th-bl-kicker {
    color: var(--f-blue-hi, #ffb04a);
    font-size: 13px;
    font-weight: 700;
}

.th-bl-arch-title {
    margin: 0;
    color: var(--f-text);
    font-family: var(--f-font-display);
    font-size: clamp(1.9rem, 1.3rem + 2.6vw, 3rem);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: normal;
}

.th-bl-arch-intro {
    margin: 0;
    color: var(--f-muted);
    font-size: clamp(15px, 14px + .3vw, 17px);
    line-height: 1.8;
}

.th-bl-filter {
    display: flex;
    gap: 8px;
    margin: 0 0 22px;
    padding-bottom: 4px;
    overflow-x: auto;
    scrollbar-width: none;
}

.th-bl-filter::-webkit-scrollbar { display: none; }

.th-bl-filter a {
    flex: none;
    padding: 8px 16px;
    border: 1px solid var(--bl-line);
    border-radius: 999px;
    color: var(--f-muted);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--f-t1, .28s), border-color var(--f-t1, .28s), background var(--f-t1, .28s);
}

.th-bl-filter a:hover { color: var(--f-text); border-color: var(--f-muted); }

.th-bl-filter a.is-on {
    border-color: transparent;
    background: var(--f-blue);
    color: var(--f-on-accent, #1a0f04);
}

/* Card grid: 1 → 2 → 3 columns */
.th-bl-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.th-bl-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--bl-line);
    border-radius: var(--f-r-lg, 22px);
    background: var(--bl-card);
    transition: transform var(--f-t1, .28s) var(--f-ease, ease), border-color var(--f-t1, .28s), box-shadow var(--f-t1, .28s);
}

.th-bl-card-media {
    display: block;
    aspect-ratio: 1200 / 630;
    overflow: hidden;
    background: var(--f-ink-2, #0c1424);
}

.th-bl-card-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--f-t2, .7s) var(--f-ease, ease);
}

.th-bl-card-ph {
    display: grid;
    place-items: center;
    height: 100%;
    padding: 16px;
    background:
        radial-gradient(90% 120% at 100% 0%, rgba(249, 115, 22, .3), transparent 60%),
        linear-gradient(160deg, var(--f-ink-3, #13203a), var(--f-ink, #070b14));
    color: var(--f-text);
    font-family: var(--f-font-display);
    font-size: 20px;
    font-weight: 700;
    text-align: center;
}

.th-bl-card-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
    padding: 16px 18px 18px;
}

.th-bl-card-title {
    margin: 0;
    font-family: var(--f-font);
    font-size: 18px;
    font-weight: 800;
    line-height: 1.6;
    letter-spacing: normal;
}

.th-bl-card-title a { color: var(--f-text); text-decoration: none; }

.th-bl-card-title a::after { content: ""; position: absolute; inset: 0; }   /* whole card clickable */
.th-bl-card { position: relative; }
.th-bl-card .th-bl-badge { position: relative; z-index: 1; }

.th-bl-card-ex {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--f-muted);
    font-size: 14.5px;
    line-height: 1.8;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.th-bl-card .th-bl-meta { margin-top: auto; font-size: 12.5px; }

@media (hover: hover) {
    .th-bl-card:hover {
        transform: translateY(-3px);
        border-color: rgba(249, 115, 22, .45);
        box-shadow: 0 18px 40px rgba(0, 0, 0, .3);
    }
    .th-bl-card:hover .th-bl-card-media img { transform: scale(1.03); }
    .th-bl-card:hover .th-bl-card-title a { color: var(--f-blue-hi, #ffb04a); }
}

/* Pagination */
.th-bl-pages {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}

.th-bl-pages .page-numbers {
    display: grid;
    place-items: center;
    min-width: 44px;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--bl-line);
    border-radius: 14px;
    color: var(--f-text);
    font-weight: 700;
    text-decoration: none;
    box-sizing: border-box;
}

.th-bl-pages a.page-numbers:hover { border-color: var(--f-blue); }

.th-bl-pages .page-numbers.current {
    border-color: transparent;
    background: var(--f-blue);
    color: var(--f-on-accent, #1a0f04);
}

.th-bl-pages .dots { border: 0; }

/* Empty state */
.th-bl-empty {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 44px 20px;
    border: 1px dashed var(--bl-line);
    border-radius: var(--f-r-lg, 22px);
    text-align: center;
}

.th-bl-empty b { font-size: 19px; }
.th-bl-empty p { max-width: 420px; margin: 0 0 6px; color: var(--f-muted); }

/* ==========================================================================
   Larger screens
   ========================================================================== */

@media (min-width: 640px) {
    .th-bl-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
    .th-bl-product { grid-template-columns: 120px 1fr; gap: 20px; padding: 20px; }
}

@media (min-width: 1024px) {
    .th-bl-grid { grid-template-columns: repeat(3, 1fr); gap: 24px; }
    .th-bl-content { font-size: 18px; }
    .th-bl-head { margin-top: 30px; }
}

@media (prefers-reduced-motion: reduce) {
    .th-bl-card,
    .th-bl-card-media img,
    .th-bl-progress span { transition: none; }
    .th-bl-card:hover { transform: none; }
}
