/*
Theme Name: Astra Child
Template: astra
*/

/* =========================================================
   FONTS (Local): Persian = IRMitra, English = Libre Baskerville
   Paths:
   /wp-content/fonts/mitra/IRMitra.woff
   /wp-content/fonts/mitra/IRMitra-Bold.woff
   /wp-content/fonts/mitra/IRMitra-Italic.woff

   /wp-content/fonts/libre-baskerville/LibreBaskerville-Regular.woff
   /wp-content/fonts/libre-baskerville/LibreBaskerville-Bold.woff
   /wp-content/fonts/libre-baskerville/LibreBaskerville-Italic.woff
========================================================= */

/* --- Local font faces --- */
@font-face{
  font-family: "IRMitra";
  src: url("/wp-content/fonts/mitra/IRMitra.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face{
  font-family: "IRMitra";
  src: url("/wp-content/fonts/mitra/IRMitra-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face{
  font-family: "IRMitra";
  src: url("/wp-content/fonts/mitra/IRMitra-Italic.woff") format("woff");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face{
  font-family: "LibreBaskervilleLocal";
  src: url("/wp-content/fonts/libre-baskerville/LibreBaskerville-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face{
  font-family: "LibreBaskervilleLocal";
  src: url("/wp-content/fonts/libre-baskerville/LibreBaskerville-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face{
  font-family: "LibreBaskervilleLocal";
  src: url("/wp-content/fonts/libre-baskerville/LibreBaskerville-Italic.woff") format("woff");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* =========================================================
   GLOBAL FONT RULES
========================================================= */

/* --- Persian pages (Polylang: fa / fa-IR) --- */
html[lang^="fa"]{
  --ast-global-font-family: "IRMitra", Tahoma, Arial, sans-serif;
  --ast-global-heading-font-family: "IRMitra", Tahoma, Arial, sans-serif;
}

html[lang^="fa"] body,
html[lang^="fa"] h1, html[lang^="fa"] h2, html[lang^="fa"] h3,
html[lang^="fa"] h4, html[lang^="fa"] h5, html[lang^="fa"] h6,
html[lang^="fa"] p,  html[lang^="fa"] a,  html[lang^="fa"] li,
html[lang^="fa"] span,
html[lang^="fa"] input, html[lang^="fa"] button,
html[lang^="fa"] textarea, html[lang^="fa"] select{
  font-family: "IRMitra", Tahoma, Arial, sans-serif !important;
}

/* --- Non-Persian pages (English etc.) --- */
html:not([lang^="fa"]){
  --ast-global-font-family: "LibreBaskervilleLocal", "Libre Baskerville", serif;
  --ast-global-heading-font-family: "LibreBaskervilleLocal", "Libre Baskerville", serif;
}

html:not([lang^="fa"]) body,
html:not([lang^="fa"]) h1, html:not([lang^="fa"]) h2, html:not([lang^="fa"]) h3,
html:not([lang^="fa"]) h4, html:not([lang^="fa"]) h5, html:not([lang^="fa"]) h6,
html:not([lang^="fa"]) p,  html:not([lang^="fa"]) a,  html:not([lang^="fa"]) li,
html:not([lang^="fa"]) span,
html:not([lang^="fa"]) input, html:not([lang^="fa"]) button,
html:not([lang^="fa"]) textarea, html:not([lang^="fa"]) select{
  font-family: "LibreBaskervilleLocal", "Libre Baskerville", serif !important;
}


/* =========================================================
   Stories Archive Cards - MAX WIDTH & AUTO HEIGHT
   ========================================================= */

/* 1) Grid Layout */
.sos-cards {
  display: grid;
  gap: 20px;
  align-items: stretch;
}
@media (min-width: 1024px){ .sos-cards{ grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1023px){ .sos-cards{ grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 2) Card Link - حذف پدینگ‌های مزاحم برای باز شدن فضا */
.sos-card-link {
  position: relative;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  background: #fff;
  /* پدینگ چپ و راست را حداقل کردیم تا فضا برای عکس و متن باز شود */
  padding: 20px 10px !important; 
  text-decoration: none;
  text-align: center;
  height: 100%;
  box-sizing: border-box;
}

/* حذف کامل کادر داخلی */
.sos-card-link::before { display: none !important; }

/* 3) Thumbnail - بزرگ و عریض */
.sos-card-thumb {
  width: 100% !important; /* استفاده از کل عرض موجود */
  margin: 0 0 15px 0 !important;
  aspect-ratio: 3 / 2;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.sos-card-thumb img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover; /* تصویر کل کادر را پر می‌کند */
}

/* 4) Title - اجازه به دو سطری شدن برای جا شدن نام‌های طولانی */
.sos-card-title {
  width: 100% !important;
  font-size: 1.15rem !important;
  line-height: 1.4 !important;
  margin: 0 0 10px 0 !important;
  color: #222;
  font-weight: bold;
  /* حذف اجبار به یک خط بودن برای جلوگیری از بیرون زدن متن */
  white-space: normal !important; 
  display: -webkit-box;
  -webkit-line-clamp: 2; /* حداکثر دو سطر */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 5) Meta Row - سطر اطلاعات (تک سطری و منظم) */
.sos-card-meta {
  width: 100% !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  justify-content: center;
  align-items: center;
  font-size: 0.85rem;
  color: #666;
  gap: 2px;
}

.sos-card-meta .sos-meta-item {
  white-space: nowrap;
}

.sos-card-meta .sos-meta-item + .sos-meta-item::before {
  content: " • ";
  padding: 0 3px;
  color: #ccc;
}


/* =========================================================
   Archive Page Title (Stories) - Bilingual Alignment
   ========================================================= */

.sos-archive-header {
    padding: 20px 0 30px 0;
    display: flex;
    /* تشخیص خودکار جهت متن: در فارسی راست و در انگلیسی چپ */
    justify-content: flex-start; 
}

.sos-archive-title {
    font-size: 2.2rem !important;
    font-weight: 800;
    color: #222;
    margin: 0;
    width: 100%;
    /* این دستور باعث می‌شود در صفحات فارسی راست‌چین و در انگلیسی چپ‌چین شود */
    text-align: start !important; 
}

/* تنظیمات موبایل */
@media (max-width: 767px) {
    .sos-archive-title {
        font-size: 1.6rem !important;
        /* موبایل معمولاً خودش درست عمل می‌کند، اما برای اطمینان: */
        text-align: start !important;
    }
}

/* =========================================================
   Single Story (single-stories.php) tweaks
   Put in: /wp-content/themes/astra-child/style.css
========================================================= */

/* Title a bit smaller */
.sos-story-title{
  font-size: clamp(2rem, 4vw, 3.1rem) !important;
  line-height: 1.1;
  margin: 0 0 10px 0;
}

/* Top meta ABOVE image: force 3 separate lines */
.sos-story-topmeta{
  margin: 0 0 10px 0;
  font-size: 0.95rem;
  line-height: 1.6;
}
.sos-story-topmeta .sos-topmeta-line{
  display: block;
}

/* Featured image spacing */
.sos-story-featured{
  margin: 0 0 10px 0;
}

/* Author BELOW image: bold, slightly bigger + one-line gap before story content */
.sos-story-author-below{
  font-weight: 700;
  font-size: 1.05rem;
  margin: 8px 0 18px 0;
}

/* === single Stories: hide Astra/WP author line(s) (keep your custom taxonomy author) === */
.single-stories .entry-meta,
.single-stories .entry-meta * ,
.single-stories .ast-single-post-order .entry-meta,
.single-stories .ast-single-post-order .entry-meta * ,
.single-stories .ast-author-box,
.single-stories .author-info,
.single-stories .post-author,
.single-stories .posted-by,
.single-stories .byline,
.single-stories .ast-post-meta,
.single-stories .ast-post-meta * ,
.single-stories .ast-meta,
.single-stories .ast-meta * {
  display: none !important;
}

/* اگر جایی “Ali Rad” لینک‌دار/متایی باز هم باقی ماند */
.single-stories a[rel="author"],
.single-stories .author a {
  display: none !important;
}

