/* The one fold control every fold on the site wears.
 *
 * Moses, 2026-09-30 19:10 UTC, verbatim: "Everything foldable should be expanded by default. Folding a section
 * should be a reaction to the page layout. Holding sections is the reaction to the long layout or navigational
 * ease. And it should be made pretty clear graphically that a section is foldable."
 *
 * This is part 2 of that order: a visible chevron that turns when the fold closes, and the whole header as the click
 * target with a pointer cursor and a hover shade. Fold and Unfold stay in the control for a screen reader and are
 * not drawn. One rule set for every fold, so all folds look alike. Paired with ui.js ensureFoldControl(), which
 * builds the markup.
 *
 * It lives in its own file rather than in app.css so it ships whole; app/css/app.css is held by another job.
 * If that job later folds these rules into app.css, delete this file and its <link>. */

.fold-ctl {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none; align-self: center;
  box-sizing: border-box; width: 22px; height: 22px; padding: 0;
  border: 1px solid var(--line-strong, #AEC2BB); border-radius: 6px;
  background: var(--panel-2, #EEF4F1); color: var(--ink-2, #12302B);   /* never a bare white shape on a title strip */
  user-select: none; transition: border-color .2s var(--ease, ease), color .2s var(--ease, ease), background .2s var(--ease, ease);
}
.fold-chev {
  display: inline-block; font-size: 11px; line-height: 1;
  transition: transform .2s var(--ease, ease), color .2s var(--ease, ease);
  transform: rotate(-90deg);            /* closed: the chevron points up, the fold reads as ready to open */
  color: var(--jade, #0E8A6E);
}
.fold-ctl.is-open .fold-chev { transform: rotate(0deg); }
.fold-word {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* The whole header is the click target: a pointer cursor, a hover wash and a visible keyboard focus ring. ui.js never
 * puts a class on the header, so the rules find it by the control it holds (the earlier rules named a class that no
 * script adds, so the wash and the ring never applied). */
details > summary:has(> .fold-ctl) { cursor: pointer; transition: background .18s var(--ease, ease); }
details > summary:has(> .fold-ctl):hover { background: var(--jade-soft-2, #DBEAE3); }
details > summary:has(> .fold-ctl):focus-visible { outline: 2px solid var(--jade, #0D8568); outline-offset: -2px; }
details > summary:has(> .fold-ctl) .fold-ctl:hover { border-color: var(--jade, #0D8568); color: var(--jade-dark, #0a6b55); background: var(--panel, #fff); }

/* The sections that already style their own header keep their padding; the control never moves the title. */
details.section > summary .fold-ctl { margin-right: 2px; }

/* The folds that build their own header text keep it; the control always sits first in the header. */
.dr-fold, .rr2-fold, .rsec-fold, .foldmark { display: none; }   /* replaced by .fold-ctl: one mark for every fold */
details.rsec > summary.h:has(> .fold-ctl)::before,
.fp-page details.fp-section > summary:has(> .fold-ctl) .fp-heading-title::before { content: none; }
details > summary:has(> .fold-ctl) > .chev { display: none; }

/* A section body that sets its own display (a grid) would otherwise stay on screen after the fold shuts,
 * because that rule beats the browser's own hide. One rule here shuts every fold the same way. */
details:not([open]) > :not(summary) { display: none !important; }

/* A long report may start with its first section open and a table of contents; nothing folds itself shut. */
@media print {
  .fold-ctl { display: none; }
  details:not([open]) > :not(summary) { display: block !important; }
}
