/* The one button, in one size. Every page with a button links this after tokens.css, and
   every component pulls it into its shadow root with BUTTON_CSS
   (components/button-css.js) first in its styles, so a button looks the same
   wherever it is. Don't restyle .btn in a component or page; reach for a
   variant here, or add one here for everyone.

   .btn               the primary action — one per view: filled --vo-blue-dark
                      (4.93:1 under white text; --vo-blue is only 3.01:1)
   .btn.ghost         a secondary action: white, a field-strength border
   .btn.danger        a destructive confirm: filled dark red
   .btn.ghost.danger  a destructive action that isn't the confirm: red text
   [data-confirm]     a destructive button confirming in place (set by
                      components/confirm-step.js, never by hand)
   .btn.icon          a square, icon-only button (give it an aria-label)
   .btn.wide          full width
   .btn-group         buttons joined into one control (a split button, or a
                      pager: the arrows with Today between)

   A ghost with aria-pressed="true" (a toggle) or aria-expanded="true" (it
   opened something) shows as on. Hover only repaints a button you can press.

   Every .btn is the control height (--vo-control-h: 36px, 44px on touch) —
   a height, not a minimum, so a row with a taller field beside it can't stretch
   it, and 16px semibold. There is no other size: don't add one in a component. */
.btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: var(--vo-control-h, 36px);
  margin: 0;
  padding: 0 0.9rem;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid var(--vo-blue-dark, #2278a0);
  border-radius: var(--vo-radius, 6px);
  background: var(--vo-blue-dark, #2278a0);
  color: #fff;
}
.btn:is(:disabled, [aria-disabled="true"]) { opacity: 0.5; cursor: default; }
.btn[aria-busy="true"] { opacity: 0.75; cursor: progress; }
.btn:focus-visible { outline: 2px solid var(--vo-blue-dark, #2278a0); outline-offset: 2px; position: relative; z-index: 1; }
.btn svg { flex: none; width: 20px; height: 20px; }

.btn.ghost { background: var(--vo-bg, #fff); border-color: var(--vo-border-field, #7d8c9b); color: var(--vo-text, #1a2733); }
/* --vo-blue-darker, not --vo-blue-dark: blue-dark on blue-light is 4.39:1. */
.btn.ghost:is([aria-pressed="true"], [aria-expanded="true"]) { background: var(--vo-blue-light, #e6f4fb); border-color: var(--vo-blue-dark, #2278a0); color: var(--vo-blue-darker, #1b6188); }
.btn.danger { background: var(--vo-red-dark, #8a1f1f); border-color: var(--vo-red-dark, #8a1f1f); color: #fff; }
.btn.ghost.danger { background: var(--vo-bg, #fff); border-color: var(--vo-border-field, #7d8c9b); color: var(--vo-red-dark, #8a1f1f); }

.btn:not(:disabled, [aria-disabled="true"]):hover { background: var(--vo-blue-darker, #1b6188); border-color: var(--vo-blue-darker, #1b6188); color: #fff; }
.btn.ghost:not(:disabled, [aria-disabled="true"]):hover { background: var(--vo-surface, #f4f7fa); border-color: var(--vo-blue-dark, #2278a0); color: var(--vo-text, #1a2733); }
.btn.danger:not(:disabled, [aria-disabled="true"]):hover { background: var(--vo-red-darker, #6b1515); border-color: var(--vo-red-darker, #6b1515); color: #fff; }
.btn.ghost.danger:not(:disabled, [aria-disabled="true"]):hover { background: var(--vo-red-light, #fdecec); border-color: var(--vo-red-dark, #8a1f1f); color: var(--vo-red-dark, #8a1f1f); }

.btn.icon { width: var(--vo-control-h, 36px); height: var(--vo-control-h, 36px); padding: 0; flex: none; }
.btn.wide { display: flex; width: 100%; }

.btn-group { display: inline-flex; }
.btn-group > .btn:not(:first-child) { margin-left: -1px; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.btn-group > .btn:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.btn-group > .btn:hover { position: relative; }

/* A button confirming in place (components/confirm-step.js): pressed once, it
   says "Confirm delete" and fades from the white it was to the solid
   destructive confirm over the arming time (--vo-confirm-arm, set by the
   script) — a press while it fades does nothing. The text turns white halfway,
   where it's still readable on the deepening red. Leaving the confirm snaps back
   (the transition is only on the confirm state). Its colours are !important so
   the variant it started as (and that variant's hover) can't paint over them.
   Keyed on button, not .btn, so a small glyph button (a ×) confirms the same way. */
button[data-confirm] {
  background: var(--vo-red-dark, #8a1f1f) !important; border-color: var(--vo-red-dark, #8a1f1f) !important; color: #fff !important;
  transition: background-color var(--vo-confirm-arm, 800ms) ease-out, border-color var(--vo-confirm-arm, 800ms) ease-out, color 0s calc(var(--vo-confirm-arm, 800ms) / 2);
}
button[data-confirm="arming"] { cursor: default; }
button[data-confirm="ready"]:hover { background: var(--vo-red-darker, #6b1515) !important; border-color: var(--vo-red-darker, #6b1515) !important; }
/* No fade: it arms pale, and fills when it's ready. */
@media (prefers-reduced-motion: reduce) {
  button[data-confirm] { transition: none; }
  button[data-confirm="arming"] { background: var(--vo-red-light, #fdecec) !important; color: var(--vo-red-dark, #8a1f1f) !important; }
}
/* What the confirm will do (role="status"), for a screen reader only: on
   screen the button's own label says it, and a line of text appearing beside
   it would shift the button out from under the second press. Clipped, not
   display: none, so it stays in the accessibility tree and is read out. */
.confirm-note { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.confirm-note[hidden] { display: none; }

/* Last and !important, so no variant or local layout rule that sets display
   can un-hide a hidden button. */
.btn[hidden] { display: none !important; }
