/* =============================================================================
   SUPPORT GROUPS — product page (/support-groups)
   Built from the 390px mobile design. Shared topbar/footer styles live in
   css/components/site.css; utilities in css/style.css.
   ============================================================================= */

.sg {
  --sg-ink: #2d3142;
  --sg-panel: #e7edf4;
  /* One rhythm for the whole page: space between sections, and from a section's heading
     to its content. (The Figma frame varies these between 53–79px and 16–36px.) */
  --sg-gap: 56px;
  --sg-head-gap: var(--sp-6);
  overflow-x: clip;
}

/* The design's page is white paper with a faint texture — lighter than the
   site default (#f1f1f3) — so the pale-blue panels read clearly against it. */
body,
.page-scroll {
  background-color: #fff;
}

body::before,
.page-scroll::before {
  opacity: 0.3;
}

/* ─── TYPE ─────────────────────────────────────────────────────────────────── */
.sg-h2 {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 2.5rem;
  color: var(--sg-ink);
}

.sg-h3 {
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.75rem;
  color: var(--sg-ink);
}

.sg-body {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.5625rem;
  letter-spacing: -0.1px;
  color: var(--primary-800);
}

.sg-small {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.625rem;
  letter-spacing: -0.09px;
  color: var(--primary-700);
}

/* ─── BUTTON ───────────────────────────────────────────────────────────────── */
.sg-btn {
  display: block;
  padding: 10px var(--sp-4);
  border-radius: 10px;
  background: var(--secondary-500);
  color: #fff;
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.75rem;
  text-align: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.07);
  transition: background-color 200ms ease;
}

.sg-btn--soft {
  background: rgba(125, 43, 41, 0.9);
}

.sg-btn:focus-visible {
  outline: 2px solid var(--secondary-300);
  outline-offset: 2px;
}

@media (hover: hover) {
  .sg-btn:hover {
    background: var(--secondary-700);
  }
}

/* ─── HERO ─────────────────────────────────────────────────────────────────── */
/* Same "card above the top bar" look as the home hero. */
.sg-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 585px;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -6px 12px -7px rgba(29, 32, 48, 0.16);
}

.sg-hero__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: bottom;
  transform: scaleX(-1);
}

.sg-hero__content {
  position: relative;
  padding: 0 var(--sp-5) 39px;
  color: #fffffe;
}

.sg-hero__title {
  font-size: 2.375rem;
  font-weight: 900;
  line-height: 3.0625rem;
  letter-spacing: -0.38px;
  margin-bottom: var(--sp-6);
}

.sg-hero__lead {
  max-width: 334px;
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.75rem;
}

.sg-hero__btn {
  width: calc(100% - 14px);
  margin: 45px auto 0;
}

/* ─── WHAT HAPPENS ─────────────────────────────────────────────────────────── */
.sg-about {
  padding: var(--sg-gap) var(--sp-5);
}

.sg-about .sg-h2 {
  margin-bottom: var(--sg-head-gap);
}

.sg-body p + p {
  margin-top: 7px;
}

.sg-body strong {
  font-weight: 700;
}

/* Sits at the left edge of the page, tucked up under the paragraph. */
.sg-about__birds {
  width: 257px;
  height: auto;
  margin-top: -5px;
  margin-right: auto;
  margin-left: calc(-1 * var(--sp-5));
  transform: scaleX(-1);
  opacity: 0.7;
}

.sg-about__quote {
  margin-top: -63px;
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 2.5rem;
  text-align: center;
  color: var(--primary-700);
}

/* ─── GOALS ────────────────────────────────────────────────────────────────── */
.sg-goals {
  padding: var(--sp-6) var(--sp-5);
  background: var(--sg-panel);
}

.sg-goal {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-height: 133px;
  padding-top: 25px;
  padding-inline: 5px;
}

.sg-goal__img {
  flex-shrink: 0;
  width: 118px;
  height: 100px;
  margin-right: -7px;
  object-fit: cover;
}

.sg-goal__text .sg-small {
  max-width: 208px;
  margin-top: 11px;
}

/* ─── AT A GLANCE ──────────────────────────────────────────────────────────── */
.sg-glance {
  padding: var(--sg-gap) var(--sp-5) 0;
}

.sg-glance__list {
  margin-top: var(--sg-head-gap);
}

.sg-glance__list li + li {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--primary-300);
}

.sg-glance__btn {
  width: calc(100% - 6px);
  margin: 36px auto 0;
}

/* ─── WHY ──────────────────────────────────────────────────────────────────── */
.sg-why {
  margin-top: var(--sg-gap);
  padding-inline: var(--sp-5);
}

/* The scroll row needs padding so card shadows aren't clipped; the negative margin cancels
   the bottom part so the gap to the next section stays exactly --sg-gap. */
.sg-why .values-scroll {
  padding-block: var(--sg-head-gap) var(--sp-4);
  margin-bottom: calc(-1 * var(--sp-4));
}

/* Same card as the home page's "در نگاه کنار" (.value-card in site.css), shorter. */
.sg-why-card {
  height: 280px;
}

/* ─── FAQ ──────────────────────────────────────────────────────────────────── */
.sg-faq {
  margin-top: var(--sg-gap);
  padding-inline: var(--sp-5);
}

.sg-faq__list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  margin-top: var(--sg-head-gap);
}

.sg-faq__item {
  padding: var(--sp-4) var(--sp-5);
  border-radius: 16px;
  background: var(--sg-panel);
}

.sg-faq__q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
  width: 100%;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.5625rem;
  letter-spacing: -0.1px;
  text-align: right;
  color: var(--sg-ink);
  /* No tap flash or accidental text selection when toggling. */
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.sg-faq__q:focus-visible {
  outline: 2px solid var(--primary-400);
  outline-offset: 4px;
  border-radius: 4px;
}

.sg-faq__q::after {
  content: "";
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background: url("/assets/images/support-groups/faq-arrow.svg") center / contain no-repeat;
  transition: transform 300ms ease;
}

.sg-faq__item.is-open .sg-faq__q::after {
  transform: rotate(180deg);
}

/* Height animates via the grid row (0fr → 1fr); visibility keeps the closed
   answer out of the tab order and away from screen readers. */
.sg-faq__panel {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows 300ms ease, visibility 300ms;
}

.sg-faq__item.is-open .sg-faq__panel {
  grid-template-rows: 1fr;
  visibility: visible;
}

.sg-faq__panel > div {
  min-height: 0;
  overflow: hidden;
}

.sg-faq__panel .sg-small {
  padding-top: var(--sp-3);
}

/* ─── CLOSING CARD ─────────────────────────────────────────────────────────── */
.sg-fit {
  margin-top: var(--sg-gap);
  padding: 0 var(--sp-5) var(--sp-5);
}

.sg-fit__card {
  padding: var(--sp-4) var(--sp-3) 23px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.07);
}

/* Photo fades out toward the bottom so the title stays readable on it. Stops are the exact
   ones from the Figma mask: solid to 225px, fully gone by 369px (of the 399px photo). */
.sg-fit__photo {
  height: 399px;
  overflow: hidden;
  border-radius: 8px;
  -webkit-mask-image: linear-gradient(to bottom, #000 225px, transparent 369px);
  mask-image: linear-gradient(to bottom, #000 225px, transparent 369px);
}

.sg-fit__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sg-fit__title {
  position: relative;
  margin-top: -79px;
  text-align: center;
  letter-spacing: -0.84px;
}

.sg-fit__text {
  position: relative;
  max-width: 322px;
  margin: 18px auto 0;
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.75rem;
  letter-spacing: -0.11px;
  text-align: center;
  color: var(--primary-700);
}

.sg-fit__btn {
  width: calc(100% - 24px);
  margin: var(--sp-5) auto 0;
}

.sg-fit__support {
  margin-top: var(--sp-5);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.875rem;
  text-align: center;
  color: rgba(45, 49, 66, 0.8);
}

.sg-fit__support button {
  font-weight: inherit;
  color: inherit;
  text-decoration: underline;
  text-underline-position: from-font;
}

/* =============================================================================
   REGISTRATION FORM (/support-groups/register)
   ============================================================================= */
.sgr {
  padding: 44px var(--sp-5) var(--sp-10);
}

.sgr-form {
  margin-top: 34px;
}

.sgr-step {
  margin-bottom: 54px;
}

.sgr-step__title {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.75rem;
  color: var(--sg-ink);
}

/* ─── FIELDS ───────────────────────────────────────────────────────────────── */
.sgr-field {
  margin-top: var(--sp-4);
}

.sgr-label {
  display: block;
  margin-bottom: 2px;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.875rem;
  color: var(--sg-ink);
}

.sgr-input {
  width: 100%;
  height: 40px;
  padding-inline: 10px;
  border: 1px solid rgba(45, 49, 66, 0.5);
  border-radius: 10px;
  background: #fff;
  font-family: var(--font-secondary);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--sg-ink);
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.sgr-input::placeholder {
  color: #9698a0;
}

.sgr-input:focus {
  outline: none;
  border-color: #27356b;
  box-shadow: 0 0 0 3px rgba(39, 53, 107, 0.15);
}

/* Phone numbers read left-to-right, but stay right-aligned like the design. */
.sgr-input[type="tel"] {
  direction: ltr;
  text-align: right;
}

.sgr-hint {
  margin-top: 5px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.875rem;
  color: rgba(45, 49, 66, 0.6);
}

/* ─── TIME SLOTS ───────────────────────────────────────────────────────────── */
.sgr-slots {
  display: flex;
  flex-direction: column;
  gap: 26px;
  margin-top: var(--sp-5);
}

.sgr-slots__note {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.875rem;
  color: var(--primary-700);
}

.sgr-slot {
  position: relative;
  display: block;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.sgr-slot.is-full {
  cursor: not-allowed;
}

/* The radio stays in the DOM for keyboard + validation; the card is what you see. */
.sgr-slot__input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.sgr-slot__card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  min-height: 70px;
  padding: 6px 19px;
  border: 1px solid #5f6374;
  border-radius: 16px;
  color: var(--sg-ink);
  transition: background-color 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

.sgr-slot__text {
  display: flex;
  flex-direction: column;
}

.sgr-slot__title {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.75rem;
}

.sgr-slot__first {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.75rem;
}

.sgr-slot__seats {
  padding: 2px var(--sp-3);
  border: 1px solid var(--secondary-500);
  border-radius: 30px;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.75rem;
  white-space: nowrap;
  color: var(--secondary-500);
}

/* Selected: 2px navy edge (1px border + 1px ring, so nothing shifts) + corner check. */
.sgr-slot__input:checked + .sgr-slot__card {
  background: rgba(208, 216, 231, 0.8);
  border-color: #27356b;
  box-shadow: 0 0 0 1px #27356b;
}

.sgr-slot__input:checked + .sgr-slot__card::after {
  content: "";
  position: absolute;
  top: -12px;
  left: -12px;
  width: 33px;
  height: 33px;
  background: url("/assets/images/support-groups/slot-check.svg") center / contain no-repeat;
}

.sgr-slot__input:focus-visible + .sgr-slot__card {
  outline: 2px solid var(--primary-400);
  outline-offset: 3px;
}

.sgr-slot.is-full .sgr-slot__card {
  background: rgba(216, 216, 216, 0.8);
  border-color: rgba(95, 99, 116, 0.5);
  color: rgba(45, 49, 66, 0.5);
}

.sgr-slot.is-full .sgr-slot__seats {
  border-color: rgba(45, 49, 66, 0.5);
  color: rgba(45, 49, 66, 0.5);
}

/* ─── SUMMARY ──────────────────────────────────────────────────────────────── */
.sgr-summary {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin-top: var(--sp-4);
  padding: var(--sp-2) var(--sp-4);
  border-radius: 16px;
  background: rgba(123, 130, 154, 0.3);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.875rem;
  color: var(--sg-ink);
}

.sgr-summary > div {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-4);
}

.sgr-summary dd {
  text-align: left;
}

/* ─── TERMS + SUBMIT ───────────────────────────────────────────────────────── */
.sgr-terms {
  display: block;
  margin-top: 10px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.75rem;
  text-align: right;
  color: var(--sg-ink);
}

/* Inline so the checkbox leads the text like a normal paragraph, even when it wraps. */
.sgr-terms input {
  width: 16px;
  height: 16px;
  margin-left: 4px;
  vertical-align: -2px;
  accent-color: var(--sg-ink);
}

.sgr-terms__link {
  font-size: inherit;
  font-weight: 600;
  color: inherit;
  text-decoration: underline;
  text-underline-position: from-font;
}

.sgr-error {
  margin-top: var(--sp-2);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5rem;
  text-align: center;
  color: var(--secondary-700);
}

.sgr-submit {
  width: 100%;
  margin-top: var(--sp-3);
}

.sgr-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── TERMS DIALOG ─────────────────────────────────────────────────────────── */
.sgr-dialog {
  width: min(390px, calc(100vw - 2 * var(--sp-4)));
  max-height: 85svh;
  margin: auto;
  padding: var(--sp-6) var(--sp-5) var(--sp-5);
  border: none;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-lg);
}

/* Title and close button stay put; the text scrolls between them. */
.sgr-dialog[open] {
  display: flex;
  flex-direction: column;
}

.sgr-dialog::backdrop {
  background: rgba(29, 32, 48, 0.5);
}

.sgr-dialog .sgr-step__title {
  font-size: 1.375rem;
  line-height: 2rem;
}

.sgr-dialog__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin-block: var(--sp-4);
  padding-left: var(--sp-2);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.75rem;
  color: var(--primary-700);
}

.sgr-dialog__body h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--sg-ink);
}

.sgr-dialog .sg-btn {
  width: 100%;
}

.sgr-dialog__body p + h3 {
  margin-top: var(--sp-4);
}

/* =============================================================================
   PAYMENT RESULT (/support-groups/payment/callback — success and failed)
   ============================================================================= */
.sgp {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 var(--sp-5) var(--sp-4);
  color: var(--sg-ink);
}

.sgp--success { padding-top: 64px; }
.sgp--failed  { padding-top: 47px; }

.sgp__icon {
  width: 96px;
  height: 96px;
}

.sgp__title {
  margin-top: var(--sp-4);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 2.125rem;
  text-align: center;
}

.sgp__ref {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 2.125rem;
  text-align: center;
  color: rgba(45, 49, 66, 0.6);
}

.sgp__box {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  padding: var(--sp-5);
  border-radius: 16px;
  background: rgba(123, 130, 154, 0.3);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.875rem;
}

.sgp--success .sgp__box { margin-top: var(--sp-4); }
.sgp--failed .sgp__box  { margin-top: 39px; }

.sgp__box-main {
  font-size: 1.5rem;
}

/* Card text is a step larger than the Figma frames (16/20/24px), by request. */
.sgp--success .sgp__box,
.sgp--failed .sgp__box {
  font-size: 1.125rem;
}

.sgp--failed .sgp__box-group {
  font-size: 1.375rem;
  line-height: 1.75rem;
}

.sgp--success .sgp__box-main {
  font-size: 1.625rem;
  line-height: 2.25rem;
}

.sgp__box-group {
  font-size: 1.25rem;
  line-height: 1.3125rem;
  letter-spacing: -0.1px;
}


.sgp__home {
  /* Sits just above the footer however tall the screen is. */
  margin-top: auto;
  padding-top: var(--sp-10);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.875rem;
  text-decoration: underline;
  text-underline-position: from-font;
}

.sgp__retry {
  width: 100%;
  margin-top: 54px;
}

.sgp__retry .sg-btn {
  width: 100%;
}

.sgp__refund {
  margin-top: 7px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.625rem;
  letter-spacing: -0.07px;
  text-align: center;
  color: rgba(45, 49, 66, 0.8);
}

.sgp__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 var(--sp-3);
  width: 100%;
  max-width: 293px;
  /* Sits just above the footer however tall the screen is. */
  margin-top: auto;
  padding-top: var(--sp-6);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.875rem;
  color: rgba(45, 49, 66, 0.8);
}

.sgp__links a {
  text-decoration: underline;
  text-underline-position: from-font;
}

/* ─── DESKTOP ──────────────────────────────────────────────────────────────── */
/* ponytail: there is no desktop design yet, so ≥900px keeps the mobile layout in
   the same centered 430px shell tablets get. Replace with a real desktop layout
   when the design exists. */
@media (min-width: 900px) {
  html {
    font-size: 16px;
  }

  body {
    max-width: var(--app-max-width);
    margin-inline: auto;
    border-inline: 1px solid var(--primary-300);
    box-shadow: var(--shadow);
  }

  .site-topbar {
    left: 50%;
    right: auto;
    width: 100%;
    max-width: var(--app-max-width);
    transform: translateX(-50%);
  }
}
