/* ===========================================================
   SAZEH PEYVAND — CMS LAYER
   1. Lets the design's fixed-count grids follow the number of
      items the admin panel holds (--n is set inline per grid).
   2. Styles the admin-added "custom sections" (.cs) in the
      design's own tokens (see :root in style.css).
   Loaded after style.css, before fa.css.
   =========================================================== */

/* ---- 1. item-count aware grids (desktop only — the mobile
        layouts in style.css / sector.css are left untouched) ---- */
@media (min-width: 821px) {
  .afc-stats[style*="--n"] { grid-template-columns: repeat(var(--n), 1fr); }
  .afc-subs[style*="--n"] { grid-template-columns: repeat(var(--n), 1fr); }
  .afc-timeline[style*="--n"] { grid-template-columns: repeat(var(--n), 1fr); }
  .afc-certs[style*="--n"] { grid-template-columns: repeat(var(--n), 1fr); }
}
@media (min-width: 901px) {
  .steps[style*="--n"] { grid-template-columns: repeat(var(--n), 1fr); }
  .band-grid[style*="--n"] { grid-template-columns: repeat(var(--n), 1fr); }
  .caps-grid[style*="--n"] { grid-template-columns: repeat(var(--n), 1fr); }
}

/* ---- 2. custom sections ---- */
.cs {
  position: relative;
  z-index: 2;
  padding: clamp(70px, 11vh, 140px) 0;
  border-top: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  --cs-soft: var(--ink-soft);
  --cs-line: var(--line);
  --cs-card: rgba(255, 255, 255, .55);
}
.cs--paper { background: var(--paper); }
.cs--dark {
  background: #0a0e14;
  color: #eef1f5;
  border-top: 0;
  --cs-soft: rgba(231, 235, 241, .64);
  --cs-line: rgba(255, 255, 255, .13);
  --cs-card: rgba(255, 255, 255, .04);
}

.cs-head { margin-bottom: clamp(28px, 4.5vh, 56px); }
.cs-kicker {
  display: block;
  margin-bottom: 16px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--accent);
}
.cs-title {
  max-width: 20ch;
  font-size: clamp(28px, 3.8vw, 56px);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -.02em;
  text-wrap: balance;
}
.cs-title em { font-style: normal; color: var(--accent); }
.cs-body { display: flex; flex-direction: column; gap: 1em; max-width: 62ch; }
.cs-body p { font-size: clamp(15px, 1.15vw, 17px); line-height: 1.75; color: var(--cs-soft); }

.cs-media { display: block; width: 100%; height: 100%; object-fit: cover; }
.cs-media--empty {
  background: repeating-linear-gradient(45deg, transparent 0 10px, var(--cs-line) 10px 11px);
}

.cs-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: clamp(22px, 3vh, 34px);
  padding: 13px 26px;
  border-radius: 40px;
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .02em;
  transition: background .35s;
}
.cs-btn i { font-style: normal; transition: transform .35s; }
.cs-btn:hover { background: var(--accent); color: #fff; }
.cs-btn:hover i { transform: translate(2px, -2px); }
.cs--dark .cs-btn { background: #eef1f5; color: #0a0e14; }
.cs--dark .cs-btn:hover { background: var(--accent); color: #fff; }
.cs-btn--big { margin-top: 0; padding: 18px 34px; font-size: 16px; flex: 0 0 auto; }

/* text */
.cs-text--split { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(28px, 4.5vw, 72px); align-items: start; }
.cs-text--split .cs-head { margin-bottom: 0; }
.cs-text--center { display: flex; flex-direction: column; align-items: center; text-align: center; }
.cs-text--center .cs-title { max-width: 24ch; }

/* image + text */
.cs-split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 84px); align-items: center; }
.cs-split--start .cs-split-media { order: -1; }
.cs-split-media { aspect-ratio: 4 / 3; overflow: hidden; border-radius: 14px; background: var(--cs-card); }

/* gallery + cards share the column grid */
.cs-grid { display: grid; grid-template-columns: repeat(var(--cs-cols, 3), 1fr); gap: clamp(14px, 1.8vw, 26px); }
.cs-shot { margin: 0; }
.cs-shot .cs-media { aspect-ratio: 4 / 3; height: auto; border-radius: 12px; }
.cs-shot figcaption {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--cs-soft);
}

.cs-card { display: flex; flex-direction: column; padding-top: 22px; border-top: 1px solid var(--cs-line); }
.cs-card-media { order: -1; aspect-ratio: 16 / 10; margin: -22px 0 22px; overflow: hidden; border-radius: 12px; }
.cs-card:has(.cs-card-media) { border-top: 0; padding-top: 22px; }
.cs-card-no { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; color: var(--accent); }
.cs-card h3 { margin: 12px 0 10px; font-size: clamp(18px, 1.5vw, 22px); font-weight: 700; line-height: 1.25; }
.cs-card .cs-body p { font-size: 15px; }

/* stats */
.cs-stats { display: grid; grid-template-columns: repeat(var(--cs-cols, 4), 1fr); margin: 0; border-top: 1px solid var(--cs-line); }
.cs-stat { padding: clamp(22px, 3vh, 34px) clamp(14px, 1.6vw, 26px) 0 0; }
.cs-stat dd { margin: 0; font-size: clamp(34px, 4.6vw, 68px); font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.cs-stat dt { margin-top: 12px; font-family: var(--mono); font-size: 12px; letter-spacing: .06em; color: var(--cs-soft); }

/* call to action */
.cs-cta { display: flex; align-items: center; justify-content: space-between; gap: clamp(24px, 5vw, 72px); }
.cs-cta .cs-head { margin-bottom: 0; }
.cs-cta .cs-head + .cs-body { margin-top: 18px; }

/* FAQ — question list beside a sticky head */
.cs-faq { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(28px, 5vw, 84px); align-items: start; }
.cs-faq-head { position: sticky; top: 110px; }
.cs-faq-head .cs-head { margin-bottom: 18px; }
.cs-faq-list { border-top: 1px solid var(--cs-line); }
.cs-qa { border-bottom: 1px solid var(--cs-line); }
.cs-qa summary {
  display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 18px;
  padding: clamp(18px, 2.6vh, 26px) 0; cursor: pointer; list-style: none;
}
.cs-qa summary::-webkit-details-marker { display: none; }
.cs-qa summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.cs-qa-no { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; color: var(--accent); }
.cs-qa h3 { margin: 0; font-size: clamp(17px, 1.35vw, 21px); font-weight: 700; line-height: 1.4; transition: color .25s; }
.cs-qa summary:hover h3 { color: var(--accent); }
.cs-qa summary i { position: relative; width: 14px; height: 14px; align-self: center; }
.cs-qa summary i::before, .cs-qa summary i::after {
  content: ""; position: absolute; inset: 6px 0 auto; height: 2px; border-radius: 2px; background: currentColor;
  transition: transform .35s cubic-bezier(.16, 1, .3, 1);
}
.cs-qa summary i::after { transform: rotate(90deg); }
.cs-qa[open] summary i::after { transform: rotate(0deg); }
.cs-qa .cs-body { padding: 0 0 clamp(20px, 3vh, 30px) 34px; max-width: 70ch; }
.cs-qa .cs-body p { font-size: clamp(15px, 1.1vw, 16.5px); }

/* scroll reveal — only armed by the page script, so content shows without JS */
.cs.cs-pre .wrap { opacity: 0; transform: translateY(24px); }
.cs .wrap { transition: opacity .7s ease, transform .8s cubic-bezier(.16, 1, .3, 1); }
@media (prefers-reduced-motion: reduce) {
  .cs.cs-pre .wrap { opacity: 1; transform: none; }
}

/* RTL / Persian */
html[dir="rtl"] .cs-title { font-size: clamp(26px, 3.4vw, 50px); line-height: 1.2; max-width: none; }
html[dir="rtl"] .cs-stat { padding: clamp(22px, 3vh, 34px) 0 0 clamp(14px, 1.6vw, 26px); }
html[dir="rtl"] .cs-stat dd { font-family: var(--morabba); font-weight: 600; }
html[dir="rtl"] .cs-btn i { transform: scaleX(-1); }
html[dir="rtl"] .cs-qa .cs-body { padding: 0 34px clamp(20px, 3vh, 30px) 0; }
html[dir="rtl"] .cs-qa h3 { font-family: var(--fa); font-weight: 700; }
html[dir="rtl"] .cs-btn:hover i { transform: scaleX(-1) translate(2px, -2px); }

@media (max-width: 900px) {
  .cs-text--split, .cs-split { grid-template-columns: 1fr; }
  .cs-split--start .cs-split-media, .cs-split-media { order: -1; }
  .cs-grid { grid-template-columns: repeat(2, 1fr); }
  .cs-stats { grid-template-columns: repeat(2, 1fr); }
  .cs-cta { flex-direction: column; align-items: flex-start; }
  .cs-faq { grid-template-columns: 1fr; }
  .cs-faq-head { position: static; }
}
@media (max-width: 560px) {
  .cs-grid { grid-template-columns: 1fr; }
}
