/**
 * FAQ V2
 * Title + search + vertical category rail + searchable accordion with
 * per-answer social share bar. Matches the Wix "Questions Customers Ask".
 */

/* Teko metric-matched fallback (@font-face + --aew-teko) lives in aew-tokens,
   loaded on every page as this widget's style dependency. */
.aew-faqv2 {
  --aew-faqv2-teko: var(--aew-teko, 'Teko', sans-serif);
}

/* Strip Elementor container padding + force full-bleed so the band spans the
   viewport. The widget's own .aew-faqv2__inner re-applies the 1440px cap. */
.elementor-column
  > .elementor-element-populated:has(.elementor-widget-agency-faq-v2),
.e-con:has(> .e-con-inner > .elementor-widget-agency-faq-v2),
.e-con:has(.elementor-widget-agency-faq-v2) {
  --padding-top: 0px;
  --padding-right: 0px;
  --padding-bottom: 0px;
  --padding-left: 0px;
  padding: 0 !important;
}

.elementor-section:has(.elementor-widget-agency-faq-v2),
.elementor-section:has(.elementor-widget-agency-faq-v2) > .elementor-container,
.e-con:has(.elementor-widget-agency-faq-v2) {
  max-width: 100% !important;
  width: 100% !important;
}

/* ── Brand tokens ────────────────────────────────────────────────────────── */
/* Scoped to .aew-faqv2 so they don't leak. Source of truth is design-system.md.
   Update there first; copy here second. */
.aew-faqv2 {
  --aew-cards:             var(--e-global-color-aew-cards, #FFFFFF);
  --aew-background:        var(--e-global-color-aew-background, #F4F4F4);
  --aew-lines:             var(--e-global-color-aew-lines, #DDDDDD);
  --aew-misc-accent:       var(--e-global-color-aew-misc-accent, #666666);
  --aew-secondary-cards:   var(--e-global-color-aew-secondary-cards, #EEEEEE);
  --aew-secondary-bg:      var(--e-global-color-aew-secondary-bg, #333333);
  --aew-secondary-accent:  var(--e-global-color-aew-secondary-accent, #555555);
  --aew-text:              var(--e-global-color-aew-text, #1A1A1A);
  --aew-cta:               var(--e-global-color-aew-cta, #444444);
  --aew-cta-hover:         var(--e-global-color-aew-cta-hover, #2B2B2B);
}

/* ── Outer block ─────────────────────────────────────────────────────────── */
/* Design-system width model: X gutter on the outer block; inner caps at 1440. */
.aew-faqv2 {
  background: var(--aew-faqv2-body-bg, var(--aew-background));
  width: 100%;
  position: relative;
  padding-left: 40px;
  padding-right: 40px;
}

.aew-faqv2 *,
.aew-faqv2 *::before,
.aew-faqv2 *::after {
  box-sizing: border-box;
}

/* ── Inner wrapper: true 1440 content cap; owns Y padding only ───────────── */
.aew-faqv2__inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 64px 0;            /* banded widget: section Y */
}

/* ── Inner shell ─────────────────────────────────────────────────────────── */
/* Wraps the whole FAQ (header + layout) so it can have its own background +
   rounded corners, distinct from the outer full-bleed band AND from the
   per-answer .aew-faqv2__panel regions. Default: transparent, no radius. */
.aew-faqv2__shell {
  background-color: var(--aew-faqv2-panel-bg, transparent);
}

@media (max-width: 1024px) {
  /* tablet: inner padding inherited (Y64 desktop / X40 outer) */
}
@media (max-width: 768px) {
  .aew-faqv2 { padding-left: 16px; padding-right: 16px; }
  .aew-faqv2__inner { padding: 32px 0; }
}

/* ── Header (title + search) ─────────────────────────────────────────────── */
.aew-faqv2__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

/* (0,2,0) beats the kit's .elementor-kit-N h1..h6 (0,1,1) — gotcha #20 */
.aew-faqv2 .aew-faqv2__title {
  margin: 0;
  color: var(--aew-faqv2-title, var(--aew-secondary-bg));
  font-family: var(--aew-faqv2-teko);
  font-weight: 600;
  font-size: 40px;
  line-height: 85%;
  text-transform: uppercase;
}

/* ── Search ──────────────────────────────────────────────────────────────── */
.aew-faqv2__search {
  position: relative;
  min-width: 260px;
  max-width: 320px;
  flex: 0 1 auto;
}

/* Wrapper-prefixed + explicit border sides so Elementor's kit input styles
   (which set a grey all-around border) don't win. */
.aew-faqv2 input.aew-faqv2__search-input {
  width: 100%;
  border-top: 0 !important;
  border-left: 0 !important;
  border-right: 0 !important;
  border-bottom: 1px solid var(--aew-faqv2-search-border, var(--aew-lines)) !important;
  border-radius: 0 !important;
  background: transparent !important;
  padding: 8px 28px 8px 0;
  font-family: 'Lato', sans-serif;
  font-size: 15px;
  color: var(--aew-faqv2-search-text, var(--aew-text));
  outline: none;
  box-shadow: none !important;
}

.aew-faqv2__search-input::placeholder {
  color: var(--aew-faqv2-search-text, var(--aew-text));
  opacity: .6;
}

.aew-faqv2__search-input:focus {
  border-bottom-color: var(--aew-cta);
}

.aew-faqv2__search-icon {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  pointer-events: none;
  color: var(--aew-faqv2-search-text, var(--aew-text));
  opacity: .7;
}

/* ── Layout: rail + main ─────────────────────────────────────────────────── */
.aew-faqv2__layout {
  display: block;
}

.aew-faqv2--has-sidebar .aew-faqv2__layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 48px;
  align-items: start;
}

/* ── Category rail ───────────────────────────────────────────────────────── */
.aew-faqv2__rail {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 4px;
}

/* Reset Elementor button bleed (gotcha #2) */
button.aew-faqv2__cat,
button.aew-faqv2__trigger,
button.aew-faqv2__share-btn {
  border: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}

/* Wrapper-prefixed for specificity — Elementor's kit sets a color on <button>
   that otherwise beats a single-class rule (same trap as the heading gotcha). */
.aew-faqv2 button.aew-faqv2__cat {
  text-align: left;
  cursor: pointer;
  padding: 0;
  margin: 0;
  font-family: var(--aew-faqv2-teko);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--aew-faqv2-cat, var(--aew-secondary-bg));
  line-height: 1.2;
  transition: color .15s ease;
}

.aew-faqv2 button.aew-faqv2__cat:hover {
  color: var(--aew-faqv2-cat-active, var(--aew-cta));
}

.aew-faqv2 button.aew-faqv2__cat.is-active {
  color: var(--aew-faqv2-cat-active, var(--aew-cta));
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ── Main column ─────────────────────────────────────────────────────────── */
.aew-faqv2__main {
  min-width: 0;
}

.aew-faqv2__noresults {
  margin: 0 0 12px;
  font-family: 'Lato', sans-serif;
  font-size: 16px;
  color: var(--aew-text);
  opacity: .8;
}

.aew-faqv2__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Question card ───────────────────────────────────────────────────────── */
.aew-faqv2__item {
  background: var(--aew-faqv2-card-bg, var(--aew-background));
  border: 1px solid var(--aew-faqv2-card-border, var(--aew-lines));
  border-radius: 8px;
  overflow: hidden;
}

.aew-faqv2__trigger {
  width: 100%;
  display: flex;
  align-items: flex-start;       /* icon stays top-aligned when text wraps */
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  text-align: left;
  padding: 24px 32px;
  margin: 0;
}

.aew-faqv2__question {
  margin: 0;
  flex: 1 1 auto;                 /* take remaining space and shrink to fit */
  min-width: 0;                   /* allow the flex item to wrap instead of overflow */
  white-space: normal;            /* override nowrap inherited from <button> */
  overflow-wrap: anywhere;        /* break very long words if needed */
  font-family: var(--aew-faqv2-teko);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: .5px;
  text-transform: uppercase;
  line-height: 1.2;
  color: var(--aew-faqv2-question, var(--aew-text));
}

.aew-faqv2__icon {
  flex: 0 0 auto;                 /* never shrink — the +/- always stays visible */
  display: inline-flex;
  margin-top: 1px;               /* optical align with first line of text */
  color: var(--aew-faqv2-icon, var(--aew-text));
}

.aew-faqv2__icon-minus { display: none; }
.aew-faqv2__item.is-open .aew-faqv2__icon-plus  { display: none; }
.aew-faqv2__item.is-open .aew-faqv2__icon-minus { display: inline; }

/* ── Answer panel (the open question's answer + share bar) ───────────────── */
.aew-faqv2__panel {
  padding: 20px;
}

.aew-faqv2__panel[hidden] { display: none; }

.aew-faqv2__answer {
  font-family: 'Lato', sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  color: var(--aew-faqv2-answer, var(--aew-text));
}

.aew-faqv2__answer p { margin: 0 0 1em; }
.aew-faqv2__answer p:last-child { margin-bottom: 0; }

.aew-faqv2__answer h3,
.aew-faqv2__answer h4 {
  font-family: var(--aew-faqv2-teko);
  font-weight: 600;
  margin: 1em 0 .35em;
  color: var(--aew-text);
}

.aew-faqv2__answer ul,
.aew-faqv2__answer ol {
  margin: 0 0 1em;
  padding-left: 1.4em;
}

.aew-faqv2__answer li { margin: 0 0 .25em; }
.aew-faqv2__answer a { color: var(--aew-cta); }
.aew-faqv2__answer a:hover { color: var(--aew-cta-hover); }

/* Inline CTA button inside an answer (e.g. "FREE CONSULTATION") */
.aew-faqv2__answer a.aew-faqv2__answer-btn {
  display: inline-block;
  margin-top: 4px;
  padding: 20px 24px 16px;
  background: var(--aew-cta);
  color: #FFFFFF;
  font-family: var(--aew-faqv2-teko);
  font-weight: 600;
  font-size: 18px;
  line-height: 85%;
  letter-spacing: .5px;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 8px;
  transition: background-color .15s ease;
}
.aew-faqv2__answer a.aew-faqv2__answer-btn:hover {
  background: var(--aew-cta-hover);
  color: #FFFFFF;
}

/* ── Share bar ───────────────────────────────────────────────────────────── */
.aew-faqv2__share {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

/* Wrapper-prefixed so the kit's `.elementor-kit-N button` padding (0,1,1)
   doesn't add space around the share icons. */
.aew-faqv2 .aew-faqv2__share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  padding: 0 !important;
  margin: 0;
  cursor: pointer;
  /* Editable via the "Share icon color" control (--aew-faqv2-share); falls back
     to the misc-accent token. !important beats the kit's button colour. */
  color: var(--aew-faqv2-share, var(--aew-misc-accent)) !important;
  opacity: .85;
  transition: opacity .15s ease, color .15s ease;
}

/* Wrapper-prefixed + !important so neither the base rule above nor the kit's
   `button:hover` (which flips it white) wins — hover goes brand-CTA gold. */
.aew-faqv2 .aew-faqv2__share-btn:hover,
.aew-faqv2 .aew-faqv2__share-btn:focus {
  opacity: 1;
  color: var(--aew-cta) !important;
}

.aew-faqv2 .aew-faqv2__share-btn svg { width: 20px; height: 20px; }

.aew-faqv2 .aew-faqv2__share-btn.is-copied {
  color: var(--aew-secondary-bg) !important;
  opacity: 1;
}

/* ── Search-hidden items ─────────────────────────────────────────────────── */
.aew-faqv2__item[hidden] { display: none; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .aew-faqv2--has-sidebar .aew-faqv2__layout {
    grid-template-columns: 210px 1fr;
    gap: 32px;
  }
}

@media (max-width: 768px) {
  .aew-faqv2--has-sidebar .aew-faqv2__layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  /* Rail becomes a horizontal scroller above the questions on mobile. */
  .aew-faqv2__rail {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 18px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .aew-faqv2__rail::-webkit-scrollbar { display: none; }
  .aew-faqv2__cat { white-space: nowrap; }

  .aew-faqv2__header { margin-bottom: 24px; }
  .aew-faqv2__search { min-width: 100%; max-width: 100%; }
  .aew-faqv2 .aew-faqv2__title { font-size: 24px; }
  .aew-faqv2__trigger { padding: 20px; }
  .aew-faqv2__panel { padding: 20px; }
  .aew-faqv2__answer { font-size: 14px; }
}
