/* FAQ on the Save Now Pay Later page (snpl-faq.php).
   - The "View all FAQs" row under "Every objection, answered".
   - The popup: it uses .review-dialog for the flip animation and backdrop (css/snpl-1.css);
     here it gets its own size. Category tabs on top, the questions as an accordion below;
     only the question list scrolls, never the page behind (html.faq-open).
   Colours come from css/snpl-1.css (:root). */

/* ---------- "View all FAQs" row ---------- */
.faq-more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 20px;
  margin-top: 28px;
  text-align: center;
}

.faq-more__text {
  margin: 0;
  color: var(--navy);
  font-size: 16px;
  font-weight: 600;
}

.faq-more__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 22px;
  border: 2px solid var(--blue);
  background: var(--snpl-white);
  color: var(--blue);
  font: 700 15px/1 "Manrope", Arial, sans-serif;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.faq-more__btn:hover {
  background: var(--blue);
  color: var(--snpl-white);
}

.faq-more__btn:focus-visible {
  outline: 3px solid var(--snpl-focus);
  outline-offset: 2px;
}

/* ---------- Popup ---------- */
html.faq-open {
  overflow: hidden;
}

.faq-dialog {
  width: min(960px, calc(100vw - 32px));
  height: min(680px, calc(100vh - 48px));
  max-width: none;
  max-height: none;
  overflow: hidden;
  background: var(--snpl-white);
}

.faq-dialog__inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  font-family: "Manrope", Arial, sans-serif;
  color: var(--snpl-text);
}

.faq-dialog__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 32px 40px 0;
}

.faq-dialog__head .dialog-close {
  position: static;
  flex: none;
  margin: -18px -26px 0 0;
}

.faq-dialog__title {
  margin: 0;
  color: var(--snpl-heading);
  font-size: 32px;
  font-weight: 800;
  line-height: 1.15;
}

.faq-dialog__title:focus {
  outline: none;
}

.faq-dialog__sub {
  margin: 8px 0 0;
  color: var(--snpl-slate);
  font-size: 15px;
  line-height: 1.5;
}

.faq-dialog__count {
  margin-left: 6px;
  color: var(--snpl-note);
  font-weight: 700;
  white-space: nowrap;
}

/* Category tabs */
.faq-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 20px 40px 16px;
}

.faq-tab {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--snpl-blue-muted);
  background: var(--snpl-white);
  color: var(--blue);
  font: 700 14px/1 "Manrope", Arial, sans-serif;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.faq-tab:hover {
  background: var(--pale-blue);
}

.faq-tab[aria-selected="true"] {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--snpl-white);
}

.faq-tab:focus-visible {
  outline: 3px solid var(--snpl-focus);
  outline-offset: 2px;
}

.faq-tab__count {
  opacity: 0.7;
}

/* The question list: the only part that scrolls */
.faq-panels {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 40px 32px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-top: 1px solid var(--line);
}

/* Thin scrollbar in the page's blues: Chrome, Edge, Safari (no arrow buttons) */
.faq-panels::-webkit-scrollbar {
  width: 6px;
}

.faq-panels::-webkit-scrollbar-track {
  background: var(--pale-blue);
  border-radius: 3px;
}

.faq-panels::-webkit-scrollbar-thumb {
  background: var(--snpl-blue-muted);
  border-radius: 3px;
}

.faq-panels::-webkit-scrollbar-thumb:hover {
  background: var(--blue);
}

.faq-panels::-webkit-scrollbar-button {
  display: none;
}

/* Firefox (it has no ::-webkit-scrollbar; setting these in Chrome would switch the rules above off) */
@supports not selector(::-webkit-scrollbar) {
  .faq-panels {
    scrollbar-width: thin;
    scrollbar-color: var(--snpl-blue-muted) var(--pale-blue);
  }
}

.faq-item {
  border-bottom: 1px solid var(--line);
}

.faq-item__heading {
  margin: 0;
}

.faq-item__btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 62px;
  padding: 16px 4px;
  border: 0;
  background: transparent;
  color: var(--navy);
  font: 700 18px/1.35 "Manrope", Arial, sans-serif;
  text-align: left;
  cursor: pointer;
}

.faq-item__btn:hover {
  color: var(--blue);
}

.faq-item__btn:focus-visible {
  outline: 3px solid var(--snpl-focus);
  outline-offset: -3px;
}

/* Plus / minus in a square */
.faq-item__icon {
  position: relative;
  flex: none;
  width: 32px;
  height: 32px;
  background: var(--pale-blue);
  color: var(--blue);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.faq-item__icon::before,
.faq-item__icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 2.5px;
  margin: -1.25px 0 0 -7px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.2s ease;
}

.faq-item__icon::after {
  transform: rotate(90deg);
}

.faq-item__btn[aria-expanded="true"] .faq-item__icon {
  background: var(--blue);
  color: var(--snpl-white);
}

.faq-item__btn[aria-expanded="true"] .faq-item__icon::after {
  transform: rotate(0deg);
}

.faq-item__answer {
  padding: 0 56px 20px 4px;
  font-size: 16px;
  line-height: 1.6;
  animation: faq-answer-in 0.25s ease both;
}

.faq-item__answer p {
  margin: 0 0 10px;
}

.faq-item__answer p:last-child {
  margin-bottom: 0;
}

.faq-item__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 24px;
  margin: 0 0 10px;
  padding-left: 22px;
}

/* "savings calculator" in an answer opens the FinOps calculator */
.faq-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.faq-link:hover {
  color: var(--snpl-blue-hover);
}

.faq-link:focus-visible {
  outline: 3px solid var(--snpl-focus);
  outline-offset: 2px;
}

@keyframes faq-answer-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Phones: full screen, tabs in one swipeable row ---------- */
@media (max-width: 600px) {
  .faq-dialog {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    margin: 0;
  }

  .faq-dialog__head {
    padding: 24px 20px 0;
  }

  .faq-dialog__head .dialog-close {
    margin: -14px -10px 0 0;
  }

  .faq-dialog__title {
    font-size: 24px;
  }

  .faq-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 16px 20px 12px;
    scrollbar-width: none;
  }

  .faq-tabs::-webkit-scrollbar {
    display: none;
  }

  .faq-panels {
    margin: 0 20px 20px;
  }

  .faq-item__btn {
    font-size: 16px;
  }

  .faq-item__answer {
    padding-right: 4px;
    font-size: 15px;
  }

  .faq-item__list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .faq-item__answer {
    animation: none;
  }
}
