/* ==========================================================================
   Red Mammoth — Home page (index.html)
   Page-specific stylesheet. Shared tokens, reset, buttons, header and footer
   now live in css/site.css (loaded before this file) — this file only holds
   the sections unique to the home page: hero, problem, solution, results
   marquee, analysis, process, features and the closing CTA banner.
   ========================================================================== */

/* Shifts the track left by exactly one full card set — N × (272px card +
   20px gap) — which includes the connecting gap between the last card of
   set A and the first card of set B. That is NOT the same as 50% of the
   track's total width: the full (doubled) track holds 2N cards with 2N-1
   gaps between them, while "two sets" only account for (N-1)+(N-1) internal
   gaps, so translateX(-50%) would land short of a true set-width and
   produce a visible snap once per loop. A fixed pixel shift removes that
   rounding error, so set B lands in exactly set A's original position and
   the loop is pixel-perfect.
   N is the number of *active* «کارنامه‌ی تحلیل‌ها» cards (result_card rows
   with is_active_published=true) — it's admin-editable now, not fixed at
   20, so the shift is a CSS custom property set inline by the template
   (site/index.html) per request: --marquee-shift: calc(-N * (272px+20px)).
   The literal 20-card value stays as the fallback for the rare case the
   variable is ever missing. */
@keyframes rmMarquee {
  from { transform: translateX(var(--marquee-shift, calc(-20 * (272px + 20px)))) }
  to { transform: translateX(0) }
}
@media (prefers-reduced-motion: reduce) { [data-marquee-track] { animation: none !important } }

/* ---- home hero's own eyebrow: the shared .eyebrow now lives in
       css/site.css (also used by login.html); this only adds the taller
       bottom margin the home hero uses ---- */
.eyebrow--hero { margin-bottom: 28px }

/* Section-naming labels (the small "مسئله" / "راه‌حل" / ... kicker above each
   heading) — kept in the markup for reference, but not shown to visitors.
   visibility:hidden (not display:none) so the label's own spacing/margin
   stays exactly as before and nothing else in the section reflows. */
.section-label--hidden { visibility: hidden }

/* ---- section title shared by those same sections ---- */
.section-title {
  font-family: var(--font-heading); font-weight: 700;
  font-size: clamp(22px, 2.6vw, 30px); line-height: 1.35; margin: 0;
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero { background: linear-gradient(180deg, var(--color-navy-light), var(--color-navy)); padding: clamp(72px, 10vw, 132px) clamp(20px, 4vw, 40px) clamp(64px, 8vw, 104px) }
.hero__title { font-family: var(--font-heading); font-weight: 700; font-size: clamp(30px, 4.6vw, 44px); line-height: 1.3; margin: 0 0 28px; max-width: 26ch }
.hero__lead { font-size: 17px; line-height: 1.9; color: var(--text-82); max-width: 58ch; margin: 0 0 40px }
.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 30px }
.hero__note { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--text-70); margin: 0 }
.hero__note i { width: 15px; height: 15px; color: var(--color-gold); flex: none }

/* ==========================================================================
   Problem
   ========================================================================== */
.problem { background: linear-gradient(180deg, var(--color-navy), var(--color-navy-dark)); padding: clamp(64px, 8vw, 112px) clamp(20px, 4vw, 40px) }
.problem__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: clamp(36px, 6vw, 88px); align-items: start }
.problem__title { margin: 0 0 22px }
.problem__lead { font-size: 17px; line-height: 1.9; color: var(--text-82); margin: 0 0 16px; max-width: 52ch }
.problem__lead:last-of-type { margin-bottom: 0 }
.problem__list { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px 24px; align-content: start; padding-top: 44px }
.problem__item { display: flex; align-items: center; gap: 12px; min-height: 24px; font-size: 15.5px; line-height: 1.5; color: var(--color-cream) }
.problem__item i { width: 18px; height: 18px; color: var(--color-gold); flex: none }

/* ==========================================================================
   Solution
   ========================================================================== */
.solution { background: linear-gradient(180deg, var(--color-navy-dark), var(--color-navy)); padding: clamp(64px, 8vw, 112px) clamp(20px, 4vw, 40px) }
.solution__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: clamp(36px, 6vw, 80px); align-items: stretch }
.solution__title { margin: 0 0 22px; max-width: 26ch }
.solution__lead { font-size: 17px; line-height: 1.9; color: var(--text-82); margin: 0 0 32px; max-width: 52ch }
.solution__steps { display: flex; flex-direction: column; gap: 14px }
.solution__step { background: var(--color-navy-light); border: 1px solid var(--color-gold); border-radius: 20px; padding: 20px 22px; display: flex; gap: 14px; align-items: flex-start }
.solution__step i { width: 20px; height: 20px; color: var(--color-gold); flex: none; margin-top: 3px }
.solution__step-title { display: block; font-family: var(--font-heading); font-weight: 700; font-size: 18px; margin-bottom: 6px }
.solution__step-desc { display: block; font-size: 14.5px; line-height: 1.85; color: var(--text-82) }
.solution__detail-title { font-family: var(--font-heading); font-weight: 700; font-size: 19px; margin: 0 0 14px }
.solution__detail-text { font-size: 15px; line-height: 1.9; color: var(--text-82); margin: 0 0 26px; max-width: 56ch }
.solution__cta { margin-top: 4px }

/* ==========================================================================
   Results / marquee
   ========================================================================== */
.results { background: linear-gradient(180deg, var(--color-navy), var(--color-navy-light)); padding: clamp(64px, 8vw, 112px) 0 }
.results__intro { max-width: var(--container); margin: 0 auto; padding: 0 clamp(20px, 4vw, 40px) 44px }
.results__title { margin: 0 0 18px; max-width: 24ch }
.results__lead { font-size: 17px; line-height: 1.9; color: var(--text-82); margin: 0; max-width: 54ch }

.marquee-viewport {
  /* The page is RTL. .marquee-track is wider than this element and sits in
     normal flow, so without this the block-layout "start" edge for the
     track is the RIGHT edge (RTL default) — the track's untransformed
     position ends up right-aligned and overflowing far to the left. The
     keyframe's -5840px shift was measured assuming a left-aligned start,
     so on top of that wrong base position it pushed the whole 11660px
     track completely past the left edge of the viewport for most of the
     cycle — the "moves a bit, then the whole rail disappears" bug. Forcing
     ltr here (matching .marquee-track's own direction) makes the
     untransformed track start flush at the left edge instead, which is
     what the keyframe math in @keyframes rmMarquee actually assumes. */
  direction: ltr;
  overflow: hidden; padding: 6px 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.marquee-viewport:hover .marquee-track { animation-play-state: paused }
.marquee-track { display: flex; width: max-content; direction: ltr; gap: 20px; animation: rmMarquee 72s linear infinite; will-change: transform }
.marquee-card {
  direction: rtl; flex: none; width: 272px; background: var(--color-navy-light);
  border: 1px solid var(--color-gold); border-radius: 20px; padding: 22px;
  box-shadow: 0 22px 38px -30px rgba(0, 0, 0, .45);
  display: flex; flex-direction: column; gap: 14px;
}
.marquee-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px }
.marquee-card__pair { display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 700; color: var(--color-cream) }
.marquee-card__pair i { width: 16px; height: 16px; color: var(--color-gold) }
.marquee-card__date { font-size: 11px; color: var(--color-slate) }
.marquee-card__result { font-family: var(--font-heading); font-weight: 700; font-size: 26px; margin: 0; color: var(--color-cream) }
.marquee-card__note { font-size: 12.5px; color: var(--text-70); margin: 0; line-height: 1.8 }
.marquee-card__tag { align-self: flex-start; font-size: 11.5px; color: var(--color-gold); background: var(--color-gold-tint); border-radius: 999px; padding: 5px 12px }

.results__meta { max-width: var(--container); margin: 0 auto; padding: 44px clamp(20px, 4vw, 40px) 0 }
.results__meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px }
.results__meta-item { display: flex; align-items: center; gap: 11px; font-size: 15px; color: var(--text-82) }
.results__meta-item i { width: 18px; height: 18px; color: var(--color-gold); flex: none }
.results__disclaimer { font-size: 12.5px; color: var(--text-70); margin: 26px 0 0; line-height: 1.9; max-width: 80ch }
.results__gallery { margin: 0 auto 44px }
.results__gallery-img { width: 100%; aspect-ratio: 21 / 9; object-fit: cover; border-radius: 20px; border: 1px solid var(--color-gold); display: block }

/* ==========================================================================
   Analysis (team output)
   ========================================================================== */
.analysis { background: linear-gradient(180deg, var(--color-navy-light), var(--color-navy)); padding: clamp(64px, 8vw, 112px) clamp(20px, 4vw, 40px) }
.analysis__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: clamp(36px, 6vw, 80px); align-items: stretch }
.analysis__title { margin: 0 0 22px; max-width: 26ch }
.analysis__lead { font-size: 17px; line-height: 1.9; color: var(--text-82); margin: 0 0 30px; max-width: 52ch }
.analysis__list { display: flex; flex-direction: column; gap: 20px }
.analysis__item { display: flex; gap: 13px; align-items: flex-start }
.analysis__item i { width: 19px; height: 19px; color: var(--color-gold); flex: none; margin-top: 4px }
.analysis__item-title { display: block; font-family: var(--font-heading); font-weight: 700; font-size: 18px; margin-bottom: 5px }
.analysis__item-desc { display: block; font-size: 14.5px; line-height: 1.85; color: var(--text-82) }
.analysis__link { display: inline-flex; align-items: center; gap: 9px; margin-top: 30px; text-decoration: none; color: var(--color-gold); font-weight: 700; font-size: 16px }
.analysis__link i { width: 16px; height: 16px }

/* ==========================================================================
   Process
   ========================================================================== */
.process { background: linear-gradient(180deg, var(--color-navy), var(--color-navy-dark)); padding: clamp(64px, 8vw, 112px) clamp(20px, 4vw, 40px) }
.process__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: clamp(36px, 6vw, 80px); align-items: stretch }
.process__title { margin: 0 0 22px }
.process__steps { display: flex; flex-direction: column; gap: 18px; margin-bottom: 28px }
.process__step { display: flex; align-items: center; gap: 12px; min-height: 24px; font-size: 15.5px; color: var(--color-cream) }
.process__step i { width: 18px; height: 18px; color: var(--color-gold); flex: none }
.process__note { max-width: 46ch; display: flex; gap: 13px; align-items: flex-start }
.process__note i { width: 19px; height: 19px; color: var(--color-gold); flex: none; margin-top: 4px }
.process__note p { font-size: 15.5px; line-height: 1.9; color: var(--color-gold); font-weight: 700; margin: 0; min-width: 0 }

/* ==========================================================================
   Features (flip cards)
   ========================================================================== */
.features { background: linear-gradient(180deg, var(--color-navy-dark), var(--color-navy)); padding: clamp(64px, 8vw, 112px) clamp(20px, 4vw, 40px) }
.features__intro { max-width: 640px; margin: 0 0 40px }
.features__lead { font-size: 16px; line-height: 1.85; color: var(--text-82); margin: 14px 0 0; max-width: 62ch }
.features__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; align-items: stretch }
.features__detail { margin-top: 44px; padding-top: 40px; border-top: 1px solid var(--color-navy-light) }
.features__detail-title { font-family: var(--font-heading); font-weight: 700; font-size: 19px; margin: 0 0 14px }
.features__detail-text { font-size: 15px; line-height: 1.9; color: var(--text-82); margin: 0; max-width: 62ch }

.flip-card { perspective: 1200px; min-height: 300px }
.flip-card__inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.3, .7, .2, 1) }
.flip-card:hover .flip-card__inner { transform: rotateY(180deg) }
.flip-card__face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 20px }
.flip-card__front { background: var(--color-navy-light); border: 1px solid var(--color-gold); padding: 24px; display: flex; flex-direction: column }
.flip-card__front i { width: 22px; height: 22px; color: var(--color-gold) }
.flip-card__front h3 { font-family: var(--font-heading); font-weight: 700; font-size: 18px; margin: 14px 0 10px }
.flip-card__front p { font-size: 14.5px; line-height: 1.85; color: var(--text-82); margin: 0 }
.flip-card__back {
  transform: rotateY(180deg); overflow: hidden; border: 1px solid var(--color-gold);
  background: var(--color-navy-dark);
  background-image: repeating-linear-gradient(135deg, rgba(246,242,232,.07) 0 2px, transparent 2px 12px);
  display: grid; place-items: center; padding: 22px;
}
.flip-card__back span { font-family: ui-monospace, monospace; font-size: 12px; color: var(--text-70); text-align: center; line-height: 1.9 }

/* ==========================================================================
   CTA banner
   ========================================================================== */
.cta-banner {
  background: linear-gradient(180deg, var(--color-navy) 1px, var(--color-oxblood-deep) 22%, var(--color-oxblood) 66%, var(--color-oxblood-dark) calc(100% - 1px));
  color: var(--color-cream);
  padding: clamp(73px, 9vw, 121px) clamp(20px, 4vw, 40px);
  position: relative; overflow: hidden;
}
.cta-banner__eyebrow { font-size: 16px; letter-spacing: .18em; margin: 0 0 26px; font-weight: 500; color: var(--text-75) }
.cta-banner__title { font-family: var(--font-heading); font-weight: 700; font-size: clamp(28px, 4.4vw, 40px); line-height: 1.32; margin: 0 0 26px; max-width: 24ch }
.cta-banner__lead { font-size: 17px; line-height: 1.9; margin: 0 0 40px; max-width: 50ch; color: var(--text-85) }
.cta-banner__actions { display: flex; flex-wrap: wrap; gap: 14px }

/* Optional background photo (بند تصویر بنر پایانی) — inert unless an admin
   uploads one; the gradient above still shows through as a tint overlay so
   brand colors and text legibility never depend on the photo's own contrast. */
.cta-banner--has-image { background: var(--color-oxblood-dark) }
.cta-banner__bg-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0 }
.cta-banner__overlay {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, var(--color-navy) 1px, var(--color-oxblood-deep) 22%, var(--color-oxblood) 66%, var(--color-oxblood-dark) calc(100% - 1px));
  opacity: .82;
}
.cta-banner--has-image .container { position: relative; z-index: 2 }
