/* Reset and the browser surfaces nobody draws: selection, caret, focus,
   scrollbars and figures. Themed from the palette, because a default blue
   selection on an orange product is the cheapest tell of an assembled page. */

*, *::before, *::after { box-sizing: border-box; }
/* `hidden` always wins: a component's own display must never resurrect it. */
[hidden] { display: none !important; }
html {
  font-size: var(--base-size, 16px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-gutter: stable;
}
body {
  margin: 0;
  min-height: 100dvh;
  /* 15px / 1.5 in the system face, the one line every screen's type comes from. */
  font: var(--t0) / var(--lh, 1.5) var(--font);
  /* §7a: a hair of tracking, near the face's own; .3px read as loose at 15px. */
  letter-spacing: .01px;
  color: var(--ink-2);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  /* §0.14: nothing overflows its box, in any language, at any width. */
  overflow-wrap: anywhere;
  word-break: normal;
  caret-color: var(--accent-ink);
  accent-color: var(--accent);
}
/* Joined scripts (Arabic and its neighbours), CJK and the Brahmic scripts break or crowd when tracked:
   i18n.js marks those languages and they keep the face's own spacing. */
:root[data-no-tracking] body { letter-spacing: normal; }
/* Icons are the exception: an icon written into a heading or a sentence stays on that line.
   As a block it pushed the words onto the line below it ("✦" over "Set up a channel with AI").
   Inside a flex or grid control the parent lays it out, so this changes nothing there. */
img, svg:not(.ci), video, canvas { display: block; max-width: 100%; }
/* A heading's lead icon: sized with the heading, a word's gap before the text. The gap is
   the margin, so markup puts no space between the icon and the words. */
:is(h1, h2, h3, h4, h5, h6) > .ci:first-child { --ci-size: 1.15em; margin-inline-end: .3em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:where(h1, h2, h3, h4, h5, h6) {
  margin: 0;
  color: var(--ink);
  font-weight: var(--heading-weight, 700);
  line-height: 1.2;
  text-wrap: balance;
}
h1 { font-size: var(--t4); }
h2 { font-size: var(--t2); }
h3 { font-size: var(--t1); }
h4 { font-size: var(--t0); }
p { margin: 0; text-wrap: pretty; }
:where(ul, ol) { margin: 0; padding: 0; }
table { border-collapse: collapse; }
code, kbd, samp { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92em; }
/* Code, keys and addresses read left to right in every language; isolated so the sentence around them keeps its own direction. */
:root[dir="rtl"] :is(code, kbd, samp, pre) { direction: ltr; unicode-bidi: isolate; }
:root[dir="rtl"] pre { text-align: left; }
/* Icons that point along the line of reading (icons.js FLIP) face the other way in RTL. */
:root[dir="rtl"] .ci-flip { scale: -1 1; }
/* What a person types, or an assistant writes back, takes its direction from its own first letter:
   a Hebrew reply in an English app reads right to left, an English one in an Arabic app left to right. */
textarea, .agent-msg, [data-user-text] { unicode-bidi: plaintext; }
:root[dir="rtl"] input:is([type="url"], [type="email"]) { direction: ltr; text-align: end; }
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 1.6em;
  padding: 0 .35em;
  border: var(--rule-w) solid var(--rule-strong);
  border-bottom-width: calc(var(--rule-w) + 1px);
  border-radius: 6px;
  font-size: var(--t-2);
  line-height: 1.5;
  color: var(--ink-2);
}
.num, [data-num] { font-variant-numeric: tabular-nums; }

::selection { background: color-mix(in oklab, var(--accent-ink) 26%, transparent); color: var(--ink); }

/* One focus ring everywhere: 3 px, offset, never hidden (WCAG 2.4.7 / 2.4.11). */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* Scrollbars follow the product: thin, the rule colour, the accent on hover. */
* { scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--rule-strong); border: 3px solid transparent; border-radius: 99px; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--ink-3); }
::-webkit-scrollbar-track { background: transparent; }

.visually-hidden, .sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  z-index: 100;
  inset-block-start: var(--s1);
  inset-inline-start: var(--s1);
  padding: var(--s0) var(--s2);
  border-radius: var(--radius-pill);
  background: var(--inverse);
  color: var(--on-inverse);
  font-weight: 700;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* §0.11: a content link shows a short line that stretches with a spring on
   hover and focus. Navigation, buttons and anything button-shaped opt out by
   not being `.link` or a bare <a> inside `.prose`. */
:is(.link, .prose a:not([class])) {
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) no-repeat 0 100% / max(33%, 1.5em) 2px;
  padding-bottom: 2px;
  transition: background-size .6s var(--ease-spring);
}
:is(.link, .prose a:not([class])):is(:hover, :focus-visible) { background-size: 100% 2px; }
:root[data-theme^="contrast"] :is(.link, .prose a:not([class])) { background-size: max(33%, 1.5em) 3px; }
@media (forced-colors: active) {
  :is(.link, .prose a:not([class])) { background: none; text-decoration: underline; }
}

/* Motion off: the system setting or the display menu's switch. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after {
  animation-duration: .01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .01ms !important;
}
