@layer cinder.tokens, cinder.foundation, cinder.components, cinder.utilities;
@import '/assets/f47cf25678047dc1d0c5372c25b330b4ffdf35604610caa62c68ff9ad26b877e/components/input/input.css';

@layer cinder.components {
  /* As a sheet the dialog has the grabber, the confirmation and Cancel; the corner close button is
   * a second way out that the sheet does not draw (row 05d). Escape and Cancel still close it. */
  .cinder-modal[data-cinder-sheet='docked'].cinder-confirm-dialog .cinder-modal__close {
    display: none;
  }

  /* The sentence that says what the dialog does, and often that it cannot be undone: it reads at the
   * body's size and colour, louder than the list or the notes under it. */
  .cinder-confirm-dialog__description {
    margin: 0;
    color: var(--cinder-text-default);
    font-size: var(--cinder-text-body);
  }

  /* Monospace inside the sentence (a key, an identifier) reads as part of the sentence. An
   * identifier is one long unbroken token, so it wraps at any character rather than widening the
   * dialog. */
  .cinder-confirm-dialog__description :where(code) {
    font-family: var(--cinder-font-mono);
    font-size: 0.95em;
    color: var(--cinder-text-default);
    overflow-wrap: anywhere;
  }

  /* The same in options: a filter summary or a workflow id in a list row or a note. */
  .cinder-confirm-dialog__options :where(code) {
    font-family: var(--cinder-font-mono);
    font-size: 0.95em;
    overflow-wrap: anywhere;
  }

  /* A body with no element in it (a failure with nothing described: its callout lives in the footer)
   * takes no room, so no padded band sits between the title and the footer. ConfirmDialog's body
   * holds elements only, so the whitespace its template leaves between blocks does not count, which
   * `:empty` (Modal's rule for a body that renders nothing at all) would not forgive. */
  .cinder-confirm-dialog .cinder-modal__body:not(:has(> *)) {
    display: none;
  }

  /* The description, the options and the typed field are one column, a step apart. */
  .cinder-confirm-dialog .cinder-modal__body > * + *:not(:empty) {
    margin-block-start: var(--cinder-space-4);
  }

  /* The footer holds the failure above the actions, outside the scrolling body, so a failure is
   * always in view with the buttons under it. */
  .cinder-confirm-dialog__footer {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-inline-size: 0;
  }

  /* The failure region is always mounted so a failure is announced, and takes no room until it has
   * one. */
  .cinder-confirm-dialog__failure:not(:empty) {
    margin-block-end: var(--cinder-space-3);
  }

  /* The typed confirmation is the footer's, above the buttons it gates, a step above them. */
  .cinder-confirm-dialog__footer > .cinder-input-field {
    margin-block-end: var(--cinder-space-3);
  }

  .cinder-confirm-dialog__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--cinder-space-3);
  }

  /* A typed destructive sheet puts both actions on their own line. Cancel keeps initial focus. */
  .cinder-modal[data-cinder-sheet='docked'].cinder-confirm-dialog
    .cinder-confirm-dialog__actions[data-cinder-typed-destructive] {
    flex-flow: column-reverse nowrap;
    align-items: stretch;
  }

  .cinder-modal[data-cinder-sheet='docked'].cinder-confirm-dialog
    .cinder-confirm-dialog__actions[data-cinder-typed-destructive]
    > button {
    flex: none;
    inline-size: 100%;
  }
  /* As a sheet the actions row takes Modal's one docked footer rule (modal.css): a compact Cancel
   * and the confirmation filling the rest. The one exception to its "a lone action fills the row",
   * for a failure that carries its own action, is in modal.css beside the rule
   * (`data-cinder-fault-only`). */

  /* What each choice does: a checkbox, or the command about to run. */
  .cinder-confirm-dialog__options {
    display: flex;
    flex-direction: column;
    gap: var(--cinder-space-3);
    min-inline-size: 0;
  }

  /* A plain list in options is flat rows: no bullets, a hairline between rows, no box of its own.
   * The first row has no rule above it. */
  .cinder-confirm-dialog__options > ul {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .cinder-confirm-dialog__options > ul > li {
    padding-block: var(--cinder-space-1);
    border-block-start: 1px solid var(--cinder-border-muted);
    font-size: var(--cinder-text-sm);
    overflow-wrap: anywhere;
  }

  /* The first row has no padding above it either, so the line that introduces the list sits one
   * column step (16px) above it, and not that step plus the row's own padding. */
  .cinder-confirm-dialog__options > ul > li:first-child {
    padding-block-start: 0;
    border-block-start: 0;
  }

  /* The last row has no padding below it, so the list does not float toward the footer. */
  .cinder-confirm-dialog__options > ul > li:last-child {
    padding-block-end: 0;
  }

  .cinder-confirm-dialog__options > ul > li :where(strong) {
    font-weight: var(--cinder-font-semibold);
  }

  /* A note in options reads as the description does: muted and small. */
  .cinder-confirm-dialog__options > p {
    margin: 0;
    color: var(--cinder-text-muted);
    font-size: var(--cinder-text-sm);
  }

  /* Cancel holds the first focus (the guard against a hasty confirm), and the dialog opens from a
   * click as often as from a key: the ring must show on that first focus either way, which
   * :focus-visible alone does not promise for a script focus after a pointer press. Same ring as
   * the button's own. */
  .cinder-confirm-dialog__cancel:focus:not(:disabled):not([aria-disabled='true']) {
    border-color: transparent;
    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-button-ring, var(--cinder-ring-color));
  }

  @media (forced-colors: active) {
    .cinder-confirm-dialog__cancel:focus:not(:disabled):not([aria-disabled='true']) {
      outline: var(--cinder-ring-width) solid ButtonText;
      outline-offset: 3px;
    }
  }
}
