/* ==========================================================================
   زفلتة - المدونة (قائمة المقالات + صفحة المقال)
   ========================================================================== */

.article-tag-inline {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 30px;
    background: var(--gold);
    color: var(--navy);
    font-size: .85rem;
    font-weight: 700;
}
a.article-tag-inline:hover { background: var(--white); color: var(--navy); }

/* ==========================================================================
   قائمة المقالات
   ========================================================================== */
.blog-section { background: var(--white); }

.blog-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 40px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--cream);
}

.blog-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.blog-cat {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 30px;
    color: var(--navy);
    font-weight: 700;
    transition: all .3s var(--ease);
}
.blog-cat span {
    display: grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 20px;
    background: var(--white);
    color: var(--gray);
    font-size: .78rem;
    transition: all .3s var(--ease);
}
.blog-cat:hover { background: var(--white); color: var(--navy); }
.blog-cat.active { background: var(--navy); color: var(--white); }
.blog-cat.active span { background: var(--gold); color: var(--navy); }

.blog-search { position: relative; flex: 0 1 300px; }
.blog-search input {
    width: 100%;
    padding: 11px 18px 11px 48px;
    border: 1px solid var(--border);
    border-radius: 30px;
    background: var(--white);
    font-family: var(--font);
    transition: border-color .3s var(--ease), box-shadow .3s var(--ease);
}
.blog-search input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(220, 154, 3, .15);
}
.blog-search button {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: var(--gold);
    color: var(--navy);
}

.blog-result { margin: -20px 0 30px; color: var(--gray); }
.blog-result a { margin-right: 10px; font-weight: 700; }

/* المقال المميز */
.featured-post {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    margin-bottom: 40px;
    border: 1px solid var(--border);
    border-radius: 28px;
    background: var(--white);
    color: var(--navy);
    overflow: hidden;
    transition: box-shadow .5s var(--ease), transform .5s var(--ease);
}
.featured-post:hover,
.featured-post.in-focus { color: var(--navy); box-shadow: var(--shadow-lg); transform: translateY(-6px); }

.featured-media { position: relative; min-height: 380px; overflow: hidden; }
.featured-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1s var(--ease);
}
.featured-post:hover .featured-media img,
.featured-post.in-focus .featured-media img { transform: scale(1.08); }
.featured-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(270deg, rgba(8, 29, 48, .35), transparent 50%);
}
.featured-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 2;
    padding: 6px 16px;
    border-radius: 30px;
    background: var(--navy);
    color: var(--gold);
    font-weight: 700;
    font-size: .9rem;
}

.featured-body {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 44px 40px;
}
.featured-body::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: repeating-linear-gradient(90deg, var(--gold) 0 34px, transparent 34px 56px);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform .7s var(--ease);
}
.featured-post:hover .featured-body::after,
.featured-post.in-focus .featured-body::after { transform: scaleX(1); animation: road-move-sm 1.6s linear infinite; }
.featured-body .article-tag-inline { align-self: flex-start; margin-bottom: 14px; }
.featured-title { font-size: clamp(1.5rem, 2.6vw, 2.1rem); line-height: 1.5; margin-bottom: 14px; transition: color .3s var(--ease); }
.featured-post:hover .featured-title,
.featured-post.in-focus .featured-title { color: var(--gold); }
.featured-excerpt { color: var(--gray); font-size: 1.05rem; }
.featured-more {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 8px;
    margin-top: 10px;
    padding: 12px 26px;
    border-radius: 30px;
    background: var(--navy);
    color: var(--white);
    font-weight: 700;
    transition: background .3s var(--ease), color .3s var(--ease);
}
.featured-more i { transition: transform .3s var(--ease); }
.featured-post:hover .featured-more,
.featured-post.in-focus .featured-more { background: var(--gold); color: var(--navy); }
.featured-post:hover .featured-more i,
.featured-post.in-focus .featured-more i { transform: translateX(-6px); }

.blog-empty {
    padding: 60px 20px;
    border: 2px dashed var(--border);
    border-radius: 24px;
    text-align: center;
}
.blog-empty i { color: var(--gold); font-size: 3rem; }
.blog-empty p { color: var(--gray); }

/* الترقيم */
.blog-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 50px;
}
.page-btn {
    display: grid;
    place-items: center;
    min-width: 46px;
    height: 46px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--navy);
    font-weight: 700;
    transition: all .3s var(--ease);
}
a.page-btn:hover { border-color: var(--gold); color: var(--gold); }
.page-btn.active { border-color: var(--navy); background: var(--navy); color: var(--gold); }
.page-btn.disabled { opacity: .4; }

@media (max-width: 991.98px) {
    .featured-post { grid-template-columns: 1fr; }
    .featured-media { min-height: 260px; }
    .featured-body { padding: 30px 26px; }
    .blog-search { flex-basis: 100%; }
}

/* ==========================================================================
   صفحة المقال
   ========================================================================== */
.read-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    height: 4px;
    background: transparent;
}
.read-progress span {
    display: block;
    height: 100%;
    width: 100%;
    background: linear-gradient(270deg, var(--gold), var(--gold-light));
    box-shadow: 0 0 10px rgba(220, 154, 3, .6);
    transform: scaleX(0);
    transform-origin: right;
}

.post-hero {
    position: relative;
    padding: 80px 0 170px;
    background: var(--navy);
    color: var(--white);
    overflow: hidden;
}
.post-hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: .3;
    animation: ken-burns 16s var(--ease) forwards;
}
.post-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(180deg, rgba(8, 29, 48, .6), var(--navy) 95%);
}
.post-hero .container { z-index: 1; max-width: 900px; text-align: center; }
.post-hero .hero-breadcrumb { justify-content: center; }
.post-title {
    margin: 18px 0 22px;
    color: var(--white);
    font-size: clamp(1.8rem, 4.2vw, 3rem);
    font-weight: 900;
    line-height: 1.45;
}
.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 24px;
    color: rgba(255, 255, 255, .8);
}
.post-meta i { color: var(--gold); margin-left: 4px; }
.post-author { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--white); }
.post-author img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--cream);
    object-fit: contain;
}

.post-section { padding-top: 30px; }

.post-cover {
    margin: -150px 0 34px;
    position: relative;
    z-index: 3;
    border-radius: 26px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}
.post-cover img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }

.post-lead {
    padding: 22px 26px;
    margin-bottom: 30px;
    border-right: 5px solid var(--gold);
    border-radius: 0 0 0 0;
    background: var(--gold-soft);
    color: var(--navy);
    font-size: 1.15rem;
    font-weight: 500;
}

/* ---------- محتوى المقال ---------- */
.post-content { font-size: 1.12rem; line-height: 2.05; color: #2b3540; }
.post-content > * + * { margin-top: 1.1em; }
.post-content p { margin-bottom: 0; }
.post-content h2 {
    position: relative;
    margin-top: 2em;
    padding-right: 20px;
    font-size: 1.65rem;
    scroll-margin-top: 110px;
}
.post-content h2::before {
    content: "";
    position: absolute;
    top: .2em;
    bottom: .2em;
    right: 0;
    width: 6px;
    border-radius: 6px;
    background: linear-gradient(180deg, var(--gold), var(--gold-light));
}
.post-content h3 { margin-top: 1.6em; font-size: 1.3rem; color: var(--navy-light); }
.post-content strong { color: var(--navy); }
.post-content a { text-decoration: underline; text-underline-offset: 4px; }

.post-content ul,
.post-content ol { padding-right: 0; list-style: none; }
.post-content ul li,
.post-content ol li { position: relative; padding-right: 30px; margin-bottom: .5em; }
.post-content ul li::before {
    content: "";
    position: absolute;
    top: .8em;
    right: 6px;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: var(--gold);
    transform: rotate(45deg);
}

.post-content figure { margin: 2em 0; }
.post-content figure img {
    width: 100%;
    max-height: 480px;
    object-fit: cover;
    border-radius: 20px;
    box-shadow: var(--shadow);
}
.post-content figcaption {
    margin-top: 10px;
    color: var(--gray);
    font-size: .95rem;
    text-align: center;
}
.post-content figcaption::before { content: "▲ "; color: var(--gold); font-size: .7em; }

.post-content .tip-box,
.post-content .warn-box {
    position: relative;
    padding: 22px 26px 22px 22px;
    padding-right: 70px;
    border-radius: 18px;
    font-size: 1.05rem;
}
.post-content .tip-box { background: #eef6ee; border: 1px solid #cfe6cf; }
.post-content .warn-box { background: var(--gold-soft); border: 1px solid #f3dca3; }
.post-content .tip-box::before,
.post-content .warn-box::before {
    position: absolute;
    top: 20px;
    right: 20px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-family: 'bootstrap-icons';
    font-size: 1.1rem;
}
.post-content .tip-box::before { content: "\f46b"; background: #2f9e44; color: var(--white); }
.post-content .warn-box::before { content: "\f33b"; background: var(--gold); color: var(--navy); }
.post-content .tip-box strong,
.post-content .warn-box strong { display: block; margin-bottom: 4px; }

.post-content table {
    width: 100%;
    margin: 1.6em 0;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    font-size: 1rem;
    line-height: 1.7;
}
.post-content th { padding: 14px 16px; background: var(--navy); color: var(--white); font-weight: 700; }
.post-content td { padding: 12px 16px; border-top: 1px solid var(--border); }
.post-content tbody tr:nth-child(even) td { background: var(--cream); }
.post-content tbody tr:hover td { background: var(--gold-soft); }

/* ظهور عناصر المقال مع السكرول */
.post-content > .is-pending { opacity: 0; transform: translateY(24px); }
.post-content > .is-shown { opacity: 1; transform: none; transition: opacity .7s var(--ease), transform .7s var(--ease); }

@media (max-width: 767.98px) {
    .post-content { font-size: 1.04rem; }
    .post-content table { display: block; overflow-x: auto; white-space: nowrap; }
    .post-cover { margin-top: -120px; }
}

/* ---------- مشاركة ---------- */
.post-share {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 44px;
    padding: 20px 24px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--cream);
}
.post-share > span { margin-left: 6px; font-weight: 700; }
.share-btn {
    position: relative;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    color: var(--white);
    font-size: 1.15rem;
    transition: transform .3s var(--ease);
}
.share-btn:hover { color: var(--white); transform: translateY(-4px) rotate(-8deg); }
.share-btn.is-wa { background: var(--whatsapp); }
.share-btn.is-x { background: #000; }
.share-btn.is-in { background: #0a66c2; }
.share-btn.is-copy { background: var(--navy); }
.copy-tip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    padding: 3px 10px;
    border-radius: 8px;
    background: var(--navy);
    color: var(--white);
    font-size: .78rem;
    white-space: nowrap;
    opacity: 0;
    transform: translate(-50%, 6px);
    transition: all .3s var(--ease);
    pointer-events: none;
}
.share-btn.copied .copy-tip { opacity: 1; transform: translate(-50%, 0); }

/* ---------- السابق والتالي ---------- */
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; }
.post-nav-link {
    padding: 18px 22px;
    border: 1px solid var(--border);
    border-radius: 18px;
    color: var(--navy);
    transition: all .35s var(--ease);
}
.post-nav-link:hover { border-color: var(--gold); background: var(--gold-soft); color: var(--navy); }
.post-nav-link small { display: block; color: var(--gold); font-weight: 700; margin-bottom: 4px; }
.post-nav-link strong { display: block; line-height: 1.6; }
.post-nav-link.is-prev { grid-column: 2; text-align: left; }
.post-nav-link.is-next:only-child { grid-column: 1 / -1; }
.post-nav-link.is-prev:only-child { grid-column: 1 / -1; }

@media (max-width: 575.98px) {
    .post-nav { grid-template-columns: 1fr; }
    .post-nav-link.is-prev { grid-column: auto; }
}

/* ---------- الشريط الجانبي ---------- */
.post-sidebar { position: sticky; top: 110px; display: grid; gap: 22px; }

.side-card {
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--white);
}
.side-title { display: flex; align-items: center; gap: 8px; font-size: 1.15rem; margin-bottom: 16px; }
.side-title i { color: var(--gold); }

.toc-list {
    position: relative;
    margin: 0;
    padding: 0 18px 0 0;
    list-style: none;
    counter-reset: toc;
}
.toc-list::before {
    content: "";
    position: absolute;
    top: 6px;
    bottom: 6px;
    right: 4px;
    width: 2px;
    background: var(--border);
}
.toc-list li { position: relative; counter-increment: toc; }
.toc-list a {
    display: block;
    padding: 7px 0;
    color: var(--gray);
    font-weight: 500;
    line-height: 1.6;
    transition: color .3s var(--ease), transform .3s var(--ease);
}
.toc-list a::before {
    content: "";
    position: absolute;
    top: 50%;
    right: -18px;
    width: 10px;
    height: 10px;
    margin-top: -5px;
    border: 2px solid var(--border);
    border-radius: 50%;
    background: var(--white);
    transition: all .3s var(--ease);
}
.toc-list a:hover { color: var(--navy); }
.toc-list a.active { color: var(--navy); font-weight: 700; transform: translateX(-4px); }
.toc-list a.active::before { border-color: var(--gold); background: var(--gold); box-shadow: 0 0 0 4px rgba(220, 154, 3, .2); }

.side-cta {
    position: relative;
    border: 0;
    background:
        radial-gradient(circle at 0 0, rgba(220, 154, 3, .25), transparent 50%),
        var(--navy);
    color: rgba(255, 255, 255, .75);
    text-align: center;
    overflow: hidden;
}
.side-cta-icon {
    display: inline-grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin-bottom: 14px;
    border-radius: 50%;
    background: var(--gold);
    color: var(--navy);
    font-size: 1.7rem;
    animation: float 4s ease-in-out infinite;
}
.side-cta h2 { color: var(--white); font-size: 1.3rem; }

@media (max-width: 991.98px) {
    .post-sidebar { position: static; }
    .toc-card { display: none; }
}

.related-section { background: var(--cream); }
