/*
 * Prontei design tokens: Caderno 1.0.0 (design/caderno/tokens/tokens.css), merged into the product's
 * base layer. Source of truth for every Prontei surface.
 *
 * Inline-safe: this file reaches every shadow root the extension adds to a host page, so it holds
 * colours, font stacks as plain strings, weights, shapes, the two shadows and motion. Never an
 * @font-face, never a type role or a space scale: those live in the product layer
 * (product-tokens.css, kit.css), under the kit's short names (CA decision D2).
 *
 * Exactly two blocks: light first, dark last. Theme-invariant tokens sit in the light block, which
 * is also :root. Reference pages scope tokens with [data-theme]. In the extension, the inline UI
 * copies this file into each shadow root and swaps the selectors:
 * `:root` → `:host` and `[data-theme="dark"]` → `:host([data-theme="dark"])`.
 * Token names and values must stay identical across both; see DESIGN-SYSTEM.md § Tokens.
 * Hex values are lowercase; Caderno writes them in capitals, and comparisons ignore case.
 */
:root,
:root[data-theme="light"] {
  /* Colour (Caderno). Each has a dark value below. */
  --pr-page: #f5efe4;          /* the page: everything Prontei owns sits on it */
  --pr-sheet: #fffdf9;         /* cards, transcripts, fields: anything laid on the paper */
  --pr-ink: #29221d;           /* text on Prontei-owned pages */
  --pr-muted: #6a6057;         /* secondary text: labels, counts, dates */
  --pr-rule: #e0d6c6;          /* one-pixel dividers, tag outlines, a progress track */
  --pr-red: #bf3a1f;           /* the bird, minute marks, progress, recording dot, link underline, focus */
  --pr-wash: #f6e3d8;          /* the ground behind a quoted or selected passage */
  --pr-danger: #9e1530;        /* error text and destructive actions, never decoration */
  --pr-fill: #29221d;          /* primary button and dictation pill */
  --pr-on-fill: #fffdf9;       /* text on the fill */
  --pr-pill-rec: #ff7e63;      /* recording dot, peak bar, focus ring and alert bar on the fill; the bird there is on-fill */
  --pr-edge: color-mix(in srgb, #29221d 32%, transparent);       /* ghost-button border, strong dividers */
  --pr-field-edge: color-mix(in srgb, #29221d 52%, transparent); /* the outline of a field, 3:1 */
  --pr-fill-hover: color-mix(in oklab, var(--pr-fill) 88%, var(--pr-page)); /* hover on the fill (D3) */
  --pr-text: #111b21;          /* transcript text: WhatsApp's own text colour, not a brand colour */

  /* Elevation: sheets are flat. The pill and lift shadows float; the others float over WhatsApp. */
  --pr-shadow-pill: 0 10px 22px -14px rgb(0 0 0 / .7);   /* the dictation pill */
  --pr-shadow-lift: 0 22px 40px -30px rgb(0 0 0 / .45);  /* a sheet lifted off a page */
  --pr-shadow-trigger: 0 2px 5px #0b141a24;
  --pr-shadow-pop: 0 10px 36px #0b141a33;

  /* Type. Prontei Serif is loaded only by Prontei-owned pages (@prontei/ui/fonts.css), never here. */
  --pr-font-serif: "Prontei Serif", "Source Serif 4", Georgia, "Times New Roman", serif;
  --pr-font-ui: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --pr-font-host: "Segoe UI", "Helvetica Neue", Helvetica, "Lucida Grande", Arial, Ubuntu, Cantarell, "Fira Sans", sans-serif;
  --pr-weight-regular: 400;
  --pr-weight-medium: 500;
  --pr-weight-headline: 560;
  --pr-weight-semibold: 600;
  --pr-weight-bold: 700;
  /* WhatsApp's stack (= --pr-font-host) and metrics, so transcripts read as native text */
  --pr-font: "Segoe UI", "Helvetica Neue", Helvetica, "Lucida Grande", Arial, Ubuntu, Cantarell, "Fira Sans", sans-serif;
  --pr-body: 14.2px;
  --pr-body-lh: 19px;
  --pr-preview: 13px;
  --pr-status: 12px;
  --pr-status-lh: 18px;
  --pr-heading: 12px;
  --pr-action: 11.5px;
  --pr-meta: 11px;

  /* Shape */
  --pr-radius-sheet: 10px;     /* cards on our own pages */
  --pr-radius-control: 999px;  /* buttons, tags, fields, the pill */
  --pr-radius-card: 7.5px;     /* the transcript card in WhatsApp Web: its bubble radius */
  --pr-radius-highlight: 3px;  /* a highlighted passage */
  --pr-radius-drop: 16px;      /* a dashed drop zone */
  --pr-radius-icon: 24%;       /* app icon tile */
  --pr-hairline-width: 1px;
  --pr-focus-width: 2px;       /* outline: var(--pr-focus-width) solid var(--pr-red) */
  --pr-focus-offset: 2px;

  /* Component geometry */
  --pr-trigger: 34px;
  --pr-ring-width: 1.8px;
  --pr-card-pad-x: 12px;
  --pr-card-head-h: 40px;
  --pr-segment-h: 4px;
  --pr-segment-gap: 4px;
  --pr-gap-side: 8px;          /* trigger distance from the bubble edge */

  /* Motion */
  --pr-fast: 100ms;
  --pr-word-in: 250ms;
  --pr-switch: 200ms;
  --pr-pulse: 1.6s;            /* the recording dot; static under reduced motion */
  --pr-shimmer: 1.6s;
  --pr-spin: 1.6s;
  --pr-blink: 1.2s;
}

:root[data-theme="dark"] {
  --pr-page: #171411;
  --pr-sheet: #221e1a;
  --pr-ink: #ede6da;
  --pr-muted: #b0a698;
  --pr-rule: #3d3730;
  --pr-red: #ff7e63;
  --pr-wash: #3b2219;
  --pr-danger: #ff8fa0;
  --pr-fill: #ede6da;
  --pr-on-fill: #171411;
  --pr-pill-rec: #bf3a1f;
  --pr-edge: color-mix(in srgb, #ede6da 32%, transparent);
  --pr-field-edge: color-mix(in srgb, #ede6da 52%, transparent);
  --pr-fill-hover: color-mix(in oklab, var(--pr-fill) 88%, var(--pr-page));
  --pr-text: #e9edef;
  --pr-shadow-trigger: 0 2px 5px #0006;
  --pr-shadow-pop: 0 10px 36px #0008;
}

html {
  color-scheme: light;
}

[data-theme='dark'] {
  color-scheme: dark;
}
