/*
 * /faqs redesign (PAWC-346), from the Figma "FAQ" frame: a 280px side column (search,
 * categories, help card) next to a 764px column of question sections, 1100px in all.
 *
 * Everything is scoped under .faq-page: .customfaq-button and .accordion-button::after are
 * global (style.css) and this page must not restyle them anywhere else. Breakpoints follow
 * style.css (768 / 992).
 */

.faq-page {
  --faq-heading: #111827;
  --faq-text: #4b5875;
  --faq-muted: #6b7280;
  --faq-green: var(--bg-base-green, #10393e);
  --faq-sage: var(--button-primary-bg, #5c7a5a);
  --faq-sage-hover: var(--button-primary-bg-hover, #5a7458);
  --faq-sage-text: #43593f;
  --faq-surface-active: #e8eee7;
  --faq-border: #e1e6e0;
  --faq-radius: 12px;
  /* Height of the fixed .modern-navbar (style.css) plus a little air, so a section or question
     reached from the nav or a link doesn't land under it. Update if the navbar's height changes. */
  --faq-anchor-offset: 96px;

  padding: 96px 40px;
}

/* body { overflow: auto } (style.css) with html { overflow-x: hidden } (main.css) makes <body>
   a scroll container that never scrolls, and position: sticky sticks to the nearest scroll
   container - so the side column would never stick. On this page only, let the viewport
   scroll instead; html still clips horizontal overflow. */
body:has(.faq-page) {
  overflow: visible;
}

.faq-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 764px);
  justify-content: space-between;
  align-items: start;
  column-gap: 56px;
  max-width: 1100px;
  margin-inline: auto;
}

/* ---------- Side column ---------- */

.faq-aside {
  position: sticky;
  top: var(--faq-anchor-offset);
  /* Search + 7 categories + the help card is ~650px: on a short screen the column scrolls on
     its own so "Contact Us" stays reachable. */
  max-height: calc(100vh - var(--faq-anchor-offset) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  /* Room for the focus rings of the search box and links, which overflow clipping would cut. */
  margin-inline: -4px;
  padding: 4px;
}

.faq-search {
  position: relative;
  margin-bottom: 28px;
}

.faq-search[hidden] {
  display: none;
}

.faq-search-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  color: var(--faq-muted);
  pointer-events: none;
}

.faq-search-input {
  width: 100%;
  height: 46px;
  padding: 0 14px 0 40px;
  border: 1px solid var(--faq-border);
  border-radius: 10px;
  background: #fff;
  color: var(--faq-heading);
  font-size: 14px;
}

.faq-search-input::placeholder {
  color: var(--faq-muted);
}

.faq-search-input:focus-visible {
  outline: 2px solid var(--faq-green);
  outline-offset: 1px;
  border-color: transparent;
}

.faq-categories-title {
  margin: 0 0 10px;
  color: var(--faq-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.faq-categories-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.faq-category-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 37px;
  padding: 8px 12px;
  border-left: 2px solid transparent;
  border-radius: 8px;
  color: var(--faq-text);
  font-size: 14px;
  line-height: 18px;
  text-decoration: none;
}

.faq-category-link:hover {
  color: var(--faq-heading);
  background: rgba(232, 238, 231, 0.6);
}

.faq-category-link.is-active {
  border-left-color: var(--faq-sage);
  border-radius: 0 8px 8px 0;
  background: var(--faq-surface-active);
  color: var(--faq-heading);
  font-weight: 500;
}

.faq-category-link:focus-visible {
  outline: 2px solid var(--faq-green);
  outline-offset: -2px;
}

.faq-category-count {
  color: var(--faq-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* A category the current search leaves empty: still listed, so the nav doesn't jump around. */
.faq-category-link.is-empty {
  opacity: 0.45;
  cursor: default;
}

.faq-category-link.is-empty:hover {
  background: none;
  color: var(--faq-text);
}

.faq-help-card {
  margin-top: 28px;
  padding: 20px;
  border-radius: var(--faq-radius);
  background: var(--faq-green);
  color: rgba(255, 255, 255, 0.8);
}

.faq-help-title {
  margin: 0 0 6px;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  line-height: 20px;
}

.faq-help-text {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 19px;
}

/* Underlined: inside running text, color alone doesn't mark it as a link. */
.faq-help-text a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.faq-help-text a:hover {
  text-decoration-thickness: 2px;
}

.faq-help-button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 20px;
  border-radius: 999px;
  background: var(--faq-sage);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.faq-help-button:hover {
  background: var(--faq-sage-hover);
  color: #fff;
}

.faq-help-button:focus-visible,
.faq-help-text a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ---------- Question sections ---------- */

.faq-category {
  scroll-margin-top: var(--faq-anchor-offset);
}

.faq-category + .faq-category {
  margin-top: 72px;
}

.faq-category[hidden] {
  display: none;
}

.faq-category-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.faq-category-heading {
  /* The Figma heading box: "Therapy & Psychiatry Appointments FAQs" fits on one line, the two
     longest headings wrap before their last words. */
  max-width: 620px;
  margin: 0;
  color: var(--faq-heading);
  font-size: 32px;
  font-weight: 500;
  line-height: 40px;
  letter-spacing: -0.3px;
}

.faq-category-heading:focus {
  outline: none;
}

.faq-category-heading:focus-visible {
  outline: 2px solid var(--faq-green);
  outline-offset: 4px;
}

.faq-expand-all {
  flex-shrink: 0;
  padding: 4px 0;
  border: 0;
  background: none;
  /* Not the Figma sage: at 12px it fails WCAG AA contrast on the page background. */
  color: var(--faq-sage-text);
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  white-space: nowrap;
}

.faq-expand-all:hover {
  color: var(--faq-green);
  text-decoration: underline;
}

.faq-expand-all:focus-visible {
  outline: 2px solid var(--faq-green);
  outline-offset: 2px;
  border-radius: 4px;
}

.faq-expand-all[hidden] {
  display: none;
}

/* .customfaq-button gives the list its global 20px bottom margin; the sections space themselves. */
.faq-page .faq-list.customfaq-button {
  margin-bottom: 0;
}

.faq-page .faq-item {
  scroll-margin-top: var(--faq-anchor-offset);
  border: 1px solid transparent;
  border-radius: var(--faq-radius);
  background: #fff;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.faq-page .faq-item + .faq-item {
  margin-top: 12px;
}

.faq-page .faq-item[hidden] {
  display: none;
}

.faq-page .faq-item:has(.accordion-button:not(.collapsed)) {
  border-color: var(--faq-border);
  box-shadow: 0 4px 16px rgba(17, 24, 39, 0.06);
}

.faq-page .faq-list.customfaq-button button.accordion-button,
.faq-page .faq-list.customfaq-button button.accordion-button.collapsed {
  gap: 16px;
  padding: 22px 22px;
  border-radius: var(--faq-radius) !important;
  background: transparent;
  color: var(--faq-heading);
  font-size: 15px;
  font-weight: 500;
  line-height: 20px;
}

.faq-page .faq-list.customfaq-button button.accordion-button::after {
  width: 18px;
  height: 18px;
  margin-left: auto;
  background-size: 18px 18px;
}

/* .customfaq-button (style.css) removes Bootstrap's focus shadow; give keyboard users a ring back. */
.faq-page .faq-list.customfaq-button button.accordion-button:focus-visible {
  outline: 2px solid var(--faq-green);
  outline-offset: -2px;
}

.faq-page .faq-list.customfaq-button .accordion-body {
  padding: 0 22px 22px;
  color: var(--faq-text);
  font-size: 14px;
  line-height: 23px;
}

.faq-page .faq-list .accordion-body p {
  margin: 0 0 12px;
}

.faq-page .faq-list .accordion-body p:last-child,
.faq-page .faq-list .accordion-body ul:last-child,
.faq-page .faq-list .accordion-body ol:last-child {
  margin-bottom: 0;
}

.faq-page .faq-list .accordion-body ul,
.faq-page .faq-list .accordion-body ol {
  margin: 0 0 12px;
  padding-left: 20px;
}

.faq-page .faq-list .accordion-body a {
  color: var(--faq-green);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.faq-empty {
  padding: 40px 24px;
  border-radius: var(--faq-radius);
  background: #fff;
  text-align: center;
}

.faq-empty[hidden] {
  display: none;
}

.faq-empty-title {
  margin: 0 0 6px;
  color: var(--faq-heading);
  font-size: 16px;
  font-weight: 500;
}

.faq-empty-text {
  margin: 0;
  color: var(--faq-text);
  font-size: 14px;
}

.faq-empty-text a {
  color: var(--faq-green);
  font-weight: 500;
}

/* ---------- Tablet and phone: one column (the Figma frame is desktop only) ---------- */

@media (max-width: 991.98px) {
  .faq-page {
    padding: 60px 20px;
  }

  .faq-layout {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 40px;
  }

  .faq-aside {
    position: static;
    max-height: none;
    overflow: visible;
    margin-inline: 0;
    padding: 0;
  }

  .faq-search {
    margin-bottom: 20px;
  }

  .faq-categories-title {
    margin-bottom: 8px;
  }

  /* Categories become a row of chips that scrolls sideways. */
  .faq-categories-list {
    display: flex;
    gap: 8px;
    margin-inline: -20px;
    padding: 2px 20px 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .faq-categories-list::-webkit-scrollbar {
    display: none;
  }

  .faq-category-link,
  .faq-category-link.is-active {
    border: 1px solid var(--faq-border);
    border-radius: 999px;
    background: #fff;
    white-space: nowrap;
  }

  .faq-category-link.is-active {
    border-color: var(--faq-sage);
    background: var(--faq-surface-active);
  }

  .faq-help-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    margin-top: 20px;
  }

  .faq-help-card .faq-help-text {
    margin-bottom: 0;
  }

  .faq-category + .faq-category {
    margin-top: 56px;
  }

  .faq-category-heading {
    font-size: 28px;
    line-height: 36px;
  }
}

@media (max-width: 767.98px) {
  .faq-page {
    padding: 48px 16px;
  }

  .faq-categories-list {
    margin-inline: -16px;
    padding-inline: 16px;
  }

  .faq-category-header {
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 16px;
  }

  .faq-category-heading {
    font-size: 24px;
    line-height: 32px;
  }

  .faq-page .faq-list.customfaq-button button.accordion-button,
  .faq-page .faq-list.customfaq-button button.accordion-button.collapsed {
    padding: 18px;
  }

  .faq-page .faq-list.customfaq-button .accordion-body {
    padding: 0 18px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .faq-page .faq-item {
    transition: none;
  }
}
