/* =========================================================================
   Component — buttons
   A button is a <button>; a link that looks like a button is an <a class="btn">.
   ========================================================================= */

/* **Paired with `[hidden]`, because the line below defeats it otherwise.**
   `[hidden] { display: none }` in `base.css` and `.btn` have the same
   specificity, and this sheet loads later — so a `<button class="btn" hidden>`
   stayed on screen and in the tab order. `base.css` names the rule and the
   classes it applies to; `U-796` is the first to hide a button this way and
   `portal/security.html`'s reveal is the button. */
.btn[hidden] {
  display: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--control-h);
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn[disabled],
.btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: .6;
}

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

.btn-primary:hover {
  background: var(--sd-primary-hover);
  color: var(--sd-on-primary);
}

.btn-outline {
  background: var(--doc-panel);
  color: var(--doc-ink);
  border-color: var(--doc-line);
}

.btn-outline:hover {
  background: var(--sd-surface-alt);
  color: var(--doc-ink);
}

.btn-quiet {
  background: transparent;
  color: var(--sd-secondary);
  padding: 0 10px;
}

.btn-quiet:hover {
  background: var(--sd-surface-alt);
}

.btn-block {
  width: 100%;
}

/* --- On the theme-invariant brand surfaces (hero, footer, sidebar) ------- *
 * These are dark teal in BOTH themes, so the themed --sd-primary would turn
 * teal-on-teal in dark mode. Pin the mint.
 * ------------------------------------------------------------------------ */

.on-brand .btn-primary {
  background: var(--brand-mint);
  color: var(--brand-mint-ink);
}

.on-brand .btn-primary:hover {
  background: var(--brand-mint-hover);
  color: var(--brand-mint-ink);
}

.on-brand .btn-ghost {
  background: transparent;
  color: var(--brand-on-dark);
  border-color: color-mix(in srgb, var(--brand-on-dark) 55%, transparent);
}

.on-brand .btn-ghost:hover {
  background: color-mix(in srgb, var(--brand-on-dark) 14%, transparent);
  color: var(--brand-on-dark);
}

/* --- Icon button --------------------------------------------------------- */

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--doc-line);
  border-radius: var(--radius);
  background: var(--doc-panel);
  color: var(--doc-ink);
  cursor: pointer;
  transition: background .15s;
}

.icon-btn:hover {
  background: var(--sd-surface-alt);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.on-brand .icon-btn {
  background: color-mix(in srgb, var(--brand-on-dark) 8%, transparent);
  border-color: color-mix(in srgb, var(--brand-on-dark) 30%, transparent);
  color: var(--brand-on-dark);
}

.on-brand .icon-btn:hover {
  background: color-mix(in srgb, var(--brand-on-dark) 18%, transparent);
}

/* --- The copy control (U-859) ------------------------------------------- */
/* An icon button the height of .btn-small, so it sits in a table row and still
   clears the 24 px pointer target; its result wraps beside it, in the body
   font even inside a .table-mono cell. */

.icon-btn-small {
  width: 32px;
  height: 32px;
}

.icon-btn-small svg,
.copy-value .btn svg {
  width: 16px;
  height: 16px;
}

.copy-value {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  vertical-align: middle;
}

.copy-value-status {
  font-family: var(--font);
  font-size: 12.5px;
  color: var(--doc-ink-soft);
}

/* --- A button inside a table row ----------------------------------------- */
/* Shorter than --control-h, which is sized for a form. Still 32 px tall and
   with real padding, so it clears the 24 px minimum a pointer target needs and
   does not shrink the row's hit area to the glyph. */

.btn-small {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

/* --- The destructive confirmation ----------------------------------------- */
/* Reached only as the SECOND press of a two-step control: the first press asks,
   this one acts. The colour is not the warning — the label is ("Confirm
   removal"), because colour never carries meaning alone (audit rule E-4).
   --sd-on-primary is the ink for a filled semantic surface; --sd-error is a
   background here rather than text, so the contrast pair to check is
   on-primary against error, not error against panel. */

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

.btn-danger:hover {
  background: var(--sd-error);
  color: var(--sd-on-primary);
  filter: brightness(.92);
}
