/*
 * Smartie — design tokens
 *
 * This is the only file in the widget allowed to contain a literal colour, font,
 * size, or timing. chat.critical.css and chat.noncritical.css consume these and
 * nothing else. Retheming the widget means editing this file and nothing else.
 *
 * Load it on the host document (not inside the shadow root) so the tokens
 * inherit through the shadow boundary and the host page can override any of
 * them from its own stylesheet. The :host selector is a fallback for when the
 * widget is adopted standalone.
 */

:root,
:host {
  /* ---------------------------------------------------------------------
   * Palette — the Smartie designs, checked against the site's own Sass
   * palette (scss/settings.scss) so nothing drifts from the rest of the page.
   * ------------------------------------------------------------------ */
  /* Every ink value clears 4.5:1 on --smartie-color-paper, including the faint
   * one, because it carries the 12px legal line. */
  --smartie-color-ink: #363f48;
  --smartie-color-ink-faint: #757575;

  /* The designs draw links and citation numbers in the logo's #0088ce, which is
   * only 3.9:1 on white and fails at body size. The same blue one step down is
   * 4.9:1 and is the site's own `blue`, so text uses that and #0088ce is kept
   * for the things that are decoration rather than words. */
  --smartie-color-brand: #0077b8;
  --smartie-color-brand-deep: #004977;
  --smartie-color-brand-bright: #0088ce;
  --smartie-color-brand-pale: #60c2f5;
  --smartie-color-brand-mist: #bde9ff;

  --smartie-color-paper: #ffffff;
  --smartie-color-paper-sunk: #f5f5f5;
  --smartie-color-paper-tint: #e6f2f9;
  --smartie-color-rule: #bfe1f3;

  --smartie-color-on-brand: #ffffff;
  --smartie-color-danger: #8b2100;
  --smartie-color-danger-bg: #fff7ed;

  /* Focus ring. 4.2:1 on paper, which is every ground the widget draws on now
   * that nothing in it is a dark panel. */
  --smartie-color-focus: #0083b8;

  /* Composites that carry colour, so they have to live here too. */
  --smartie-shadow-float: 0 0.125rem 0.375rem rgb(14 28 39 / 35%);

  /* The transcript fades out under the head rather than running into it. Only
   * the alpha matters; the colour is never painted. */
  --smartie-fade-mask: linear-gradient(to bottom, rgb(0 0 0 / 0%) 0, rgb(0 0 0 / 100%) 3rem);

  /* ---------------------------------------------------------------------
   * Type — the site's brand face, with a system stack behind it. The widget
   * loads no webfont of its own; filson-pro is already on the page.
   * ------------------------------------------------------------------ */
  --smartie-font-body: "filson-pro", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --smartie-font-display: var(--smartie-font-body);

  --smartie-size-tag: 0.5rem;
  --smartie-size-xs: 0.6875rem;
  --smartie-size-marker: 0.75rem;
  --smartie-size-sm: 0.875rem;
  --smartie-size-base: 1rem;
  --smartie-size-lg: 1.125rem;
  /* 28px on a phone up to 40px from about 970px out, which is where the design
   * settles. */
  --smartie-size-display: clamp(1.75rem, 1.05rem + 2.4vw, 2.5rem);

  --smartie-weight-medium: 500;
  --smartie-weight-bold: 700;

  --smartie-leading-tight: 1.2;
  --smartie-leading-body: 1.55;
  /* Tighter than the site's body copy: a chat reads as a column of short
   * paragraphs rather than as an article. */
  --smartie-leading-message: 1.4;

  --smartie-tracking-tag: 0.16em;

  /* ---------------------------------------------------------------------
   * Space and shape
   * ------------------------------------------------------------------ */
  --smartie-space-2xs: 0.25rem;
  --smartie-space-xs: 0.5rem;
  --smartie-space-sm: 0.75rem;
  --smartie-space-md: 1rem;
  --smartie-space-lg: 1.5rem;
  --smartie-space-xl: 2rem;
  --smartie-space-2xl: 3rem;

  --smartie-radius-sm: 0.25rem;
  --smartie-radius-field: 0.5rem;
  --smartie-radius-bubble: 1.25rem;
  --smartie-radius-pill: 62.4375rem;

  --smartie-border-hairline: 0.0625rem;
  --smartie-border-accent: 0.125rem;
  --smartie-focus-width: 0.1875rem;
  --smartie-focus-offset: 0.125rem;

  /* Minimum comfortable pointer target. Controls drawn smaller than this carry
   * an invisible pad out to it. */
  --smartie-target-min: 2.75rem;

  /* Room under the last answer. The page raises this where it floats something over the
     bottom of the transcript, since a transcript cannot be scrolled past its own end. */
  --smartie-log-tail: 2rem;

  --smartie-send-size: 2rem;
  --smartie-scroll-size: 2rem;
  /* 21px between the button and the message box, measured off the design. */
  --smartie-scroll-gap: 1.3125rem;
  --smartie-wordmark-width: 6.5rem;
  --smartie-figure-width: 9rem;
  --smartie-figure-inset: 0rem;

  /* ---------------------------------------------------------------------
   * The shell — the site's own container, restated so the chat's content lines
   * up with the header above it and the footer below it. The site drops the
   * gutter and pins a width from `md` up (scss/base/_container.scss), and these
   * are the same numbers.
   * ------------------------------------------------------------------ */
  --smartie-shell-gutter: 1.25rem;
  --smartie-shell-width: 100%;

  /* ---------------------------------------------------------------------
   * Motion — hover feedback, nothing else.
   * ------------------------------------------------------------------ */
  --smartie-duration-fast: 120ms;
}

@media (min-width: 48rem) {
  :root,
  :host {
    --smartie-figure-width: 15.75rem;
    --smartie-wordmark-width: 9.25rem;
  }
}

@media (min-width: 64rem) {
  :root,
  :host {
    --smartie-shell-gutter: 0rem;
    --smartie-shell-width: 54.6875rem;
    --smartie-figure-inset: 6rem;
  }
}

@media (min-width: 80rem) {
  :root,
  :host {
    --smartie-shell-width: 71.25rem;
  }
}

@media (min-width: 90rem) {
  :root,
  :host {
    --smartie-shell-width: 82.5rem;
  }
}
