/* =========================================================================
   Shared FAQ accordion + vertical scroll nav.

   Used by basic-callout, fifty-fifty-accordion, and faq-fifty-fifty blocks.
   When a FAQ list has more items than the max-visible threshold (default 5),
   the list sits inside a fixed-height viewport with a vertical progress bar
   and up/down arrows on the right side.
   ========================================================================= */

/* Container */
.vio-faqs {
  --vio-faqs-q-bg: var(--wp--preset--color--vio-alabaster, #F2F0E6);
  margin-top: 32px;
  min-width: 0;
}

/* Section bg auto-contrast */
.vio-bg--vio-mtn-greige .vio-faqs { --vio-faqs-q-bg: var(--wp--preset--color--vio-lotion, #FEFFF9); }
.vio-bg--vio-lotion     .vio-faqs { --vio-faqs-q-bg: var(--wp--preset--color--vio-mtn-greige, #E9E3DC); }

.vio-faqs__list,
.vio-faqs__item,
.vio-faqs__a {
  min-width: 0;
}

/* Answer panel must collapse when [hidden]. */
.vio-faqs__a[hidden] {
  display: none !important;
}

.vio-faqs__a,
.vio-faqs__q-text {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Title */
.vio-faqs__title {
  margin: 0 0 24px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--wp--preset--color--vio-ink, #030303);
}

/* List */
.vio-faqs__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vio-faqs__item {
  margin: 0;
}

/* Question button */
.vio-faqs__q {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: var(--vio-faqs-q-bg);
  border: 0;
  border-radius: 0;
  cursor: pointer;
  font: inherit;
  font-size: 18px;
  line-height: 1.4;
  color: var(--wp--preset--color--vio-ink, #030303);
  text-align: left;
}

.vio-faqs__q:focus-visible {
  outline: 2px solid var(--wp--preset--color--vio-ink, #030303);
  outline-offset: 2px;
}

.vio-faqs__sparkle {
  flex-shrink: 0;
  color: var(--wp--preset--color--vio-mouse, #B29D92);
}

.vio-faqs__q-text {
  flex: 1 1 auto;
  min-width: 0;
}

/* Chevron toggle (plus/minus rendered via ::before) */
.vio-faqs__pm {
  flex-shrink: 0;
  color: var(--wp--preset--color--vio-ink, #030303);
  position: relative;
  display: inline-block;
  width: 12px;
  height: 12px;
  background: transparent;
  border: 0;
  outline: 0;
  box-shadow: none;
}

.vio-faqs__pm::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translate(-50%, -65%) rotate(45deg);
  transition: transform 0.22s ease;
}

.vio-faqs__pm::after {
  display: none;
}

.vio-faqs__q[aria-expanded="true"] .vio-faqs__pm::before {
  transform: translate(-50%, -35%) rotate(-135deg);
}

.vio-faqs__q[aria-expanded="true"] .vio-faqs__q-text {
  font-weight: 600;
}

/* Answer panel */
.vio-faqs__a {
  padding: 0 16px 18px;
  font-size: 18px;
  line-height: 1.6;
  color: var(--wp--preset--color--vio-ink, #030303);
  background: var(--vio-faqs-q-bg);
}

.vio-faqs__a p {
  margin: 0 0 0.75em;
}

.vio-faqs__a p:last-child {
  margin-bottom: 0;
}


/* =========================================================================
   Vertical scroll nav.

   Layout: FAQ list on the left, narrow nav column on the right.
   Nav column stacks: up arrow, vertical track (flex-grows), down arrow.
   ========================================================================= */

.vio-faqs__scroll-wrap {
  display: flex;
  gap: 20px;
  align-items: stretch;
}

/* Viewport: fixed height set by JS after measuring max-visible items.
   overflow-y: scroll is set by JS once measured so the SSR layout
   renders all items before JS hydrates. */
.vio-faqs__viewport {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  /* Smooth scroll for programmatic scrollTo/scrollBy calls. */
  scroll-behavior: smooth;
  /* Hide native scrollbar (Firefox). Webkit handled below. */
  scrollbar-width: none;
}

/* Hide native scrollbar (Webkit/Blink). */
.vio-faqs__viewport::-webkit-scrollbar {
  display: none;
}

/* Nav column */
.vio-faqs__scrollnav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 4px 0;
}

/* Arrow buttons - match the google-reviews / providers carousel circles */
.vio-faqs__arrow {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: rgba(0, 0, 0, 0.45);
  opacity: 0.85;
  transition: opacity 0.18s ease;
}

.vio-faqs__arrow:hover {
  opacity: 1;
}

.vio-faqs__arrow[disabled] {
  opacity: 0.3;
  pointer-events: none;
  cursor: default;
}

.vio-faqs__arrow svg {
  width: 36px;
  height: 36px;
  display: block;
}

/* Vertical progress track */
.vio-faqs__track {
  /* flex-basis: 0 (not auto) so the track's min-height doesn't anchor
     its initial size at 40px. With `auto`, the initial main-axis size
     resolves to the min-height value, and in some layouts flex-grow
     doesn't manage to distribute the remaining space — the track
     stays at 40px while the scrollnav above and below it is much
     taller. `0` forces the track to start at zero and grow into all
     remaining space in the scrollnav column. */
  flex: 1 1 0;
  width: 4px;
  min-height: 40px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.12);
  position: relative;
}

/* Progress thumb */
.vio-faqs__thumb {
  position: absolute;
  left: 0;
  width: 100%;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  transition: top 0.25s ease, height 0.25s ease;
  min-height: 16px;
}

/* Dark background variants */
.vio-bg--vio-ink .vio-faqs__arrow {
  color: rgba(255, 255, 255, 0.55);
}

.vio-bg--vio-ink .vio-faqs__track {
  background: rgba(255, 255, 255, 0.18);
}

.vio-bg--vio-ink .vio-faqs__thumb {
  background: rgba(255, 255, 255, 0.75);
}

/* Mobile: hide the visual scrollnav (no up/down arrows or thumb), but
   KEEP the viewport's max-height cap so only ~5 FAQs are visible at a
   time. The user touch-swipes inside the viewport to reveal the rest.
   Previously this block removed the max-height entirely, so all 12
   FAQs rendered full-height with no internal scroll. */
@media (max-width: 767px) {
  .vio-faqs__scrollnav {
    display: none;
  }
  .vio-faqs__viewport {
    /* Allow touch momentum scrolling on iOS. */
    -webkit-overflow-scrolling: touch;
    /* Belt-and-suspenders: hide any UA scrollbar in case the touch
       device exposes one. The viewport already sets scrollbar-width:
       none (Firefox) and ::-webkit-scrollbar display:none (Safari/
       Chrome), but reasserting here makes the mobile intent explicit. */
    scrollbar-width: none;
  }
  .vio-faqs__scroll-wrap {
    display: block;
  }
}
