/* ============================================================================
   agent-hub: design tokens
   ----------------------------------------------------------------------------
   The wiki themed to the Agent Hub application. Every value here is taken from
   the app's own token file (web/tokens.css) so the docs and the product read as
   one house: lichen slate neutrals, near-black ink, one copper signal, IBM Plex,
   and the app's 2px and 4px radii.

   The ground is the app's canvas, #F3F5F2 in light and #111513 in dark. Links
   are ink with a quiet underline, as they are in the app; copper is kept for
   focus and the one filled control, and for the warning callout, which is the
   docs' nearest thing to "this needs you".

   Type is IBM Plex Sans for words and Plex Mono for code, the faces the app
   ships. The OFL files sit in fonts/ beside this sheet, so a render stays
   offline.

   Contrast was checked against the surface each value is read on. Text clears
   4.5:1, the control boundary clears the 3:1 that SC 1.4.11 asks for, and each
   status label clears 4.5:1 on its own tint. Dark is a second palette built for
   the dark ground, not this file inverted.
   ========================================================================== */

:root {
  color-scheme: light;

  /* ---- ground and surfaces ------------------------------------------------
     The app's canvas, its raised step for what floats, and two sunken steps
     for the breadcrumb bar and for code and quote surfaces. */
  --color-bg: #F3F5F2;
  --color-surface: #FBFCFA;
  --color-surface-sunken: #E8ECE7;
  --color-surface-sunken-deep: #DDE3DC;
  --color-bg-elevated: #FBFCFA;

  /* ---- ink ----------------------------------------------------------------
     The app's three ink steps: 15.95:1, 8.97:1 and 5.82:1 on the canvas, so
     even the faint step clears 4.5:1 as text. */
  --color-text: #151B17;
  --color-heading: #151B17;
  --color-text-muted: #3B4640;
  --color-text-faint: #56625A;

  /* ---- rules --------------------------------------------------------------
     A quiet decorative rule, a stronger one, and a control boundary held to
     3:1 because it is the only thing describing that control's extent. */
  --color-line: #D3DAD2;
  --color-line-strong: #BAC4BA;
  --color-line-control: #66726A;   /* 4.58:1 on the canvas */

  /* ---- accent -------------------------------------------------------------
     The app's split: copper fills the one primary control and draws the focus
     ring (6.66:1 on the canvas), and a link or the current page is ink, told
     apart by its underline or by the sunken ground under it. */
  --color-accent: #84461D;
  --color-on-accent: #F3F5F2;
  --color-accent-text: #151B17;
  --color-accent-soft: #E8ECE7;
  --color-accent-ring: #66726A;
  --color-current-tint: #E8ECE7;

  --focus-ring: #84461D;
  --focus-ring-offset: 2px;
  --focus-ring-width: 2px;

  /* ---- status ------------------------------------------------------------
     The app's status family, one tint, line and label per role. A note is
     neutral, as the app's kinds are; a warning takes the copper wash and a
     caution the deletion tone. Every label clears 4.5:1 on its own tint. */
  --status-success-tint: #DFEBE1;
  --status-success-line: #BCD3C1;
  --status-success-text: #2C6A3D;
  --status-info-tint: #E8ECE7;
  --status-info-line: #D3DAD2;
  --status-info-text: #3B4640;
  --status-warn-tint: #F1E4D8;
  --status-warn-line: #E0C6AE;
  --status-warn-text: #84461D;
  --status-danger-tint: #F7E3EA;
  --status-danger-line: #EBC3D1;
  --status-danger-text: #A3154A;
  --status-neutral-tint: #E8ECE7;
  --status-neutral-line: #D3DAD2;
  --status-neutral-text: #3B4640;

  /* ---- type ---------------------------------------------------------------
     The app's faces: IBM Plex Sans for words, Plex Mono for code, from
     fonts.css. Leading and tracking run the same optical direction as the
     defaults, tightening as size grows. */
  --font-display: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Ubuntu, Cantarell, sans-serif;
  --font-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Ubuntu, Cantarell, sans-serif;
  --font-code: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  --text-xs: 0.75rem;      /* 12, the app's type floor */
  --text-sm: 0.875rem;     /* 14 / 20 */
  --text-body: 1rem;       /* 16 */
  --text-lg: 1.125rem;     /* 18 / 28 */
  --text-h3: 1.25rem;      /* 20 */
  --text-h2: 1.5rem;       /* 24 / 29 */
  --text-h1: clamp(2.25rem, 1.5rem + 2.4vw, 3rem); /* 36 to 48 */

  --lh-tight: 1.12;
  --lh-snug: 1.25;
  --lh-normal: 1.5;
  --lh-relaxed: 1.6;

  --ls-display: -0.03em;
  --ls-tight: -0.02em;
  --ls-snug: -0.01em;

  --measure: 68ch;

  /* ---- space --------------------------------------------------------------
     A 4px base and its multiples, the same rhythm the app uses. */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* ---- radius -------------------------------------------------------------
     The app's set: 2px for a control, 4px for a field, a card or a sheet. The
     pill is kept for dots and the switch. */
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 4px;
  --radius-xl: 4px;
  --radius-pill: 999px;

  /* ---- elevation ----------------------------------------------------------
     Hairlines, not boxes: nothing on the canvas casts a shadow. Only what
     floats over it keeps one, in the app's slate shadow tone. */
  --shadow-sm: none;
  --shadow-md: 0 4px 8px -2px rgba(21, 27, 23, 0.08), 0 2px 4px -2px rgba(21, 27, 23, 0.06);
  --shadow-lg: 0 8px 24px rgba(21, 27, 23, 0.14);

  /* ---- motion -------------------------------------------------------------
     One easing family with long tails, every duration named. */
  --dur-fast: 120ms;
  --dur: 180ms;
  --dur-slow: 280ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-strong: cubic-bezier(0.23, 1, 0.32, 1);

  /* ---- scrim and layers --------------------------------------------------- */
  --color-scrim: rgba(21, 27, 23, 0.44);
  --z-base: 0;
  --z-sticky: 10;
  --z-header: 30;
  --z-overlay: 40;
  --z-skip-link: 50;
  --z-lightbox: 60;

  /* ---- code and selection -------------------------------------------------
     The code surface is the app's ink in both grounds, taken to a reading
     background, so a code block is a picture of code and keeps one contrast
     regime. A selection and a mark take the copper wash, the app's tint for a
     passage the reader is pointed at. */
  --color-code-bg: #151B17;
  --color-code-fg: #E4EAE5;
  --color-code-line: #29312C;
  --color-inline-code-bg: #E8ECE7;
  --color-inline-code-fg: #151B17;
  --color-selection-bg: #F1E4D8;
  --color-selection-fg: #151B17;
  --color-mark: #F1E4D8;
  --color-mark-ink: #151B17;

  /* ---- diagram palette ----------------------------------------------------
     Read by diagrams.js. The light-ground values, paired to the canvas the way
     the tokens above are: ink, muted, and copper for accent, with a spread of
     hues for the categorical series. The dark block redeclares the whole set. */
  --diagram-font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Ubuntu, Cantarell, sans-serif;
  --diagram-ground: #F3F5F2;
  --diagram-surface: #FBFCFA;
  --diagram-surface-alt: #E8ECE7;
  --diagram-ink: #151B17;
  --diagram-muted: #3B4640;
  --diagram-line: #BAC4BA;
  --diagram-accent: #84461D;
  --diagram-accent-soft: #F1E4D8;
  --diagram-accent-ink: #6B3816;
  --diagram-accent-2: #B4794E;
  --diagram-accent-3: #D9B08F;
  --diagram-yellow: #B98A12;
  --diagram-cyan: #2B7C8A;
  --diagram-red: #9E3B2B;
  --diagram-amber: #95590B;
  --diagram-green: #2E7D4F;
  --diagram-blue: #2F5FA8;
  --diagram-violet: #6E4B92;
  --diagram-pink: #B4508C;

  /* ---- lightbox -----------------------------------------------------------
     The diagram viewer stages a diagram on a dark field in both grounds, so it
     carries the app's dark tokens rather than borrowing the page's. */
  --lb-bg: #111513;
  --lb-bar: #161B18;
  --lb-line: #29312C;
  --lb-line-strong: #3A443D;
  --lb-text: #E4EAE5;
  --lb-muted: #B5BFB8;
  --lb-faint: #8E9991;
  --lb-accent: #E3A06F;
  --lb-accent-line: #6B4A33;
  --lb-hint: #8E9991;
}

/* ---- dark -----------------------------------------------------------------
   A second palette for the app's slate near-black ground. Ink is 15.08:1,
   muted 9.74:1, faint 6.24:1, and a raised surface is genuinely lighter than
   the ground so elevation reads without a shadow. */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --color-bg: #111513;
    --color-surface: #161B18;
    --color-surface-sunken: #1A1F1C;
    --color-surface-sunken-deep: #212823;
    --color-bg-elevated: #1A1F1C;

    --color-text: #E4EAE5;
    --color-heading: #E4EAE5;
    --color-text-muted: #B5BFB8;
    --color-text-faint: #8E9991;

    --color-line: #29312C;
    --color-line-strong: #3A443D;
    --color-line-control: #7A867E;   /* 4.86:1 on the ground */

    --color-accent: #E3A06F;
    --color-on-accent: #111513;
    --color-accent-text: #E4EAE5;
    --color-accent-soft: #1A1F1C;
    --color-accent-ring: #7A867E;
    --color-current-tint: #1A1F1C;

    --focus-ring: #E3A06F;

    --status-success-tint: #16261B;
    --status-success-line: #24402C;
    --status-success-text: #7DC490;
    --status-info-tint: #1A1F1C;
    --status-info-line: #29312C;
    --status-info-text: #B5BFB8;
    --status-warn-tint: #2E241C;
    --status-warn-line: #4A3727;
    --status-warn-text: #E3A06F;
    --status-danger-tint: #3A1824;
    --status-danger-line: #5A2638;
    --status-danger-text: #FF7099;
    --status-neutral-tint: #1A1F1C;
    --status-neutral-line: #29312C;
    --status-neutral-text: #B5BFB8;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 8px -2px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

    --color-scrim: rgba(0, 0, 0, 0.62);
    --color-code-bg: #0B0E0C;
    --color-code-fg: #E4EAE5;
    --color-code-line: #29312C;
    --color-inline-code-bg: #1A1F1C;
    --color-inline-code-fg: #E4EAE5;
    --color-selection-bg: #4A3727;
    --color-selection-fg: #E4EAE5;
    --color-mark: #2E241C;
    --color-mark-ink: #F1E4D8;

    /* ---- diagram palette, dark ground ------------------------------------- */
    --diagram-ground: #111513;
    --diagram-surface: #161B18;
    --diagram-surface-alt: #1A1F1C;
    --diagram-ink: #E4EAE5;
    --diagram-muted: #8E9991;
    --diagram-line: #3A443D;
    --diagram-accent: #E3A06F;
    --diagram-accent-soft: #2E241C;
    --diagram-accent-ink: #F1C9A8;
    --diagram-accent-2: #C78452;
    --diagram-accent-3: #8F5A35;
    --diagram-yellow: #DDA44E;
    --diagram-cyan: #63B8B4;
    --diagram-red: #E08373;
    --diagram-amber: #DDA44E;
    --diagram-green: #6FC08C;
    --diagram-blue: #8AAAE8;
    --diagram-violet: #B893D9;
    --diagram-pink: #DB8FBE;
  }
}

/* The explicit toggle, for a reader who pinned a ground. Mirrors the block
   above; a pinned dark must beat prefers-color-scheme in both directions.
   Screen only, so a printed page is always the light document. */
@media screen {
  :root[data-theme="dark"] {
    color-scheme: dark;

    --color-bg: #111513;
    --color-surface: #161B18;
    --color-surface-sunken: #1A1F1C;
    --color-surface-sunken-deep: #212823;
    --color-bg-elevated: #1A1F1C;

    --color-text: #E4EAE5;
    --color-heading: #E4EAE5;
    --color-text-muted: #B5BFB8;
    --color-text-faint: #8E9991;

    --color-line: #29312C;
    --color-line-strong: #3A443D;
    --color-line-control: #7A867E;

    --color-accent: #E3A06F;
    --color-on-accent: #111513;
    --color-accent-text: #E4EAE5;
    --color-accent-soft: #1A1F1C;
    --color-accent-ring: #7A867E;
    --color-current-tint: #1A1F1C;

    --focus-ring: #E3A06F;

    --status-success-tint: #16261B;
    --status-success-line: #24402C;
    --status-success-text: #7DC490;
    --status-info-tint: #1A1F1C;
    --status-info-line: #29312C;
    --status-info-text: #B5BFB8;
    --status-warn-tint: #2E241C;
    --status-warn-line: #4A3727;
    --status-warn-text: #E3A06F;
    --status-danger-tint: #3A1824;
    --status-danger-line: #5A2638;
    --status-danger-text: #FF7099;
    --status-neutral-tint: #1A1F1C;
    --status-neutral-line: #29312C;
    --status-neutral-text: #B5BFB8;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 8px -2px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

    --color-scrim: rgba(0, 0, 0, 0.62);
    --color-code-bg: #0B0E0C;
    --color-code-fg: #E4EAE5;
    --color-code-line: #29312C;
    --color-inline-code-bg: #1A1F1C;
    --color-inline-code-fg: #E4EAE5;
    --color-selection-bg: #4A3727;
    --color-selection-fg: #E4EAE5;
    --color-mark: #2E241C;
    --color-mark-ink: #F1E4D8;

    /* ---- diagram palette, dark ground ------------------------------------- */
    --diagram-ground: #111513;
    --diagram-surface: #161B18;
    --diagram-surface-alt: #1A1F1C;
    --diagram-ink: #E4EAE5;
    --diagram-muted: #8E9991;
    --diagram-line: #3A443D;
    --diagram-accent: #E3A06F;
    --diagram-accent-soft: #2E241C;
    --diagram-accent-ink: #F1C9A8;
    --diagram-accent-2: #C78452;
    --diagram-accent-3: #8F5A35;
    --diagram-yellow: #DDA44E;
    --diagram-cyan: #63B8B4;
    --diagram-red: #E08373;
    --diagram-amber: #DDA44E;
    --diagram-green: #6FC08C;
    --diagram-blue: #8AAAE8;
    --diagram-violet: #B893D9;
    --diagram-pink: #DB8FBE;
  }
}
