/* =========================================================
   Shared FAQ section — every page except the FAQ page
   ---------------------------------------------------------
   Markup: template-parts/sections/faq-panel.php
   Behaviour: initFaqSections() in assets/js/main.js

   • The image and the grey question panel share ONE locked height,
     so opening/closing a question never resizes the image.
   • That height fits the panel's resting content (first answer open),
     measured by JS, between --tf-min-height and --tf-max-height — so
     short FAQ lists leave no empty gap.
   • When the questions don't fit, the list gets a vertical scrollbar
     inside the panel (no pagination).
   • Fonts are unchanged: Montserrat for questions, Inter for answers.
   ========================================================= */

.teedup-faq {
  --tf-green: var(--color-brand-forest, #003415);
  --tf-ink: #1e1e1e;
  --tf-copy: #2c2c2c;
  --tf-muted: #5b5f58;
  --tf-panel-bg: #f2f2f2;
  --tf-line: rgba(0, 0, 0, 0.09);
  --tf-radius: 18px;
  --tf-gap: clamp(16px, 1.25vw, 24px);
  --tf-pad: clamp(10px, 0.85vw, 16px);
  /* Upper limit; beyond this the question list scrolls. JS sets --tf-height to fit the content. */
  --tf-max-height: clamp(580px, 33.5vw, 660px);
  --tf-min-height: 360px;
  --tf-height: var(--tf-max-height);
  --tf-media-height: var(--tf-height);
  --tf-question-size: clamp(16px, calc(0.6vw + 8px), 20px);
  --tf-answer-size: clamp(14px, calc(0.35vw + 10px), 17px);
  --tf-icon: 30px;
  /* Chevron (points up) inlined so it never depends on a separate request. */
  --tf-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.05442 14.1797L10.1146 9.11955L15.1747 14.1797L16.7291 12.6142L10.1146 5.99969L3.5 12.6142L5.05442 14.1797Z'/%3E%3C/svg%3E");
}

/* Header: the home FAQ header clipped the button shadow (overflow: hidden). */
html body .teedup-faq .faq-contact__header {
  overflow: visible;
}

/* ---------- Layout: image + panel, one locked height ---------- */

html body .teedup-faq .teedup-faq__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  gap: var(--tf-gap);
  height: var(--tf-height);
  margin-top: 0;
  margin-bottom: 0;
}

html body .teedup-faq .teedup-faq__body--no-media {
  grid-template-columns: minmax(0, 1fr);
}

html body .teedup-faq .teedup-faq__media {
  position: relative;
  height: var(--tf-media-height);
  min-height: 0;
  margin: 0;
  overflow: hidden;
  border-radius: var(--tf-radius);
  background: var(--tf-panel-bg);
}

html body .teedup-faq .teedup-faq__media img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  aspect-ratio: auto;
  object-fit: cover;
  object-position: center;
  border-radius: 0;
}

/* ---------- Grey panel ---------- */

html body .teedup-faq .teedup-faq__panel {
  position: relative;
  display: flex;
  height: 100%;
  min-height: 0;
  min-width: 0;
  max-height: var(--tf-max-height);
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--tf-radius);
  padding: var(--tf-pad);
  background: var(--tf-panel-bg);
  box-sizing: border-box;
}

html body .teedup-faq .teedup-faq__list {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 0 4px 0 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: auto;
  scrollbar-gutter: stable;
  background: transparent;
  border-radius: 0;
  height: auto;
  max-height: none;
  aspect-ratio: auto;
}

/* Visible vertical scrollbar (only appears when the questions exceed the panel height). */
/* Firefox only: in Chrome these standard properties would switch off the styled bar below
   and fall back to an auto-hiding overlay scrollbar. */
@supports (-moz-appearance: none) {
  html body .teedup-faq .teedup-faq__list {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 52, 21, 0.5) rgba(0, 52, 21, 0.08);
  }
}

html body .teedup-faq .teedup-faq__list::-webkit-scrollbar {
  width: 6px;
}

html body .teedup-faq .teedup-faq__list::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(0, 52, 21, 0.08);
}

html body .teedup-faq .teedup-faq__list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(0, 52, 21, 0.5);
}

html body .teedup-faq .teedup-faq__list::-webkit-scrollbar-thumb:hover {
  background: var(--tf-green);
}

/* Soft fades tell the user there is more to scroll inside the panel. */
html body .teedup-faq .teedup-faq__panel::before,
html body .teedup-faq .teedup-faq__panel::after {
  position: absolute;
  z-index: 2;
  left: var(--tf-pad);
  right: calc(var(--tf-pad) + 10px);
  height: 28px;
  content: "";
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

html body .teedup-faq .teedup-faq__panel::before {
  top: var(--tf-pad);
  background: linear-gradient(var(--tf-panel-bg), rgba(242, 242, 242, 0));
}

html body .teedup-faq .teedup-faq__panel::after {
  bottom: var(--tf-pad);
  background: linear-gradient(rgba(242, 242, 242, 0), var(--tf-panel-bg));
}

html body .teedup-faq .teedup-faq__panel.is-scrolled::before,
html body .teedup-faq .teedup-faq__panel.has-more-below::after {
  opacity: 1;
}

/* ---------- Accordion rows ---------- */

html body .teedup-faq .teedup-faq__item {
  position: relative;
  margin: 0;
  border: 0;
  border-radius: 12px;
  padding: 0;
  background: transparent;
  box-shadow: none;
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

html body .teedup-faq .teedup-faq__item[hidden] {
  display: none;
}

/* Divider between rows (hidden around the open card). */
html body .teedup-faq .teedup-faq__item + .teedup-faq__item::before {
  position: absolute;
  top: 0;
  left: 16px;
  right: 14px;
  height: 1px;
  background: var(--tf-line);
  content: "";
  transition: opacity 0.2s ease;
}

html body .teedup-faq .teedup-faq__item:has(> .teedup-faq__heading [aria-expanded="true"])::before,
html body .teedup-faq .teedup-faq__item:has(> .teedup-faq__heading [aria-expanded="true"]) + .teedup-faq__item::before {
  opacity: 0;
}

html body .teedup-faq .teedup-faq__item:has(> .teedup-faq__heading [aria-expanded="true"]) {
  /* background: #ffffff; */
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.06);
}

html body .teedup-faq .teedup-faq__heading {
  margin: 0;
  padding: 0;
  font: inherit;
  letter-spacing: normal;
  text-transform: none;
}

html body .teedup-faq .teedup-faq__question {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 0;
  align-items: center;
  gap: 16px;
  margin: 0;
  border: 0;
  border-radius: 12px;
  padding: clamp(11px, 0.75vw, 14px) 14px clamp(11px, 0.75vw, 14px) 16px;
  color: var(--tf-ink);
  /* background: transparent; */
  box-shadow: none;
  font-family: "Montserrat", var(--font-sans, sans-serif);
  font-size: var(--tf-question-size);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0;
  text-align: left;
  text-transform: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

html body .teedup-faq .teedup-faq__question--static {
  cursor: default;
}

html body .teedup-faq .teedup-faq__question::before,
html body .teedup-faq .teedup-faq__question::after {
  display: none;
  content: none;
}

html body .teedup-faq .teedup-faq__question-text {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
}

html body .teedup-faq .teedup-faq__question:hover,
html body .teedup-faq .teedup-faq__question[aria-expanded="true"] {
  color: var(--tf-green);
}

html body .teedup-faq .teedup-faq__question:focus-visible {
  outline: 2px solid var(--tf-green);
  outline-offset: -2px;
}

/* Round chevron button */
html body .teedup-faq .teedup-faq__icon {
  position: relative;
  display: inline-flex;
  width: var(--tf-icon);
  height: var(--tf-icon);
  flex: 0 0 var(--tf-icon);
  align-items: center;
  justify-content: center;
  /* border: 1px solid var(--tf-line); */
  border-radius: 50%;
  /* background: #ffffff; */
  transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.35s cubic-bezier(.22, 1, .36, 1);
}

html body .teedup-faq .teedup-faq__icon::before {
  width: 16px;
  height: 16px;
  background: #000000;
  content: "";
  -webkit-mask: var(--tf-chevron) center / contain no-repeat;
  mask: var(--tf-chevron) center / contain no-repeat;
  transform: rotate(180deg);
  transition: background-color 0.25s ease;
}

/* html body .teedup-faq .teedup-faq__question:hover .teedup-faq__icon {
  border-color: rgba(0, 52, 21, 0.35);
} */

html body .teedup-faq .teedup-faq__question[aria-expanded="true"] .teedup-faq__icon {
  transform: rotate(180deg);
}

/* html body .teedup-faq .teedup-faq__question[aria-expanded="true"] .teedup-faq__icon::before {
  background: #ffffff;
} */

/* Answer — padding lives on the inner wrapper so the open/close height animation stays smooth. */
html body .teedup-faq .teedup-faq__answer {
  overflow: hidden;
  margin: 0;
  padding: 0;
}

html body .teedup-faq .teedup-faq__answer[hidden] {
  display: none;
}

html body .teedup-faq .teedup-faq__answer-inner {
  padding: 0 calc(var(--tf-icon) + 30px) clamp(14px, 1vw, 18px) 16px;
  color: var(--tf-copy);
  font-family: "Inter", var(--font-sans, sans-serif);
  font-size: var(--tf-answer-size);
  font-weight: 400;
  line-height: 1.6;
}

html body .teedup-faq .teedup-faq__answer-inner p,
html body .teedup-faq .teedup-faq__answer-inner li {
  margin: 0;
  color: inherit;
  font: inherit;
}

html body .teedup-faq .teedup-faq__answer-inner p + p,
html body .teedup-faq .teedup-faq__answer-inner ul,
html body .teedup-faq .teedup-faq__answer-inner ol {
  margin-top: 8px;
}

html body .teedup-faq .teedup-faq__answer-inner a {
  color: var(--tf-green);
  text-decoration: underline;
  text-underline-offset: 2px;
}

html body .teedup-faq .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Responsive ---------- */

@media (max-width: 1199px) {
  .teedup-faq {
    --tf-max-height: 560px;
  }
}

/* Tablet: image on top, panel below — both keep a locked height. */
@media (max-width: 1023px) {
  .teedup-faq {
    --tf-max-height: 540px;
    --tf-media-height: 340px;
    --tf-min-height: 0px;
  }

  html body .teedup-faq .teedup-faq__body {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
  }

  html body .teedup-faq .teedup-faq__panel {
    height: var(--tf-height);
  }
}

/* Phone: fixed-height image, panel grows with the open answer (no nested scrolling on touch). */
@media (max-width: 767px) {
  .teedup-faq {
    --tf-media-height: 220px;
    --tf-radius: 14px;
    --tf-icon: 28px;
    --tf-question-size: 16px;
    --tf-answer-size: 14px;
  }

  /* Phone order (header flattens into the column): heading → image → panel → "View All" button. */
  html body .teedup-faq .teedup-faq__body {
    order: 2;
  }

  html body .teedup-faq .product-faq__button {
    order: 3;
    align-self: flex-start;
    margin-top: 24px;
  }

  html body .teedup-faq .teedup-faq__panel {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  html body .teedup-faq .teedup-faq__list {
    flex: 0 0 auto;
    padding-right: 0;
    overflow: visible;
    scrollbar-gutter: auto;
  }

  html body .teedup-faq .teedup-faq__panel::before,
  html body .teedup-faq .teedup-faq__panel::after {
    display: none;
  }

  html body .teedup-faq .teedup-faq__question {
    gap: 12px;
    padding: 12px 10px 12px 12px;
  }

  html body .teedup-faq .teedup-faq__answer-inner {
    padding: 0 12px 14px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body .teedup-faq .teedup-faq__item,
  html body .teedup-faq .teedup-faq__icon,
  html body .teedup-faq .teedup-faq__question {
    transition: none;
  }
}
