/* Watership design tokens, version 3 (2026-11-19): the console look. Inter for prose and headings, JetBrains Mono
   for structure, a blue accent, dark by default with light as the reader's choice, and a wider page.
   Version 2 (2026-10-24) added the six-step type scale (section 2, Type) and the type roles (section 6).
   See design/type-scale.md in the watership repository for the role map and the per-framework overrides.
   One file for watership.ca and every Watership documentation site. Copy it into the repo unchanged and load it before
   the site's own CSS; map the framework's variables onto these tokens instead of copying hex values.

   Colors use light-dark(), so each token holds both themes and resolves against the element's
   color-scheme. Dark is the default: :root sets color-scheme: dark, and light applies only when the reader
   picks it with the site's day/night toggle. A site's toggle only has to mark the chosen theme; the pinning
   block below already covers Docusaurus, Starlight, Fumadocs (next-themes), Furo, Zensical, and the main
   site. Each framework's own default must also be set to dark (see the spec).

   Line breaks: nothing here sets text-wrap: balance or pretty, and nothing caps the width of a heading
   or paragraph. Width belongs to the column container, never to the text element. */

/* ---------- 1. Fonts (SIL Open Font License 1.1). Fix the url() paths for the repo, or drop this block
   where the framework loads the fonts itself (Fumadocs uses next/font/local). ---------- */
@font-face { font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap; src: url(../assets/fonts/inter.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap; src: url(../assets/fonts/jetbrains-mono.woff2) format("woff2"); }

/* ---------- 2. Tokens ---------- */
:root {
  color-scheme: dark;

  /* Surfaces */
  --ws-paper: light-dark(#fbfbf9, #141618);          /* page background */
  --ws-sheet: light-dark(#ffffff, #1a1d20);          /* raised: code blocks, cards, rule cards, menus */
  --ws-wash: light-dark(#f2f2ee, #1c1f22);           /* quiet fill: inline code, hover, active nav, th */
  --ws-wash-strong: light-dark(#ebebe5, #25292c);    /* pressed or selected fill */

  /* Text (contrast on paper: light / dark) */
  --ws-ink: light-dark(#192028, #ecebe6);            /* headings, strong, links  15.9 / 15.2 */
  --ws-body: light-dark(#2f343a, #d2d3cf);           /* prose                    12.1 / 12.1 */
  --ws-soft: light-dark(#50565d, #b4b6b2);           /* secondary, nav at rest    7.2 / 8.9 */
  --ws-faint: light-dark(#62676d, #9b9e9a);          /* meta, labels, captions    5.5 / 6.7 */

  /* Lines */
  --ws-rule: light-dark(#dcdcd6, #33373b);           /* hairlines (decorative, no contrast duty) */
  --ws-rule-strong: light-dark(#192028, #ecebe6);    /* section rules, the main site's strong hairline */
  --ws-control-border: light-dark(#868a90, #6e7379); /* inputs, secondary buttons: 3.35 / 3.79, passes 1.4.11 */

  /* Accent: console blue. The wordmark keeps its own sail red; the interface uses blue. */
  --ws-accent: light-dark(#1f4fd8, #8fb0ff);         /* 6.2 / 8.4 on paper, usable as text */
  --ws-accent-strong: light-dark(#173da8, #b6ccff);  /* hover and pressed */
  --ws-accent-wash: light-dark(#e9effc, #1c2540);    /* tinted fill; ink on it 13.9 / 12.6 */
  --ws-on-accent: light-dark(#ffffff, #141618);      /* text on an accent fill: 6.2 / 8.4 */
  --ws-on-ink: light-dark(#fbfbf9, #141618);         /* text on an ink fill (primary button) */
  --ws-selection: light-dark(#d6e0fb, #2b3d6e);

  /* Tiers and states. Each fg passes 4.5:1 on its bg and on paper. */
  --ws-never-bg: light-dark(#fbeeea, #43231f);   --ws-never-fg: light-dark(#9b2f22, #ffafa1);
  --ws-avoid-bg: light-dark(#e9eef8, #1f2c45);   --ws-avoid-fg: light-dark(#244a8d, #aec7ff);
  --ws-prefer-bg: light-dark(#efefea, #2a2d30);  --ws-prefer-fg: light-dark(#50565d, #d2d3cf);
  --ws-mean-bg: light-dark(#eaf3ec, #1b3024);    --ws-mean-fg: light-dark(#1f5a37, #8fd6ac);
  --ws-caution-bg: light-dark(#fbf3e2, #3a2c12); --ws-caution-fg: light-dark(#7a4d00, #f2c46d);
  /* Callout roles: note = avoid (blue), tip = mean (green), caution = caution (amber), danger = never (red) */

  /* Code (on --ws-sheet; every color passes 4.5:1 in both themes) */
  --ws-code-bg: var(--ws-sheet);
  --ws-code-fg: var(--ws-ink);
  --ws-code-comment: var(--ws-faint);
  --ws-code-keyword: var(--ws-avoid-fg);
  --ws-code-string: var(--ws-mean-fg);
  --ws-code-number: var(--ws-never-fg);
  --ws-code-function: var(--ws-accent);
  --ws-code-punct: var(--ws-soft);
  --ws-code-highlight: light-dark(rgb(31 79 216 / .07), rgb(143 176 255 / .10));

  /* Type: Inter for prose and headings, JetBrains Mono for structure (nav, labels, numbers, code) */
  --ws-font-text: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --ws-font-head: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --ws-font-ui: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  --ws-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;

  /* The type scale: six sizes for the whole family, and nothing else. Every role maps to one step (see the
     role table in type-scale.md). Two families, two weights each (400 and 600), no uppercase styles. */
  --ws-text-sm: .8125rem;    /* 13px, step 1: every chrome role (nav, sidebar, TOC, breadcrumb, buttons, search
                                trigger, footer, pills, labels, table heads, captions, callout titles) and code blocks */
  --ws-text-md: .9375rem;    /* 15px, step 2: table cells, inline code in prose, card and dense secondary text */
  --ws-text-base: 1.0625rem; /* 17px, step 3: prose, h4, pagination titles, header site name, search input */
  --ws-text-lg: 1.1875rem;   /* 19px, step 4: lead or dek, h3, rule and card titles */
  --ws-text-xl: 1.5rem;      /* 24px, step 5: h2 */
  --ws-text-2xl: clamp(2rem, 1.7rem + 1.2vw, 2.5rem); /* 32 to 40px, step 6: every h1, the home hero included */

  /* Retired steps. They resolve onto the scale so old rules stop adding sizes; delete them once no rule
     names them (grep for ws-text-2xs, ws-text-xs and ws-text-3xl). */
  --ws-text-2xs: var(--ws-text-sm);
  --ws-text-xs: var(--ws-text-sm);
  --ws-text-3xl: var(--ws-text-2xl);

  --ws-leading-prose: 1.65;  /* body, lead, table cells, list items */
  --ws-leading-ui: 1.45;     /* chrome that can wrap: sidebar, TOC, footer, labels, captions */
  --ws-leading-head: 1.2;    /* h1 to h4 */
  --ws-leading-code: 1.6;    /* code blocks */
  --ws-weight-regular: 400;  /* prose, chrome at rest, code */
  --ws-weight-strong: 600;   /* headings, strong and b, labels, pills, buttons, the current nav item */
  --ws-weight-ui: 400;       /* was 500; chrome at rest uses the regular weight */
  --ws-tracking-head: -.025em; /* h1 and h2 only */
  --ws-tracking-label: 0;     /* labels are sentence case and untracked */

  /* Role shorthands for the font property. Use these instead of writing sizes. */
  --ws-type-ui: var(--ws-weight-regular) var(--ws-text-sm)/var(--ws-leading-ui) var(--ws-font-ui);
  --ws-type-label: var(--ws-weight-strong) var(--ws-text-sm)/var(--ws-leading-ui) var(--ws-font-ui);
  --ws-type-code: var(--ws-weight-regular) var(--ws-text-sm)/var(--ws-leading-code) var(--ws-font-mono);
  --ws-type-small: var(--ws-weight-regular) var(--ws-text-md)/1.55 var(--ws-font-text);
  --ws-type-body: var(--ws-weight-regular) var(--ws-text-base)/var(--ws-leading-prose) var(--ws-font-text);
  --ws-type-lead: var(--ws-weight-regular) var(--ws-text-lg)/1.6 var(--ws-font-text);
  --ws-type-h4: var(--ws-weight-strong) var(--ws-text-base)/1.35 var(--ws-font-head);
  --ws-type-h3: var(--ws-weight-strong) var(--ws-text-lg)/1.3 var(--ws-font-head);
  --ws-type-h2: var(--ws-weight-strong) var(--ws-text-xl)/1.25 var(--ws-font-head);
  --ws-type-h1: var(--ws-weight-strong) var(--ws-text-2xl)/var(--ws-leading-head) var(--ws-font-head);

  /* Space: a 4px scale */
  --ws-space-1: 4px;  --ws-space-2: 8px;  --ws-space-3: 12px; --ws-space-4: 16px;
  --ws-space-5: 20px; --ws-space-6: 24px; --ws-space-8: 32px; --ws-space-10: 40px;
  --ws-space-12: 48px; --ws-space-16: 64px;

  /* Shape and elevation. Hairlines do the work; the one shadow is for floating menus. */
  --ws-radius-sm: 4px;  /* pills, kbd, inline code */
  --ws-radius: 6px;     /* buttons, inputs, search, code blocks, cards, callouts, menus */
  --ws-radius-lg: 10px; /* large panels only */
  --ws-shadow-color: light-dark(rgb(25 32 40 / .10), rgb(0 0 0 / .45));
  --ws-shadow-pop: 0 1px 2px var(--ws-shadow-color), 0 10px 28px var(--ws-shadow-color);

  /* Layout */
  --ws-header-h: 60px;
  --ws-header-bg: color-mix(in srgb, var(--ws-paper) 86%, transparent);
  --ws-content-w: 52rem;  /* prose column container */
  --ws-page-w: 88rem;     /* header, footer, and page grid */
  --ws-gutter: 16px;      /* 24px from 768px up */
  --ws-target: 44px;      /* control height; 24px is the floor for inline targets */

  /* Motion */
  --ws-ease: cubic-bezier(.2, .7, .2, 1);
  --ws-dur: 140ms;
}
@media (min-width: 768px) { :root { --ws-gutter: 24px; } }

/* ---------- 3. Theme pinning for sites with a toggle ---------- */
:root[data-theme="light"], :root.light, body[data-theme="light"], [data-md-color-scheme="default"] { color-scheme: light; }
:root[data-theme="dark"], :root.dark, body[data-theme="dark"], [data-md-color-scheme="slate"] { color-scheme: dark; }

/* Image swaps for the wordmark where the framework has no light/dark logo option. All rules are (0,1,0),
   so the later block wins: the dark default first, then an explicit choice. */
.ws-only-light { display: none; }
.ws-only-dark { display: inline-block; }
:where(:root[data-theme="light"], :root.light, body[data-theme="light"], [data-md-color-scheme="default"]) .ws-only-light { display: inline-block; }
:where(:root[data-theme="light"], :root.light, body[data-theme="light"], [data-md-color-scheme="default"]) .ws-only-dark { display: none; }
:where(:root[data-theme="dark"], :root.dark, body[data-theme="dark"], [data-md-color-scheme="slate"]) .ws-only-light { display: none; }
:where(:root[data-theme="dark"], :root.dark, body[data-theme="dark"], [data-md-color-scheme="slate"]) .ws-only-dark { display: inline-block; }

/* ---------- 4. Base ---------- */
.ws-header, .ws-header *, .ws-footer, .ws-footer *, .ws-menu__panel, .ws-btn, .ws-rule, .ws-callout { box-sizing: border-box; }
::selection { background: var(--ws-selection); color: var(--ws-ink); }
:focus-visible { outline: 2px solid var(--ws-accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- 5. Shared components. Use these class names in markup you write yourself (header, footer,
   menus, pills). For markup the framework owns, map its classes to the same declarations. ---------- */

/* Brand block: wordmark (home link to watership.ca), a hairline, the site name (link to the site root). */
.ws-brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
.ws-brand__home { display: inline-flex; align-items: center; min-height: var(--ws-target); flex: none; }
:where(.ws-brand__home img) { display: block; width: auto; height: 20px; }
.ws-brand__divider { width: 1px; height: 20px; flex: none; background: var(--ws-rule); }
.ws-brand__site { min-width: 0; overflow: hidden; color: var(--ws-ink); font: var(--ws-weight-strong) var(--ws-text-base)/1.2 var(--ws-font-head); letter-spacing: -.005em; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.ws-brand__site:hover { color: var(--ws-accent); }
@media (max-width: 480px) {
  .ws-brand { gap: 10px; }
  :where(.ws-brand__home img), .ws-brand__divider { height: 18px; }
}

/* Header shell, for sites that draw their own header (main site, DITA, Furo top bar). */
.ws-header { position: sticky; top: 0; z-index: 50; height: var(--ws-header-h); background: var(--ws-header-bg); border-bottom: 1px solid var(--ws-rule); -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px); }
.ws-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 100%; width: min(100%, var(--ws-page-w)); margin-inline: auto; padding-inline: var(--ws-gutter); }
.ws-header__nav { display: flex; align-items: center; gap: 2px; font: var(--ws-weight-ui) var(--ws-text-sm)/1 var(--ws-font-ui); }

/* Header and top-level links: mono, soft at rest, ink on hover, the current page underlined in sail red. */
.ws-navlink { display: inline-flex; align-items: center; min-height: 36px; padding: 0 10px; border-radius: var(--ws-radius); color: var(--ws-soft); text-decoration: none; transition: color var(--ws-dur) var(--ws-ease), background-color var(--ws-dur) var(--ws-ease); }
.ws-navlink:hover { color: var(--ws-ink); background: var(--ws-wash); }
.ws-navlink[aria-current] { color: var(--ws-ink); text-decoration: underline 2px var(--ws-accent); text-underline-offset: .45em; }

/* The "Watership Content Model" menu: a <details> or the framework's dropdown. */
.ws-menu { position: relative; }
.ws-menu > summary { list-style: none; cursor: pointer; }
.ws-menu > summary::-webkit-details-marker { display: none; }
.ws-menu__panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 13rem; padding: 6px; background: var(--ws-sheet); border: 1px solid var(--ws-rule); border-radius: var(--ws-radius); box-shadow: var(--ws-shadow-pop); font: var(--ws-weight-ui) var(--ws-text-sm)/1.3 var(--ws-font-ui); }
.ws-menu__panel ul { list-style: none; margin: 0; padding: 0; }
.ws-menu__panel a, .ws-menu__current { display: flex; align-items: center; min-height: 32px; padding: 0 10px; border-radius: var(--ws-radius-sm); color: var(--ws-body); text-decoration: none; }
.ws-menu__panel a:hover { background: var(--ws-wash); color: var(--ws-ink); }
.ws-menu__current { background: var(--ws-wash); color: var(--ws-ink); font-weight: 600; box-shadow: inset 2px 0 0 var(--ws-accent); }
.ws-menu__home { margin-bottom: 4px; padding-bottom: 4px; border-bottom: 1px solid var(--ws-rule); }

/* Footer: lead (wordmark and line), then This site, Watership Content Model, and Contact columns,
   then the fine line. */
.ws-footer { margin-top: var(--ws-space-16); border-top: 1px solid var(--ws-rule); background: var(--ws-paper); color: var(--ws-faint); font: 400 var(--ws-text-sm)/1.45 var(--ws-font-ui); }
.ws-footer__inner { display: grid; grid-template-columns: 1.3fr repeat(3, minmax(0, 1fr)); gap: 32px 40px; width: min(100%, var(--ws-page-w)); margin-inline: auto; padding: 40px var(--ws-gutter) 28px; }
.ws-footer__lead { display: grid; gap: 10px; align-content: start; }
:where(.ws-footer__lead img) { display: block; width: auto; height: 20px; }
.ws-footer__lead p { margin: 0; }
.ws-footer__col { display: flex; flex-direction: column; gap: 6px; }
.ws-footer__title { margin: 0 0 4px; color: var(--ws-ink); font: var(--ws-type-label); }
.ws-footer ul { list-style: none; margin: 0; padding: 0; display: contents; }
.ws-footer a { color: var(--ws-soft); text-decoration: none; }
.ws-footer a:hover { color: var(--ws-ink); text-decoration: underline 1px var(--ws-accent); text-underline-offset: .25em; }
.ws-footer [aria-current] { color: var(--ws-ink); font-weight: 600; }
.ws-footer__fine { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; padding-top: 16px; border-top: 1px solid var(--ws-rule); font-size: var(--ws-text-sm); }
@media (max-width: 900px) { .ws-footer__inner { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ws-footer__lead { grid-column: 1 / -1; } }
@media (max-width: 480px) { .ws-footer__inner { grid-template-columns: 1fr; } }

/* Buttons */
.ws-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--ws-target); padding: 0 18px; border: 1px solid var(--ws-ink); border-radius: var(--ws-radius); background: var(--ws-ink); color: var(--ws-on-ink); font: var(--ws-weight-strong) var(--ws-text-sm)/1.2 var(--ws-font-ui); text-decoration: none; cursor: pointer; transition: background-color var(--ws-dur) var(--ws-ease), border-color var(--ws-dur) var(--ws-ease), color var(--ws-dur) var(--ws-ease); }
.ws-btn:hover { background: var(--ws-accent); border-color: var(--ws-accent); color: var(--ws-on-accent); }
.ws-btn--secondary { background: transparent; border-color: var(--ws-control-border); color: var(--ws-ink); }
.ws-btn--secondary:hover { background: var(--ws-wash); border-color: var(--ws-ink); color: var(--ws-ink); }

/* Tier pills */
.ws-pill { display: inline-flex; align-items: center; min-height: 22px; padding: 1px 8px; border-radius: var(--ws-radius-sm); font: var(--ws-weight-strong) var(--ws-text-sm)/1.4 var(--ws-font-ui); white-space: nowrap; }
.ws-pill--never { background: var(--ws-never-bg); color: var(--ws-never-fg); }
.ws-pill--avoid { background: var(--ws-avoid-bg); color: var(--ws-avoid-fg); }
.ws-pill--prefer { background: var(--ws-prefer-bg); color: var(--ws-prefer-fg); }
.ws-pill--outline { background: transparent; box-shadow: inset 0 0 0 1px var(--ws-rule); color: var(--ws-faint); }

/* Rule card: sheet, hairline, rounded; the pill carries the tier (no colored side bar). */
.ws-rule { margin: 0 0 var(--ws-space-4); padding: 18px 20px; background: var(--ws-sheet); border: 1px solid var(--ws-rule); border-radius: var(--ws-radius); scroll-margin-top: calc(var(--ws-header-h) + 16px); }
.ws-rule:target, .ws-rule:has(:target) { border-color: var(--ws-accent); box-shadow: 0 0 0 3px var(--ws-accent-wash); }
.ws-rule__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 10px; color: var(--ws-faint); font: var(--ws-type-ui); }
.ws-example { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 12px; padding: 10px 12px; border-radius: var(--ws-radius-sm); background: var(--ws-wash); }
.ws-example + .ws-example { margin-top: 4px; }
.ws-example--good { background: var(--ws-mean-bg); }
.ws-example__label { padding-top: 2px; color: var(--ws-faint); font: var(--ws-type-label); }
.ws-example--good .ws-example__label { color: var(--ws-mean-fg); }
@media (max-width: 600px) { .ws-example { grid-template-columns: 1fr; gap: 2px; } }

/* Callout */
.ws-callout { --ws-callout-fg: var(--ws-avoid-fg); margin: 0 0 1.2em; padding: 14px 16px 14px 18px; background: var(--ws-sheet); border: 1px solid var(--ws-rule); border-radius: var(--ws-radius); box-shadow: inset 3px 0 0 var(--ws-callout-fg); }
.ws-callout--tip { --ws-callout-fg: var(--ws-mean-fg); }
.ws-callout--caution { --ws-callout-fg: var(--ws-caution-fg); }
.ws-callout--danger { --ws-callout-fg: var(--ws-never-fg); }
.ws-callout__title { margin: 0 0 4px; color: var(--ws-callout-fg); font: var(--ws-type-label); }
.ws-callout > :last-child { margin-bottom: 0; }

/* ---------- 6. Type roles. Zero-specificity defaults for markup a site writes itself (main site, DITA, custom
   components). Framework pages also need the overrides listed for their framework in type-scale.md, because
   framework rules are more specific than these. ---------- */
:where(body) { font: var(--ws-type-body); }
:where(h1) { font: var(--ws-type-h1); letter-spacing: var(--ws-tracking-head); }
:where(h2) { font: var(--ws-type-h2); letter-spacing: var(--ws-tracking-head); }
:where(h3) { font: var(--ws-type-h3); }
:where(h4, h5, h6) { font: var(--ws-type-h4); }
:where(strong, b, th, dt) { font-weight: var(--ws-weight-strong); }
:where(small) { font-size: inherit; }  /* small text is a role (caption, meta), not a size step of its own */
:where(code, kbd, samp) { font-family: var(--ws-font-mono); font-size: var(--ws-text-md); font-weight: var(--ws-weight-regular); }
:where(td, th, caption, figcaption, nav, footer, header, aside, button, label, .ws-ui, .ws-label) :where(code, kbd, samp) { font-size: var(--ws-text-sm); }
:where(h1, h2, h3, h4, h5, h6, pre) :where(code, kbd, samp) { font-size: inherit; }
:where(pre) { font: var(--ws-type-code); }
:where(table) { font: var(--ws-type-small); }
:where(th) { font: var(--ws-type-label); color: var(--ws-faint); text-align: start; }
:where(figcaption, caption) { font: var(--ws-type-ui); color: var(--ws-faint); }
:where(input, select, textarea) { font: var(--ws-weight-regular) var(--ws-text-base)/1.4 var(--ws-font-text); } /* 17px Inter: below 16px iOS zooms on focus, and mono stops at md */
:where(button) { font: var(--ws-type-label); }
.ws-ui { font: var(--ws-type-ui); }
.ws-label { font: var(--ws-type-label); color: var(--ws-faint); }
.ws-lead { font: var(--ws-type-lead); color: var(--ws-soft); }

/* Skip link, the same on every site: "Skip to content" in the label style on an ink chip, shown at the
   top left on focus. Give the framework's own skip link this class or these declarations. */
.ws-skip { box-sizing: border-box; position: fixed; top: 12px; left: 100%; z-index: 1000; display: inline-flex; align-items: center; min-height: 44px; padding: 10px 14px; border-radius: var(--ws-radius); background: var(--ws-ink); color: var(--ws-on-ink); font: var(--ws-type-label); text-decoration: none; }
.ws-skip:focus, .ws-skip:focus-visible { left: 12px; color: var(--ws-on-ink); }
