/* ================== تنظیمات فونت  ================== */
@font-face {
    font-family: 'Vazir';
    src: url("../../fonts/Vazir.woff") format('woff'),
         url("../../fonts/Vazir.ttf") format('truetype');
    font-weight: 400; 
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazir';
    src: url("../../fonts/Vazir-Medium.woff2") format('woff2'),
         url("../../fonts/Vazir-Medium.woff") format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazir';
    src: url("../../fonts/Vazir-Bold.woff") format('woff');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ================== متغیرهای سراسری ================== */
:root {
    --primary-color: #3a3a3a;
    --accent-color: #F7DD89;
    --text-color: #303030;
    --color-bg-light: #fbf1ca;
    --color-bg: #fdf8e1;
    --font: 'Vazir', sans-serif; 
    --font-size-headings: clamp(16px, 1.2vw, 18px);
    --font-size-btn: clamp(13px, 4vw, 16px);
    --font-size-text: clamp(14px, 4.2vw, 17px);
    --en-font: 'Inter';
    --slide-count: 5;
    --slider-gap: 15px;
}

/*=============general=============*/

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

body { 
    font-family: var(--font);
    background: var(--color-bg); 
    transition: 0.4s; 
    overflow-x: hidden; 
    width: 100%;
    position: relative;
}

input, button, textarea, select {
    font-family: inherit;
}

.bg-circle {
    position: fixed;
    width: 1300px;
    height: 1250px;
    background: #fff1bb;
    border-radius: 50%; 
    top: -300px; 
    left: -400px;
    z-index: -1; 
    pointer-events: none; 
}

/* ================== LAYOUT ================== */

.article-page-wrapper {
    display: flex;
    flex-wrap: wrap;
    margin: 60px auto 60px auto;
    z-index: 2;
    width: 75%;
}

.article-main-content {
    width: 100%;
    /* بهینه‌سازی فاصله از بالا برای واکنش‌گرایی بهتر */
    margin-top: clamp(110px, 12vh, 160px);
}

/* ساختار دو ستونه جدید */
.article-split-layout {
    display: flex;
    gap: clamp(40px, 5vw, 80px); /* فاصله متغیر و بهینه بین متن و عکس */
    align-items: flex-start;
}

.article-text-content {
    flex: 1;
    min-width: 0; /* جلوگیری از بهم ریختگی متن */
}

.article-image-content {
    flex: 0 0 40%; /* کوچکتر کردن عکس مشابه رسپی */
    max-width: 40%;
}

html[lang^="en"] div.article-text-content p {
    font-size: clamp(15px, 4vw, 16px);
}


/* ================== TITLE & META ================== */

.article-main-title {
    font-size: clamp(18px, 2vw, 24px);
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
    padding-right: 5px;
}

.title-underline {
    width: 40%; 
    height: 1px;
    background: #c2c1c177;
    margin-right: 5px;
    margin-bottom: 20px;
    margin-top: 15px;
}

.article-meta-info {
    display: flex;
    gap: clamp(15px, 2vw, 30px); /* فاصله منعطف بین آیتم‌ها */
    align-items: center;
    margin-bottom: 35px;
    padding-right: 5px;
    flex-wrap: wrap; 
}

.article-meta-info span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #696969;
    font-size: 13px;
    white-space: nowrap; /* جلوگیری از شکستن کلمات خودِ آیتم */
}

.article-meta-info span a {
    color: #696969;
    text-decoration: none;
    transition: color 0.3s ease;
}

.article-meta-info span a:hover {
    color: #000;
}

/* ================== CONTENT MEDIA ================== */

.article-thumbnail-container {
    width: 80%;
    aspect-ratio: 1 / 1;
    border-radius: 25px;
    overflow: hidden;
    margin: 0 auto; /* وسط‌چین کردن کانتینر عکس شاخص */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.205);
}

.article-thumbnail-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.article-body-text {
    font-size: clamp(14px, 1.1vw, 16px);
    line-height: 2.4;
    text-align: justify;
    color: var(--primary-color);
}

.article-body-text p {
    font-size: clamp(14px, 1.5vw, 16px);
    line-height: 2.4;
    text-align: justify;
    text-justify: inter-word;
    color: var(--primary-color);
    margin-bottom: 15px;
}

/* اصلاح چیدمان لیست‌ها و بولت پوینت‌ها */
.article-body-text ul,
.article-body-text ol {
    padding-inline-start: 35px; /* تنظیم اتوماتیک پدینگ برای راست‌چین و چپ‌چین */
    margin-top: 15px;
    margin-bottom: 25px;
}

.article-body-text li {
    margin-bottom: 10px;
    line-height: 2;
    font-size: clamp(14px, 1.1vw, 16px);
}

.article-body-text h2, 
.article-body-text h3 {
    color: #1a1a1a;
    font-weight: 700;
    margin-top: 30px;
    margin-bottom: 15px;
}

/* استایل‌دهی اختصاصی عکس‌های داخل متن - آپدیت به 75% و حاشیه متغیر */
.article-body-text img {
    display: block;
    max-width: 100%;
    width: 75%;
    height: auto;
    border-radius: 25px;
    margin: clamp(15px, 3vw, 25px) auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   استایل‌دهی ویدیوها و Iframe ها مخصوص ویرایشگر کلاسیک وردپرس
   ========================================================================== */

/* 1. تنظیم عرض 75 درصد برای تگ‌های خام در کلاسیک ادیتور و فاصله حدود 15 پیکسل */
.article-body-text iframe,
.article-body-text video,
.article-body-text .wp-video,
.article-body-text .aparat-video {
    width: 75% !important;
    max-width: 75% !important;
    margin: clamp(1.5rem, 3vw, 3rem) auto !important; 
    display: block !important;
    clear: both !important;
    border-radius: 25px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
}

/* 2. تنظیم نسبت ابعاد و حذف حاشیه‌ها */
.article-body-text iframe,
.article-body-text video {
    height: auto !important;
    aspect-ratio: 16 / 9;
    border: none !important;
    outline: none !important;
    background: transparent !important;
}

/* 3. اگر مدیا داخل ظرف خود وردپرس (.wp-video) بود، باید 100 درصدِ آن ظرف 75 درصدی را پر کند */
.article-body-text .wp-video .mejs-container,
.article-body-text .wp-video video,
.article-body-text .wp-video iframe,
.article-body-text .aparat-video iframe {
    width: 100% !important; 
    max-width: 100% !important;
    margin: 0 auto !important;
    box-shadow: none !important;
}

/* استایل‌های مخصوص زبان انگلیسی در مقاله */
html[lang^="en"] .article-body-text,
html[lang^="en"] .article-body-text p {
    text-align: justify;
    text-justify: inter-word;
    text-align-last: left;
    direction: ltr;
}

html[lang^="en"] .article-main-title {
    padding-right: 0;
    padding-left: 5px;
}

html[lang^="en"] .title-underline {
    margin-right: 0;
    margin-left: 5px;
}

/* ================== GALLERY SECTION ================== */

.article-gallery-section {
    margin-top: 50px;
    margin-bottom: 80px;
    width: 80%;
    margin-left: auto;
    margin-right: auto;
}

.article-gallery-section h2 {
    font-size: var(--font-size-headings);
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 25px;
}

html[lang^="en"] .article-gallery-section h2 {
    text-align: left;
}

.article-gallery .swiper-wrapper {
    display: flex;
    flex-wrap: nowrap; 
    gap: var(--slider-gap); 
    overflow: hidden; 
    scroll-behavior: smooth;
    box-sizing: border-box;
    padding: 5px 2px 15px 2px; 
}

.article-gallery .swiper-slide {
    flex: 0 0 auto;
    width: calc((100% - (var(--slider-gap) * (var(--slide-count) - 1))) / var(--slide-count)) !important; 
    margin-right: 0 !important; 
}

.related-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 20px; 
    text-decoration: none;
    box-shadow: 0 5px 15px rgba(65, 27, 10, 0.05);
    transition: all 0.3s ease-in-out;
    width: 100%;
    height: 260px; 
    min-height: 260px;
    max-height: 260px;
    overflow: hidden;
    position: relative; 
    border: 1px solid rgba(255, 255, 255, 0.6);
    -webkit-mask-image: -webkit-radial-gradient(white, black);
}

.related-card img {
    width: 100%;
    height: 100%; 
    object-fit: cover; 
    border-radius: 0; 
    transition: transform 0.4s ease;
}

.related-card h4 {
    position: absolute; 
    bottom: 0;
    left: 0;
    margin: 0;
    width: 100%;
    min-height: 60px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.4;
    font-size: clamp(10px, 0.9vw, 13px);
    font-weight: 600;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

.related-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(65, 27, 10, 0.15);
}

.related-card:hover img {
    transform: scale(1.05);
}

.article-gallery .swiper-pagination {
    margin-top: 10px !important;
    position: relative !important;
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 8px;
    bottom: auto !important;
}

.article-gallery .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background: #30303067 !important;
    opacity: 1;
    border-radius: 20px;
    transition: all 0.4s ease;
    cursor: pointer;
}

.article-gallery .swiper-pagination-bullet-active {
    background: var(--accent-color) !important;
    width: 30px; 
    box-shadow: 0 2px 8px rgba(247, 221, 137, 0.4);
}

/* ==========================================================================
   Responsive Design (Mobile & Tablet)
   ========================================================================== */
@media (max-width: 1200px) {
    :root {
        --slide-count: 3; 
    }

    .article-page-wrapper, .article-gallery-section {
        width: 80%;
        margin: 0 auto 50px;
    }
    
    .article-main-content {
        margin-top: 120px;
    }

    .article-split-layout {
        flex-direction: column-reverse;
        gap: 50px;
    }
    
    .article-image-content {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .article-text-content {
        font-size: 14px;
    }

    .article-main-title {
        font-size: 24px;
    }

    .article-thumbnail-container {
        border-radius: 15px;
        aspect-ratio: 1 / 1; 
        width: 70%;
        margin: 0 auto;
    }

    /* تنظیم مدیاهای داخل متن در تبلت - هماهنگ سازی width و max-width */
    .article-body-text img {
        width: 85%;
        margin: 15px auto;
    }
    
    .article-body-text iframe,
    .article-body-text video,
    .article-body-text .wp-video,
    .article-body-text .aparat-video {
        width: 85% !important;
        max-width: 85% !important;
        margin: 15px auto !important;
    }

    .related-card {
        height: 200px;
        min-height: 200px;
        max-height: 200px;
    }
}

@media (max-width: 575px) {
    :root {
        --slide-count: 1.5; 
    }

    .article-page-wrapper, .article-gallery-section {
        width: 85%; 
        margin: 0 auto 50px;
    }

    .article-main-content {
        margin-top: 120px;
    }

    .article-main-title h1 {
        align-items: center;
    }

    .title-underline {
        width: 100%;
    }

    /* حل مشکل متا اینفو (پشت سر هم قرار گرفتن) */
    .article-meta-info {
        display: flex;
        flex-wrap: wrap;
        gap: 12px 18px; /* فاصله افقی و عمودی بهینه شده */
        align-items: center;
        justify-content: flex-start;
        margin-bottom: 25px;
    }

    .article-meta-info span {
        font-size: 12px;
    }

    .article-main-title {
        font-size: 20px; 
    }

    .article-thumbnail-container {
        width: 100%;
        aspect-ratio: 1 / 1;
    }

    /* عرض ۱۰۰ درصد مدیاها در گوشی موبایل و فاصله 15 پیکسل */
    .article-body-text img {
        width: 100%;
        margin: 15px auto;
    }
    
    .article-body-text iframe,
    .article-body-text video,
    .article-body-text .wp-video,
    .article-body-text .aparat-video {
        width: 100% !important;
        max-width: 100% !important;
        margin: 20px auto !important;
    }

    .related-card {
        height: 200px;
        min-height: 200px;
        max-height: 200px;
    }

    .article-split-layout {
        flex-direction: column-reverse;
        gap: 30px;
    }
}
