/* ══ FAQ — a help center (ported from Monia, in Rand's navy + gold) ══
   Search-first hero (live filter with highlighted matches), a numbered
   accordion that animates its height with grid-template-rows and morphs
   plus into minus, deep links per question (#q-id), and a sticky help
   card. Works without JS: every answer is shown open. */

.fq-page { --fq-fs-lg: 1.125rem; --fq-fs-sm: 0.875rem; --fq-fs-xs: 0.8125rem; --fq-fs-2xs: 0.6875rem; --fq-accent-border: rgba(var(--rgb-gold), 0.5); }

/* ── Hero ── */
.fq-hero {
  position: relative;
  padding: var(--sp-16) 0 var(--sp-12);
  background: linear-gradient(180deg, #fbf6ea 0%, var(--color-background) 100%);
  text-align: center;
  overflow: hidden;
  isolation: isolate;
}
/* Faint dot grid that fades out toward the edges */
.fq-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgba(var(--rgb-navy), 0.16) 1px, transparent 1.4px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 60% 70% at 50% 40%, #000, transparent 75%);
          mask-image: radial-gradient(ellipse 60% 70% at 50% 40%, #000, transparent 75%);
}
.fq-hero::after {
  content: '';
  position: absolute;
  z-index: -1;
  width: 560px; height: 560px;
  inset-inline-end: -180px; top: -260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--rgb-gold), 0.2), transparent 66%);
}
.fq-hero__title { margin: 0; font-size: clamp(2.25rem, 1.4rem + 3vw, 3.5rem); font-weight: var(--fw-extrabold); letter-spacing: -0.03em; line-height: 1.15; color: var(--color-text); }
html[lang="ar"] .fq-hero__title { letter-spacing: 0; line-height: 1.3; }
.fq-hero .title-stroke { margin: var(--sp-5) auto var(--sp-5); }
.fq-hero__desc { max-width: 56ch; margin: 0 auto var(--sp-8); font-size: var(--fq-fs-lg); line-height: 1.8; color: var(--color-text-secondary); }

/* Search */
.fq-search { position: relative; max-width: 620px; margin: 0 auto; }
.fq-search__icon { position: absolute; top: 50%; inset-inline-start: var(--sp-5); width: 20px; height: 20px; transform: translateY(-50%); color: var(--color-text-muted); pointer-events: none; }
.fq-search__input {
  width: 100%;
  height: 60px;
  padding: 0 var(--sp-12);
  padding-inline-start: calc(var(--sp-5) + 20px + var(--sp-3));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  font-family: inherit; font-size: 1rem; color: var(--color-text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-base);
}
.fq-search__input::placeholder { color: var(--color-text-muted); }
.fq-search__input:focus { outline: none; border-color: var(--brand-gold); box-shadow: var(--shadow-lg), 0 0 0 4px rgba(var(--rgb-gold), 0.2); }
.fq-search__input::-webkit-search-cancel-button { display: none; }
.fq-search__clear {
  position: absolute; top: 50%; inset-inline-end: var(--sp-3); transform: translateY(-50%);
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: var(--color-background-alt); color: var(--color-text-secondary);
  cursor: pointer;
}
.fq-search__clear[hidden] { display: none; }
.fq-search__clear svg { width: 16px; height: 16px; }
.fq-kbd { position: absolute; top: 50%; inset-inline-end: var(--sp-5); transform: translateY(-50%); padding: 2px var(--sp-2); border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-size: var(--fq-fs-2xs); font-family: ui-monospace, monospace; color: var(--color-text-muted); pointer-events: none; }
.fq-search.has-value .fq-kbd { display: none; }
.fq-status { min-height: 1.5em; margin: var(--sp-4) 0 0; font-size: var(--fq-fs-sm); color: var(--color-text-secondary); }

/* ── Body ── */
.fq-body { padding: var(--sp-12) 0 var(--sp-20); background: var(--color-background); }
.fq-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--sp-10); align-items: start; }

.fq-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-5); }
.fq-count { margin: 0; font-size: var(--fq-fs-sm); font-weight: var(--fw-semibold); color: var(--color-text-secondary); }
.fq-toggle-all { min-height: 40px; padding: var(--sp-2) var(--sp-3); border: 0; border-radius: var(--radius-md); background: none; font-family: inherit; font-size: var(--fq-fs-sm); font-weight: var(--fw-semibold); color: var(--color-primary); cursor: pointer; }
.fq-toggle-all:hover { background: var(--color-primary-bg); }

.fq-list { display: grid; gap: var(--sp-3); margin: 0; padding: 0; list-style: none; counter-reset: fq; }
.fq-item[hidden] { display: none; }
.fq-card {
  counter-increment: fq;
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  scroll-margin-top: calc(var(--navbar-height) + var(--sp-6));
  transition: border-color 0.3s, box-shadow 0.3s;
}
.fq-card::before {
  content: '';
  position: absolute;
  inset-block: 0; inset-inline-start: 0;
  width: 3px;
  background: var(--brand-gold);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.4s var(--ease-out-soft);
}
.fq-card:hover { border-color: var(--color-border-strong); }
.fq-card.is-open { border-color: var(--fq-accent-border); box-shadow: var(--shadow-lg); }
.fq-card.is-open::before { transform: scaleY(1); }

.fq-q {
  display: flex; align-items: center; gap: var(--sp-4);
  width: 100%;
  padding: var(--sp-5) var(--sp-6);
  border: 0; background: none;
  font-family: inherit; text-align: start;
  color: var(--color-text);
  cursor: pointer;
}
.fq-q:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--brand-gold-dark); border-radius: var(--radius-xl); }
.fq-q::before {
  content: counter(fq, decimal-leading-zero);
  flex-shrink: 0;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  background: var(--color-background-alt);
  font-size: var(--fq-fs-xs); font-weight: var(--fw-bold); font-variant-numeric: tabular-nums;
  color: var(--color-text-secondary);
  transition: background 0.3s, color 0.3s;
}
.fq-card.is-open .fq-q::before { background: var(--brand-navy); color: var(--brand-gold-light); }
.fq-q__text { flex: 1; min-width: 0; font-size: 1rem; font-weight: var(--fw-semibold); line-height: 1.6; overflow-wrap: anywhere; }
.fq-q__text mark, .fq-a__text mark { background: rgba(var(--rgb-gold), 0.3); color: inherit; border-radius: 3px; padding: 0 2px; }

/* Plus that becomes a minus */
.fq-icon { position: relative; flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--color-primary-bg); transition: background 0.3s, transform 0.4s var(--ease-out-soft); }
.fq-icon::before, .fq-icon::after { content: ''; position: absolute; top: 50%; left: 50%; width: 12px; height: 2px; margin: -1px 0 0 -6px; border-radius: 2px; background: var(--color-primary); transition: transform 0.4s var(--ease-out-soft), background 0.3s; }
.fq-icon::after { transform: rotate(90deg); }
.fq-card.is-open .fq-icon { background: var(--brand-navy); transform: rotate(180deg); }
.fq-card.is-open .fq-icon::before, .fq-card.is-open .fq-icon::after { background: #fff; }
.fq-card.is-open .fq-icon::after { transform: rotate(0deg); }

/* Height animation without measuring */
.fq-a { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.4s var(--ease-out-soft); }
.fq-card.is-open .fq-a { grid-template-rows: 1fr; }
.no-js .fq-a { grid-template-rows: 1fr; }
.fq-a__inner { min-height: 0; overflow: hidden; }
.fq-a__body {
  padding: 0 var(--sp-6) var(--sp-6);
  padding-inline-start: calc(var(--sp-6) + 36px + var(--sp-4));
  opacity: 0; transform: translateY(-6px);
  transition: opacity 0.3s, transform 0.4s var(--ease-out-soft);
}
.fq-card.is-open .fq-a__body, .no-js .fq-a__body { opacity: 1; transform: none; transition-delay: 0.08s; }
.fq-a__text { margin: 0; font-size: 1rem; line-height: 1.9; color: var(--color-text-secondary); overflow-wrap: anywhere; white-space: pre-line; }
.fq-a__foot { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-5); }
.fq-owner-btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: 34px; padding: 0 var(--sp-3);
  border: 1px solid var(--color-border-light); border-radius: var(--radius-full);
  background: var(--color-surface);
  font-family: inherit; font-size: var(--fq-fs-xs); font-weight: var(--fw-semibold);
  color: var(--color-text-secondary); text-decoration: none; cursor: pointer;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}
.fq-owner-btn:hover { border-color: var(--color-border-strong); color: var(--color-primary); }
.fq-owner-btn--danger:hover { border-color: var(--color-error); color: var(--color-error); }
.fq-a__foot form { margin: 0; }

/* No match */
.fq-empty { padding: var(--sp-12) var(--sp-6); text-align: center; background: var(--color-surface); border: 1px dashed var(--color-border-strong); border-radius: var(--radius-xl); }
.fq-empty[hidden] { display: none; }
.fq-empty h2 { margin: 0 0 var(--sp-2); font-size: 1.25rem; color: var(--color-text); }
.fq-empty p { margin: 0 0 var(--sp-5); color: var(--color-text-secondary); }

/* ── Help card ── */
.fq-help {
  position: sticky;
  top: calc(var(--navbar-height) + var(--sp-6));
  display: grid;
  gap: var(--sp-4);
}
.fq-help__card {
  position: relative;
  padding: var(--sp-8) var(--sp-6);
  border-radius: var(--radius-2xl);
  background: linear-gradient(150deg, var(--brand-navy-darker), var(--brand-navy-dark) 55%, var(--brand-navy));
  color: #fff;
  overflow: hidden;
  isolation: isolate;
}
.fq-help__card::after { content: ''; position: absolute; z-index: -1; width: 260px; height: 260px; inset-inline-end: -90px; top: -110px; border-radius: 50%; background: radial-gradient(circle, rgba(var(--rgb-gold), 0.3), transparent 65%); }
.fq-help__icon { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; margin-bottom: var(--sp-5); border-radius: var(--radius-lg); background: rgba(255, 255, 255, 0.1); color: var(--brand-gold-light); }
.fq-help__icon svg { width: 24px; height: 24px; }
.fq-help__title { margin: 0 0 var(--sp-2); font-size: 1.25rem; font-weight: var(--fw-bold); color: #fff; }
.fq-help__desc { margin: 0 0 var(--sp-6); font-size: var(--fq-fs-sm); line-height: 1.8; color: rgba(255, 255, 255, 0.8); }
.fq-help__btn {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 48px; padding: 0 var(--sp-5);
  border-radius: var(--radius-full);
  font-weight: var(--fw-bold); font-size: var(--fq-fs-sm); text-decoration: none;
  transition: transform var(--transition-fast), box-shadow var(--transition-base), background var(--transition-fast);
}
.fq-help__btn--form { background: var(--gradient-gold); color: var(--brand-navy-darker); }
.fq-help__btn--form:hover { color: var(--brand-navy-darker); box-shadow: 0 10px 24px rgba(var(--rgb-gold), 0.45); transform: translateY(-1px); }
.fq-help__btn--ig { margin-top: var(--sp-2); border: 1px solid rgba(255, 255, 255, 0.25); color: #fff; }
.fq-help__btn--ig:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.fq-help__btn svg { width: 18px; height: 18px; }

.fq-links { padding: var(--sp-5) var(--sp-6); background: var(--color-surface); border: 1px solid var(--color-border-light); border-radius: var(--radius-2xl); }
.fq-links__title { margin: 0 0 var(--sp-2); font-size: var(--fq-fs-xs); font-weight: var(--fw-semibold); color: var(--color-text-muted); }
.fq-links ul { margin: 0; padding: 0; list-style: none; }
.fq-links li + li { border-top: 1px solid var(--color-border-light); }
.fq-links a { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: 44px; padding: var(--sp-2) 0; font-size: var(--fq-fs-sm); font-weight: var(--fw-medium); color: var(--color-text); text-decoration: none; }
.fq-links a:hover { color: var(--color-primary); }
.fq-arrow { width: 16px; height: 16px; color: var(--color-text-muted); transition: transform var(--transition-base), color var(--transition-base); }
[dir="rtl"] .fq-arrow { transform: scaleX(-1); }
.fq-links a:hover .fq-arrow { color: var(--color-primary); transform: translateX(3px); }
[dir="rtl"] .fq-links a:hover .fq-arrow { transform: scaleX(-1) translateX(3px); }

.fq-owner-add {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: 44px; margin-top: var(--sp-6); padding: 0 var(--sp-6);
  border-radius: var(--radius-full);
  background: var(--gradient-primary); color: var(--color-on-dark);
  font-weight: var(--fw-semibold); font-size: var(--fq-fs-sm); text-decoration: none;
}
.fq-owner-add:hover { color: var(--color-on-dark); box-shadow: var(--shadow-primary); }

@media (prefers-reduced-motion: reduce) {
  .fq-a, .fq-a__body, .fq-icon, .fq-icon::before, .fq-icon::after, .fq-card::before { transition: none; }
}

/* ── Tablet + phone ── */
@media (max-width: 960px) {
  .fq-layout { grid-template-columns: 1fr; }
  .fq-help { position: static; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .fq-hero { padding: var(--sp-10) 0 var(--sp-8); }
  .fq-hero__desc { font-size: 1rem; margin-bottom: var(--sp-6); }
  .fq-search__input { height: 54px; font-size: var(--fq-fs-sm); }
  .fq-kbd { display: none; }
  .fq-body { padding: var(--sp-6) 0 var(--sp-12); }
  .fq-help { grid-template-columns: 1fr; }
  .fq-q { padding: var(--sp-4); gap: var(--sp-3); }
  .fq-q::before { width: 30px; height: 30px; }
  .fq-q__text { font-size: var(--fq-fs-sm); }
  .fq-a__body { padding: 0 var(--sp-4) var(--sp-5); padding-inline-start: calc(var(--sp-4) + 30px + var(--sp-3)); }
  .fq-a__text { font-size: var(--fq-fs-sm); }
}
