@layer cinder.tokens, cinder.foundation, cinder.components, cinder.utilities;
/* The stacked form draws Radio's own indicator. radio-group.css overrides form-field.css's column
 * direction at equal specificity, so it must come after it wherever it is first pulled in. */
@import '/assets/2d787c00d1964e7c031a8d5ee91591f471bfb3e389d446fb11d1f30dfea4779d/components/form-field/form-field.css';
@import '/assets/2d787c00d1964e7c031a8d5ee91591f471bfb3e389d446fb11d1f30dfea4779d/components/radio-group/radio-group.css';

@layer cinder.components {
  /* ========================================
 * SEGMENTED CONTROL
 * ======================================== */

  /* The frame drawn around a control that has a description, a note or an error. A grid cell (a
     form section) gives its item an automatic minimum width, which is the options' unwrapped
     width: the frame would grow past the room it has, the control would measure that grown frame
     as its room, never overflow and never stack, and the message under it would be cut off. With
     no minimum, the frame is as wide as its cell, so the control stacks and the message wraps. */
  .cinder-segmented-control-field {
    min-inline-size: 0;
    max-inline-size: 100%;
  }

  .cinder-segmented-control-container {
    display: inline-flex;
    flex-direction: column;
    gap: var(--cinder-space-2);
    /* `inline-flex` only governs how THIS element lays out its own children —
       it does nothing to stop an ancestor from stretching this element's own
       box. A CSS Grid cell (or a flex row with the default align-items:
       stretch) will still stretch it to fill the full cross-size, leaving the
       pill's border/background way wider than its buttons. Pin it to its
       content so it only goes full-width when explicitly requested via
       data-cinder-full-width below. */
    inline-size: fit-content;

    /* COR-2312: the control never stretches and never wraps. When it is wider
       than the room it has, this box scrolls sideways, with no scrollbar: the
       options stay reachable by scrolling and by arrow keys. Overflow on one
       axis clips the other too, so the box keeps room for an option's focus
       ring (box-shadow, or the forced-colors outline at a 1px offset) and hands
       it straight back with a matching negative margin, as NavigationBar does;
       the cap adds the room on both sides so the control itself can still
       reach the full width of its container. */
    --_cinder-segmented-control-ring-room: calc(
      var(--cinder-ring-width) + max(var(--cinder-ring-offset), 1px)
    );
    max-inline-size: calc(100% + 2 * var(--_cinder-segmented-control-ring-room));
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    padding: var(--_cinder-segmented-control-ring-room);
    margin: calc(-1 * var(--_cinder-segmented-control-ring-room));
  }

  .cinder-segmented-control-container::-webkit-scrollbar {
    display: none;
  }

  /* COR-2181: with `overflow="select"` the options are a Select when the segments do not fit. The
     strip stays in the document at its own width, out of the layout and out of sight, so the control
     can tell when they fit again; the Select takes the room the strip had. */
  .cinder-segmented-control-container[data-cinder-overflowing] {
    position: relative;
    inline-size: calc(100% + 2 * var(--_cinder-segmented-control-ring-room));
    overflow: visible;
  }

  .cinder-segmented-control[data-cinder-measuring] {
    position: absolute;
    inset-block-start: 0;
    inset-inline-start: 0;
    block-size: 0;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
  }

  .cinder-segmented-control-container:has([data-cinder-full-width]) {
    display: flex;
    /* Logical, not physical `width` — mixing the two for the same axis on one
       element is ambiguous. Using inline-size throughout means this cleanly
       overrides the base rule's inline-size:fit-content via normal cascade
       (higher specificity), with no physical/logical conflict. The ring room
       is added back so the track spans the container exactly. */
    inline-size: calc(100% + 2 * var(--_cinder-segmented-control-ring-room));
  }

  .cinder-segmented-control-label {
    color: var(--cinder-text-default);
    font-size: var(--cinder-text-sm);
    font-weight: var(--cinder-font-medium);
  }

  /* ── Attached (default) ─────────────────────────────────────────────────── */

  .cinder-segmented-control {
    display: inline-flex;
    align-items: center;
    gap: 0;
    padding: 1px;
    /* The inset track is a tone step, not an outline (COR-2311). */
    border: 0;
    border-radius: var(--cinder-radius-md);
    background: var(--cinder-surface-inset);
    /* As wide as its options and no wider (COR-2312): a column container or a
       stretching grid cell never widens the track, and the options never wrap.
       The container scrolls when this is wider than the room it has. */
    flex-wrap: nowrap;
    inline-size: max-content;
    align-self: flex-start;
  }

  /* ── Full width ─────────────────────────────────────────────────────────── */

  .cinder-segmented-control[data-cinder-full-width] {
    display: flex;
    inline-size: 100%;
    align-self: stretch;
  }

  .cinder-segmented-control[data-cinder-full-width] .cinder-segmented-control-option {
    flex: 1;
  }

  /* ── Stacked (the options do not fit the room, COR-2448 AC3) ────────────── */

  /* The control falls back to a radio list: one full-width option per row, none clipped. It takes the
     full width like `fullWidth`, and the vertical rules below draw the separators between rows. */
  .cinder-segmented-control-container[data-cinder-stacked] {
    display: flex;
    inline-size: calc(100% + 2 * var(--_cinder-segmented-control-ring-room));
  }

  .cinder-segmented-control-container[data-cinder-stacked] .cinder-segmented-control {
    inline-size: 100%;
    align-self: stretch;
    align-items: stretch;
  }

  .cinder-segmented-control-container[data-cinder-stacked] .cinder-segmented-control-option {
    justify-content: flex-start;
    text-align: start;
  }

  /* No separator in a column: the attached rule is 60% of a row's width and starts at its edge,
     which reads as a stray line between the rows. */
  .cinder-segmented-control-container[data-cinder-stacked]
    .cinder-segmented-control
    .cinder-segmented-control-option:not(:first-child)::before {
    content: none;
  }

  /* A radio list, not a field with suggestions under it. Each row is a leading radio (the one
     Radio draws, in the markup) and its label: no track, no raised face, border or ring on the
     chosen row. The filled radio and the default text colour mark the choice. A row keeps the
     control height (a 44px target on a coarse pointer) and the keyboard ring. */
  .cinder-segmented-control-container[data-cinder-stacked]
    .cinder-segmented-control[role='radiogroup']:not([data-cinder-detached]) {
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .cinder-segmented-control-container[data-cinder-stacked]
    .cinder-segmented-control
    .cinder-segmented-control-option[role='radio'] {
    gap: var(--cinder-space-3);
    /* The radio sits on the column's own edge, as RadioGroup's does: the label above and the help
       text below start where the radios start. Focused or not, so a row does not shift. */
    padding-inline: 0 var(--cinder-space-1);
  }

  .cinder-segmented-control-container[data-cinder-stacked]
    .cinder-segmented-control
    .cinder-segmented-control-option[role='radio']:not(:focus-visible) {
    border: 0;
    border-radius: var(--cinder-radius-md);
    background: transparent;
    box-shadow: none;
    font-size: var(--cinder-text-sm);
  }

  .cinder-segmented-control-container[data-cinder-stacked]
    .cinder-segmented-control
    .cinder-segmented-control-option[role='radio']:not(:disabled):not([aria-disabled='true']) {
    color: var(--cinder-text-default);
  }

  /* A stacked row is drawn at RadioGroup's rhythm: a row as tall as its label's line, a gap of
     space-2 between rows. The touch target is the hit area (an invisible box 44px tall centred on
     the row), never the drawn height, so a phone's list of choices reads like the RadioGroups
     around it. Only the stacked form: the unstacked control keeps its own height. */
  .cinder-segmented-control-container[data-cinder-stacked] .cinder-segmented-control {
    gap: var(--cinder-space-2);
  }

  .cinder-segmented-control-container[data-cinder-stacked]
    .cinder-segmented-control
    .cinder-segmented-control-option[role='radio'] {
    position: relative;
    min-block-size: calc(var(--cinder-text-sm) * var(--cinder-leading-normal));
    padding-block: 0;
  }

  @media (pointer: coarse) {
    .cinder-segmented-control-container[data-cinder-stacked]
      .cinder-segmented-control
      .cinder-segmented-control-option[role='radio']::after {
      content: '';
      position: absolute;
      inset-inline: 0;
      inset-block-start: 50%;
      block-size: max(100%, 44px);
      transform: translateY(-50%);
    }
  }

  /* ── Vertical orientation ───────────────────────────────────────────────── */

  .cinder-segmented-control[data-cinder-orientation='vertical'] {
    flex-direction: column;
  }

  /* ── Detached ────────────────────────────────────────────────────────────── */

  .cinder-segmented-control[data-cinder-detached] {
    gap: var(--cinder-space-1);
    padding: 0;
    border: none;
    background: transparent;
  }

  .cinder-segmented-control[data-cinder-detached] .cinder-segmented-control-option {
    border: 1px solid var(--cinder-border-muted);
    border-radius: var(--cinder-radius-md);
  }

  /* ── Disabled group ─────────────────────────────────────────────────────── */

  .cinder-segmented-control[aria-disabled='true'] {
    pointer-events: none;
  }

  /* ── Option base ────────────────────────────────────────────────────────── */

  .cinder-segmented-control-option {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--cinder-space-1);
    border: 0;
    /* Concentric with the attached container: it is `--cinder-radius-md` and insets
       its options by exactly its 1px padding, so the option's radius has to be that
       same token minus that same inset. It used to be derived from
       `--cinder-radius-sm` — an unrelated step on the scale — which put a 5px curve
       inside an 8px one at a 1px inset where 7px was required. Two curves with
       different centers read as off-axis, which is what "all of the different
       rounded corners look really bad" was describing. Deriving from the
       container's own token means it cannot drift again when the scale moves.
       The detached variant overrides this below: it has no padding and no border,
       so its options are not nested inside anything and take the full radius. */
    border-radius: calc(var(--cinder-radius-md) - 1px);
    background: transparent;
    color: var(--cinder-text-muted);
    cursor: pointer;
    font-weight: var(--cinder-font-medium);
    line-height: 1;
    text-decoration: none;
    transition:
      background-color var(--cinder-duration-fast) var(--cinder-ease-standard),
      color var(--cinder-duration-fast) var(--cinder-ease-standard),
      box-shadow var(--cinder-duration-fast) var(--cinder-ease-standard);
  }

  /* Separator between attached options */
  .cinder-segmented-control:not([data-cinder-detached])
    .cinder-segmented-control-option:not(:first-child)::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    block-size: 60%;
    border-inline-start: 1px solid var(--cinder-border-muted);
    transition: opacity var(--cinder-duration-fast) var(--cinder-ease-standard);
  }

  .cinder-segmented-control:not([data-cinder-detached])
    .cinder-segmented-control-option[data-cinder-selected]:not(:first-child)::before,
  .cinder-segmented-control:not([data-cinder-detached])
    .cinder-segmented-control-option[data-cinder-current]:not(:first-child)::before,
  .cinder-segmented-control:not([data-cinder-detached])
    .cinder-segmented-control-option[data-cinder-pressed]:not(:first-child)::before,
  .cinder-segmented-control:not([data-cinder-detached])
    [data-cinder-selected]
    + .cinder-segmented-control-option::before,
  .cinder-segmented-control:not([data-cinder-detached])
    [data-cinder-current]
    + .cinder-segmented-control-option::before,
  .cinder-segmented-control:not([data-cinder-detached])
    [data-cinder-pressed]
    + .cinder-segmented-control-option::before {
    opacity: 0;
  }

  .cinder-segmented-control[data-cinder-orientation='vertical']
    .cinder-segmented-control-option:not(:first-child)::before {
    inset-inline-start: unset;
    inset-block-start: 0;
    inline-size: 60%;
    block-size: auto;
    border-inline-start: none;
    border-block-start: 1px solid var(--cinder-border-muted);
  }

  /* ── Size variants ──────────────────────────────────────────────────────── */

  /* The control's outer box is a Button's painted height for its size, so a
 * SegmentedControl lines up with a Button of the same size at every pointer. A
 * coarse pointer does not draw it 44px tall (COR-2489: 42px options with 12px
 * at the sides read as tall buttons with thin padding on a phone); each option
 * reaches 44px through a hit area that takes no layout space, as a Button does.
 * An attached control wraps its options in 1px of padding and no border (the
 * track is a tone step, COR-2311), so each attached option is 2px shorter than
 * the step; a detached option carries its own 1px border and takes the full
 * step.
 * density="toolbar" resolves to data-cinder-size="sm" in the component, so a
 * toolbar SegmentedControl is the same height as a toolbar Chip and a
 * size="sm" Button. At `sm` an attached option is 26px, above the WCAG 2.5.8
 * minimum target for options that sit flush against each other; do not
 * shrink `sm` below 28px. */
  .cinder-segmented-control {
    --_cinder-segmented-control-height: var(--_cinder-painted-height-md);
  }

  .cinder-segmented-control .cinder-segmented-control-option {
    min-block-size: calc(var(--_cinder-segmented-control-height) - 2px);
  }

  .cinder-segmented-control[data-cinder-detached] .cinder-segmented-control-option {
    min-block-size: var(--_cinder-segmented-control-height);
  }

  .cinder-segmented-control[data-cinder-size='sm'] {
    --_cinder-segmented-control-height: var(--_cinder-painted-height-sm);
  }

  .cinder-segmented-control[data-cinder-size='lg'] {
    --_cinder-segmented-control-height: var(--_cinder-painted-height-lg);
  }

  /* A stacked or vertical control is a column of rows, whose hit areas cannot reach past each other,
     so each row keeps a list row's minimum: the touch target on a coarse pointer, as tall as its
     content otherwise. */
  .cinder-segmented-control-container[data-cinder-stacked]
    .cinder-segmented-control
    .cinder-segmented-control-option,
  .cinder-segmented-control[data-cinder-orientation='vertical']:not([data-cinder-detached])
    .cinder-segmented-control-option {
    min-block-size: max(
      calc(var(--_cinder-segmented-control-height) - 2px),
      var(--cinder-list-row-min-height)
    );
  }

  .cinder-segmented-control[data-cinder-orientation='vertical'][data-cinder-detached]
    .cinder-segmented-control-option {
    min-block-size: max(var(--_cinder-segmented-control-height), var(--cinder-list-row-min-height));
  }

  /* The hit area of a horizontal option on a coarse pointer: 44px tall, centred on the painted
     option, taking no layout space. `min()` leaves an option already 44px or taller alone. The
     selected tab of a tablist draws its indicator in this pseudo-element, and needs no larger
     target: it is already chosen. */
  @media (any-pointer: coarse) {
    .cinder-segmented-control[data-cinder-orientation='horizontal']:not(
        [data-cinder-variant='tablist']
      )
      .cinder-segmented-control-option::after,
    .cinder-segmented-control[data-cinder-orientation='horizontal'][data-cinder-variant='tablist']
      .cinder-segmented-control-option:not([data-cinder-selected])::after {
      content: '';
      position: absolute;
      inset-block: min(0px, calc((100% - var(--cinder-touch-target-min)) / 2));
      inset-inline: 0;
    }
  }

  .cinder-segmented-control[data-cinder-size='sm'] .cinder-segmented-control-option {
    padding-block: var(--cinder-space-1);
    padding-inline: var(--cinder-space-2);
    font-size: var(--cinder-text-xs);
  }

  .cinder-segmented-control[data-cinder-size='md'] .cinder-segmented-control-option {
    padding-block: var(--cinder-space-1);
    padding-inline: var(--cinder-space-2);
    font-size: var(--cinder-text-sm);
  }

  .cinder-segmented-control[data-cinder-size='lg'] .cinder-segmented-control-option {
    padding-block: var(--cinder-space-2);
    padding-inline: var(--cinder-space-3, 0.75rem);
    font-size: var(--cinder-text-sm);
  }

  /* Attached horizontal options need at least 12px between the inter-segment
 * separator (rendered as a ::before pseudo-element at inset-inline-start: 0)
 * and the option label. The base `sm` and `md` size rules use --cinder-space-2
 * (0.5rem = 8px), which causes labels to pinch against the separator. Bump
 * the inline padding to --cinder-space-3 (0.75rem = 12px) on attached
 * horizontal sm/md controls only — `lg` already uses --cinder-space-3, and
 * detached/vertical variants keep their per-size defaults. Toolbar-density
 * controls resolve to data-cinder-size="sm" via the Svelte component, so
 * attached horizontal toolbars match the `sm` arm of this selector and
 * correctly receive the 12px inline padding too. */
  .cinder-segmented-control:not(
      [data-cinder-detached]
    )[data-cinder-orientation='horizontal'][data-cinder-size='sm']
    .cinder-segmented-control-option,
  .cinder-segmented-control:not(
      [data-cinder-detached]
    )[data-cinder-orientation='horizontal'][data-cinder-size='md']
    .cinder-segmented-control-option {
    padding-inline: var(--cinder-space-3, 0.75rem);
  }

  /* ── Hover ──────────────────────────────────────────────────────────────── */

  /* Sticky-hover suppression on touch: wrap hover-only chrome so it doesn't
 * "stick" after tap on touch devices that emulate :hover. */
  @media (hover: hover) {
    .cinder-segmented-control-option:hover:not(:disabled):not([aria-disabled='true']):not(
        [data-cinder-selected]
      ):not([data-cinder-current]):not([data-cinder-pressed]) {
      background: color-mix(in oklch, var(--cinder-accent-solid), transparent 90%);
      color: var(--cinder-text-default);
    }

    /* Selected/pressed segments get hover feedback too, so they don't read as
   * disabled. Step the raised pill to the theme-aware raised-hover surface while
   * keeping the selected text colour (inherited from the resting
   * selected/pressed rules). A selected-but-disabled segment stays focusable
   * and is marked with aria-disabled="true" rather than the native disabled
   * attribute (see segmented-control.a11y.md / the C6 selected-but-disabled
   * contract), so guard on BOTH :not(:disabled) and :not([aria-disabled='true'])
   * to keep hover chrome off disabled segments. */
    .cinder-segmented-control-option[data-cinder-selected]:hover:not(:disabled):not(
        [aria-disabled='true']
      ),
    .cinder-segmented-control-option[data-cinder-current]:hover:not(:disabled):not(
        [aria-disabled='true']
      ),
    .cinder-segmented-control-option[data-cinder-pressed]:hover:not(:disabled):not(
        [aria-disabled='true']
      ) {
      background: var(--cinder-surface-raised-hover);
    }
  }

  /* ── Focus ──────────────────────────────────────────────────────────────── */

  .cinder-segmented-control-option:focus-visible {
    outline: var(--cinder-ring-width) solid transparent;
    box-shadow:
      0 0 0 var(--cinder-ring-offset) var(--cinder-ring-offset-color),
      0 0 0 calc(var(--cinder-ring-offset) + var(--cinder-ring-width))
        var(--_cinder-segmented-control-ring, var(--cinder-ring-color));
    z-index: 1;
  }

  /* ── Disabled option ────────────────────────────────────────────────────── */

  .cinder-segmented-control-option:disabled,
  .cinder-segmented-control-option[aria-disabled='true'] {
    cursor: not-allowed;
  }

  /* ── Selected (single mode) ─────────────────────────────────────────────── */

  /* The selected segment is a raised surface pill on the inset track, as the boards draw it
     (rows 02y and the Hooks "Then" control, decisions "Coordinator calls for B07 piece 2"), not an
     accent fill: the track recedes, the choice lifts out of it, and the text keeps the default
     colour. The weight stays the same as the other segments, so choosing one never moves the rest. */
  /* The raised pill alone sits about 1.1:1 on the track in light and dark, so the selected segment
     also draws a 1px ring in the contrast tier inside its edge (COR-2312): `--cinder-border-contrast`
     clears 3:1 against the inset track and the raised pill in both themes, which the
     `segmented-control:selected-indicator:*` contrast pairings hold. */
  .cinder-segmented-control-option[data-cinder-selected],
  .cinder-segmented-control-option[data-cinder-current] {
    background: var(--cinder-surface-raised);
    color: var(--cinder-text-default);
    box-shadow:
      var(--cinder-shadow-sm),
      inset 0 0 0 1px var(--cinder-border-contrast);
  }

  .cinder-segmented-control-option-icon {
    opacity: 0.9;
  }

  /* The count after a label ("Waiting on you 2"): regular weight and tabular figures, in the
     colour the segment already has, so it reads on the selected fill as well as at rest. The
     option's own gap spaces it from the label; the screen-reader comma is out of flow. */
  .cinder-segmented-control-option-count {
    font-weight: var(--cinder-font-normal);
    font-variant-numeric: tabular-nums;
    opacity: 0.85;
  }

  /* The comma that makes the name read "Waiting on you, 2". A zero-size inline box rather than
     the visually-hidden utility, which is absolutely positioned and so is read as a block. */
  .cinder-segmented-control-option-count-separator {
    display: inline-block;
    inline-size: 0;
    block-size: 0;
    overflow: hidden;
  }

  /* ── Pressed (multiple mode) ────────────────────────────────────────────── */

  .cinder-segmented-control-option[data-cinder-pressed] {
    background: var(--cinder-surface-raised);
    color: var(--cinder-text-default);
    box-shadow:
      var(--cinder-shadow-sm),
      inset 0 0 0 1px var(--cinder-border-contrast);
  }

  /* For the default pill variant: the `[data-cinder-selected]` rule (specificity
   * 0,1,0) is declared after `:focus-visible` (0,1,0) and wins by cascade order,
   * replacing the focus ring's box-shadow with shadow-sm. Re-assert the ring so
   * the selected+focused segment still shows a visible ring in single and multiple
   * selection modes. Scope to :not([data-cinder-variant='tablist']) so this does
   * not conflict with the tablist re-assert below.
   * Specificity 0,3,0 beats the base shadow-sm rule's 0,2,0 — intentional. */
  .cinder-segmented-control:not([data-cinder-variant='tablist'])
    .cinder-segmented-control-option[data-cinder-selected]:focus-visible,
  .cinder-segmented-control:not([data-cinder-variant='tablist'])
    .cinder-segmented-control-option[data-cinder-pressed]:focus-visible,
  .cinder-segmented-control:not([data-cinder-variant='tablist'])
    .cinder-segmented-control-option[data-cinder-current]:focus-visible {
    /* The pill is a surface shift, not a fill (focus-ring-policy.md), so it keeps the tight ring. */
    box-shadow:
      0 0 0 var(--cinder-ring-offset) var(--cinder-ring-offset-color),
      0 0 0 calc(var(--cinder-ring-offset) + var(--cinder-ring-width))
        var(--_cinder-segmented-control-ring, var(--cinder-ring-color));
    z-index: 1;
  }

  /* Forced-colors: selected/pressed segments also need outline fallback. Selection
   * semantics apply (the segment represents a chosen option) → Highlight. */
  @media (forced-colors: active) {
    .cinder-segmented-control:not([data-cinder-variant='tablist'])
      .cinder-segmented-control-option[data-cinder-selected]:focus-visible,
    .cinder-segmented-control:not([data-cinder-variant='tablist'])
      .cinder-segmented-control-option[data-cinder-pressed]:focus-visible,
    .cinder-segmented-control:not([data-cinder-variant='tablist'])
      .cinder-segmented-control-option[data-cinder-current]:focus-visible {
      outline: var(--cinder-ring-width) solid Highlight;
      outline-offset: 1px;
      box-shadow: none;
    }
  }

  /* ── Tablist variant (single mode only) ─────────────────────────────────────
 * See documentation/decisions/segmented-control-tablist-variant.md. The tablist variant
 * carries tab semantics for externally owned panels, so it must read as a
 * tab strip rather than the default filled-pill radiogroup. All rules here are
 * scoped to single-selection roots so the invalid `selectionMode="multiple"` +
 * `variant="tablist"` combination keeps the radiogroup/multiple pill visuals;
 * visual isolation of that combination is proven in the Playwright regression.
 *
 * These rules come after the base selected/pressed/separator declarations so
 * the tablist treatment deliberately wins, and each override matches or
 * exceeds the specificity of the base selector it replaces without broadening
 * to non-tablist roots.
 * ──────────────────────────────────────────────────────────────────────────── */

  /* Strip the surface-inset container chrome: no background, no enclosing border,
 * no inset padding. Layout, sizing, density, and full-width behavior are
 * unaffected because they key off other selectors. */
  .cinder-segmented-control[data-cinder-selection-mode='single'][data-cinder-variant='tablist'] {
    padding: 0;
    border: none;
    background: transparent;
  }

  /* Suppress the connected-bar separators between attached tablist options. The
 * base separator and its vertical variant both render via the option
 * ::before; neutralize them here for tablists only. */
  .cinder-segmented-control[data-cinder-selection-mode='single'][data-cinder-variant='tablist']:not(
      [data-cinder-detached]
    )
    .cinder-segmented-control-option:not(:first-child)::before {
    content: none;
  }

  /* Selected tab: accent text, no filled background, no selected shadow. The
 * underline-style indicator (below) carries the selected affordance instead. */
  .cinder-segmented-control[data-cinder-selection-mode='single'][data-cinder-variant='tablist']
    .cinder-segmented-control-option[data-cinder-selected] {
    background: transparent;
    color: var(--cinder-accent-text);
  }

  /* The base `[data-cinder-selected]` rule paints the filled-pill drop shadow via
 * box-shadow; strip it for tablists. Scope to `:not(:focus-visible)` so this
 * does not run on the focused selected tab — the focus ring (also box-shadow)
 * must survive there. */
  .cinder-segmented-control[data-cinder-selection-mode='single'][data-cinder-variant='tablist']
    .cinder-segmented-control-option[data-cinder-selected]:not(:focus-visible) {
    box-shadow: none;
  }

  /* Re-assert the focus ring on the selected + focused tab. Stripping the pill
 * shadow above is not enough: the base `[data-cinder-selected]` rule
 * (box-shadow: shadow-sm, specificity 0,2,0) is declared after the base
 * `:focus-visible` ring rule (equal specificity), so on a focused selected tab
 * the base selected shadow would otherwise win and the ring would vanish. This
 * higher-specificity tablist rule, declared last, restores the exact base ring
 * shadow so keyboard focus stays visible on the active tab. */
  .cinder-segmented-control[data-cinder-selection-mode='single'][data-cinder-variant='tablist']
    .cinder-segmented-control-option[data-cinder-selected]:focus-visible {
    box-shadow:
      0 0 0 var(--cinder-ring-offset) var(--cinder-ring-offset-color),
      0 0 0 calc(var(--cinder-ring-offset) + var(--cinder-ring-width))
        var(--_cinder-segmented-control-ring, var(--cinder-ring-color));
  }

  /* Forced-colors / Windows High Contrast: box-shadow rings are suppressed by the
 * UA, so the base option focus ring (outline: transparent + box-shadow) becomes
 * invisible. Substitute a system-color outline, matching the Tabs component. */
  @media (forced-colors: active) {
    .cinder-segmented-control-option:focus-visible {
      outline: var(--cinder-ring-width) solid Highlight;
      outline-offset: 1px;
    }

    /* Forced-colors: selected+focused tab in tablist → selection semantics → Highlight. */
    .cinder-segmented-control[data-cinder-selection-mode='single'][data-cinder-variant='tablist']
      .cinder-segmented-control-option[data-cinder-selected]:focus-visible {
      outline: var(--cinder-ring-width) solid Highlight;
      outline-offset: 1px;
      box-shadow: none;
    }
  }

  /* Selected hover must not restore the filled pill — keep the selected tab's
 * transparent background and accent text. Unselected hover keeps the base
 * accent-tint treatment from the base hover rule. */
  @media (hover: hover) {
    .cinder-segmented-control[data-cinder-selection-mode='single'][data-cinder-variant='tablist']
      .cinder-segmented-control-option[data-cinder-selected]:hover {
      background: transparent;
      color: var(--cinder-accent-text);
    }
  }

  /* Accent indicator on the selected tab edge. The option is already
 * position: relative (base rule), so the absolutely positioned ::after anchors
 * to it without changing layout. Horizontal tablists place the indicator on the
 * block-end edge spanning the inline axis; the vertical override below moves it
 * to the inline-start edge spanning the block axis. */
  .cinder-segmented-control[data-cinder-selection-mode='single'][data-cinder-variant='tablist']
    .cinder-segmented-control-option[data-cinder-selected]::after {
    content: '';
    position: absolute;
    inset-inline: 0;
    inset-block-end: 0;
    block-size: 2px;
    background: var(--cinder-accent-solid);
    border-radius: var(--cinder-radius-full);
  }

  /* Vertical tablist indicator: inline-start edge, spanning the block axis. */
  .cinder-segmented-control[data-cinder-selection-mode='single'][data-cinder-variant='tablist'][data-cinder-orientation='vertical']
    .cinder-segmented-control-option[data-cinder-selected]::after {
    inset-inline: 0 auto;
    inset-block: 0;
    inline-size: 2px;
    block-size: auto;
  }

  /* ── Disabled text, last ────────────────────────────────────────────────── */

  /* A disabled segment keeps its selected or pressed pill but its text takes the disabled colour
     (never an opacity fade). Written after the selected and pressed rules, at a specificity that
     beats the plain ones, so a selected-but-disabled segment still reads as disabled. */
  .cinder-segmented-control .cinder-segmented-control-option:disabled,
  .cinder-segmented-control .cinder-segmented-control-option[aria-disabled='true'],
  .cinder-segmented-control[aria-disabled='true'] .cinder-segmented-control-option {
    color: var(--cinder-text-disabled);
  }

  /* A disabled control reads as disabled at a glance (s2#15): the inset track loses its fill for
     the disabled control edge, and the chosen segment drops its raised pill, shadow and contrast
     ring for the disabled fill, as a disabled Input does. Its choice still shows. */
  .cinder-segmented-control[aria-disabled='true']:not([data-cinder-variant='tablist']):not(
      [data-cinder-detached]
    ) {
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--cinder-control-border-disabled);
  }

  .cinder-segmented-control[aria-disabled='true']:not([data-cinder-variant='tablist'])
    .cinder-segmented-control-option:is(
      [data-cinder-selected],
      [data-cinder-current],
      [data-cinder-pressed]
    ) {
    background: var(--cinder-fill-disabled);
    box-shadow: inset 0 0 0 1px var(--cinder-control-border-disabled);
  }
}
