/**
 * بخشِ «دوره‌های منتخب» (آکادمی) — pgf-*  (۳.۷.۲۵)
 * قفسهٔ افقیِ فشرده: دسکتاپ ۴ کارت، ≤۱۱۰۰ سه، ≤۸۰۰ دو‌وکمی، ≤۵۶۰ یک‌وکمی (کشیدنی).
 * رنگ‌ها از توکن‌های قالب (--bm-*) → روز/شب و تنظیماتِ رنگ.
 */
.pgf {
  --pgf-surface: var(--bm-surface, #fff);
  --pgf-text: var(--bm-text, #10172a);
  --pgf-muted: var(--bm-text-sub, #6f7b92);
  --pgf-border: var(--bm-border, #dde3ee);
  --pgf-primary: var(--bm-primary, #5659f5);
  --pgf-soft: color-mix(in srgb, var(--pgf-primary) 10%, var(--pgf-surface));
  --pgf-gap: 16px;
  --pgf-cols: 4;
  --pgf-shadow: 0 8px 26px rgba(27, 38, 72, .06);
  --pgf-shadow-hover: 0 18px 44px rgba(27, 38, 72, .13);
  position: relative;
  padding: clamp(44px, 4.6vw, 64px) 32px;
  color: var(--pgf-text);
  font-family: var(--bm-font, "Vazirmatn", Tahoma, Arial, sans-serif);
  font-size: 16px;
  line-height: normal;
  text-align: right;
  direction: rtl;
}
:root[data-theme="dark"] .pgf {
  --pgf-shadow: 0 10px 30px rgba(0, 0, 0, .22);
  --pgf-shadow-hover: 0 20px 48px rgba(0, 0, 0, .34);
}
.pgf *, .pgf *::before, .pgf *::after { box-sizing: border-box; }
:where(.pgf) :where(button) { font: inherit; }
.pgf-container { width: min(1136px, 100%); margin-inline: auto; }

/* ---------- سربرگ ---------- */
.pgf-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; margin-bottom: 18px; }
.pgf .pgf-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 30px;
  margin: 0 0 10px;
  padding: 4px 12px;
  color: var(--pgf-primary);
  background: var(--pgf-soft);
  border: 1px solid color-mix(in srgb, var(--pgf-primary) 18%, transparent);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.6;
}
.pgf .pgf-eyebrow::before { width: 7px; height: 7px; content: ""; background: currentColor; border-radius: 50%; box-shadow: 0 0 0 5px color-mix(in srgb, currentColor 12%, transparent); }
.pgf .pgf-title-main {
  margin: 0;
  color: var(--pgf-text);
  font-family: var(--bm-font-heading, inherit);
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 900;
  line-height: 1.35;
  letter-spacing: -.035em;
}
.pgf .pgf-title-main span { color: var(--pgf-primary); }
.pgf-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* زبانه‌ها (segmented) */
.pgf-tabs { display: inline-flex; gap: 2px; padding: 4px; background: var(--pgf-surface); border: 1px solid var(--pgf-border); border-radius: 999px; box-shadow: var(--pgf-shadow); }
.pgf .pgf-tab {
  min-height: 34px;
  margin: 0;
  padding: 5px 14px;
  color: var(--pgf-muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
  white-space: nowrap;
  cursor: pointer;
  transition: color .2s ease, background-color .2s ease;
}
.pgf .pgf-tab:hover { color: var(--pgf-text); }
.pgf .pgf-tab.is-active { color: #fff; background: var(--pgf-primary); box-shadow: 0 6px 14px color-mix(in srgb, var(--pgf-primary) 32%, transparent); }
.pgf .pgf-tab:focus-visible { outline: 2px solid var(--pgf-primary); outline-offset: 2px; }

/* فلش‌ها و «همه دوره‌ها» */
.pgf-arrows { display: inline-flex; gap: 6px; }
.pgf .pgf-arrow {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--pgf-text);
  background: var(--pgf-surface);
  border: 1px solid var(--pgf-border);
  border-radius: 50%;
  box-shadow: var(--pgf-shadow);
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease, opacity .2s ease;
}
.pgf .pgf-arrow svg { width: 17px; height: 17px; }
.pgf .pgf-arrow:hover:not(:disabled) { color: var(--pgf-primary); border-color: color-mix(in srgb, var(--pgf-primary) 45%, var(--pgf-border)); }
.pgf .pgf-arrow:disabled { opacity: .38; cursor: default; }
.pgf .pgf-arrow:focus-visible { outline: 2px solid var(--pgf-primary); outline-offset: 2px; }
.pgf.is-static .pgf-arrows { display: none; }
.pgf .pgf-all { display: inline-flex; align-items: center; gap: 6px; color: var(--pgf-primary); font-size: 13.5px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.pgf .pgf-all:hover { color: var(--pgf-primary); }
.pgf .pgf-all svg { width: 16px; height: 16px; transition: transform .2s ease; }
.pgf .pgf-all:hover svg { transform: translateX(-3px); }

/* ---------- قفسه ---------- */
.pgf .pgf-panel[hidden] { display: none; }
.pgf .pgf-panel.is-entering { animation: pgf-in .35s cubic-bezier(.2, .7, .2, 1); }
@keyframes pgf-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.pgf .pgf-track {
  display: grid;
  grid-auto-columns: calc((100% - (var(--pgf-cols) - 1) * var(--pgf-gap)) / var(--pgf-cols));
  grid-auto-flow: column;
  gap: var(--pgf-gap);
  margin: -6px -8px;
  padding: 6px 8px 14px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-padding-inline: 8px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.pgf .pgf-track::-webkit-scrollbar { display: none; }
.pgf .pgf-track:focus-visible { outline: 2px solid var(--pgf-primary); outline-offset: 2px; border-radius: 20px; }
.pgf-empty { margin: 0; padding: 20px; color: var(--pgf-muted); text-align: center; }

/* ---------- کارت ---------- */
.pgf .pgf-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 8px;
  background: var(--pgf-surface);
  border: 1px solid var(--pgf-border);
  border-radius: 18px;
  box-shadow: var(--pgf-shadow);
  scroll-snap-align: start;
  transition: transform .3s cubic-bezier(.2, .7, .2, 1), box-shadow .3s ease, border-color .3s ease;
}
@media (hover: hover) and (pointer: fine) {
  .pgf .pgf-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--pgf-primary) 32%, var(--pgf-border)); box-shadow: var(--pgf-shadow-hover); }
  .pgf .pgf-card:hover .pgf-media img { transform: scale(1.05); }
  .pgf .pgf-card:hover .pgf-title a { color: var(--pgf-primary); }
}
.pgf .pgf-media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--pgf-soft);
  border-radius: 12px;
}
.pgf .pgf-media img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100% !important;
  max-width: none !important;
  object-fit: cover;
  transition: transform .6s cubic-bezier(.22, 1, .36, 1);
}
.pgf .pgf-chip {
  position: absolute;
  top: 8px;
  right: 8px;
  max-width: calc(100% - 70px);
  overflow: hidden;
  padding: 3px 9px;
  color: var(--pgf-primary);
  background: rgba(255, 255, 255, .92);
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.6;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.pgf .pgf-flag { position: absolute; top: 8px; left: 8px; padding: 3px 9px; color: #fff; background: #ef4444; border-radius: 999px; font-size: 10.5px; font-weight: 800; line-height: 1.6; }
.pgf .pgf-flag.is-free { background: #10b981; }
.pgf .pgf-body { display: flex; flex: 1; flex-direction: column; gap: 8px; padding: 10px 6px 2px; }
.pgf .pgf-title { margin: 0; font-family: var(--bm-font-heading, inherit); font-size: 14.5px; font-weight: 800; line-height: 1.65; letter-spacing: -.01em; }
.pgf .pgf-title a {
  display: -webkit-box;
  overflow: hidden;
  min-height: calc(2 * 1.65em);
  color: var(--pgf-text);
  text-decoration: none;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  transition: color .2s ease;
}
.pgf .pgf-title a::after { position: absolute; z-index: 1; inset: 0; content: ""; border-radius: 18px; }
.pgf .pgf-title a:focus-visible { outline: none; }
.pgf .pgf-card:has(.pgf-title a:focus-visible) { outline: 2px solid var(--pgf-primary); outline-offset: 3px; }
.pgf .pgf-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; padding: 0; color: var(--pgf-muted); list-style: none; font-size: 11.5px; font-weight: 600; line-height: 1.6; }
.pgf .pgf-meta li { display: inline-flex; align-items: center; gap: 4px; margin: 0; }
.pgf .pgf-meta svg { width: 14px; height: 14px; color: var(--pgf-primary); }
.pgf .pgf-teacher { display: flex; align-items: center; gap: 7px; margin: 0; color: var(--pgf-muted); font-size: 12px; font-weight: 600; line-height: 1.5; }
.pgf .pgf-tav { display: inline-grid; flex: none; place-items: center; width: 24px; height: 24px; overflow: hidden; color: var(--pgf-muted); background: var(--pgf-soft); border-radius: 50%; }
.pgf .pgf-tav svg { width: 14px; height: 14px; }
.pgf .pgf-tav img { width: 100%; height: 100% !important; object-fit: cover; }
.pgf .pgf-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 9px;
  border-top: 1px dashed var(--pgf-border);
}
.pgf .pgf-rate { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; line-height: 1.5; }
.pgf .pgf-rate svg { width: 14px; height: 14px; color: #f5a524; }
.pgf .pgf-rate b { color: var(--pgf-text); font-weight: 800; }
.pgf .pgf-rate small { color: var(--pgf-muted); font-size: 11px; }
.pgf .pgf-price { display: inline-flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: 0 6px; color: var(--pgf-primary); font-size: 14px; font-weight: 900; line-height: 1.5; text-align: left; }
.pgf .pgf-price.is-free { color: #10b981; }
.pgf .pgf-price del { color: var(--pgf-muted); font-size: 11px; font-weight: 600; }
.pgf .pgf-price ins { text-decoration: none; }

/* ============ واکنش‌گرا ============ */
@media (max-width: 1100px) { .pgf { --pgf-cols: 3; } }
@media (max-width: 900px) { .pgf { padding-inline: 24px; } }
@media (max-width: 800px) {
  .pgf { --pgf-gap: 12px; }
  .pgf .pgf-track { grid-auto-columns: 42%; }
  .pgf-head { align-items: flex-start; flex-direction: column; }
  .pgf-tools { width: 100%; }
  .pgf .pgf-all { margin-inline-start: auto; }
}
@media (max-width: 560px) {
  .pgf { padding-inline: 16px; }
  .pgf .pgf-title-main { font-size: clamp(22px, 6.4vw, 26px); }
  .pgf-tools { flex-wrap: nowrap; }
  .pgf .pgf-tabs { overflow-x: auto; max-width: calc(100% - 90px); scrollbar-width: none; }
  .pgf-tabs::-webkit-scrollbar { display: none; }
  .pgf .pgf-tab { padding-inline: 11px; font-size: 12.5px; }
  .pgf-arrows { display: none; }
  .pgf .pgf-track { grid-auto-columns: 76%; margin-inline: -16px; padding-inline: 16px; scroll-padding-inline: 16px; }
  .pgf .pgf-card { border-radius: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .pgf .pgf-card, .pgf .pgf-media img, .pgf .pgf-tab, .pgf .pgf-all svg { transition: none; }
  .pgf .pgf-panel.is-entering { animation: none; }
}

/* ---------- خنثی‌سازیِ قوانینِ سراسریِ چیدمانِ آکادمی (v3-mobile.css) ---------- */
.pg-home > section.pgf > .pgf-container { padding-left: 0 !important; padding-right: 0 !important; }
@media (max-width: 900px) { .pg-home section.pgf { padding-top: 44px !important; padding-bottom: 44px !important; } }
@media (max-width: 560px) { .pg-home section.pgf { padding-top: 36px !important; padding-bottom: 36px !important; } }
