/* OAIT Design System 2.1.0 · reference/css/button.css
   Buttons, button rows, and icon buttons (unit c-actions).

   Components
   - Button (.oa-btn): six variants, three sizes, wide, icons, loading, and disabled.
   - Button row (.oa-actions): dialog and sheet footers, the responsive modal footer, and page
     pairs.
   - Icon button (.oa-icon-btn): standard, filled, tonal, and outlined; toggles through
     aria-pressed.

   Implements canonical §10.0, §10.1, §10.2, §2.7, §2.8, §4.6, §6.3, §8.2, and D-CAI-01 to D-CAI-07,
   D-CAI-20, D-COL-05, D-SEM-10, D-SEM-15, D-ARC-02, D-ARC-03, D-ARC-04, D-ARC-05, D-ARC-11, D-ARC-12,
   D-ARC-20, D-ARC-22, D-ARC-33, D-LAY-12, C-1.

   Tokens read: --color-primary, --color-on-primary, --color-secondary-container,
   --color-on-secondary-container, --color-primary-ink, --color-primary-container,
   --color-on-primary-container, --color-outline, --color-outline-variant, --color-error,
   --color-on-error, --color-on-card-art, --color-on-surface, --color-on-surface-variant;
   --size-button-sm, --size-button-md, --size-button-lg, --size-icon-sm, --size-icon-md,
   --size-icon-lg; --space-2, --space-3, --space-5, --space-6, --space-7; --radius-full;
   --text-label-md and --text-label-lg with their companions; --shadow-elevation-1;
   --opacity-state-hover, --opacity-state-pressed, --opacity-state-disabled-container,
   --opacity-state-disabled-content; --duration-short-3; --ease-standard.
   Context property read: --oa-state (the state-layer opacity; documentation pages force it inline).
   Component-local properties: --oa-btn-height, --oa-btn-icon.

   Classes: .oa-btn (+ --filled, --tonal, --outlined, --text, --danger, --on-art; --sm, --lg, md is
   the default; --wide; __icon, __label; loading through [aria-busy="true"] with
   aria-disabled="true"), .oa-actions (+ --sheet, --modal, --page), .oa-icon-btn (+ --filled,
   --tonal, --outlined; standard is the default; toggles through [aria-pressed]).

   Relies on base.css for .oa-icon (1em box, FILL axis, --mirror), the global :focus-visible ring,
   [data-demo-focus], and the reduced-motion switch, and on feedback.css for .oa-spinner, whose arc
   and size this file points at the button's label color and icon size.
   Each control resets --oa-state to 0 at rest, so a container that sets it (a clickable card
   pressed through its title link) never paints its layer on the buttons inside it.
   Breakpoints are literal: sm 40rem (640px), md 48rem (768px). */


/* ---------------------------------------------------------------------------------------------
   1. Button. A pill with a 1px border (transparent unless outlined, so forced colors draw its
   edge), the label in label-lg (label-md at sm), at most one icon, and a state layer: a ::before
   of the label color at 8% on hover and 12% while pressed, covering the border box. Nothing moves,
   lifts, scales, or casts a new shadow (D-CAI-01, D-CAI-02, D-CAI-03, D-SEM-15). Always write one
   variant modifier; without one the button draws like the text button.
   --------------------------------------------------------------------------------------------- */

.oa-btn {
  --oa-state: 0;
  --oa-btn-height: var(--size-button-md);
  --oa-btn-icon: var(--size-icon-md);
  position: relative;
  isolation: isolate;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  box-sizing: border-box;
  block-size: var(--oa-btn-height);
  margin: 0;
  padding-block: 0;
  padding-inline: var(--space-6);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  background-color: transparent;
  color: var(--color-primary-ink);
  font-family: inherit;
  font-size: var(--text-label-lg);
  line-height: var(--text-label-lg--line-height);
  letter-spacing: var(--text-label-lg--letter-spacing);
  font-weight: var(--text-label-lg--font-weight);
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: middle;
  cursor: pointer;
  -webkit-user-select: none; /* Safari on iOS reads only the prefixed property */
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--duration-short-3) var(--ease-standard),
    border-color var(--duration-short-3) var(--ease-standard),
    color var(--duration-short-3) var(--ease-standard);
}

/* The state layer sits under the label and icon (--z-behind inside the isolated button). */
.oa-btn::before {
  content: "";
  position: absolute;
  inset: -1px; /* the layer covers the 1px border, so hover shows no lighter rim */
  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-btn:hover {
    --oa-state: var(--opacity-state-hover);
  }
}

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

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

/* Icons: 18px in sm, 20px in md and lg (D-ARC-22). Directional arrows also take .oa-icon--mirror. */
.oa-btn .oa-btn__icon {
  flex-shrink: 0;
  font-size: var(--oa-btn-icon);
}

.oa-btn__label {
  min-inline-size: 0;
}


/* Sizes: sm 40px with its hit area extended to 48px (5px above and below, the 1px border counted),
   md 48px (the default), lg 56px (D-CAI-03, D-ARC-04, D-ARC-05, D-ARC-20). */

.oa-btn--sm {
  --oa-btn-height: var(--size-button-sm);
  --oa-btn-icon: var(--size-icon-sm);
  padding-inline: var(--space-5);
  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-btn--sm::after {
  content: "";
  position: absolute;
  inset-block: -5px;
  inset-inline: 0;
}

.oa-btn--lg {
  --oa-btn-height: var(--size-button-lg);
  padding-inline: var(--space-7);
}

/* Wide: fills the row; a label too long for one line wraps to a second and the button grows
   from its size's height (the main button on phones, long French labels). */
.oa-btn--wide {
  inline-size: 100%;
  block-size: auto;
  min-block-size: var(--oa-btn-height);
  padding-block: var(--space-2);
  white-space: normal;
}

.oa-btn--wide .oa-btn__label {
  text-wrap: balance;
}


/* Variants (D-CAI-02, D-ARC-11, D-ARC-12). on-art is for family products only: under an endorsed
   accent its on-primary label is white on white, so endorsed brands put the filled button on art. */

.oa-btn--filled {
  background-color: var(--color-primary);
  color: var(--color-on-primary);
}

.oa-btn--tonal {
  background-color: var(--color-secondary-container);
  color: var(--color-on-secondary-container);
}

.oa-btn--outlined {
  border-color: var(--color-outline);
  color: var(--color-primary-ink);
}

.oa-btn--text {
  color: var(--color-primary-ink);
}

.oa-btn--danger {
  background-color: var(--color-error);
  color: var(--color-on-error);
}

.oa-btn--on-art {
  background-color: var(--color-on-card-art);
  color: var(--color-on-primary);
  box-shadow: var(--shadow-elevation-1);
}


/* Loading: aria-busy="true" plus aria-disabled="true". Colors and focus stay; presses are ignored
   by the script; the script locks the width before the label changes (D-CAI-06). The spinner takes
   the leading icon's place at its size, as a quarter arc in the label color with no track, as
   D-CAI-06 draws it: canonical §10.23's primary-ink arc would be 2.58:1 on the orange fill, and its
   outline-variant track leaves the arc only 1.4 to 1.9:1 from it on the danger fill, under the
   Tamakkan accent, and on the orange fill in dark. On outlined and text buttons the arc is
   primary-ink, as canonical draws it. */

.oa-btn[aria-busy="true"] {
  cursor: default;
}

.oa-btn .oa-spinner {
  --oa-spinner-arc: currentColor;
  --oa-spinner-track: transparent;
  --oa-spinner-size: var(--oa-btn-icon);
}


/* Disabled: native disabled, or aria-disabled="true" on a focusable control that cannot apply.
   The fill becomes on-surface at 12%, the label (and an outline) on-surface at 38% and 12%, and the
   state layer stays off. Never opacity on the whole button (D-COL-05, D-ARC-33). */

.oa-btn:is(:disabled, [aria-disabled="true"]) {
  --oa-state: 0;
  cursor: default;
}

.oa-btn:is(:disabled, [aria-disabled="true"]:not([aria-busy="true"])) {
  color: color-mix(in srgb, var(--color-on-surface) calc(var(--opacity-state-disabled-content) * 100%), transparent);
  box-shadow: none;
}

.oa-btn:is(.oa-btn--filled, .oa-btn--tonal, .oa-btn--danger, .oa-btn--on-art):is(:disabled, [aria-disabled="true"]:not([aria-busy="true"])) {
  background-color: color-mix(in srgb, var(--color-on-surface) calc(var(--opacity-state-disabled-container) * 100%), transparent);
}

.oa-btn--outlined:is(:disabled, [aria-disabled="true"]:not([aria-busy="true"])) {
  border-color: color-mix(in srgb, var(--color-on-surface) calc(var(--opacity-state-disabled-container) * 100%), transparent);
}

@media (forced-colors: active) {
  .oa-btn:is(:disabled, [aria-disabled="true"]:not([aria-busy="true"])) {
    border-color: GrayText;
    color: GrayText;
  }
}


/* ---------------------------------------------------------------------------------------------
   2. Button row (.oa-actions). Dialog footer by default: Cancel first, the main button last, so it
   lands at the inline end; 8px apart (D-CAI-04). Write the buttons as the dialog wants them (md,
   Cancel as a text button).
   --sheet   bottom sheet: both buttons lg, sharing the width; Cancel outlined.
   --modal   the content of .oa-modal: the sheet layout below 768px (both buttons grow to 56px, the
             text Cancel takes the outline), the dialog layout from 768px.
   --page    a pair on a page: the filled button first, at the inline start, 12px apart; below
             640px a full-width column, the filled button on top (D-CAI-04; the hero CTA row of
             canonical §4.5 and §10.27, D-LAY-10, D-CSN-35).
   Long labels wrap the row; the buttons never shrink below their label.
   --------------------------------------------------------------------------------------------- */

.oa-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

.oa-actions--sheet > .oa-btn {
  flex: 1 1 0;
}

@media (width < 48rem) {
  .oa-actions--modal > .oa-btn {
    --oa-btn-height: var(--size-button-lg);
    flex: 1 1 0;
    padding-inline: var(--space-7);
  }

  .oa-actions--modal > .oa-btn--text {
    border-color: var(--color-outline);
  }
}

.oa-actions--page {
  justify-content: flex-start;
  gap: var(--space-3);
}

@media (width < 40rem) {
  .oa-actions--page {
    flex-direction: column;
    align-items: stretch;
  }

  .oa-actions--page > .oa-btn {
    inline-size: 100%;
    block-size: auto;
    min-block-size: var(--oa-btn-height);
    padding-block: var(--space-2);
    white-space: normal;
  }
}


/* ---------------------------------------------------------------------------------------------
   3. Icon button. A 48×48 circle with a 24px icon, a 1px border (transparent unless outlined), and
   the state layer over its border box.
   standard (default): on-surface-variant, no container (header and row actions).
   --filled: the view's one main action when it has no words; it counts as the one filled control.
   --tonal: secondary-container. --outlined: an outline-variant hairline, for busy surfaces (the
   Pause control and carousel pager arrows on moving art; table pagination circles are
   site-nav.css's, with an outline edge, canonical §10.13); the icon identifies it (V-2).
   Toggles (standard and outlined only): aria-pressed; pressed = primary-container with the
   on-primary-container icon at FILL 1. The name stays the same in both states (D-CAI-07, D-CAI-14).
   --------------------------------------------------------------------------------------------- */

.oa-icon-btn {
  --oa-state: 0;
  position: relative;
  isolation: isolate;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  inline-size: var(--size-button-md);
  block-size: var(--size-button-md);
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  background-color: transparent;
  color: var(--color-on-surface-variant);
  font-family: inherit;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  -webkit-user-select: none; /* Safari on iOS reads only the prefixed property */
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--duration-short-3) var(--ease-standard),
    border-color var(--duration-short-3) var(--ease-standard),
    color var(--duration-short-3) var(--ease-standard);
}

.oa-icon-btn::before {
  content: "";
  position: absolute;
  inset: -1px; /* the layer covers the 1px border, so hover shows no lighter rim */
  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-icon-btn:hover {
    --oa-state: var(--opacity-state-hover);
  }
}

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

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

.oa-icon-btn > .oa-icon {
  font-size: var(--size-icon-lg);
}

.oa-icon-btn--filled {
  background-color: var(--color-primary);
  color: var(--color-on-primary);
}

.oa-icon-btn--tonal {
  background-color: var(--color-secondary-container);
  color: var(--color-on-secondary-container);
}

.oa-icon-btn--outlined {
  border-color: var(--color-outline-variant);
}

/* Toggle on: the family's selected look plus the filled glyph, its non-color cue (D-CAI-14). */
.oa-icon-btn[aria-pressed="true"]:not(.oa-icon-btn--filled, .oa-icon-btn--tonal, :disabled, [aria-disabled="true"]) {
  border-color: transparent;
  background-color: var(--color-primary-container);
  color: var(--color-on-primary-container);
}

.oa-icon-btn[aria-pressed="true"] > .oa-icon {
  font-variation-settings: "FILL" 1;
}

.oa-icon-btn:is(:disabled, [aria-disabled="true"]) {
  --oa-state: 0;
  color: color-mix(in srgb, var(--color-on-surface) calc(var(--opacity-state-disabled-content) * 100%), transparent);
  cursor: default;
}

.oa-icon-btn:is(.oa-icon-btn--filled, .oa-icon-btn--tonal):is(:disabled, [aria-disabled="true"]) {
  background-color: color-mix(in srgb, var(--color-on-surface) calc(var(--opacity-state-disabled-container) * 100%), transparent);
}

.oa-icon-btn--outlined:is(:disabled, [aria-disabled="true"]) {
  border-color: color-mix(in srgb, var(--color-on-surface) calc(var(--opacity-state-disabled-container) * 100%), transparent);
}

@media (forced-colors: active) {
  .oa-icon-btn:is(:disabled, [aria-disabled="true"]) {
    border-color: GrayText;
    color: GrayText;
  }
}
