/* controls.css — foundation-ui's control vocabulary (increment-controls-sheet, owner 2026-12-01).
 *
 * Load order: tokens.css → themes.css → shell.css → controls.css (ShellCSS lists it right after
 * shell.css). It is its own sheet so a host with its own chrome can load the vocabulary without the
 * floor's frame (Assets.ControlsCSS): every selector here carries a class (CS-U2), so nothing of the
 * host's own is restyled. Tokens only. */

/* The page's title row. */
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-header h1 { margin: 0; font-size: var(--fs-xl); }

/* A control inside a .form-field draws itself (CS-U3): the floor gives bare controls this look through
   shell.css's element rules, a host without them would show a native control. :where() keeps it at
   zero specificity, so any host or library class wins. */
:where(.form-field) > :where(input:not([type=checkbox], [type=radio], [type=hidden]), select, textarea) {
  font: inherit; color: var(--fg);
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--r-sm);
  transition: border-color var(--t-fast);
}
:where(.form-field) > :where(input:not([type=checkbox], [type=radio], [type=hidden]), select, textarea):focus { outline: none; border-color: var(--accent); }

/* ── Form controls — the accepted control vocabulary ──────────────────────────
   docs/specs/ui-control-vocabulary/. A native <select> or checkbox paints OS chrome that
   ignores every token — the failure the 2026-09-15 scrollbar ruling already named, seen
   again as a blue checkbox on a dark theme. Tokens only, so these follow the theme. */

/* icon-push-toggle. aria-pressed IS the state, never a parallel data-* flag (generalised from
   infra-forge .mf-template-toggle). */
.fui-toggle { color: var(--fg-muted); }
.fui-toggle[aria-pressed="true"] { color: var(--selected); border-color: var(--selected); }
/* The state is a glyph pair, never colour alone (ui_controls.md, owner 2026-11-07): a toggle that
   carries <i class="… icon on"> + <i class="… icon off"> shows the one of its state, with the plain
   border in both (no ring): muted while off, the selection colour while on (owner 2026-11-27,
   increment-selected-state SL2, superseding "grey in both"). */
.fui-toggle[aria-pressed="true"] .icon.off,
.fui-toggle[aria-pressed="false"] .icon.on { display: none; }
.fui-toggle:has(.icon.off) { border-color: var(--border); }
.fui-toggle:has(.icon.off):hover { border-color: var(--border-strong); }
.fui-toggle[aria-pressed="false"]:has(.icon.off) { color: var(--fg-muted); }
.fui-toggle[aria-pressed="true"]:has(.icon.off),
.fui-toggle[aria-pressed="true"]:has(.icon.off):hover { color: var(--selected); }
/* Hover previews "on": a wash of the selection colour, stronger than selected (SL8, SL9); the glyph
   takes the ink, so it reads on the wash in every theme (increment-wash-contrast WC1). */
.fui-toggle:not(:disabled):hover,
.fui-toggle[aria-pressed="false"]:has(.icon.off):not(:disabled):hover { color: var(--fg); background: rgba(var(--selected-rgb), 0.16); }

/* Segmented chips + loop share one markup: hidden radios carrying the data, labels
   carrying the look (generalised from iiriki .i2-mode-radio). */
.fui-chips, .fui-loop { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* Visually hidden, NOT display:none — the radio must keep its place in the tab order and
   stay arrow-key reachable, which is how a segmented control is operated without a mouse. */
.fui-chip-radio {
  position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important;
  overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important;
}
.fui-chip {
  display: inline-flex; align-items: center; padding: 3px 10px; cursor: pointer;
  font-size: var(--fs-sm); color: var(--fg-muted); background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--r-pill);
}
.fui-chip:hover { color: var(--fg); border-color: var(--selected); background: rgba(var(--selected-rgb), 0.16); }
.fui-chip-radio:checked + .fui-chip { color: var(--selected); border-color: var(--selected); }
/* A checked chip keeps its surface under the pointer: its text is the selection colour, which a wash of
   the same colour would dim (increment-wash-contrast WC2). */
.fui-chip-radio:checked + .fui-chip:hover { background: var(--bg-input); }
/* Keyboard focus has to land somewhere visible once the input itself is hidden. */
.fui-chip-radio:focus-visible + .fui-chip { outline: 2px solid var(--accent); outline-offset: 2px; }
/* The loop shows only the checked chip; its button advances to the next radio. */
.fui-loop .fui-chip { display: none; }
.fui-loop .fui-chip-radio:checked + .fui-chip { display: inline-flex; }

/* The global filter band (increment-prompt-band; lifted from ree-x .rx-filter-row): one row under
   the page title — the quick chips, the range control, apply and clear — wrapping only when the
   viewport is too narrow. A chip that is a link (the band's) marks the period in force with
   aria-current, the radio chip's checked look. Tokens only. */
.fui-prompt-band { margin: 0 0 12px; }
.fui-prompt-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; }
.fui-prompt-field { display: flex; flex-direction: column; gap: 4px; flex: 0 1 auto; min-width: 0; }
.fui-prompt-label { font-size: var(--fs-sm); color: var(--fg-muted); }
.fui-prompt-band .fui-chips { min-height: 36px; }
a.fui-chip { text-decoration: none; }
a.fui-chip[aria-current="true"] { color: var(--selected); border-color: var(--selected); }
a.fui-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fui-prompt-actions { display: flex; align-items: center; gap: 6px; min-height: 36px; }
.fui-prompt-note { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; font-size: var(--fs-sm); color: var(--fg-muted); }

/* Inset form labels (increment-form-inset; ui_and_styling § Form fields). A form opts in with
   .form-inset: each .form-field puts its label INSIDE the control's top-left corner — static,
   never a floating placeholder — so a field costs one row of height, not two, and text, select,
   textarea and tom-select all read the same. The field's help is its data-tip, never a line under
   it. Lifted from infra-forge's components.css (the rule's reference) so the class contract has one
   home; consumers keep the class names. */
.form-inset .form-field { position: relative; }
.form-inset .form-field > label,
.form-inset label.form-field > span {
  position: absolute; top: 1px; left: 1px; right: 1px;
  padding: 3px 0 2px 10px;    /* the text keeps its 4px / 11px corner; the box covers the control's top padding */
  background: var(--bg-input); border-top-left-radius: var(--r-sm); border-top-right-radius: var(--r-sm);
                              /* FI7: opaque, so a scrolled textarea's text passes UNDER the label, never through
                                 it; FI9: it reaches the right edge — only a textarea's label stops short, below */
  z-index: 2;                 /* above tom-select's .ts-control (z-index 1) */
  font-size: var(--fs-xs); line-height: 1.2; color: var(--fg-muted);
  pointer-events: none;       /* a click lands on the control underneath */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.form-inset .form-field > input,
.form-inset .form-field > select,
.form-inset .form-field > textarea { padding: 19px 10px 5px; min-height: 44px; box-sizing: border-box;
  margin: 0; background: var(--bg-input); }  /* FI8: the label's own surface — a host's margin or background cannot split them */
/* FI9: a textarea scrolls — its label leaves the scrollbar visible. */
.form-inset .form-field:has(> textarea) > label { right: 12px; border-top-right-radius: 0; }
/* tom-select: four classes outrank the vendor's two or three, so no !important (infra-forge's
   copy needed it; the floor's own .ts-control has no padding rule to fight). */
.form-inset .form-field .ts-wrapper.single .ts-control,
.form-inset .form-field .ts-wrapper.multi .ts-control { padding: 17px 10px 3px; min-height: 44px; height: auto; }
.form-inset .form-field:focus-within > label,
.form-inset label.form-field:focus-within > span { color: var(--accent); }
/* A boolean in an inset form: the icon-push-toggle sits in the same box a text field draws. */
.form-inset .form-field-toggle {
  min-height: 44px; box-sizing: border-box;
  padding-top: 19px; padding-right: 10px; padding-bottom: 5px; padding-left: 10px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg-input);
}
