/* quality.css: accessibility and performance overrides. Loaded last, after styles.css and conversion.css, on every page.
 * Nothing here changes layout on purpose; each rule fixes a measured problem. */

/* ---- Images ---- */
/* <picture> wraps the artwork so browsers that read WebP get the smaller file and the rest get the JPEG. */
picture { display: block; }
@media (min-width: 900px) {
  /* Hero artwork: WebP where the browser supports image-set() with type(), the original JPEG everywhere else. */
  .hero::before {
    background-image: url(assets/hero.jpg);
    background-image: image-set(url(assets/hero.webp) type("image/webp"), url(assets/hero.jpg) type("image/jpeg"));
  }
}

/* ---- Contrast of control boundaries (WCAG 1.4.11, 3:1) ---- */
/* The old border (#2a2a38) was about 1.3:1 against the field and the panel, so the edge of a text box was hard to see. */
:root { --border-ctl: #6a6a84; --state-on: #a5b4fc; }
select,
input[type=number],
.idea-form input[type=text],
.promptbox textarea.prompt-text,
.seg-ctl span,
.chips span { border-color: var(--border-ctl); }
select:hover, input[type=number]:hover, .idea-form input[type=text]:hover { border-color: #8d8da8; }
/* Placeholder text: the browser default measured 4.3:1 here (and Firefox fades it further). */
::placeholder { color: var(--muted); opacity: 1; }
/* Selected state: a lighter, thicker edge so "on" does not depend on a faint tint alone. */
.seg-ctl input:checked + span,
.chips input:checked + span,
.card[aria-pressed=true] { border-color: var(--state-on); box-shadow: inset 0 0 0 1px var(--state-on); }
/* Windows high-contrast mode drops background colors, so mark the selected choice with an outline. */
@media (forced-colors: active) {
  .seg-ctl input:checked + span,
  .chips input:checked + span,
  .card[aria-pressed=true] { outline: 2px solid Highlight; outline-offset: -4px; }
  .btn, .copybtn, .ghostbtn, .chip-btn, .card { border: 1px solid ButtonText; }
}

/* ---- Touch targets of at least 44 px (WCAG 2.5.8) ---- */
a.linkbtn { display: inline-flex; align-items: center; }
input[type=range] { min-height: 44px; }
.crumb a { display: inline-flex; align-items: center; min-height: 44px; }
.crumb { margin-bottom: 0; }
/* Short labels were under 44 px wide ("Costs" 42 px in the header, "FAQ" 34 px in the footer). */
.site-header nav a { min-width: 44px; justify-content: center; }
.flinks a { min-width: 44px; }
.site-footer p > a:first-child { display: inline-block; padding: 11px 0; }
/* "Details" sits at the end of a one-line note: grow its tap area without moving the text. */
.ref-note a { position: relative; }
.ref-note a::after { content: ""; position: absolute; left: -10px; right: -10px; top: -12px; bottom: -12px; }

/* ---- Keyboard focus ---- */
/* The skip link sits above the sticky header and is always readable when focused. */
.skip { z-index: 20; font-weight: 600; text-decoration: none; padding: 11px 14px; }
.skip:focus { outline: 2px solid #fff; outline-offset: 2px; }
/* Scrollable tables can be reached and scrolled from the keyboard; show where focus is. */
.tbl:focus-visible, .table-wrap:focus-visible { outline: 2px solid var(--state-on); outline-offset: 2px; }

/* ---- Status messages ---- */
/* These live regions stay in the page while empty (visually hidden), so a screen reader
 * announces the first message too. A region that is created or un-hidden together with
 * its text is often not announced. */
.copied-panel:empty,
.pick-result:empty {
  position: absolute; width: 1px; height: 1px; margin: 0 !important; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---- Motion ---- */
/* The site has no animation today; this keeps it that way for people who ask for reduced motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---- Not-found page ---- */
.nf-list { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-wrap: wrap; gap: 12px; }
.nf-note { max-width: 720px; }
