/* Every FAQ section's title, broadcast from a megaphone. The unit is a full-width banner
   above the questions: a large megaphone hangs well off the viewport's left edge,
   aimed ~6deg above level. Its sound beam runs from behind the bell out past the
   right edge (main clips both sides) and carries the title in two stacked lines.
   Long, thin bolts project from the bell rim, each aligned on one vanishing point
   in the throat. Only the image keeps a torn-paper backing; beam and lightning are
   flat symbol-kit ink. Geometry is in cqi of the banner so it scales as one piece. */
.faq.faq--megaphone {
  padding-top: clamp(21px, 3vw, 42px) !important;
  /* The next section's slanted top edge rises into this one; keep the last question clear. */
  padding-bottom: clamp(150px, 14vw, 230px) !important;
}
/* .wrap is a container too, so the banner's own height can be written in cqi. */
.faq--megaphone .wrap {
  container-type: inline-size;
  grid-template-columns: 1fr;
  gap: 0;
}
.faq--megaphone .wrap > div:last-child { max-width: 900px; }
/* The banner sits right on the list, so the list drops its top rule. */
.faq--megaphone details:first-child { border-top: 0; }

.faq--megaphone .faq-heading {
  /* --aim: beam angle. --mega: megaphone width. --tuck: share of it that hangs off
     the viewport's left edge. Points on the drawing are fractions of --mega,
     measured from the megaphone's bottom-left corner (the image is square). */
  --aim: -6deg;
  --mega: 38cqi;
  --tuck: .4;
  /* --drop: how far the megaphone sinks below the banner (its handle is off-screen). */
  --drop: 7cqi;
  --beam-start: 10cqi;
  --beam-end: 26cqi;
  --mx: calc((100cqi - 100vw) / 2 - var(--tuck) * var(--mega));
  /* Driver (beam source) and throat (the bolts' vanishing point). */
  --src-x: calc(var(--mx) + .712 * var(--mega));
  --src-y: calc(.61 * var(--mega) - var(--drop));
  --vp-x: calc(var(--mx) + .504 * var(--mega));
  --vp-y: calc(.56 * var(--mega) - var(--drop));
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  width: 100%;
  /* Tall enough that the beam's far end, where it leaves the viewport, just
     reaches the banner's top edge: source height + rise + half the beam. */
  height: calc(
    var(--src-y)
    + tan(-1 * var(--aim)) * ((100vw + 100cqi) / 2 - var(--src-x))
    + var(--beam-end) / 2
  );
}

.faq-heading__megaphone {
  /* The drawing points ~11deg up; this turns it onto --aim. */
  --torn-angle: 5deg;
  position: absolute;
  z-index: 2;
  left: var(--mx);
  bottom: calc(-1 * var(--drop));
  width: var(--mega);
  pointer-events: none;
}

/* The beam box starts at the driver, behind the megaphone, and is longer than
   the viewport is wide. The title rides its axis, at the same angle. */
.faq-heading__callout {
  position: absolute;
  z-index: 1;
  left: var(--src-x);
  bottom: var(--src-y);
  width: 100vw;
  height: var(--beam-end);
  display: flex;
  align-items: center;
  padding-left: 17cqi;
  translate: 0 50%;
  rotate: var(--aim);
  transform-origin: 0 50%;
}

.faq-heading__ray {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--sym-a);
  clip-path: polygon(
    0 calc(50% - var(--beam-start) / 2),
    100% 0,
    100% 100%,
    0 calc(50% + var(--beam-start) / 2)
  );
}

.faq--megaphone .faq-heading h2 {
  max-width: none;
  margin: 0;
  color: var(--ink);
  font-size: min(5cqi, 200cqi / var(--chars, 18));
  line-height: .98;
  white-space: nowrap;
  /* Display caps sit low in their line box; lift them onto the beam's axis. */
  translate: 0 -.06em;
}
.faq-heading__line { display: block; }

/* Bolts project from the bell rim. Each one's inner end sits on the rim, --r out
   from the vanishing point at angle --a off the beam axis, and the bolt points
   straight away from that point. The drawing is stretched long and thin. */
.faq-heading > .faq-heading__bolt {
  --r: 16cqi;
  --w: 3.4cqi;
  --dir: calc(var(--aim) + var(--a));
  position: absolute;
  z-index: 3;
  width: var(--w);
  height: auto;
  left: calc(var(--vp-x) + var(--r) * cos(var(--dir)) - var(--w) / 2);
  bottom: calc(var(--vp-y) - var(--r) * sin(var(--dir)) - var(--w) * 1.667);
  /* Pivot on the inner end; the drawing runs top to bottom, so turn it to --dir. */
  transform-origin: 50% 0;
  rotate: calc(var(--dir) - 90deg);
  scale: .42 1.55;
}
.faq-heading > .faq-heading__bolt--1 { --a: -30deg; }
.faq-heading > .faq-heading__bolt--2 { --a: -52deg; --r: 16.5cqi; --w: 2.9cqi; }
.faq-heading > .faq-heading__bolt--3 { --a: 30deg; }
.faq-heading > .faq-heading__bolt--4 { --a: 42deg; --r: 15.5cqi; --w: 2.9cqi; }

@media (max-width: 760px) {
  .faq--megaphone .faq-heading {
    --mega: 52cqi;
    --tuck: .36;
    --drop: 14cqi;
    --beam-start: 13cqi;
    --beam-end: 34cqi;
  }
  .faq-heading__callout { padding-left: 21cqi; }
  /* --chars (the longer title line, set in the markup) shrinks long titles to fit the beam. */
  .faq--megaphone .faq-heading h2 { font-size: min(6.6cqi, 180cqi / var(--chars, 18)); }
  .faq-heading > .faq-heading__bolt--1,
  .faq-heading > .faq-heading__bolt--3 { --r: 22cqi; --w: 4.6cqi; }
  .faq-heading > .faq-heading__bolt--2 { --r: 22.6cqi; --w: 4cqi; }
  .faq-heading > .faq-heading__bolt--4 { --r: 21.2cqi; --w: 4cqi; }
}
