/* styles/system.css - redesign global styling. Scoped under .ui so it only applies on
   opted-in pages and overrides base.css element rules via class specificity. */

.ui {
  background: var(--bg);
  color: var(--text-body);
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  /* Dark-theme the native form controls (notably the <select> option popup, which otherwise
     renders light-on-white because the select background is transparent). */
  color-scheme: dark;
}
.ui select option,
.ui select optgroup { background-color: #141416; color: #f0f1f3; }
.ui .container {
  max-width: var(--container-default);
  margin: 0 auto;
  padding: var(--sp-5);
}

/* type scale (Balanced) */
.ui h1 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--h1-size);
  line-height: var(--h1-lh);
  letter-spacing: var(--h1-track);
  color: var(--text);
  text-wrap: balance;
  margin: 0 0 var(--sp-3);
}
.ui h2 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--h2-size);
  line-height: var(--h2-lh);
  letter-spacing: var(--h2-track);
  color: #ededf0;
  text-wrap: balance;
  margin: 0 0 var(--sp-2);
}
.ui h3 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--h3-size);
  line-height: var(--h3-lh);
  color: var(--text-2);
  margin: 0 0 var(--sp-2);
}
.ui p {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: var(--body-size);
  line-height: var(--body-lh);
  color: var(--text-body);
  max-width: 82ch;
  text-wrap: pretty;
  margin: 0 0 var(--sp-4);
}
.ui .page-head { margin-bottom: var(--sp-5); }
.ui .lede {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: var(--lede-size);
  line-height: var(--lede-lh);
  color: var(--text-body);
  max-width: 56ch;
}
.ui .rule { border: 0; height: 1px; background: var(--hairline); margin: var(--sp-6) 0; }

/* eyebrow / label / caption */
.ui .eyebrow {
  display: block;
  font: 600 11px/1 var(--font-mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--sp-3);
}
.ui .label {
  display: block;
  font: 600 10.5px/1 var(--font-sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-2);
}
.ui .caption {
  font: 400 12px/1.45 var(--font-sans);
  color: var(--text-muted);
}

/* links: underline is off by default (var(--link-ul) == 0); the "Show link underlines"
   setting raises it to 1px. Hover always reveals the underline. Two roles:
   .ref = ordinary cross-reference (accent color, solid underline);
   .def = definition link (blends into prose at body color, dotted underline). */
.ui a {
  color: var(--accent-link);
  text-decoration: none;
  border-bottom: var(--link-ul) solid rgba(var(--accent-rgb), 0.45);
}
.ui a:hover { color: var(--accent-link); border-bottom: 1px solid rgba(var(--accent-rgb), 0.55); }

.ui a.ref { color: var(--accent-link); border-bottom-style: solid; }
.ui a.ref:hover { border-bottom: 1px solid rgba(var(--accent-rgb), 0.55); }

.ui a.def { color: inherit; border-bottom: var(--link-ul) dotted rgba(255, 255, 255, 0.30); }
.ui a.def:hover { color: var(--accent); border-bottom: 1px dotted var(--accent); }

/* inline code */
.ui code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  color: var(--accent-link);
  background: rgba(var(--accent-rgb), 0.10);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
}

/* numeric readout */
.ui .readout {
  font: 500 13px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}
.ui .readout b { color: var(--accent); font-weight: 600; }

/* global polish */
.ui ::selection { background: var(--accent-muted); color: #fff; }
.ui ::placeholder { color: var(--text-muted); opacity: 1; }
.ui :focus-visible { outline: var(--focus-ring); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .ui * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
