/* ==========================================================================
   SANCTUARY — FAQ page
   Loaded on the site and in the editor by functions.php (section 2).
   Uses the brand tokens from sp-core.css (--sp-cream, --sp-brown, etc.).
   ========================================================================== */

.fq-page > .sp-pagehero:first-child { margin-top: 0; }

/* .sp-section clips with overflow:hidden, which would stop the topic index
   sticking. clip keeps the clipping without creating a scroll box. */
.sp-section.fq-section { overflow: visible; overflow-x: clip; }

/* Two columns: sticky topic index, then the questions */
.fq-layout {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: clamp(40px, 7vw, 120px);
  align-items: start;
}
.fq-index {
  position: sticky;
  top: 130px;
  display: flex;
  flex-direction: column;
}
.fq-index .is-style-sp-eyebrow { margin-bottom: 18px; }
.fq-index-link { margin: 0; }
.fq-index-link a {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 11px 0;
  border-top: 1px solid var(--sp-line);
  font-family: var(--sp-ui);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sp-dark);
  text-decoration: none;
  transition: color 0.3s var(--sp-ease), padding-left 0.4s var(--sp-ease);
}
.fq-index-link:last-of-type a { border-bottom: 1px solid var(--sp-line); }
.fq-index-link a span {
  font-family: var(--sp-mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: var(--sp-brown);
}
.fq-index-link a:hover,
.fq-index-link a:focus-visible { color: var(--sp-brown); padding-left: 6px; }

/* A topic */
.fq-groups { min-width: 0; }
.fq-group { scroll-margin-top: 130px; }
.fq-group + .fq-group { margin-top: clamp(64px, 8vw, 110px); }
.fq-group-num {
  font-family: var(--sp-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--sp-brown);
  margin: 0 0 10px;
}
.fq-group-title {
  font-family: var(--sp-display);
  font-weight: 400;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  letter-spacing: 0.03em;
  line-height: 1.1;
  margin: 0 0 clamp(22px, 3vw, 34px);
  text-wrap: balance;
}

/* A question */
.sp-faq-item {
  border-top: 1px solid var(--sp-line);
  margin: 0 !important;
}
.sp-faq-item:last-child { border-bottom: 1px solid var(--sp-line); }
.sp-faq-item > summary {
  list-style: none;
  cursor: pointer;
  position: relative;
  padding: 24px 56px 24px 0;
  font-family: var(--sp-editorial);
  font-size: clamp(1.2rem, 1.7vw, 1.45rem);
  font-weight: 500;
  line-height: 1.35;
  color: var(--sp-dark);
  transition: color 0.3s var(--sp-ease);
  text-wrap: pretty;
}
.sp-faq-item > summary::-webkit-details-marker { display: none; }
.sp-faq-item > summary::marker { content: ""; }

/* The plus that turns to a minus — two hairlines, no icon file */
.sp-faq-item > summary::before,
.sp-faq-item > summary::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 50%;
  width: 16px;
  height: 1px;
  background: var(--sp-brown);
  transition: transform 0.45s var(--sp-ease), opacity 0.3s var(--sp-ease);
}
.sp-faq-item > summary::after { transform: rotate(90deg); }
.sp-faq-item[open] > summary::after { transform: rotate(0deg); opacity: 0; }

.sp-faq-item > summary:hover,
.sp-faq-item > summary:focus-visible,
.sp-faq-item[open] > summary { color: var(--sp-brown); }
.sp-faq-item > summary:focus-visible { outline: 1px solid var(--sp-brown); outline-offset: 4px; }

/* The answer */
.sp-faq-item > :not(summary) {
  font-family: var(--sp-ui);
  font-size: 0.98rem;
  line-height: 1.75;
  color: var(--sp-dark-2);
  max-width: 64ch;
  margin: 0;
  padding: 0 56px 28px 0;
}
.sp-faq-item[open] > :not(summary) { animation: fq-in 0.5s var(--sp-ease-out) both; }
.sp-faq-item a {
  color: var(--sp-brown);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
@keyframes fq-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

/* Closing band */
.fq-close .sp-measure-18 { margin-left: auto; margin-right: auto; }
.fq-close-text {
  font-family: var(--sp-editorial);
  font-style: italic;
  font-size: clamp(1.15rem, 1.5vw, 1.4rem);
  line-height: 1.6;
  color: var(--sp-brown-lt);
  max-width: 40ch;
  margin: 22px auto 0;
}
.fq-close-text a {
  color: var(--sp-cream);
  font-style: normal;
  font-family: var(--sp-ui);
  font-size: 0.85em;
  letter-spacing: 0.04em;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  overflow-wrap: anywhere;
}

/* Tablet and phone: index becomes a row of topic chips above the questions */
@media (max-width: 900px) {
  .fq-layout { grid-template-columns: minmax(0, 1fr); gap: 48px; }
  .fq-index {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }
  .fq-index .is-style-sp-eyebrow { width: 100%; margin-bottom: 8px; }
  .fq-index-link a,
  .fq-index-link:last-of-type a {
    border: 1px solid var(--sp-line);
    padding: 9px 14px;
    font-size: 0.64rem;
    letter-spacing: 0.14em;
  }
  .fq-index-link a:hover { padding-left: 14px; }
  .sp-faq-item > summary { padding-right: 40px; }
  .sp-faq-item > :not(summary) { padding-right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .sp-faq-item[open] > :not(summary) { animation: none; }
  .sp-faq-item > summary::before,
  .sp-faq-item > summary::after,
  .fq-index-link a { transition: none; }
}

/* Editor: show every answer so it can be typed into without clicking */
.editor-styles-wrapper .sp-faq-item > :not(summary) { animation: none; }
.editor-styles-wrapper .fq-index { position: static; }
