/**
 * The shared components' colours — 4.1b.
 *
 * WHY THIS FILE EXISTS. Seven colour defects shipped with fully green test
 * suites (spec §7.52). Every one was a *usage* mistake: the palette was right
 * and the call site reached for the wrong role. 4.1a's primary button asked for
 * `accent-wash` — then named `accent-fill` — which in dark mode is the same
 * navy as the card behind it, so the button rendered at 1.00:1. Invisible.
 *
 * So role choices live HERE, once, and call sites choose nothing. A screen
 * writes `<Button variant="primary">`; it cannot pick a colour, correctly or
 * otherwise. That is the fix — not vigilance, but removing the choice.
 *
 * Rules for anyone editing this file:
 *   - A solid fill is `accent` + `on-accent`, paired with `accent-hover` +
 *     `on-accent-hover`. Never `accent-wash`, which is a tinted BACKGROUND for
 *     text and equals `surface` in dark.
 *   - Anything with an edge a person must find — inputs, controls — uses
 *     `border-strong`, which owes 3:1 (WCAG 1.4.11). Plain `border` is for
 *     decoration.
 *   - Change nothing here without running the rendered-contrast check. It opens
 *     every screen in both themes and measures what was actually painted, which
 *     is the only thing that catches this class.
 */

.etv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--etv-space-2);
  /* 44px is the accessible minimum target, matching apps/web's form buttons. */
  min-height: 44px;
  padding: var(--etv-space-3) var(--etv-space-8);
  border: 1px solid transparent;
  border-radius: var(--etv-radius-sm);
  font: inherit;
  font-weight: var(--etv-weight-semibold);
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--etv-dur-quick) var(--etv-ease-out),
    color var(--etv-dur-quick) var(--etv-ease-out),
    border-color var(--etv-dur-quick) var(--etv-ease-out);
}

/* Shares the hover appearance rather than inventing a third one, and only the
   timing differs — the rule apps/web settled at 3.11. On a touch device, where
   hover does not exist, this is the ONLY feedback a press produces. */
.etv-btn:active:not(:disabled) {
  transition-duration: var(--etv-dur-press);
}

.etv-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.etv-btn--block {
  width: 100%;
}

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

/* The PAIR moves, not just the fill. In light, navy-700 on gold-ink is 2.73:1 —
   a fail — so the text must flip to white; a hover that changed only the
   background would be wrong in one theme. §7.46. */
.etv-btn--primary:hover:not(:disabled),
.etv-btn--primary:active:not(:disabled) {
  background: var(--etv-accent-hover);
  color: var(--etv-on-accent-hover);
}

.etv-btn--secondary {
  background: transparent;
  color: var(--etv-link);
  border-color: var(--etv-border-strong);
}

.etv-btn--secondary:hover:not(:disabled),
.etv-btn--secondary:active:not(:disabled) {
  border-color: var(--etv-accent);
  background: var(--etv-sunk);
}

.etv-field {
  display: grid;
  gap: var(--etv-space-2);
  align-content: start;
}

.etv-field__label {
  font-size: var(--etv-text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--etv-ink-strong);
  font-weight: var(--etv-weight-semibold);
}

.etv-field__input {
  width: 100%;
  min-height: 44px;
  padding: var(--etv-space-3);
  font: inherit;
  color: var(--etv-ink);
  /* `sunk`, not `surface`: on a card, which is already `surface`, a surface
     input is the same colour as its own container. */
  background: var(--etv-sunk);
  /* `border-strong`, not `border`. The edge is what tells you an input is
     there — WCAG 1.4.11 wants 3:1, and plain `border` measured 1.45:1. */
  border: 1px solid var(--etv-border-strong);
  border-radius: var(--etv-radius-sm);
  transition: border-color var(--etv-dur-quick) var(--etv-ease-out);
}

.etv-field__input:hover {
  border-color: var(--etv-accent);
}

.etv-field__input[aria-invalid='true'] {
  border-color: var(--etv-err);
  border-width: 2px;
}

.etv-field__hint {
  margin: 0;
  font-size: var(--etv-text-sm);
  line-height: var(--etv-leading-sm);
  color: var(--etv-muted);
  max-width: var(--etv-measure-text);
}

.etv-field__error {
  margin: 0;
  font-size: var(--etv-text-sm);
  line-height: var(--etv-leading-sm);
  color: var(--etv-err);
  font-weight: var(--etv-weight-medium);
}

/* Colour is not a message: it reaches only people who can see it, and never
   reaches a screen reader. The marker is what makes the state legible. */
.etv-field__error::before {
  content: '! ';
  font-weight: var(--etv-weight-bold);
}

.etv-card {
  background: var(--etv-surface);
  /* Plain `border` is correct here — a card edge is decoration, not a control
     someone has to locate. */
  border: 1px solid var(--etv-border);
  border-radius: var(--etv-radius-md);
  padding: var(--etv-space-6);
}

.etv-card__title {
  font-family: var(--etv-font-display);
  font-variation-settings: 'WONK' 0;
  color: var(--etv-ink-strong);
  margin: 0 0 var(--etv-space-2);
}

/* Visible focus is how a keyboard user knows where they are. Never removed
   without a replacement. */
.etv-btn:focus-visible,
.etv-field__input:focus-visible {
  outline: 2px solid var(--etv-accent);
  outline-offset: 2px;
}
