/* OAIT Design System 2.1.0 · reference/css/disclosure.css
   Accordion and disclosure (unit c-containers).

   Components
   - Accordion (.oa-accordion): FAQs and static disclosures as native <details>/<summary>; controlled
     disclosures (filter groups, navigation groups) as a <button aria-expanded aria-controls> and
     its panel. Default rows (FAQ, settings) and compact rows (--compact: filters, groups).
     The FAQ section itself (heading, at most six questions) is c-marketing's faq.md.

   Implements canonical §10.25, §5.2, §6.2, §6.3, §7.1, §7.3, §8.3 and D-CSN-31, D-ARC-20, D-COL-05,
   D-SEM-10, D-SEM-11, D-SEM-15, D-SEM-16, D-BCP-33.

   Tokens read: --color-outline-variant, --color-on-surface, --color-on-surface-variant;
   --radius-8px; --size-touch-target, --size-focus-inset; --space-2, --space-4, --space-5,
   --space-6, --space-12, --space-16, --space-row-inset; --opacity-state-hover,
   --opacity-state-pressed; --z-behind; --duration-short-3, --duration-short-4; --ease-standard;
   --text-title-sm, --text-label-md, --text-body-md (with --text-body-lg--line-height for the
   24px answer line) and their companions.
   Context property read: --oa-state (the state-layer opacity; documentation pages force it inline).

   Classes: .oa-accordion (+ --compact; __item, __summary, __icon, __panel).

   Relies on base.css for .oa-icon, the [hidden] rule, and the focus ring. */


/* ---------------------------------------------------------------------------------------------
   1. Accordion. A column of items, a 1px outline-variant hairline above the first and below each
   (D-CSN-31). Several items may be open at once; nothing animates the panel's height.
   --------------------------------------------------------------------------------------------- */

.oa-accordion {
  margin: 0;
  padding: 0;
}

.oa-accordion__item {
  margin: 0;
  border-block-end: 1px solid var(--color-outline-variant);
}

.oa-accordion__item:first-child {
  border-block-start: 1px solid var(--color-outline-variant);
}


/* ---------------------------------------------------------------------------------------------
   2. Summary row: a <summary> (or a <button> for a controlled disclosure) at least 64px tall,
   20px block padding, the label in title-sm on-surface, the expand_more chevron at the inline end.
   16px inline padding keeps the label clear of the inset ring. The 8% / 12% state layer of the
   label color covers the border box; the ring inset (-4px), because the rows sit edge to edge (canonical §10.25,
   §6.3; D-CSN-31, D-COL-05). Questions are not headings: no heading element inside a summary.
   --------------------------------------------------------------------------------------------- */

.oa-accordion__summary {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  box-sizing: border-box;
  inline-size: 100%;
  min-block-size: var(--space-16);
  margin: 0;
  padding-block: var(--space-5);
  padding-inline: var(--space-row-inset);
  border: 1px solid transparent;
  background: none;
  color: var(--color-on-surface);
  font: inherit;
  font-size: var(--text-title-sm);
  line-height: var(--text-title-sm--line-height);
  letter-spacing: var(--text-title-sm--letter-spacing);
  font-weight: var(--text-title-sm--font-weight);
  text-align: start;
  list-style: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.oa-accordion__summary::-webkit-details-marker {
  display: none;
}

.oa-accordion__summary::before {
  content: "";
  position: absolute;
  inset: -1px; /* over the 1px transparent edge as well */
  z-index: var(--z-behind);
  border-radius: inherit;
  background-color: currentColor;
  opacity: var(--oa-state, 0);
  pointer-events: none;
  transition: opacity var(--duration-short-3) var(--ease-standard);
}

@media (hover: hover) {
  .oa-accordion__summary:hover {
    --oa-state: var(--opacity-state-hover);
  }
}

.oa-accordion__summary:active {
  --oa-state: var(--opacity-state-pressed);
}

.oa-accordion__summary:active::before {
  transition-duration: 0ms; /* lint-ok: a press shows at once; only hover and release fade (canonical §2.7, §7.2) */
}

.oa-accordion__summary:is(:focus-visible, [data-demo-focus]) {
  outline-offset: var(--size-focus-inset);
}


/* The chevron: expand_more 24px in on-surface-variant, turning 180° when open over short-4
   standard. It is not mirrored in right-to-left pages; under reduced motion it turns at once
   (canonical §7.3, §8.3). */

.oa-accordion__icon {
  flex-shrink: 0;
  color: var(--color-on-surface-variant);
  transition: transform var(--duration-short-4) var(--ease-standard);
}

.oa-accordion__item[open] > .oa-accordion__summary > .oa-accordion__icon,
.oa-accordion__summary[aria-expanded="true"] > .oa-accordion__icon {
  transform: rotate(180deg);
}


/* ---------------------------------------------------------------------------------------------
   3. Panel: the answer in body-md at a 24px line (the body-lg line: 24px Latin, the Arabic block's
   1.75 in Arabic), on-surface-variant, 640px at most, 48px clear of the chevron column, 24px
   below (canonical §10.25).
   --------------------------------------------------------------------------------------------- */

.oa-accordion__panel {
  box-sizing: border-box;
  max-inline-size: 40rem; /* component constant: the answer column caps at 640px (canonical §10.25) */
  margin: 0;
  padding-block: 0 var(--space-6);
  padding-inline: var(--space-row-inset) var(--space-12);
  color: var(--color-on-surface-variant);
  font-size: var(--text-body-md);
  line-height: var(--text-body-lg--line-height);
  letter-spacing: var(--text-body-md--letter-spacing);
  font-weight: var(--text-body-md--font-weight);
}

.oa-accordion__panel > * {
  margin: 0;
}

.oa-accordion__panel > * + * {
  margin-block-start: var(--space-2);
}


/* ---------------------------------------------------------------------------------------------
   4. Compact rows (filter groups, navigation groups): 48px, 8px inline padding, 8px corners, the
   label in label-md on-surface-variant, no hairlines; the panel holds its controls 8px below
   (canonical §5.2, §10.25; D-CSN-31).
   --------------------------------------------------------------------------------------------- */

.oa-accordion--compact .oa-accordion__item,
.oa-accordion--compact .oa-accordion__item:first-child {
  border-block: 0;
}

.oa-accordion--compact .oa-accordion__summary {
  min-block-size: var(--size-touch-target);
  padding-block: 0;
  padding-inline: var(--space-2);
  border-radius: var(--radius-8px);
  color: var(--color-on-surface-variant);
  font-size: var(--text-label-md);
  line-height: var(--text-label-md--line-height);
  letter-spacing: var(--text-label-md--letter-spacing);
  font-weight: var(--text-label-md--font-weight);
}

.oa-accordion--compact .oa-accordion__panel {
  max-inline-size: none;
  padding: var(--space-2) 0 0;
  color: var(--color-on-surface);
  font-size: var(--text-body-lg);
  line-height: var(--text-body-lg--line-height);
  letter-spacing: var(--text-body-lg--letter-spacing);
  font-weight: var(--text-body-lg--font-weight);
}
