/*
 * Reslumen role mapping.
 *
 * Which brand token plays which part, in each colour mode. The tokens next door
 * in tokens.css are brand facts; this file is where the decisions live, and it
 * is the one stylesheet in the theme meant to be read and edited by hand.
 *
 * The decisions and their reasons are tabulated on the demo site's "Role
 * mapping" page. They were taken from Reslumen's existing mkdocs stylesheet,
 * which had already made all of them, and rewritten against Shibuya's roles.
 *
 * Selectors match Shibuya's own — `html.light` and `html.dark` — because Shibuya
 * sets some roles at that specificity. Being equally specific and later in the
 * cascade is what makes these win; nothing here needs `!important`.
 */

/* Roles that do not vary by colour mode, and a no-JavaScript fallback. */
:root {
  --sy-c-background: #ffffff;
  --sy-c-text: var(--color-base-800);
  --sy-c-heading: var(--color-base-900);

  /* The brand's only warm red. It is declared in the tokens as the colour of a
     string interpolation in a code block, which is the one place the marketing
     site needed a red at all; the danger admonitions are the other. */
  --rl-c-danger-seed: var(--astro-code-token-string-expression);
}

/* Geometry, type and motion ------------------------------------------------
   The token file next door is the brand's colours, its two faces, its shadows
   and its keyframes, and that is all of it: the website expresses its radii,
   its type ladder and its durations as Tailwind utilities, so none of the three
   ever reaches a custom property a consumer could vendor. `DESIGN.md` in the
   branding repository states all three as scales, and they are restated here
   once rather than retyped as a literal at each of the several dozen places the
   machinery spends them. A step then changes in one edit, and a value that is
   off the ladder is visible as one.

   Being a restatement rather than a copy, this block is the one part of the
   brand layer that can fall behind upstream without `just sync-tokens` saying
   so. The scales are small and they are stated in the comments below, which is
   what a reader checks them against.

   Radii. "Anything the pointer can act on is 8px" is the system's own rule, and
   the rest of the ladder hangs off it: 4px on the smallest chips, 6px on badges
   and on the two smallest control sizes, 8px on buttons, fields and icon tiles,
   12px on cards, code panels and hairline lattices, 16px on a large tinted
   panel. */
:root {
  --rl-r-sm: 0.25rem;
  --rl-r-md: 0.375rem;
  --rl-r-lg: 0.5rem;
  --rl-r-xl: 0.75rem;
  --rl-r-2xl: 1rem;

  /* The type ladder, at its mobile step. The brand names ten roles and the
     documentation spends eight of them: Label for an overline, a step number or
     a navigation caption; Caption for metadata and anything secondary; Body for
     prose; Lead for the paragraph under a title; Subtitle for a card or step
     heading; Title, Headline and Display for the landing composition's three
     heading sizes, with Metric for a figure. Everything the theme sets is one
     of these, so a thirteen-pixel step invented for one row of chrome shows up
     as the exception it is. */
  --rl-t-label: 0.75rem;
  --rl-t-caption: 0.875rem;
  --rl-t-body: 1rem;
  --rl-t-lead: 1.125rem;
  --rl-t-subtitle: 1.25rem;
  --rl-t-title: 1.5rem;
  --rl-t-headline: 1.875rem;
  --rl-t-metric: 2.25rem;
  --rl-t-display: 3rem;

  /* Tracking. Every heading at Title size and above carries -0.05em, which is
     what makes a large heading read as a machined object rather than as a loud
     one; Subtitle and below are left at normal. A label is uppercase at
     0.025em, and no other tracking is named anywhere in the system. */
  --rl-tracking-heading: -0.05em;
  --rl-tracking-label: 0.025em;

  /* Motion. 300ms for a control or a panel, 200ms for a link's colour, and the
     brand names no third duration. */
  --rl-d-control: 300ms;
  --rl-d-link: 200ms;
}

html.light {
  /* Page. White rather than the lightest base step: Reslumen's documentation
     and marketing site are both pure white, and a tinted page reads as a
     different product. */
  --sy-c-background: #ffffff;
  --sy-c-background-contrast: var(--color-base-950);
  --sy-c-background-dropback: color-mix(in srgb, #ffffff 80%, transparent);

  /* Text. Body copy stops short of black at base-800, which is the production
     choice. Headings take the same step, which is what the marketing site does:
     a heading there is `text-base-800 font-semibold`, and the hierarchy is
     carried by size and weight rather than by a second, darker ink. base-900 is
     kept for the words that have to out-weigh a heading.

     This is a decided divergence from the website, not an oversight. The
     website's prose is `text-base-500` and reserves base-800 for headings;
     taking that literally would lighten every paragraph in the documentation by
     three steps, from 14.67:1 on white to 4.84:1 — over the minimum, but with
     little margin for material a reader stays with for an hour. The marketing
     site's paragraphs are short and its pages are not read end to end; these
     are. Answered under `.scratch/website-design-parity/` ticket 08. */
  --sy-c-text: var(--color-base-800);
  --sy-c-heading: var(--color-base-800);
  --sy-c-bold: var(--color-base-900);
  --sy-c-light: var(--color-base-500);

  /* Structure. Borders sit one step darker than dividers so a bordered card
     still reads as an object against a divided page. */
  --sy-c-border: var(--color-base-300);
  --sy-c-divider: var(--color-base-200);
  --sy-c-surface: var(--color-base-50);
  --sy-c-overlay: color-mix(in srgb, var(--color-base-950) 8%, transparent);

  /* Chrome links. Not the article's. A link in prose takes no colour of its
     own — the roles below draw that one — so what spends these is everything
     around the article: the sections bar's current entry, the breadcrumbs, the
     navigation tree's current page, the footer's hover, the tab underline.

     Stated here rather than left to Shibuya, which reaches for the translucent
     step 10 of the accent scale. Step 10 is a hovered *solid* in Radix's
     vocabulary, and this brand's solid is a bright mint, so borrowing it for
     text would put pale green words on a white page. Step 11 is the step Radix
     reserves for text, and it is the mid-dark teal the production documentation
     has always used for a link. */
  --sy-c-link: var(--accent-11);
  --sy-c-link-hover: var(--accent-12);

  /* Prose links. `Wrapper.astro`'s `prose` variant draws a link in running text
     with no colour of its own: the surrounding ink, a dashed rule beneath it,
     and a solid rule over a teal ground once the pointer or the keyboard
     reaches it. The rule is what carries the affordance once the colour is
     gone, which is what keeps the treatment inside WCAG 1.4.1 — a non-colour
     cue rather than a colour one — so it is present at rest on every link the
     reader can follow. Answered under `.scratch/website-design-parity/`
     ticket 09.

     Both values are the website's own. base-500 reads at 4.84:1 on the page,
     and the teal-200 ground carries the body ink at 12.30:1. */
  --rl-c-prose-link-rule: var(--color-base-500);
  --rl-c-prose-link-ground: var(--color-teal-200);

  /* Focus. The accent solid is too light to ring a control on a white page, so
     the ring takes the text step instead. Dark mode can use the solid, where it
     is the brightest thing available. */
  --rl-c-focus: var(--accent-11);

  /* The control's focus ring, which is a role of its own because it is the one
     ring in the theme that does not take `--rl-c-focus`. `Button.astro` focuses
     to `outline-teal-300`, and that literal value is taken here in preference
     to the 3:1 that WCAG 2.1 SC 1.4.11 asks of a focus indicator: teal-300 is
     1.29:1 against the white page and 1.05:1 against the base-200 band a
     control sits on, so a keyboard user has more difficulty telling which
     control they are on than a stronger ring would have cost them.

     That is a decided trade of focus visibility for exact parity with the
     product's own controls, not an oversight. It is answered under
     `.scratch/website-design-parity/` ticket 10 and recorded on the demo site's
     "Role mapping" page, it is bounded — prose links, navigation entries,
     breadcrumbs and the takeover all keep `--rl-c-focus`, and a forced-colours
     rendering substitutes the system's own colour regardless — and reversing
     it is this one line. */
  --rl-c-control-focus: var(--color-teal-300);

  /* The search field's ring, which is the same trade in a second place:
     `HelpCenterSearch.astro` focuses to `focus:ring-2 focus:ring-teal-500
     focus:ring-offset-2 focus:ring-offset-base-200`, and teal-500 is 1.53:1
     against the white page and 1.24:1 against the base-200 band it is offset
     from. It is a role of its own rather than a second spender of
     `--rl-c-control-focus`, because the website rings a field and a button in
     different colours and either decision can be reversed without the other.
     Answered under `.scratch/website-design-parity/` ticket 11. */
  --rl-c-field-focus: var(--color-teal-500);

  /* Code. The brand's syntax palette was tuned against base-800, and Shibuya's
     dark-code mode reaches for near-black instead; a code block that is darker
     than the brand's own dark surface reads as a hole in the page rather than
     as a panel on it.

     Line numbers are left to the author, which is another decided divergence.
     The website numbers every line of every block through CSS counters; Sphinx
     numbers a block only where the author writes `:linenos:`. The author is the
     one who knows whether the prose refers to a line number, and numbering a
     two-line install snippet is noise the reader has to look past. The divider
     below is what separates those numbers when an author does ask for them.
     Answered under `.scratch/website-design-parity/` ticket 08.

     A block's caption is its header, not a second surface: it takes the code
     ground itself so the panel reads as one object, and the hairline the code
     panel already draws is what marks where the header stops. */
  --code-block-background: var(--color-base-800);
  --code-block-caption-background: var(--code-block-background);
  --code-block-highlight: color-mix(in srgb, var(--color-base-50) 10%, transparent);
  --code-block-linenos-divider: color-mix(in srgb, var(--color-base-50) 24%, transparent);

  /* Admonitions. Upstream spends ten Radix hues on eleven kinds; this brand has
     four families and one red, so the kinds are grouped by what they ask of the
     reader — informational, helpful, cautionary, dangerous, provisional — and
     each group takes one family. A reader learns five bands rather than ten
     hues, and every band is a colour the rest of the site already uses.

     Within each group: `-rail` is the 4px edge and the icon disc, `-band` the
     tint behind the title, `-surface` the body's ground, `-text` the title. */
  --rl-c-info-rail: var(--color-blue-600);
  --rl-c-info-band: color-mix(in srgb, var(--color-blue-200) 55%, transparent);
  --rl-c-info-surface: color-mix(in srgb, var(--color-blue-100) 40%, transparent);
  --rl-c-info-text: var(--color-blue-800);

  --rl-c-help-rail: var(--color-teal-600);
  --rl-c-help-band: color-mix(in srgb, var(--color-teal-200) 55%, transparent);
  --rl-c-help-surface: color-mix(in srgb, var(--color-teal-100) 40%, transparent);
  --rl-c-help-text: var(--color-teal-800);

  --rl-c-caution-rail: var(--color-yellow-600);
  --rl-c-caution-band: color-mix(in srgb, var(--color-yellow-200) 55%, transparent);
  --rl-c-caution-surface: color-mix(in srgb, var(--color-yellow-100) 40%, transparent);
  --rl-c-caution-text: var(--color-yellow-800);

  /* The one colour the brand declares outside its four families: the red its
     code blocks give a string interpolation. Darkened for text, which the raw
     value does not reach 4.5:1 as. */
  --rl-c-danger-rail: var(--rl-c-danger-seed);
  --rl-c-danger-band: color-mix(in srgb, var(--rl-c-danger-seed) 14%, transparent);
  --rl-c-danger-surface: color-mix(in srgb, var(--rl-c-danger-seed) 7%, transparent);
  --rl-c-danger-text: color-mix(in srgb, var(--rl-c-danger-seed) 62%, var(--color-base-950));

  --rl-c-provisional-rail: var(--color-base-400);
  --rl-c-provisional-band: color-mix(in srgb, var(--color-base-200) 55%, transparent);
  --rl-c-provisional-surface: color-mix(in srgb, var(--color-base-100) 50%, transparent);
  --rl-c-provisional-text: var(--color-base-700);

  /* Footer. White, matching the page: the marketing site's footer is separated
     by a rule rather than by a change of ground. */
  --sy-c-foot-background: #ffffff;
  --sy-c-foot-text: var(--color-base-900);
  --sy-c-foot-divider: var(--color-base-200);

  /* Shell. The website's field is bounded rather than full-bleed — it is
     painted on a centred 80rem element over a white page — and these semantic
     values keep its token decisions in the brand layer. */
  --rl-image-stripe-field: var(--background-image-stripes);
  --rl-f-prose: var(--font-sans);
  --rl-c-control-inset: color-mix(in srgb, #ffffff 65%, transparent);

  /* Controls. The website's Button is one contract with a ring per variant:
     `bg-teal-500 ring-teal-600` for the accent, `bg-base-100 ring-base-200` for
     the muted one. The ring is named here so the machinery can spend one
     variable in one rule; step 8 is the accent scale's border step, which is
     where teal-600 sits relative to the teal-500 solid. */
  --rl-c-control-ring: var(--sy-c-border);
  --rl-c-control-ring-accent: var(--accent-8);
  --rl-c-control-muted: var(--color-base-100);

  /* Depth. The website raises a card on `shadow-xl` and a panel on
     `shadow-2xl`. Both are vendored next door; these are where they are spent,
     so dark mode can substitute a treatment of its own. */
  --rl-shadow-card: var(--shadow-xl);
  --rl-shadow-panel: var(--shadow-2xl);

  /* The help centre's field. `HelpCenterSearch.astro` is `bg-base-100
     placeholder-base-400` with `text-teal-700` ink. The ink is the one value
     that does not survive the move to documentation: teal-700 on base-100 is
     2.52:1, short of the 4.5:1 a reader needs to read back what they typed, so
     the field takes the accent's text step at 5.07:1 — the step a link already
     takes. The ground and the placeholder are the website's own. */
  --rl-c-field: var(--color-base-100);
  --rl-c-field-text: var(--accent-11);
  --rl-c-field-placeholder: var(--color-base-400);

  /* Chrome links. `Navigation.astro` rests its links at base-800 and hovers
     them *quieter*, at base-600, never teal. Every navigation surface — the
     section bar, both sidebars, the breadcrumbs, the page-to-page cards —
     follows it, and marks where the reader is by going the other way instead,
     to the darkest ink the page has. The accent is left to mean one thing: a
     link in prose. */
  --rl-c-nav-link: var(--color-base-800);
  --rl-c-nav-link-hover: var(--color-base-600);
  --rl-c-nav-link-current: var(--color-base-950);

  /* Selection. `BaseLayout.astro` puts `selection:bg-base-800
     selection:text-teal-500` on the html element, which is 9.57:1. */
  --rl-c-selection-background: var(--color-base-800);
  --rl-c-selection-text: var(--color-teal-500);

  /* Highlight. Yellow is the website's marker colour, and a search term found
     in a page is exactly what it marks. */
  --rl-c-highlight-background: var(--color-yellow-300);
  --rl-c-highlight-text: var(--color-base-900);

  /* Announcement. Upstream fills this bar with the accent, which under this
     brand would be a full-width band of bright mint. The website says something
     out of band on a dark ground instead — its footer, its callout panels — so
     the bar takes that, and keeps the accent for the one link inside it. */
  --sy-c-banner-bg: var(--color-base-900);
  --sy-c-banner: var(--color-base-100);

  /* Landing composition. The website's frontpage is assembled from a handful
     of pieces the rest of a documentation site has no use for: the small label
     above a heading and the mark beside it, the coloured rule down a figure,
     the icon tile on a card, the dot on a numbered step, and the tinted panel a
     callout sits on. They are named here so that the landing layout can be the
     website's composition rather than a second brand invented next to it.

     The four rules are the four colour families in the order the frontpage
     spends them — teal, yellow, blue, then the neutral — which is the order the
     accent, the secondary and the tertiary are already bound in elsewhere. */
  --rl-c-eyebrow: var(--color-base-600);
  --rl-c-eyebrow-mark: var(--color-teal-700);

  --rl-c-rule-primary: var(--color-teal-500);
  --rl-c-rule-secondary: var(--color-yellow-500);
  --rl-c-rule-tertiary: var(--color-blue-500);
  --rl-c-rule-neutral: var(--color-base-400);

  /* `bg-teal-500 text-teal-950` and its two siblings: a solid chip carrying its
     own family's darkest step as ink, which is the pairing that reads on all
     three fills without a fourth colour being brought in for the mark. */
  --rl-c-tile-primary: var(--color-teal-500);
  --rl-c-tile-primary-mark: var(--color-teal-950);
  --rl-c-tile-secondary: var(--color-yellow-400);
  --rl-c-tile-secondary-mark: var(--color-yellow-950);
  --rl-c-tile-tertiary: var(--color-blue-500);
  --rl-c-tile-tertiary-mark: var(--color-blue-950);

  /* A numbered step's dot — `bg-teal-200 ring-teal-500` on the website — is the
     family's tint ringed in the rule colour above, with one ink for all three. */
  --rl-c-step-primary: var(--color-teal-200);
  --rl-c-step-secondary: var(--color-yellow-300);
  --rl-c-step-tertiary: var(--color-blue-200);
  --rl-c-step-mark: var(--color-base-800);

  /* The panel the workflow and the closing call sit on: `bg-linear-180
     from-base-50 via-base-100 to-base-200`, raised on the panel shadow the
     cards next to it already spend. */
  --rl-image-panel: linear-gradient(
    180deg,
    var(--color-base-50) 0%,
    var(--color-base-100) 50%,
    var(--color-base-200) 100%
  );

  /* Prose. Shibuya paints long-form material from its own `--yue-*` roles, and
     leaving them at their defaults is what makes an otherwise branded page read
     as a stock theme. Markers and quote rules take teal, the website's
     interactive colour; inline code takes a neutral chip rather than a tinted
     one, because a run of code in a sentence is not a link. */
  --yue-c-ul-marker: var(--color-teal-700);
  --yue-c-ol-marker: var(--color-base-500);
  --yue-c-quote: var(--color-base-500);
  --yue-c-quote-border: var(--color-teal-500);
  --yue-c-quote-symbol: var(--color-teal-700);
  --yue-c-code-text: var(--color-base-800);
  --yue-c-code-background: var(--color-base-100);
  --yue-c-caption: var(--color-base-500);
  --yue-c-table-border: var(--color-base-200);
  --yue-c-th-border: var(--color-base-200);
  --yue-c-td-border: var(--color-base-200);
  --yue-c-th-background: var(--color-base-50);
  --yue-c-row-background: var(--color-base-50);
  --yue-c-hr: var(--color-base-200);
  --sig-name: var(--accent-8);
}

html.dark {
  /* Page. base-900 rather than base-950: the darkest step is reserved for
     surfaces that need to sit under the page, and this is the value the
     production documentation reads at night. */
  --sy-c-background: var(--color-base-900);
  --sy-c-background-contrast: var(--color-base-50);
  --sy-c-background-dropback: color-mix(in srgb, var(--color-base-900) 80%, transparent);

  --sy-c-text: var(--color-base-200);
  --sy-c-heading: var(--color-base-50);
  --sy-c-bold: var(--color-base-50);
  --sy-c-light: var(--color-base-400);

  --sy-c-border: var(--color-base-700);
  --sy-c-divider: var(--color-base-800);
  --sy-c-surface: var(--color-base-800);
  --sy-c-overlay: color-mix(in srgb, var(--color-base-50) 6%, transparent);

  /* Links and focus. The same decisions one ramp along: step 11 is still the
     text step, and here the solid is the brightest thing on the page, so the
     focus ring can have it.

     The prose link's rule moves one step lighter, the way secondary ink does,
     and its ground becomes a wash of the website's teal over the page rather
     than teal-200 carried into the dark, which would be a near-white band
     behind a paragraph; the body ink reads on that wash at 9.88:1. The
     control's ring takes teal-300 here as well, where at 13.71:1 against the
     page it is not a trade at all; nor is the field's teal-500, at 9.59:1
     against the band it is offset from. */
  --sy-c-link: var(--accent-11);
  --sy-c-link-hover: var(--accent-12);
  --rl-c-prose-link-rule: var(--color-base-400);
  --rl-c-prose-link-ground: color-mix(in srgb, var(--color-teal-500) 16%, transparent);
  --rl-c-focus: var(--accent-9);
  --rl-c-control-focus: var(--color-teal-300);
  --rl-c-field-focus: var(--color-teal-500);

  /* Code keeps its own ground in both modes — the palette was tuned once — and
     the caption band keeps taking that same ground with it. */
  --code-block-background: var(--color-base-800);
  --code-block-caption-background: var(--code-block-background);
  --code-block-highlight: color-mix(in srgb, var(--color-base-50) 10%, transparent);
  --code-block-linenos-divider: color-mix(in srgb, var(--color-base-50) 24%, transparent);

  /* The same five bands, at the steps that hold up against a dark page: rails
     and titles move to the light end of each family, grounds become a wash of
     the family over the page rather than a tint of white. */
  --rl-c-info-rail: var(--color-blue-500);
  --rl-c-info-band: color-mix(in srgb, var(--color-blue-500) 16%, transparent);
  --rl-c-info-surface: color-mix(in srgb, var(--color-blue-500) 8%, transparent);
  --rl-c-info-text: var(--color-blue-300);

  --rl-c-help-rail: var(--color-teal-500);
  --rl-c-help-band: color-mix(in srgb, var(--color-teal-500) 16%, transparent);
  --rl-c-help-surface: color-mix(in srgb, var(--color-teal-500) 8%, transparent);
  --rl-c-help-text: var(--color-teal-300);

  --rl-c-caution-rail: var(--color-yellow-600);
  --rl-c-caution-band: color-mix(in srgb, var(--color-yellow-600) 16%, transparent);
  --rl-c-caution-surface: color-mix(in srgb, var(--color-yellow-600) 8%, transparent);
  --rl-c-caution-text: var(--color-yellow-300);

  --rl-c-danger-rail: var(--rl-c-danger-seed);
  --rl-c-danger-band: color-mix(in srgb, var(--rl-c-danger-seed) 20%, transparent);
  --rl-c-danger-surface: color-mix(in srgb, var(--rl-c-danger-seed) 10%, transparent);
  --rl-c-danger-text: color-mix(in srgb, var(--rl-c-danger-seed) 70%, #ffffff);

  --rl-c-provisional-rail: var(--color-base-500);
  --rl-c-provisional-band: color-mix(in srgb, var(--color-base-400) 16%, transparent);
  --rl-c-provisional-surface: color-mix(in srgb, var(--color-base-400) 8%, transparent);
  --rl-c-provisional-text: var(--color-base-300);

  --sy-c-foot-background: var(--color-base-900);
  --sy-c-foot-text: var(--color-base-100);
  --sy-c-foot-divider: var(--color-base-800);

  /* The same field, one ramp along. The brand's dark treatment keeps the
     geometry exactly — 125 degrees, a hairline every 7px — and moves only the
     colour of the hairline, from the light frame's #e8e8e8 to Instrument Ink,
     picked so the field whispers at the same volume against a base-900 page as
     it does against white. An angle or a period of its own here would have been
     a second stripe field rather than this one after dark. */
  --rl-image-stripe-field: repeating-linear-gradient(
    125deg,
    transparent,
    transparent 6px,
    var(--color-base-800) 6px,
    var(--color-base-800) 7px
  );
  --rl-f-prose: var(--font-sans);
  --rl-c-control-inset: color-mix(in srgb, #ffffff 15%, transparent);

  /* The same control contract, at the steps that read against a dark page. */
  --rl-c-control-ring: var(--sy-c-border);
  --rl-c-control-ring-accent: var(--accent-8);
  --rl-c-control-muted: var(--color-base-800);

  /* The website has no dark canon for depth, so the shadows become a wash of
     the overlay role rather than a darkening of an already dark page. */
  --rl-shadow-card: 0 1px 2px var(--sy-c-overlay), 0 10px 24px var(--sy-c-overlay);
  --rl-shadow-panel: 0 2px 4px var(--sy-c-overlay), 0 20px 48px var(--sy-c-overlay);

  --rl-c-field: var(--color-base-800);
  --rl-c-field-text: var(--accent-11);
  --rl-c-field-placeholder: var(--color-base-500);

  /* The same three steps, read the other way up: the ink lightens towards the
     reader's own place and dims under the pointer. */
  --rl-c-nav-link: var(--color-base-200);
  --rl-c-nav-link-hover: var(--color-base-400);
  --rl-c-nav-link-current: var(--color-base-50);

  /* Swapped rather than dropped, which is the pair the brand's dark canon
     names: the ink slab that carries mint words in light becomes a mint ground
     carrying the page's own dark ink. base-800 as a ground is all but invisible
     against a base-900 page, so keeping the light pair was never an option; a
     neutral pair would have been the one place on the page where selection
     stopped being a miniature of the code slab. Deep Ink on teal-500 is
     11.57:1, the same pairing every mint fill in the system carries. */
  --rl-c-selection-background: var(--color-teal-500);
  --rl-c-selection-text: var(--color-base-900);

  /* The same marker, at the step that stays legible against a dark page. */
  --rl-c-highlight-background: var(--color-yellow-800);
  --rl-c-highlight-text: var(--color-yellow-50);

  /* The announcement bar is already the page's dark ground in light mode, so
     in dark mode it goes one step further down rather than lighting up. */
  --sy-c-banner-bg: var(--color-base-950);
  --sy-c-banner: var(--color-base-100);

  /* The landing pieces, one ramp along. The tiles keep their solids, because a
     chip is meant to be the brightest thing on its card in either mode, and the
     eyebrow's mark takes the step the rest of the dark page reads teal at.
     Everything that was a tint becomes a wash of the same family over the page,
     the way the admonition bands do, and the step's ink inverts with it:
     base-800 on a wash of teal would be a mark nobody can see. */
  --rl-c-eyebrow: var(--color-base-400);
  --rl-c-eyebrow-mark: var(--color-teal-500);

  --rl-c-rule-primary: var(--color-teal-600);
  --rl-c-rule-secondary: var(--color-yellow-600);
  --rl-c-rule-tertiary: var(--color-blue-500);
  --rl-c-rule-neutral: var(--color-base-500);

  --rl-c-step-primary: color-mix(in srgb, var(--color-teal-500) 22%, transparent);
  --rl-c-step-secondary: color-mix(in srgb, var(--color-yellow-500) 22%, transparent);
  --rl-c-step-tertiary: color-mix(in srgb, var(--color-blue-500) 22%, transparent);
  --rl-c-step-mark: var(--color-base-100);

  /* The panel is a rise out of the page rather than down towards it: base-800
     over base-900 is the same one-step lift the surface role already makes. */
  --rl-image-panel: linear-gradient(
    180deg,
    var(--color-base-800) 0%,
    var(--color-base-800) 50%,
    var(--color-base-900) 100%
  );

  /* The same prose decisions, one ramp along: the hierarchy is what carries
     over, not the values. */
  --yue-c-ul-marker: var(--color-teal-600);
  --yue-c-ol-marker: var(--color-base-400);
  --yue-c-quote: var(--color-base-300);
  --yue-c-quote-border: var(--color-teal-800);
  --yue-c-quote-symbol: var(--color-teal-600);
  --yue-c-code-text: var(--color-base-100);
  --yue-c-code-background: var(--color-base-800);
  --yue-c-caption: var(--color-base-400);
  --yue-c-table-border: var(--color-base-700);
  --yue-c-th-border: var(--color-base-700);
  --yue-c-td-border: var(--color-base-800);
  --yue-c-th-background: var(--color-base-800);
  --yue-c-row-background: var(--color-base-800);
  --yue-c-hr: var(--color-base-800);
}

/* Admonition kinds, grouped into the five bands above ----------------------
   Upstream declares one Radix hue per kind at `:root`; these are the same
   variables, said again in the brand's terms. The grouping is the decision —
   which kinds ask the same thing of a reader — and the band variables next
   door are where each group's actual colours are chosen, per colour mode. */
html.light,
html.dark {
  /* Informational: something to know before reading on. */
  --note-1: var(--rl-c-info-surface);
  --note-2: var(--rl-c-info-band);
  --note-3: var(--rl-c-info-rail);
  --note-4: var(--rl-c-info-text);
  --seealso-1: var(--rl-c-info-surface);
  --seealso-2: var(--rl-c-info-band);
  --seealso-3: var(--rl-c-info-rail);
  --seealso-4: var(--rl-c-info-text);

  /* Helpful: an offer the reader can take or leave. */
  --tip-1: var(--rl-c-help-surface);
  --tip-2: var(--rl-c-help-band);
  --tip-3: var(--rl-c-help-rail);
  --tip-4: var(--rl-c-help-text);
  --hint-1: var(--rl-c-help-surface);
  --hint-2: var(--rl-c-help-band);
  --hint-3: var(--rl-c-help-rail);
  --hint-4: var(--rl-c-help-text);

  /* Cautionary: something that costs the reader if skipped. Yellow is the
     website's marker colour, and this is the documentation's version of being
     marked. */
  --important-1: var(--rl-c-caution-surface);
  --important-2: var(--rl-c-caution-band);
  --important-3: var(--rl-c-caution-rail);
  --important-4: var(--rl-c-caution-text);
  --attention-1: var(--rl-c-caution-surface);
  --attention-2: var(--rl-c-caution-band);
  --attention-3: var(--rl-c-caution-rail);
  --attention-4: var(--rl-c-caution-text);
  --caution-1: var(--rl-c-caution-surface);
  --caution-2: var(--rl-c-caution-band);
  --caution-3: var(--rl-c-caution-rail);
  --caution-4: var(--rl-c-caution-text);
  --warning-1: var(--rl-c-caution-surface);
  --warning-2: var(--rl-c-caution-band);
  --warning-3: var(--rl-c-caution-rail);
  --warning-4: var(--rl-c-caution-text);

  /* Dangerous: something that breaks if ignored. */
  --danger-1: var(--rl-c-danger-surface);
  --danger-2: var(--rl-c-danger-band);
  --danger-3: var(--rl-c-danger-rail);
  --danger-4: var(--rl-c-danger-text);
  --error-1: var(--rl-c-danger-surface);
  --error-2: var(--rl-c-danger-band);
  --error-3: var(--rl-c-danger-rail);
  --error-4: var(--rl-c-danger-text);

  /* Provisional: a note to the documentation's own authors. It is the one kind
     that is not addressed to the reader, so it is the one kind with no colour. */
  --todo-1: var(--rl-c-provisional-surface);
  --todo-2: var(--rl-c-provisional-band);
  --todo-3: var(--rl-c-provisional-rail);
  --todo-4: var(--rl-c-provisional-text);

  /* Version directives. Upstream leaves these on Radix's green, amber, orange
     and red — the four hues in the theme that never went through the grouping
     above, and the only place a documentation page still showed a colour from
     somebody else's system. They say the same five things the kinds do, so
     they take the same five bands. */
  --versionadded-1: var(--rl-c-help-surface);
  --versionadded-2: var(--rl-c-help-rail);
  --versionchanged-1: var(--rl-c-info-surface);
  --versionchanged-2: var(--rl-c-info-rail);
  --versionremoved-1: var(--rl-c-danger-surface);
  --versionremoved-2: var(--rl-c-danger-rail);
  --deprecated-1: var(--rl-c-caution-surface);
  --deprecated-2: var(--rl-c-caution-rail);
}

/* Which glyph each kind carries ---------------------------------------------
   Upstream names one Lucide icon per kind through these variables; the same
   variables are said again here in the website's Tabler vocabulary, which
   `icons.css` next door publishes.

   The choices follow the meaning rather than upstream's: a note is the
   information mark the website's own pages use as their eyebrow, a tip is the
   brain it puts beside an idea, and the four cautionary kinds separate into the
   triangle a reader reads as "mind this" and the circle they read as "note
   this". Where the website already had a glyph for a meaning, that is the one
   used; nothing here invents an icon the brand does not own. */
html.light,
html.dark {
  --note-icon: var(--rl-icon-info-circle);
  --seealso-icon: var(--rl-icon-chevron-right);

  --tip-icon: var(--rl-icon-brain);
  --hint-icon: var(--rl-icon-question-mark);

  --important-icon: var(--rl-icon-shield);
  --attention-icon: var(--rl-icon-alert-circle);
  --caution-icon: var(--rl-icon-alert-triangle);
  --warning-icon: var(--rl-icon-alert-triangle);

  --danger-icon: var(--rl-icon-flame);
  --error-icon: var(--rl-icon-circle-x);

  --todo-icon: var(--rl-icon-file-dots);

  --versionadded-icon: var(--rl-icon-plus);
  --versionchanged-icon: var(--rl-icon-arrow-iteration);
  --versionremoved-icon: var(--rl-icon-minus);
  --deprecated-icon: var(--rl-icon-clock);
}

/* Sphinx-design's own palette ----------------------------------------------
   The extension ships Bootstrap's colours — a blue primary, a grey secondary, a
   green success, an orange warning — and a documentation page that uses its
   cards, badges and buttons is a page painted by somebody else's brand. The
   same nine names are said again here in this brand's terms, matching the
   admonition bands wherever the name means the same thing: info is the blue
   family, success the teal, warning the yellow, danger the red.

   Declared on the article rather than on the root: the extension puts its
   defaults at `:root`, and Shibuya puts its own on `.yue`, so the article is
   where a value has to be said to reach a card inside it. `-text` is the
   foreground a filled variant carries, so each solid is paired with the one
   that reads on it. */
html.light .yue {
  --sd-color-primary: var(--accent-9);
  --sd-color-primary-highlight: var(--accent-10);
  --sd-color-primary-text: var(--accent-contrast);
  --sd-color-primary-bg: var(--accent-a4);

  --sd-color-secondary: var(--color-base-800);
  --sd-color-secondary-highlight: var(--color-base-900);
  --sd-color-secondary-text: #ffffff;
  --sd-color-secondary-bg: color-mix(in srgb, var(--color-base-800) 16%, transparent);

  --sd-color-success: var(--color-teal-800);
  --sd-color-success-highlight: var(--color-teal-900);
  --sd-color-success-text: #ffffff;
  --sd-color-success-bg: color-mix(in srgb, var(--color-teal-500) 24%, transparent);

  --sd-color-info: var(--color-blue-700);
  --sd-color-info-highlight: var(--color-blue-800);
  --sd-color-info-text: #ffffff;
  --sd-color-info-bg: color-mix(in srgb, var(--color-blue-500) 24%, transparent);

  --sd-color-warning: var(--color-yellow-800);
  --sd-color-warning-highlight: var(--color-yellow-900);
  --sd-color-warning-text: #ffffff;
  --sd-color-warning-bg: color-mix(in srgb, var(--color-yellow-500) 32%, transparent);

  --sd-color-danger: var(--rl-c-danger-text);
  --sd-color-danger-highlight: color-mix(in srgb, var(--rl-c-danger-text) 80%, #000000);
  --sd-color-danger-text: #ffffff;
  --sd-color-danger-bg: var(--rl-c-danger-band);

  --sd-color-light: var(--color-base-100);
  --sd-color-light-highlight: var(--color-base-200);
  --sd-color-light-text: var(--color-base-900);
  --sd-color-light-bg: color-mix(in srgb, var(--color-base-300) 30%, transparent);

  --sd-color-muted: var(--color-base-500);
  --sd-color-muted-highlight: var(--color-base-600);
  --sd-color-muted-text: #ffffff;
  --sd-color-muted-bg: color-mix(in srgb, var(--color-base-500) 20%, transparent);

  --sd-color-dark: var(--color-base-800);
  --sd-color-dark-highlight: var(--color-base-900);
  --sd-color-dark-text: var(--color-base-50);
  --sd-color-dark-bg: color-mix(in srgb, var(--color-base-800) 20%, transparent);

  --sd-color-black: var(--color-base-950);
  --sd-color-black-highlight: #000000;
  --sd-color-black-text: #ffffff;

  --sd-color-white: #ffffff;
  --sd-color-white-highlight: var(--color-base-200);
  --sd-color-white-text: var(--color-base-900);

  /* Cards and the tab strip, which are chrome rather than palette: both take
     the page's own surfaces so a card reads as part of the document. */
  --sd-color-card-background: var(--sy-c-background);
  --sd-color-card-border: var(--sy-c-border);
  --sd-color-card-border-hover: var(--accent-8);
  --sd-color-card-text: var(--sy-c-text);
  --sd-color-card-header: transparent;
  --sd-color-card-footer: transparent;
  --sd-color-shadow: var(--sy-c-overlay);

  --sd-color-tabs-label-active: var(--sy-c-link);
  --sd-color-tabs-label-hover: var(--sy-c-text);
  --sd-color-tabs-label-inactive: var(--sy-c-light);
  --sd-color-tabs-underline-active: var(--sy-c-link);
  --sd-color-tabs-underline-hover: var(--sy-c-border);
  --sd-color-tabs-underline-inactive: var(--sy-c-divider);
  --sd-color-tabs-overline: var(--sy-c-divider);
  --sd-color-tabs-underline: var(--sy-c-divider);
}

html.dark .yue {
  /* One ramp along, and the foregrounds flip with it: on a dark page the solid
     is the light end of the family and its text is the page's own dark. */
  --sd-color-primary: var(--accent-9);
  --sd-color-primary-highlight: var(--accent-10);
  --sd-color-primary-text: var(--accent-contrast);
  --sd-color-primary-bg: var(--accent-a4);

  --sd-color-secondary: var(--color-base-300);
  --sd-color-secondary-highlight: var(--color-base-200);
  --sd-color-secondary-text: var(--color-base-950);
  --sd-color-secondary-bg: color-mix(in srgb, var(--color-base-300) 16%, transparent);

  --sd-color-success: var(--color-teal-500);
  --sd-color-success-highlight: var(--color-teal-400);
  --sd-color-success-text: var(--color-base-950);
  --sd-color-success-bg: color-mix(in srgb, var(--color-teal-500) 20%, transparent);

  --sd-color-info: var(--color-blue-400);
  --sd-color-info-highlight: var(--color-blue-300);
  --sd-color-info-text: var(--color-base-950);
  --sd-color-info-bg: color-mix(in srgb, var(--color-blue-500) 20%, transparent);

  --sd-color-warning: var(--color-yellow-600);
  --sd-color-warning-highlight: var(--color-yellow-500);
  --sd-color-warning-text: var(--color-base-950);
  --sd-color-warning-bg: color-mix(in srgb, var(--color-yellow-600) 20%, transparent);

  --sd-color-danger: var(--rl-c-danger-seed);
  --sd-color-danger-highlight: color-mix(in srgb, var(--rl-c-danger-seed) 80%, #ffffff);
  --sd-color-danger-text: var(--color-base-950);
  --sd-color-danger-bg: var(--rl-c-danger-band);

  --sd-color-light: var(--color-base-700);
  --sd-color-light-highlight: var(--color-base-600);
  --sd-color-light-text: var(--color-base-50);
  --sd-color-light-bg: color-mix(in srgb, var(--color-base-600) 30%, transparent);

  --sd-color-muted: var(--color-base-400);
  --sd-color-muted-highlight: var(--color-base-300);
  --sd-color-muted-text: var(--color-base-950);
  --sd-color-muted-bg: color-mix(in srgb, var(--color-base-400) 20%, transparent);

  --sd-color-dark: var(--color-base-100);
  --sd-color-dark-highlight: #ffffff;
  --sd-color-dark-text: var(--color-base-950);
  --sd-color-dark-bg: color-mix(in srgb, var(--color-base-100) 20%, transparent);

  --sd-color-black: var(--color-base-950);
  --sd-color-black-highlight: #000000;
  --sd-color-black-text: var(--color-base-50);

  --sd-color-white: #ffffff;
  --sd-color-white-highlight: var(--color-base-200);
  --sd-color-white-text: var(--color-base-950);

  --sd-color-card-background: var(--sy-c-background);
  --sd-color-card-border: var(--sy-c-border);
  --sd-color-card-border-hover: var(--accent-8);
  --sd-color-card-text: var(--sy-c-text);
  --sd-color-card-header: transparent;
  --sd-color-card-footer: transparent;
  --sd-color-shadow: var(--sy-c-overlay);

  --sd-color-tabs-label-active: var(--sy-c-link);
  --sd-color-tabs-label-hover: var(--sy-c-text);
  --sd-color-tabs-label-inactive: var(--sy-c-light);
  --sd-color-tabs-underline-active: var(--sy-c-link);
  --sd-color-tabs-underline-hover: var(--sy-c-border);
  --sd-color-tabs-underline-inactive: var(--sy-c-divider);
  --sd-color-tabs-overline: var(--sy-c-divider);
  --sd-color-tabs-underline: var(--sy-c-divider);
}


/* ANSI colours in a transcript ---------------------------------------------
   A page that quotes a program's terminal output — click-extra runs a command
   and shows the session, a Jupyter cell prints in colour — carries the sixteen
   colours a terminal names. Pygments has no values of its own for them, so the
   ANSI-capable formatter supplies a default set, and those defaults are the
   xterm palette: an "ANSI black" of `#000`, which on this brand's code ground
   is invisible, and backgrounds that assume a pale page.

   They are bound here instead, and this is a role mapping like any other: each
   ANSI name is a role, and it is spent on the family the brand already uses for
   that kind of thing. The brand has three colour families, one red and a
   neutral ramp against a terminal's six hues, so green and cyan are two steps of
   the teal ramp and magenta is the brand's red carried towards its blue. What
   the reader gets is a transcript in the site's palette rather than a window
   from another program.

   One set of values, declared once: this theme's two syntax styles are
   deliberately identical, and code sits on the same dark ground in both colour
   modes, so the light and dark variables take the same colours.

   The `bg` half of each pair is not a background. Where a program set a
   background colour, the formatter paints that colour from a fixed value of its
   own and reads the variable for the ink to put on top of it, so each one here
   is whichever end of the neutral ramp reads on the ground the terminal
   asked for. */
:root {
  /* The brand names no purple. This is the one it would name: its red, half way
     to the blue of a keyword. */
  --rl-c-ansi-magenta-seed: color-mix(in srgb, var(--rl-c-danger-seed) 55%, var(--color-blue-500));

  --syntax-light-ansi-black: var(--color-base-600);
  --syntax-light-ansi-bgblack: var(--color-base-50);
  --syntax-dark-ansi-black: var(--color-base-600);
  --syntax-dark-ansi-bgblack: var(--color-base-50);
  --syntax-light-ansi-red: var(--rl-c-danger-seed);
  --syntax-light-ansi-bgred: var(--color-base-50);
  --syntax-dark-ansi-red: var(--rl-c-danger-seed);
  --syntax-dark-ansi-bgred: var(--color-base-50);
  --syntax-light-ansi-green: var(--color-teal-600);
  --syntax-light-ansi-bggreen: var(--color-base-50);
  --syntax-dark-ansi-green: var(--color-teal-600);
  --syntax-dark-ansi-bggreen: var(--color-base-50);
  --syntax-light-ansi-yellow: var(--color-yellow-600);
  --syntax-light-ansi-bgyellow: var(--color-base-950);
  --syntax-dark-ansi-yellow: var(--color-yellow-600);
  --syntax-dark-ansi-bgyellow: var(--color-base-950);
  --syntax-light-ansi-blue: var(--color-blue-500);
  --syntax-light-ansi-bgblue: var(--color-base-50);
  --syntax-dark-ansi-blue: var(--color-blue-500);
  --syntax-dark-ansi-bgblue: var(--color-base-50);
  --syntax-light-ansi-magenta: var(--rl-c-ansi-magenta-seed);
  --syntax-light-ansi-bgmagenta: var(--color-base-50);
  --syntax-dark-ansi-magenta: var(--rl-c-ansi-magenta-seed);
  --syntax-dark-ansi-bgmagenta: var(--color-base-50);
  --syntax-light-ansi-cyan: var(--color-teal-400);
  --syntax-light-ansi-bgcyan: var(--color-base-50);
  --syntax-dark-ansi-cyan: var(--color-teal-400);
  --syntax-dark-ansi-bgcyan: var(--color-base-50);
  --syntax-light-ansi-white: var(--color-base-200);
  --syntax-light-ansi-bgwhite: var(--color-base-950);
  --syntax-dark-ansi-white: var(--color-base-200);
  --syntax-dark-ansi-bgwhite: var(--color-base-950);
  --syntax-light-ansi-brightblack: var(--color-base-500);
  --syntax-light-ansi-bgbrightblack: var(--color-base-50);
  --syntax-dark-ansi-brightblack: var(--color-base-500);
  --syntax-dark-ansi-bgbrightblack: var(--color-base-50);
  --syntax-light-ansi-brightred: color-mix(in srgb, var(--rl-c-danger-seed) 70%, #ffffff);
  --syntax-light-ansi-bgbrightred: var(--color-base-50);
  --syntax-dark-ansi-brightred: color-mix(in srgb, var(--rl-c-danger-seed) 70%, #ffffff);
  --syntax-dark-ansi-bgbrightred: var(--color-base-50);
  --syntax-light-ansi-brightgreen: var(--color-teal-500);
  --syntax-light-ansi-bgbrightgreen: var(--color-base-950);
  --syntax-dark-ansi-brightgreen: var(--color-teal-500);
  --syntax-dark-ansi-bgbrightgreen: var(--color-base-950);
  --syntax-light-ansi-brightyellow: var(--color-yellow-500);
  --syntax-light-ansi-bgbrightyellow: var(--color-base-950);
  --syntax-dark-ansi-brightyellow: var(--color-yellow-500);
  --syntax-dark-ansi-bgbrightyellow: var(--color-base-950);
  --syntax-light-ansi-brightblue: var(--color-blue-400);
  --syntax-light-ansi-bgbrightblue: var(--color-base-50);
  --syntax-dark-ansi-brightblue: var(--color-blue-400);
  --syntax-dark-ansi-bgbrightblue: var(--color-base-50);
  --syntax-light-ansi-brightmagenta: color-mix(in srgb, var(--rl-c-ansi-magenta-seed) 70%, #ffffff);
  --syntax-light-ansi-bgbrightmagenta: var(--color-base-50);
  --syntax-dark-ansi-brightmagenta: color-mix(in srgb, var(--rl-c-ansi-magenta-seed) 70%, #ffffff);
  --syntax-dark-ansi-bgbrightmagenta: var(--color-base-50);
  --syntax-light-ansi-brightcyan: var(--color-teal-300);
  --syntax-light-ansi-bgbrightcyan: var(--color-base-950);
  --syntax-dark-ansi-brightcyan: var(--color-teal-300);
  --syntax-dark-ansi-bgbrightcyan: var(--color-base-950);
  --syntax-light-ansi-brightwhite: var(--color-base-50);
  --syntax-light-ansi-bgbrightwhite: var(--color-base-950);
  --syntax-dark-ansi-brightwhite: var(--color-base-50);
  --syntax-dark-ansi-bgbrightwhite: var(--color-base-950);
}
