/* =============================================================================
   Smartrise base styles (v1.289 design system).
   Bare elements styled with the tokens so pages not yet moved onto the kit stop
   looking broken. Every rule is wrapped in :where() — zero specificity — so any
   class a legacy page already uses still wins. No raw colours here (design lint).
   ============================================================================= */
:where(html) { -webkit-text-size-adjust: 100%; }
:where(body) {
  margin: 0;
  background: var(--sr-bg);
  color: var(--sr-text);
  font-family: var(--sr-font-body);
  font-size: var(--sr-size-md);
  line-height: var(--sr-leading);
  -webkit-font-smoothing: antialiased;
}
:where(h1, h2, h3, h4) {
  font-family: var(--sr-font-display);
  line-height: var(--sr-leading-tight);
  font-weight: var(--sr-weight-bold);
  letter-spacing: normal;
  text-transform: none;
  margin: 0 0 var(--sr-space-3);
}
:where(h1, h2) { letter-spacing: var(--sr-track-tight); } /* v1.326 P2: page titles sit tighter */
:where(h1) { font-size: var(--sr-size-3xl); }
:where(h2) { font-size: var(--sr-size-2xl); }
:where(h3) { font-size: var(--sr-size-xl); }
:where(h4) { font-size: var(--sr-size-lg); }
/* heading and link COLOURS only on pages moved onto the kit: older pages have headings and links that
   take their colour from a dark band around them (white on teal), and a colour here would win over that */
:where(.sr-app, .sr-field-app) :where(h1, h2, h3, h4) { color: var(--sr-heading); }
/* v1.326 P2: a section is a step below a page — h3 / h4 on kit pages in Public Sans 600 (Satoshi has no 600; it stays
   for page titles and big figures) */
:where(.sr-app, .sr-field-app) :where(h3, h4) { font-family: var(--sr-font-body); font-weight: var(--sr-weight-semibold); letter-spacing: normal; }
:where(.sr-app, .sr-field-app) :where(a) { color: var(--sr-link); text-underline-offset: 2px; }
:where(.sr-app, .sr-field-app) :where(a:hover) { color: var(--sr-heading); }
:where(code, kbd, samp) { font-family: var(--sr-font-mono); font-size: var(--sr-size-sm); }
:where(small) { font-size: var(--sr-size-xs); } /* v1.326 P2: on the scale (the browser's "smaller" made 11.67 px) */
:where(td, th, time, .num) { font-variant-numeric: tabular-nums; }
:where(hr) { border: 0; border-top: 1px solid var(--sr-line); margin: var(--sr-space-5) 0; }

/* form controls */
:where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="hidden"]), select, textarea) {
  font: inherit;
  font-size: var(--sr-size-md);
  color: var(--sr-text);
  background: var(--sr-surface);
  border: 1px solid var(--sr-control-line); /* v1.326: 3:1 against the surface (WCAG 1.4.11) */
  border-radius: var(--sr-radius-md);
  min-height: var(--sr-control-h);
  padding: 0 var(--sr-space-3);
  box-sizing: border-box;
  max-width: 100%;
  transition: border-color var(--sr-dur-fast) var(--sr-ease), box-shadow var(--sr-dur-fast) var(--sr-ease);
}
:where(textarea) { padding: var(--sr-space-2) var(--sr-space-3); min-height: 88px; line-height: var(--sr-leading); }
:where(input, select, textarea):where(:hover) { border-color: var(--sr-text-faint); }
/* v1.326 P6: one drawn chevron on a kit page's selects, the same on every device (two token-coloured strokes, no image) */
:is(.sr-app, .sr-field-app, .sr-portal) select:not([multiple]):not([size]), select.sr-select:not([multiple]):not([size]) {
  -webkit-appearance: none; appearance: none; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--sr-text-soft) 50%), linear-gradient(135deg, var(--sr-text-soft) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
:where(input, select, textarea)::placeholder { color: var(--sr-text-faint); }
:where(input[type="checkbox"], input[type="radio"]) { accent-color: var(--sr-link); width: 16px; height: 16px; }
:where(input:disabled, select:disabled, textarea:disabled) { background: var(--sr-surface-2); color: var(--sr-text-faint); cursor: not-allowed; }

/* buttons: sentence case and the body font only. Size, padding, colour and border are left to each
   page — legacy icon buttons size themselves with the browser's own padding (34 px squares) */
:where(button, input[type="submit"], input[type="button"], input[type="reset"]) {
  font-family: inherit;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
}
:where(button:disabled) { cursor: not-allowed; }

/* tables */
:where(table) { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
:where(th) {
  text-align: left;
  font-size: var(--sr-size-sm);
  font-weight: var(--sr-weight-semibold);
  color: var(--sr-text-soft);
  text-transform: none;
  letter-spacing: normal;
  padding: var(--sr-space-2) var(--sr-space-3);
  border-bottom: 1px solid var(--sr-line);
}
:where(td) { padding: var(--sr-space-2) var(--sr-space-3); border-bottom: 1px solid var(--sr-line); }

/* focus ring: always visible for keyboard users (v1.326: brand teal, 6.2:1) */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--sr-focus);
  outline-offset: 2px;
}
/* a text box shows its focus on its own edge: a teal border, a 1 px teal line and the soft halo (no offset outline) */
:where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="submit"], [type="button"], [type="reset"]), select, textarea):focus-visible {
  outline: 0; border-color: var(--sr-focus); box-shadow: 0 0 0 1px var(--sr-focus), var(--sr-focus-ring);
}

/* v1.326 PREMIUM: an icon from ui_icon() sits on the text's baseline and never shrinks in a flex row (was an inline style) */
.ui-icon { vertical-align: -0.15em; flex: none; }

:where([hidden]) { display: none !important; }
