/*
Theme Name: Stamlia Professional
Description: A highly optimized, modern, and accessible RTL health portal theme featuring responsive ad serving, dynamic LCP preloading, and premium glassmorphic UI designs.
Version: 2.0
*/

:root {
    --primary: #00695c;
    --primary-dark: #004d40;
    --primary-light: #00897b;
    --accent: #e65100;
    /* Darker orange for better contrast */
    --text-main: #2c3e50;
    --text-muted: #546e7a;
    --bg-body: #f8fafb;
    --card-bg: #ffffff;
    --border-color: #e3edf3;
    --white: #ffffff;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.08);
    --radius-md: 12px;
}

/* --- GLOBAL RESET --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', sans-serif;
    direction: rtl;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.7;
    text-align: right;
}

a {
    color: inherit;
    text-decoration: none;
    transition: 0.3s ease;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    max-width: 95%;
    /* Requested desktop improvement */
    margin: 0 auto;
    padding: 0 20px;
}

/* --- SITE HEADER --- */
.site-header {
    /* Component Scoped Variables */
    --hdr-bg: var(--white);
    --hdr-text: var(--text-main);
    --hdr-primary: var(--primary);
    --hdr-primary-dark: var(--primary-dark);
    --hdr-primary-light: var(--primary-light);
    --hdr-muted: var(--text-muted);
    --hdr-search-bg: #f1f5f7;
    --hdr-search-focus-bg: var(--white);
    --hdr-nav-bg: var(--primary);
    --hdr-nav-text: var(--white);
    --hdr-nav-hover-bg: var(--primary-dark);

    background: var(--hdr-bg);
    position: sticky;
    top: 0;
    z-index: 99999; /* Increased to stay above hovered ads and Google AdSense iframes */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.header-top {
    padding: 15px 0;
}

.header-top-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-branding .logo-text a {
    font-size: 34px;
    font-weight: 900;
    color: var(--hdr-primary);
    background: linear-gradient(135deg, var(--hdr-primary), var(--hdr-primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.site-description {
    font-size: 14px;
    color: var(--hdr-muted);
    margin-top: -5px;
}

.header-tools {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* SEARCH BOX */
.header-search .search-form {
    display: flex;
    align-items: center;
    background: var(--hdr-search-bg);
    border-radius: 30px;
    padding: 0 15px;
    transition: 0.3s;
    border: 1px solid transparent;
    height: 48px; /* Enforces 48px minimum height for touch targets */
}

.header-search .search-form:focus-within {
    background: var(--hdr-search-focus-bg);
    border-color: var(--hdr-primary-light);
}

.search-input {
    border: none;
    background: transparent;
    padding: 0 10px;
    outline: none;
    font-family: inherit;
    width: 220px;
    font-size: 14px;
    color: var(--hdr-text);
    height: 100%;
}

.search-submit {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--hdr-primary);
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-left: -15px; /* Flush align left in RTL form to preserve 48x48px clickable target area */
    outline: none;
}

/* NAVIGATION BAR */
.header-nav-bar {
    background: #0c2422 !important; /* Dark premium teal background to ensure high contrast (> 15:1) with white text */
    color: var(--hdr-nav-text) !important;
}

.main-menu-list {
    display: flex;
    gap: 0;
}

.main-menu-list>li>a {
    padding: 15px 25px;
    display: block;
    font-weight: 700;
    font-size: 16px;
    color: var(--hdr-nav-text);
}

.main-menu-list>li {
    position: relative;
}

.main-menu-list .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--hdr-nav-hover-bg);
    min-width: 220px;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    z-index: 99999; /* Sub-menu z-index increased */
}

.main-menu-list li:hover>.sub-menu {
    display: block;
}

.main-menu-list .sub-menu li a {
    padding: 12px 20px;
    color: var(--hdr-nav-text);
    display: block;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 14px;
}

.main-menu-list .sub-menu li a:hover {
    background: var(--hdr-primary);
}

.main-menu-list>li:hover>a {
    background: var(--hdr-nav-hover-bg);
}

/* --- MAIN LAYOUT --- */
.site-main {
    padding: 40px 0;
}

.main-layout-grid {
    display: grid;
    grid-template-columns: 69% 29%;
    gap: 2%; /* Increased gap slightly for a cleaner breathing room */
}

.articles-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.article-card {
    /* Scoped Variables for Card */
    --card-bg: var(--white);
    --card-title-color: var(--text-main);
    --card-excerpt-color: var(--text-muted);
    --card-btn-color: var(--primary);
    --card-btn-hover-color: var(--primary-dark);
    --card-shadow: var(--shadow-sm);
    --card-hover-shadow: var(--shadow-md);
    --card-radius: var(--radius-md);
    --card-border: 1px solid var(--border-color);

    background: var(--card-bg);
    border-radius: var(--card-radius);
    border: var(--card-border);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    display: flex;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
}

.article-card:hover {
    transform: translateY(-5px); /* Increased transform slightly for a premium feel */
    box-shadow: var(--card-hover-shadow);
}

.article-thumb {
    width: 320px;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.article-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Premium cover display */
    transition: transform 0.5s ease;
}

.article-card:hover .article-thumb img {
    transform: scale(1.05); /* Modern hover scale effect */
}

/* Category Badge over Thumbnail */
.card-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--card-btn-color);
    color: var(--white);
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 20px;
    z-index: 10;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.article-body {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.article-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 12px;
    line-height: 1.4;
}

.article-title a {
    color: var(--card-title-color);
}

.article-title a:hover {
    color: var(--card-btn-color);
}

.article-excerpt {
    font-size: 15px;
    color: var(--card-excerpt-color);
    margin-bottom: 20px;
    line-height: 1.6;
}

.btn-more {
    margin-top: auto;
    font-weight: 800;
    color: var(--card-btn-color);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: 0.2s;
}

.btn-more:hover {
    color: var(--card-btn-hover-color);
    transform: translateX(-5px); /* Slide left on hover (RTL indicator) */
}

/* --- SIDEBAR --- */
.site-sidebar {
    --sb-widget-bg: var(--card-bg);
    --sb-widget-shadow: var(--shadow-sm);
    --sb-widget-radius: var(--radius-md);
    --sb-title-border: var(--primary);
    --sb-title-color: var(--text-main);
    --sb-link-color: var(--text-main);
    --sb-link-hover-color: var(--primary);
    --sb-border: 1px solid var(--border-color);
}

.sidebar-widget {
    background: var(--sb-widget-bg);
    padding: 25px;
    border-radius: var(--sb-widget-radius);
    box-shadow: var(--sb-widget-shadow);
    border: var(--sb-border);
    margin-bottom: 30px;
}

.widget-title {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 20px;
    border-right: 4px solid var(--sb-title-border);
    padding-right: 12px;
    color: var(--sb-title-color);
}

/* SIDEBAR POPULAR POSTS WITH IMAGES */
.site-sidebar .popular-posts-list {
    padding: 0;
    margin: 0;
    list-style: none;
}

.site-sidebar .popular-posts-list li {
    display: flex !important;
    gap: 15px;
    margin-bottom: 18px;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.site-sidebar .popular-posts-list li:last-child {
    border-bottom: none;
}

.pop-thumb {
    width: 80px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.pop-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.site-sidebar .popular-posts-list li:hover .pop-thumb img {
    transform: scale(1.08); /* Hover zoom for sidebar thumbnail */
}

.pop-content {
    flex: 1;
}

.pop-content a {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    display: block;
    color: var(--sb-link-color);
}

.pop-content a:hover {
    color: var(--sb-link-hover-color);
}

.sidebar-ad-box {
    width: 360px;
    height: 360px;
    background: #f1f5f7;
    border: 1px dashed #cfd8dc;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569; /* Slate 600 - High contrast (> 4.5:1) for placeholder text */
    font-size: 13px;
    overflow: hidden;
}

.sidebar-ad-box-300x250 {
    width: 300px;
    height: 250px;
    max-width: 100%;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8eb 100%);
    border: 1px dashed var(--primary-light);
    border-radius: var(--radius-md);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-dark);
    font-size: 14px;
    font-weight: 700;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.02);
}

.sidebar-ad-box-300x250:hover {
    border-style: solid;
    border-color: var(--primary);
    background: linear-gradient(135deg, #eef2f5 0%, #dbe1e6 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05), inset 0 0 10px rgba(0, 0, 0, 0.01);
}

.article-ad-widget-728x90 {
    margin: 40px auto;
    display: flex;
    justify-content: center;
    width: 100%;
    clear: both;
}

.article-ad-box-728x90 {
    width: 728px;
    min-height: 90px;
    max-width: 100%;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8eb 100%);
    border: 1px dashed var(--primary-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-dark);
    font-size: 14px;
    font-weight: 700;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.02);
}

.article-ad-box-728x90:hover {
    border-style: solid;
    border-color: var(--primary);
    background: linear-gradient(135deg, #eef2f5 0%, #dbe1e6 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05), inset 0 0 10px rgba(0, 0, 0, 0.01);
}

/* --- PAGINATION IMPROVEMENT --- */
.pagination-wrapper .page-numbers {
    display: flex;
    list-style: none;
    gap: 8px;
    justify-content: center;
}

.pagination-wrapper li {
    display: inline-block;
}

.pagination-wrapper .page-numbers a,
.pagination-wrapper .page-numbers span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 45px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-weight: 700;
    color: var(--text-main);
}

.pagination-wrapper .page-numbers span.current {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* --- MOBILE SPECIFIC FIXES --- */
@media (max-width: 1024px) {
    .main-layout-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-top-container {
        display: flex;
        flex-direction: row-reverse;
        justify-content: space-between;
        align-items: center;
        padding: 5px 0;
    }

    .site-branding {
        text-align: right;
    }

    .site-branding .logo-text a {
        font-size: 24px;
    }

    .menu-toggle {
        display: block;
        order: 1;
        background: none;
        border: none;
        cursor: pointer;
        padding: 10px;
    }

    .menu-toggle span {
        display: block;
        width: 25px;
        height: 3px;
        background: var(--primary);
        margin: 4px 0;
        border-radius: 2px;
    }

    .header-tools {
        order: 2;
        gap: 10px;
    }

    .header-search {
        display: none;
    }

    .header-nav-bar {
        display: none;
        background: var(--primary-dark);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .article-card {
        flex-direction: column;
    }

    .article-thumb {
        width: 100%;
        height: 200px;
    }

    body.mobile-active .header-nav-bar {
        display: block;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        z-index: 1001;
        box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
    }

    body.mobile-active .main-menu-list {
        flex-direction: column;
        padding: 10px 0;
    }

    body.mobile-active .main-menu-list>li>a {
        padding: 12px 20px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
}

/* --- SITE FOOTER --- */
.site-footer {
    /* Component Scoped Variables */
    --ftr-bg: #0c1b1a; /* Dark Pine Green (provides > 7:1 contrast for white text) */
    --ftr-text: #ffffff;
    --ftr-link-color: #ffffff;
    --ftr-link-hover-color: #38bdf8; /* Accessible Sky Blue (contrast > 4.5:1) */
    --ftr-copyright-color: #94a3b8; /* Accessible Slate (contrast > 4.5:1) */

    background: var(--ftr-bg);
    color: var(--ftr-text);
    padding: 30px 0;
    margin-top: 60px;
    text-align: center;
}

.footer-minimal {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.footer-minimal-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0;
}

.footer-minimal-links li {
    display: flex;
    align-items: center;
}

.footer-minimal-links li:not(:last-child)::after {
    content: "|";
    margin: 0 15px;
    color: rgba(255, 255, 255, 0.6); /* Increased contrast for the separator */
    font-size: 14px;
}

.footer-minimal-links li a {
    color: var(--ftr-link-color);
    font-size: 15px;
    font-weight: 500;
    transition: 0.3s;
}

.footer-minimal-links li a:hover {
    color: var(--ftr-link-hover-color);
}

.footer-copyright p {
    font-size: 14px;
    color: var(--ftr-copyright-color);
    margin-top: 10px;
}

/* --- SINGLE ARTICLE PAGE --- */
.article-card-single {
    background: var(--card-bg);
    padding: 11px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 8px;
}

.post-title {
    font-size: 36px;
    font-weight: 900;
    line-height: 1.3;
    color: var(--text-main);
    margin: 20px 0;
}

.post-meta {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 30px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.post-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.post-thumbnail {
    margin-bottom: 35px;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.post-content {
    font-size: 18px;
    line-height: 1.9;
    color: var(--text-main);
}

.post-content h2,
.post-content h3 {
    margin: 40px 0 20px;
    color: var(--primary-dark);
}

.post-content p {
    margin-bottom: 25px;
}

.post-content ul,
.post-content ol {
    margin-bottom: 25px;
    padding-right: 25px;
}

.post-content li {
    margin-bottom: 10px;
}

/* --- BREADCRUMBS --- */
.post-breadcrumbs {
    margin-bottom: 25px;
    font-size: 13px;
    color: var(--text-muted);
}

.post-breadcrumbs a {
    color: var(--primary);
    font-weight: 600;
}

/* --- POST TAGS (LABELS) --- */
.post-tags-container {
    margin: 7px 0;
    padding: 7px;
    background: #fdfdfd;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.tags-title {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 20px;
    color: var(--primary-dark);
}

.post-tags-list {
    display: flex;
    flex-direction: row;
    /* Horizontal row */
    flex-wrap: wrap;
    gap: 12px;
    padding: 0;
    margin: 0;
}

.post-tags-list li {
    width: auto;
}

.post-tags-list li a {
    display: block;
    background: var(--white);
    color: var(--text-main);
    padding: 10px 25px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
    transition: 0.3s;
}

.post-tags-list li a:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
    transform: translateY(-3px);
}

/* --- AUTHOR BOX --- */
.author-box {
    margin: 7px 0;
    padding: 7px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
}

.author-box-right {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex: 2;
    /* Take more space */
}

.author-avatar {
    width: 100px;
    height: 100px;
    flex: 0 0 100px;
    /* Force fixed width, no growing or shrinking */
    overflow: hidden;
    border-radius: 50%;
    border: 3px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    background: #f8f9fa;
}

.author-avatar img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

.author-name {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 8px;
}

.author-bio {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.8;
    margin-bottom: 20px;
    /* Removed max-width to let it expand */
}

.author-socials {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.author-socials a {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: var(--primary-dark);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    font-size: 20px;
    transition: 0.3s;
    text-decoration: none !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.author-socials a i,
.author-socials a svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    display: block;
}

.author-socials a:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
    transform: translateY(-3px);
}

.author-socials a.facebook:hover {
    background: #1877f2;
    border-color: #1877f2;
}

.author-socials a.twitter:hover {
    background: #000;
    border-color: #000;
}

.author-socials a.linkedin:hover {
    background: #0077b5;
    border-color: #0077b5;
}

.author-socials a.instagram:hover {
    background: #e1306c;
    border-color: #e1306c;
}

.author-box-left {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.author-more-link {
    display: inline-block;
    padding: 14px 28px;
    background: var(--white);
    color: #0b2e2b !important; /* Dark teal for high contrast (> 11:1) on white background */
    border-radius: 30px;
    font-size: 15px;
    font-weight: 700;
    border: 1.5px solid #0b2e2b; /* Solid dark border for contrast */
    box-shadow: var(--shadow-sm);
    transition: 0.3s;
    white-space: nowrap;
}

.author-more-link:hover {
    background: #0b2e2b !important;
    color: var(--white) !important;
    border-color: #0b2e2b !important;
}

/* RESPONSIVE AUTHOR BOX */
@media (max-width: 768px) {
    .author-box {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .author-box-right {
        flex-direction: column;
        align-items: center;
    }

    .author-socials {
        justify-content: center;
    }

    .author-bio {
        max-width: 100%;
    }
}

/* --- RELATED POSTS SECTION --- */
.related-posts-section {
    margin-top: 40px;
}

.section-title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 30px;
    border-right: 5px solid var(--primary);
    padding-right: 15px;
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* Single horizontal row of 4 */
    gap: 20px;
}

.related-card {
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: 0.3s;
}

.related-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.related-thumb {
    height: 150px;
    /* Adjusted height for 4-column layout */
    overflow: hidden;
    position: relative;
}

.related-thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block;
    transition: transform 0.5s ease;
}

.related-title {
    padding: 15px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* RESPONSIVE SINGLE */
@media (max-width: 768px) {
    .article-card-single {
        padding: 25px;
    }

    .post-title {
        font-size: 28px;
    }

    .related-posts-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 columns on mobile for better fit */
        gap: 15px;
    }

    .related-thumb {
        height: 140px;
    }
}

/* --- ACCESSIBILITY OVERRIDES (High Specificity) --- */
/* Target header navigation links specifically to prevent color overrides */
.header-nav-bar nav.main-navigation ul.main-menu-list li a {
    color: #ffffff !important;
    font-weight: 700 !important;
}

/* LuckyWP Table of Contents Overrides */
div.lwptoc_i {
    border: 1px solid var(--border-color) !important;
    background-color: #ffffff !important; /* Pure white background for maximum contrast */
    box-shadow: var(--shadow-sm) !important;
    border-radius: var(--radius-md) !important;
}

div.lwptoc_i .lwptoc_header {
    border-bottom: 2px solid var(--primary-light) !important;
}

div.lwptoc_i .lwptoc_toggle_label,
div.lwptoc_i a.lwptoc_toggle_label {
    color: var(--primary-dark) !important;
    font-weight: 700 !important;
}

div.lwptoc_i .lwptoc_item_number {
    color: #111827 !important; /* Dark Slate Grey (contrast > 10:1) */
    font-weight: 800 !important;
}

div.lwptoc_i .lwptoc_item_label {
    color: #1f2937 !important; /* High contrast Dark Grey */
}

div.lwptoc_i .lwptoc_item a:hover .lwptoc_item_label {
    color: var(--primary) !important;
}

/* Breadcrumbs Overrides (Rank Math) */
div.post-breadcrumbs nav.rank-math-breadcrumb p,
div.post-breadcrumbs nav.rank-math-breadcrumb p a {
    color: var(--primary-dark) !important;
    text-decoration: underline;
}

div.post-breadcrumbs nav.rank-math-breadcrumb p span.last-breadcrumb {
    color: var(--text-muted) !important;
    text-decoration: none;
}

/* Post Meta Contrast - Darker for readability */
.post-meta,
.post-meta span,
.post-meta span i {
    color: #37474f !important;
    /* Blue Grey 800 - Very high contrast */
}

.post-meta span i {
    color: var(--primary);
}

/* --- CATEGORY INDEX SITEMAP PAGE --- */
.sitemap-page {
    padding: 50px 0;
    direction: rtl;
    text-align: right;
}

.sitemap-header {
    margin-bottom: 40px;
    text-align: center;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 20px;
}

.sitemap-page-title {
    font-size: 32px;
    font-weight: 900;
    color: var(--primary-dark);
    margin-bottom: 10px;
}

.sitemap-description {
    font-size: 16px;
    color: var(--text-muted);
}

.sitemap-container {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.sitemap-section {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.sitemap-category-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-light);
}

.sitemap-category-title a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--primary-dark);
    text-decoration: none;
}

.sitemap-category-title a:hover {
    color: var(--primary);
}

.category-count {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: normal;
}

.sitemap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.sitemap-item {
    border-radius: 8px;
    overflow: hidden;
    background: #fafbfc;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease-in-out;
}

.sitemap-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-light);
}

.sitemap-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    text-decoration: none;
    height: 100%;
}

.sitemap-thumb-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: #eef2f5;
}

.sitemap-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sitemap-post-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-main);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sitemap-link:hover .sitemap-post-title {
    color: var(--primary);
}

@media (max-width: 768px) {
    .sitemap-section {
        padding: 20px;
    }
    .sitemap-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* --- HERO SECTION STYLES --- */
.homepage-hero-section {
    background: #f1f5f9;
    padding: 30px 0;
    border-bottom: 1px solid var(--border-color);
}

.hero-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    height: 420px;
}

.hero-grid-side {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}


.hero-card {
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: #000; /* Fallback black background */
}

.hero-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.hero-card-large {
    height: 100%;
}

.hero-card-small {
    height: calc(50% - 10px);
}

/* Double-layer dynamic image layout to prevent cropping of elements */
.hero-card-blur-bg {
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    background-size: cover;
    background-position: center;
    filter: blur(15px) brightness(0.5); /* Blurred and dimmed background layer */
    opacity: 0.7;
    z-index: 1;
}

.hero-card-image-tag {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Scale image to fit card size without cropping */
    z-index: 2; /* Foreground image layer */
    transition: transform 0.6s ease;
}

.hero-card:hover .hero-card-image-tag {
    transform: scale(1.03); /* Clean premium zoom on hover */
}

.hero-card-fallback-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    z-index: 1;
}

/* Overlay gradient for high text readability on top of images */
.hero-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 60%, rgba(0,0,0,0) 100%);
    z-index: 3; /* Placed above the image layers */
    pointer-events: none;
}

.hero-card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px;
    z-index: 4; /* Text on top of everything */
    direction: rtl;
    text-align: right;
}

.hero-card-small .hero-card-content {
    padding: 20px;
}

.hero-badge {
    display: inline-block;
    background: var(--primary);
    color: var(--white);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
    position: relative;
}

.hero-title {
    font-size: 26px;
    font-weight: 900;
    line-height: 1.3;
    color: var(--white);
    margin-bottom: 10px;
}

.hero-title-small {
    font-size: 18px;
    font-weight: 800;
    line-height: 1.3;
    color: var(--white);
    margin-bottom: 8px;
}

.hero-title a,
.hero-title-small a {
    color: inherit;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    text-decoration: none;
}

.hero-title a:hover,
.hero-title-small a:hover {
    color: var(--primary-light);
}

.hero-meta {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    gap: 15px;
}

/* Responsive adjustments for Hero */
@media (max-width: 1024px) {
    .hero-grid {
        height: auto;
        grid-template-columns: 1fr;
    }
    
    .hero-card-large {
        height: 350px;
    }
    
    .hero-grid-side {
        height: auto;
    }
    
    .hero-card-small {
        height: 200px;
    }
}

@media (max-width: 768px) {
    .homepage-hero-section {
        padding: 20px 0;
    }
    
    .hero-title {
        font-size: 20px;
    }
    
    .hero-title-small {
        font-size: 16px;
    }
}

/* --- MOBILE VIEWPORT FULL SCREEN FIXES --- */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* High specificity override for Customizer's !important container width */
    html body .container {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 12px !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
    }
    
    /* Force main page elements to remain within viewport limits */
    html body .site-header,
    html body .homepage-hero-section,
    html body .site-main,
    html body .site-footer {
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Enforce grid boundaries to prevent side-scrolling. 
       minmax(0, 1fr) is critical to prevent grid cells from expanding beyond screen width. */
    html body .hero-grid,
    html body .main-layout-grid {
        max-width: 100% !important;
        width: 100% !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 15px !important;
        height: auto !important;
        box-sizing: border-box !important;
    }
    
    /* Make sure hero cards are centered and scale down */
    html body .hero-card-large,
    html body .hero-card-small {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    html body .hero-grid-side {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        box-sizing: border-box !important;
    }
    
    /* Force article card elements to stay inside the container width */
    html body .article-card {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    html body .article-body {
        width: 100% !important;
        max-width: 100% !important;
        padding: 15px !important; /* Reduced from 25px for mobile readability and text wrapping */
        box-sizing: border-box !important;
    }
    
    /* single post full screen on mobile */
    .article-card-single {
        padding: 15px 12px !important;
        border-radius: 8px;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-shadow: none !important;
        border: none !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .site-main {
        padding: 15px 0 !important;
    }
    
    .header-top-container {
        padding: 5px 12px !important;
    }
    
    .site-footer .container {
        padding: 0 15px !important;
    }

    /* scale down any overflow iframe to fit container width */
    iframe {
        max-width: 100% !important;
        width: 100% !important;
    }
}

/* --- MOBILE LOOP ADS STYLE --- */
.mobile-loop-ad {
    display: none;
    margin: 25px auto;
    text-align: center;
    width: 100%;
    clear: both;
}

.mobile-loop-ad-box {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 320px;
    min-height: 100px;
    background: #f8fafc;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

/* Accessibility high-contrast ad label styles */
.iaa-ad-label,
div.iaa-ad-label {
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #475569 !important; /* Charcoal text color for high contrast against background */
    text-transform: uppercase !important;
    letter-spacing: 1.5px !important;
    margin-bottom: 8px !important;
    text-align: center !important;
}

@media (max-width: 768px) {
    .mobile-loop-ad {
        display: block; /* Show only on mobile loop */
    }
}