/*
  Accordion — Website Refresh 2026 1e (Figma), "Accordion" frame
  (Accordion Icon, Accordion Header Row, Accordion Item, Accordion).
  Source: https://www.figma.com/design/2W6CyIAW3cKDEqdv26CeE2/Website-Refresh-2026-1e?node-id=8064-38997

  Requires tokens.css, icons.css, and typography.css (for
  .rs-paragraph, used inside the open panel) to be loaded first.
  Pair with js/accordion.js for the open/close behaviour.

  The whole header row is the click/hover/focus target (a single
  <button> wrapping the heading text + icon), not just the icon —
  matches both the confirmed UX recommendation discussed before
  building this, and Figma's own structure (Accordion Item's Closed
  state is literally a <button> in the reference code).

  State model: a single source of truth, the trigger button's
  aria-expanded attribute — CSS reacts to it directly via attribute
  selectors rather than a separately-maintained class, so the visual
  state can never drift from the accessible state.

  Icon colour flips to white on hover/active regardless of open/
  closed state (confirmed by checking the actual exported icon SVGs,
  not assumed): default state's dark-90 stroke wouldn't be visible
  against the dark hover/active circle background.
*/

.rs-accordion {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.rs-accordion-item__trigger {
  display: flex;
  align-items: flex-start;
  gap: var(--space-20);
  width: 100%;
  padding: var(--space-20);
  border: none;
  border-radius: var(--space-12);
  background-color: transparent;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease;
}
.rs-accordion-item__trigger:hover {
  background-color: var(--color-neutral-100);
}
.rs-accordion-item__trigger:active {
  background-color: var(--color-neutral-200);
}
.rs-accordion-item__trigger[aria-expanded="true"] {
  background-color: var(--color-neutral-100);
}
.rs-accordion-item__trigger[aria-expanded="true"]:hover {
  background-color: var(--color-neutral-200);
}
.rs-accordion-item__trigger[aria-expanded="true"]:active {
  background-color: var(--color-neutral-300);
}

.rs-accordion-item__heading {
  flex: 1 1 0%;
  padding: var(--space-6) 0;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.25px;
  color: var(--color-transparency-dark-90);
}

@media (max-width: 768px) {
  /* Same H5 size step Heading Text uses at this breakpoint
     (Mobile/Header/H5: 18px) — this markup is a <span>, not an
     actual .rs-heading--h5, so it needs its own copy of that
     responsive step rather than inheriting it. */
  .rs-accordion-item__heading {
    font-size: 18px;
  }
}

.rs-accordion-icon {
  position: relative;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: var(--color-neutral-100);
  border: 1.5px solid var(--color-transparency-dark-70);
  color: var(--color-transparency-dark-90);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.rs-accordion-item__trigger:hover .rs-accordion-icon {
  background-color: var(--color-neutral-800);
  border-color: transparent;
  color: var(--color-neutral-white-50);
}
.rs-accordion-item__trigger:active .rs-accordion-icon {
  background-color: var(--color-neutral-900);
  border-color: transparent;
  color: var(--color-neutral-white-50);
}

.rs-accordion-icon__glyph {
  width: 20px;
  height: 20px;
  stroke-width: 2.5px;
}

.rs-accordion-icon__glyph--minus {
  display: none;
}
.rs-accordion-item__trigger[aria-expanded="true"] .rs-accordion-icon__glyph--plus {
  display: none;
}
.rs-accordion-item__trigger[aria-expanded="true"] .rs-accordion-icon__glyph--minus {
  display: block;
}

/* Smooth open/close (matches Figma's Smart Animate / Ease Out /
   200ms transition between the Open and Closed variants) via the
   CSS grid-rows collapse technique: the panel is a single-row grid
   whose track animates between 0fr and 1fr, so it transitions to/
   from its natural content height without ever needing that height
   measured in JS. overflow: hidden on both the panel and its inner
   wrapper clips the content while the track is anywhere short of
   1fr; min-height: 0 on the inner wrapper is required for it to
   actually shrink below its content's intrinsic height inside the
   grid track. Driven by the trigger's aria-expanded, same single
   source of truth accordion.js already uses for the icon swap. */

.rs-accordion-item__panel {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  transition: grid-template-rows 200ms ease-out;
}
.rs-accordion-item__trigger[aria-expanded="true"] + .rs-accordion-item__panel {
  grid-template-rows: 1fr;
}

.rs-accordion-item__panel-inner {
  min-height: 0;
  overflow: hidden;
  padding: var(--space-12) var(--space-20) 0 var(--space-20);
}
