/* FAQ page — grouped topics + search.
   Only the /faq page loads this; the shared accordion look lives in
   cdn/css/style.css (.faqAccordion) and is reused as-is here.

   Two layouts:
   - >=992px: sidebar of topic tabs, one group on screen at a time.
   - <=991px: no tabs at all — every group stacks under its own heading.

   --faq-scroll-offset clears the fixed site header when we scroll a group
   into view; assets/js/faq.js overwrites it with the measured height. */
:root {
  --faq-scroll-offset: 96px;
}

.faqPageHead {
  max-width: 720px;
  margin: 0 auto 40px;
  text-align: center;
}

.faqSearch {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 460px;
  margin: 24px auto 0;
}
.faqSearchIcon {
  position: absolute;
  left: 18px;
  color: var(--primary-sky-500);
  pointer-events: none;
}
.faqSearchInput {
  width: 100%;
  padding: 14px 44px 14px 46px;
  border: 1px solid var(--primary-sky-200);
  border-radius: 999px;
  background: var(--white);
  color: var(--primary-sky-900);
  font-family: var(--baseFont);
  /* 16px, not 15px: anything smaller makes iOS Safari zoom on focus. */
  font-size: 16px;
  line-height: 1.4;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}
.faqSearchInput::-webkit-search-cancel-button { display: none; }
.faqSearchInput::placeholder { color: var(--primary-sky-300); }
.faqSearchInput:focus {
  border-color: var(--secondary-orange-600-primary);
  box-shadow: 0 0 0 3px rgba(130, 150, 118, 0.15);
}
.faqSearchClear {
  position: absolute;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--primary-sky-100);
  color: var(--primary-sky-600);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.faqSearchClear:hover {
  background: var(--primary-sky-200);
  color: var(--primary-sky-900);
}

.faqPageBody {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
  align-items: start;
}

.faqSidebar { position: sticky; top: 24px; }

.faqTabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.faqTab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--primary-sky-600);
  font-family: var(--baseFont);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.faqTab:hover { background: var(--primary-sky-50); color: var(--primary-sky-900); }
.faqTab.is-active {
  background: var(--primary-sky-50);
  border-color: var(--primary-sky-200);
  color: var(--primary-sky-900);
}
.faqTab:focus-visible {
  outline: 2px solid var(--secondary-orange-600-primary);
  outline-offset: 2px;
}
.faqTabCount {
  flex: none;
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--primary-sky-100);
  color: var(--primary-sky-600);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.faqTab.is-active .faqTabCount {
  background: var(--secondary-orange-600-primary);
  color: var(--white);
}
/* Zero matches for the current search term. */
.faqTab.is-empty { opacity: 0.45; }

.faqHelpCard {
  margin-top: 28px;
  padding: 22px;
  border: 1px solid var(--primary-sky-200);
  border-radius: 16px;
  background: var(--primary-sky-25);
}
.faqHelpTitle {
  color: var(--primary-sky-900);
  font-size: 17px;
  font-weight: 600;
}
.faqHelpText {
  margin: 6px 0 16px;
  color: var(--primary-sky-500);
  font-size: 14px;
  line-height: 1.5;
}

.faqPanels { min-width: 0; }
/* Desktop tab state. Search misses use the hidden attribute instead, so the
   two never fight — see the max-width:991px block. */
.faqPanel.is-tab-hidden { display: none; }
.faqPanel { scroll-margin-top: var(--faq-scroll-offset); }

.faqPanelHead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.faqPanelTitle {
  margin: 0;
  color: var(--primary-sky-900);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.25;
}
.faqPanelMeta {
  flex: none;
  color: var(--primary-sky-300);
  font-size: 13px;
  font-weight: 600;
}

/* A search spans every group, so on desktop it also overrides the tab
   state — otherwise matches outside the open tab would stay invisible. */
.faqPanels.is-searching .faqPanel.is-tab-hidden:not([hidden]) { display: block; }

/* During a search the panel headers become section labels across all
   groups, so keep them visible but quieter. */
.faqPanels.is-searching .faqPanelTitle { font-size: 20px; }
.faqPanels.is-searching .faqPanelHead { margin-top: 24px; }
.faqPanels.is-searching .faqPanel:first-child .faqPanelHead { margin-top: 0; }

.faqAccordion .accordion-item[hidden] { display: none; }
/* Long questions wrap under the +/- glyph instead of squashing it. */
.faqAccordion .accordion-button {
  align-items: flex-start;
  text-align: left;
  overflow-wrap: anywhere;
}
.faqAccordion .accordion-button::after {
  flex: none;
  margin-top: 6px;
}
/* Answers are cms html — keep wide content inside the column. */
.faqAccordion .accordion-body { overflow-wrap: anywhere; }
.faqAccordion .accordion-body img { max-width: 100%; height: auto; }
.faqAccordion .accordion-body table { width: 100%; display: block; overflow-x: auto; }

.faqAccordion mark {
  padding: 0 1px;
  border-radius: 3px;
  background: rgba(130, 150, 118, 0.22);
  color: inherit;
}

.faqNoResults {
  margin: 32px 0 0;
  padding: 28px;
  border: 1px dashed var(--primary-sky-200);
  border-radius: 16px;
  color: var(--primary-sky-500);
  text-align: center;
}
.faqNoResults a { color: var(--secondary-orange-700); }

/* Tablet landscape — keep the two columns, tighten them. */
@media (max-width: 1199px) {
  .faqPageBody {
    grid-template-columns: 240px 1fr;
    gap: 28px;
  }
  .faqTab { padding: 11px 14px; font-size: 14px; }
  .faqPanelTitle { font-size: 24px; }
}

/* Tablet portrait and below — no tabs. Every group stacks in one column
   under its own heading, and the help card drops to the bottom. */
@media (max-width: 991px) {
  .faqPageBody {
    display: flex;
    flex-direction: column;
    /* Must be restated: the desktop grid sets align-items:start, which in a
       column flex box shrink-wraps every child instead of filling the row. */
    align-items: stretch;
    gap: 0;
  }

  /* Tabs are the desktop-only affordance; the headings do the wayfinding
     here. The aside collapses so its help card can be ordered independently
     of the answers — which needs flex, not block. */
  .faqSidebar {
    display: contents;
    position: static;
  }
  .faqTabs {
    display: none;
  }

  .faqPanels { order: 1; }
  .faqHelpCard { order: 2; }

  /* Undo the tab state — only a search miss may hide a group now. */
  .faqPanel.is-tab-hidden:not([hidden]) {
    display: block;
  }

  .faqPanel + .faqPanel {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--primary-sky-100);
  }
  /* A search can hide any group, and css can't tell which one is the first
     still-visible sibling — so drop the rule and let spacing separate them. */
  .faqPanels.is-searching .faqPanel + .faqPanel {
    padding-top: 0;
    border-top: 0;
  }

  /* Headings carry the grouping now, so give them more presence. */
  .faqPanelHead {
    margin-bottom: 12px;
  }
  .faqPanelTitle {
    font-size: 22px;
  }
  .faqPanels.is-searching .faqPanelTitle {
    font-size: 20px;
  }
  .faqPanels.is-searching .faqPanelHead {
    margin-top: 0;
  }

  .faqHelpCard {
    margin-top: 44px;
  }
}

@media (max-width: 767px) {
  .faqPageHead { margin-bottom: 28px; }
  .faqSearch { margin-top: 20px; }
  .faqPanel + .faqPanel { margin-top: 32px; padding-top: 26px; }
  .faqPanelTitle { font-size: 20px; }
  .faqPanels.is-searching .faqPanelTitle { font-size: 18px; }
  .faqHelpCard { padding: 20px 18px; }
  .faqNoResults { padding: 24px 18px; }
}

@media (max-width: 575px) {
  .faqPanelHead {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .faqSearchInput { padding: 13px 42px 13px 42px; }
  .faqSearchIcon { left: 15px; }
  /* Comfortable thumb targets on the questions themselves. */
  .faqAccordion .accordion-button {
    padding-top: 18px;
    padding-bottom: 18px;
    font-size: 17px;
    gap: 12px;
  }
  .faqAccordion .accordion-body {
    padding-bottom: 20px;
    font-size: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .faqTab,
  .faqSearchInput,
  .faqSearchClear {
    transition: none;
  }
}
