/* ────────────────────────────────────────────────────────────────────
 * Help-dialog accordion content element
 * Theme-reactive (uses Bootstrap CSS variables; never hardcoded colors).
 * The base accordion comes from Bootstrap 5.3 — only additions here:
 *   - breadcrumb above each question (small, muted)
 *   - subtitle inside the body (muted lead)
 *   - sensible spacing for stacked items
 * ──────────────────────────────────────────────────────────────────── */

.q4u-hd-accordion-wrap {
  margin-block: 1.25rem;
}

.q4u-hd-accordion-section {
  margin-block-start: 1.75rem;
}
.q4u-hd-accordion-section:first-child {
  margin-block-start: 0;
}
.q4u-hd-accordion-section-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: .5rem;
}

.q4u-hd-accordion-q {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  text-align: left;
}

.q4u-hd-accordion-crumb {
  font-size: .8125rem;
  font-weight: 400;
  letter-spacing: .01em;
  line-height: 1.2;
  /* Default: muted secondary tint that respects theme + dark mode. */
  color: inherit;
  opacity: .65;
}

/* When the button is in hover or open state, Bootstrap repaints the
   button bg + foreground. inherit + opacity keeps the crumb in step
   with whatever Bootstrap chose, so it stays readable on every theme. */
.accordion-button:hover .q4u-hd-accordion-crumb,
.accordion-button:not(.collapsed) .q4u-hd-accordion-crumb {
  color: inherit;
  opacity: .8;
}

.q4u-hd-accordion-title {
  font-weight: 600;
  line-height: 1.35;
}

.q4u-hd-accordion-body {
  padding-block: 1rem;
}

.q4u-hd-accordion-subtitle {
  font-size: .9375rem;
  margin-bottom: .75rem;
}

.q4u-hd-accordion-answer {
  /* RTE content — let theme typography rule */
}

.q4u-hd-accordion-answer > *:first-child { margin-top: 0; }
.q4u-hd-accordion-answer > *:last-child  { margin-bottom: 0; }

.q4u-hd-accordion-cta {
  /* keep CTAs inline-blocky and themed via .btn-{style} */
}

.q4u-hd-accordion-empty {
  margin-block: 1rem;
}

/* ── Gallery (above answer text) ───────────────────────────────── */
/* Layout concept:
 *   < 768px       : 1 column gallery, gallery stacks above answer
 *   ≥ 768px, 2-4  : 2 columns (max 4 images → 2×2 grid), still stacked
 *                   above the answer
 *   ≥ 768px, 1    : gallery + answer become side-by-side via the body
 *                   grid below — image left ≈40 %, text right ≈60 %
 */
.q4u-hd-accordion-gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
  margin-bottom: 1rem;
}
@media (min-width: 768px) {
  .q4u-hd-accordion-gallery {
    grid-template-columns: repeat(2, 1fr);
  }
  /* Single image: don't subdivide the gallery — fill its cell so the
     figure spans the whole 40% (in side-by-side mode) or full-width
     (when stacked above the answer). */
  .q4u-hd-accordion-gallery:has(> .q4u-hd-accordion-figure:only-child) {
    grid-template-columns: 1fr;
  }
}

/* Side-by-side variant: when the body has exactly one image figure, the
 * accordion body becomes a 2-col grid at md+ (image cell fills its 40%,
 * answer cell takes 60%). subtitle + ctas span both columns. Below md,
 * the body falls back to default block flow — image stacked above
 * answer, big and readable. */
@media (min-width: 768px) {
  .q4u-hd-accordion-body:has(.q4u-hd-accordion-figure:only-child) {
    display: grid;
    grid-template-columns: 40% 1fr;
    column-gap: 1.25rem;
    grid-template-areas:
      "subtitle subtitle"
      "gallery  answer"
      "ctas     ctas";
  }
  .q4u-hd-accordion-body:has(.q4u-hd-accordion-figure:only-child) > .q4u-hd-accordion-subtitle { grid-area: subtitle; }
  .q4u-hd-accordion-body:has(.q4u-hd-accordion-figure:only-child) > .q4u-hd-accordion-gallery  { grid-area: gallery; margin-bottom: 0; }
  .q4u-hd-accordion-body:has(.q4u-hd-accordion-figure:only-child) > .q4u-hd-accordion-answer   { grid-area: answer; }
  .q4u-hd-accordion-body:has(.q4u-hd-accordion-figure:only-child) > .q4u-hd-accordion-ctas     { grid-area: ctas; }
}
.q4u-hd-accordion-figure {
  margin: 0;
  background: var(--bs-tertiary-bg, #f8f9fa);
  border-radius: var(--bs-border-radius, .375rem);
  overflow: hidden;
  aspect-ratio: 4 / 3;
}
.q4u-hd-accordion-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Bootstrap's default chevron is fine in light + dark via --bs-accordion-* vars.
   No theme overrides needed — confirmed against the project's 4 themes. */
