/*
 * Block: accordion  —  rebuilt from the prototype FAQ (kitchen-sink .faq/.faqs).
 * Root: section.accordion-area > .accordion > .accordion-section.
 * ------------------------------------------------------------------
 * The generic accordion COMPONENT (css/components/accordion.css) is the
 * "hairline, no box" treatment shared by how-to-apply and course-list
 * accordions. This block gives the pagebuilder accordion the prototype's
 * boxed-FAQ look instead, scoped under .accordion-area so the shared
 * component is untouched for its other consumers.
 *
 * Mechanics preserved: app.js toggles .accordion-section-active on the
 * .accordion-section and aria-expanded on the inner <button>. The FontAwesome
 * <i> stays in the markup but is hidden; a token plus/cross marker replaces it
 * (real markup has no svg).
 *
 * The panel opens on height, not max-height. See the note above the rule: a
 * max-height animation needs a ceiling, and a ceiling silently truncates any
 * panel taller than it.
 */

.accordion-area .accordion {
  max-width: 900px;
}

/* each item = a bordered FAQ box; blue border when open */
.accordion-area .accordion-section {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  overflow: hidden;
  color: var(--text);
  transition: border-color var(--transition);
}
.accordion-area .accordion-section:last-of-type {
  border-bottom: 2px solid var(--line);
}
.accordion-area .accordion-section-active {
  border-color: var(--blue);
}

/* clickable header: question (+ optional subtitle) left, plus/cross right */
.accordion-area .accordion-section-title {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 1rem;
  padding: 1.15rem 1.35rem;
  cursor: pointer;
}
.accordion-area .accordion-section-title h3 {
  grid-column: 1;
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.3;
}
.accordion-area .accordion-section-title button {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  color: var(--text-heading);
  text-decoration: none;
}
/* hide the FontAwesome glyph; the CSS marker replaces it */
.accordion-area .accordion-section-title button i {
  display: none;
}
.accordion-area .accordion-section-title p {
  grid-column: 1;
  margin: 0.35rem 0 0 0;
  font-size: 1.1rem;
  color: var(--text-muted);
}

/* plus that rotates to a cross on open (two currentColor bars) */
.accordion-area .accordion-section-title::after {
  content: "";
  grid-column: 2;
  grid-row: 1 / -1;
  align-self: center;
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  color: var(--blue);
  background:
    linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat;
  transition: transform var(--transition);
}
.accordion-area .accordion-section-active .accordion-section-title::after {
  transform: rotate(45deg);
}

/* answer: collapsed to height 0, opens to its own height.
 *
 * This was `max-height: 0` animating to `max-height: 60rem`, which is the
 * standard trick and carries the standard fault: 60rem is a CEILING, and
 * `overflow: hidden` means anything past it is cut off with no scrollbar, no
 * warning and nothing in the editor to suggest it. 60rem is 960px, which at
 * this block's 1.1rem/1.55 is about 35 lines, so a phone-width panel holding
 * roughly 1,400 characters of prose lost everything after it. Long FAQ answers
 * and entry-requirement lists are exactly the content this block is for.
 *
 * `height: 0` -> `height: auto` has no ceiling and cannot truncate. Browsers
 * without `interpolate-size` open it instantly rather than sliding, which is
 * the correct trade: an unanimated panel that shows all of its content beats an
 * animated one that hides some. Where `interpolate-size` is supported the
 * transition below animates to auto and the slide is unchanged.
 *
 * Do not reintroduce a max-height here. If the animation matters more than the
 * content, the fix is a wrapper element and a grid-template-rows 0fr/1fr
 * transition, which is a markup change and needs deciding as one. */
.accordion-area {
  interpolate-size: allow-keywords;
}
.accordion-area .accordion-section-content {
  display: block;
  height: 0;
  overflow: hidden;
  padding: 0 1.35rem;
  font-size: 1.1rem;
  line-height: 1.55;
  color: var(--text-muted);
  transition: height var(--transition), padding var(--transition);
}
.accordion-area .accordion-section-active .accordion-section-content {
  height: auto;
  padding-bottom: 1.3rem;
}
