/* ============================================================================
   Parity docs theme (2026-11-09).

   The docs pages wear the front page (site/assets/parity.css): cream paper,
   Wayne Green ink, Instrument Serif headings, IBM Plex Mono for code, and the
   same masthead. The front page's mirror stays on the front page; the docs
   are for reading.

   How it gets onto the pages: docs/docs.json "theme" names this file and
   docs/_header.html. The docs builder copies it to site/docs/theme/parity.css
   and links it after the kit's docs.css, so the --dk-* tokens and the rules
   below win without !important. The kit's docs.css stays Squire's bytes.

   Dark is the front page's dark set: change one, change both.

   File map: 1. fonts and tokens  2. frame  3. masthead  4. sidebar
             5. article and code  6. footer  7. dark  8. responsive  9. motion
   ========================================================================== */

/* ---------------------------------------------------- 1. fonts and tokens */

@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../../assets/fonts/instrument-serif-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../../assets/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../../assets/fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2");
}

:root {
  --p-bench: #f6f1e3;
  --p-paper: #fffdf7;
  --p-sand: #ede6d3;
  --p-line: #d9cfb6;
  --p-ink: #1a1a1a;
  --p-ink-2: #45463f;
  --p-green: #0c5449;
  --p-green-deep: #083d35;
  --p-gold: #ffcc33;
  --p-masthead: rgba(246, 241, 227, 0.94);
  --p-current: #e7efe9;
  --p-masthead-h: 64px;
  --p-serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --p-body: var(--wsu-font-family-body, Lato, Calibri, "Helvetica Neue", Arial, sans-serif);
  --p-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;

  --dk-bg: var(--p-bench);
  --dk-ink: var(--p-ink);
  --dk-muted: var(--p-ink-2);
  --dk-rule: var(--p-line);
  --dk-accent: var(--p-green);
  --dk-on-accent: #ffffff;
  --dk-code-bg: var(--p-sand);
  --dk-note: #0e5a7d;
  --dk-tip: var(--p-green);
  --dk-warning: #6b4f00;
  --dk-danger: #b3261e;
  --dk-display: var(--p-serif);
  --dk-mono: var(--p-mono);
  --dk-radius: 12px;
  --dk-focus: var(--p-green);
  --dk-focus-w: 3px;
  --dk-focus-o: 3px;
  --dk-sidebar: 15rem;
  --dk-prose-max: 46rem;
  --dk-gap: 1.75rem;

  color-scheme: light;
}

/* ------------------------------------------------------------- 2. frame */

html {
  background: var(--dk-bg);
  scroll-padding-top: calc(var(--p-masthead-h) + 1rem);
}

body {
  margin: 0;
  color: var(--dk-ink);
  background: var(--dk-bg);
  font-family: var(--p-body);
}

:where(a, button, summary, [tabindex]):focus-visible {
  outline: var(--dk-focus-w) solid var(--dk-focus);
  outline-offset: var(--dk-focus-o);
  border-radius: 3px;
}

/* ---------------------------------------------------------- 3. masthead */

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--p-masthead);
  border-bottom: 1px solid var(--dk-rule);
}

.masthead__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-sizing: border-box;
  max-width: 76rem;
  min-height: var(--p-masthead-h);
  margin-inline: auto;
  padding-inline: clamp(1.1rem, 4vw, 2.5rem);
}

.masthead__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--dk-ink);
  text-decoration: none;
}

/* Wordmark first; the mark rides small beside it until the new one lands. */
.masthead__mark {
  border-radius: 6px;
}

.masthead__name {
  font-family: var(--p-serif);
  font-size: 1.9rem;
  line-height: 1;
  letter-spacing: -0.01em;
}

.masthead__ver {
  font-family: var(--p-mono);
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--dk-rule);
  border-radius: 999px;
  color: var(--dk-muted);
}

.masthead__nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.15rem 1.1rem;
}

.masthead__nav a {
  color: var(--dk-ink);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
}

.masthead__nav a:hover,
.masthead__nav a[aria-current="page"] {
  border-bottom-color: var(--dk-accent);
}

.masthead__nav .masthead__install {
  padding: 0.4rem 0.95rem;
  border: 2px solid var(--dk-accent);
  border-radius: 999px;
  color: var(--dk-accent);
}

.masthead__nav .masthead__install:hover {
  background: var(--dk-accent);
  color: var(--dk-on-accent);
}

/* ----------------------------------------------------------- 4. sidebar */

.docs-nav a[aria-current="page"] {
  background: var(--p-current);
  box-shadow: inset 3px 0 0 var(--dk-accent);
  color: var(--dk-ink);
  font-weight: 700;
}

/* ------------------------------------------------- 5. article and code */

/* The kit sets the article in --dk-display, which is Lato under WayneUI's tokens. Parity's display is the serif,
   so the article names the body face itself and the serif stays on the headings below. */
.docs-article {
  font-family: var(--p-body);
}

.docs-article h1,
.docs-article h2 {
  font-family: var(--p-serif);
  font-weight: 400;
  letter-spacing: -0.01em;
}

.docs-article h1 {
  font-size: clamp(2.6rem, 6vw, 3.6rem);
  line-height: 1;
}

.docs-article h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.2rem);
  line-height: 1.1;
}

.docs-article h3 {
  font-family: var(--p-body);
  font-weight: 700;
}

.docs-article :is(h1, h2) code {
  font-family: var(--p-mono);
  font-size: 0.7em;
}

.docs-article code {
  font-family: var(--p-mono);
}

/* Printouts and commands read on the front page's dark terminal in both themes. */
.docs-article pre {
  background: #102320;
  color: #e8efea;
  border: 0;
}

.docs-article pre code {
  background: none;
  color: inherit;
}

/* With docs.js the block sits in .docs-copy: the terminal moves to the wrapper and the pre stops short of a
   gutter for the Copy button, so the button never covers a line, scrolled or not (the stack's pattern). */
.docs-copy {
  margin: 0 0 1rem;
  background: #102320;
  border-radius: var(--dk-radius);
}

.docs-copy > pre {
  margin: 0;
  margin-inline-end: 4.75rem;
  padding-inline-end: 0.75rem;
  background: transparent;
  border-radius: var(--dk-radius) 0 0 var(--dk-radius);
}

.docs-article table {
  background: var(--p-paper);
}

/* A screen of the desktop app (guides/desktop-app): framed like the front page's app window, the caption under
   it. The page picks the light or the dark screen with a <picture>, the same way the front page does. */
.docs-article figure.app-shot {
  margin: 1.6rem 0 2rem;
}

.docs-article figure.app-shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--p-line-2, var(--dk-rule));
  border-radius: var(--dk-radius);
  background: var(--p-paper);
}

.docs-article figure.app-shot figcaption {
  margin-top: 0.6rem;
  font-size: 0.92rem;
  color: var(--dk-muted);
}

/* ------------------------------------------------------------ 6. footer */

.docs-footer {
  color: var(--dk-muted);
}

/* -------------------------------------------------------------- 7. dark */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --p-paper: #13201d;
    --p-sand: #1a2b27;
    --p-masthead: rgba(12, 21, 19, 0.94);
    --p-current: #1a2b27;
    --dk-bg: #0c1513;
    --dk-ink: #ecefe9;
    --dk-muted: #b9c7c1;
    --dk-rule: #26392f;
    --dk-accent: #74cfb4;
    --dk-on-accent: #062520;
    --dk-code-bg: #1a2b27;
    --dk-note: #8cc8e6;
    --dk-tip: #74cfb4;
    --dk-warning: #ffd866;
    --dk-danger: #ff9a8a;
    --dk-focus: var(--p-gold);
    color-scheme: dark;
  }

  :root:not([data-theme="light"]) .docs-article pre,
  :root:not([data-theme="light"]) .docs-copy {
    background: #08110f;
  }

  :root:not([data-theme="light"]) .docs-copy > pre {
    background: transparent;
  }
}

:root[data-theme="dark"] {
  --p-paper: #13201d;
  --p-sand: #1a2b27;
  --p-masthead: rgba(12, 21, 19, 0.94);
  --p-current: #1a2b27;
  --dk-bg: #0c1513;
  --dk-ink: #ecefe9;
  --dk-muted: #b9c7c1;
  --dk-rule: #26392f;
  --dk-accent: #74cfb4;
  --dk-on-accent: #062520;
  --dk-code-bg: #1a2b27;
  --dk-note: #8cc8e6;
  --dk-tip: #74cfb4;
  --dk-warning: #ffd866;
  --dk-danger: #ff9a8a;
  --dk-focus: var(--p-gold);
  color-scheme: dark;
}

:root[data-theme="dark"] .docs-article pre,
:root[data-theme="dark"] .docs-copy {
  background: #08110f;
}

:root[data-theme="dark"] .docs-copy > pre {
  background: transparent;
}

/* -------------------------------------------------------- 8. responsive */

@media (min-width: 760px) {
  .docs-nav--sidebar {
    position: sticky;
    top: calc(var(--p-masthead-h) + 1.25rem);
    max-block-size: calc(100vh - var(--p-masthead-h) - 2.5rem);
    overflow-y: auto;
  }
}

@media (min-width: 1200px) {
  .docs-layout--toc .docs-toc {
    top: calc(var(--p-masthead-h) + 1.25rem);
  }
}

@media (max-width: 1100px) {
  .masthead__nav a[href*="index.html#"]:not(.masthead__install) {
    display: none;
  }
}

@media (max-width: 640px) {
  :root {
    --dk-gap: 1rem;
  }

  .masthead__nav a:not(.masthead__install) {
    display: none;
  }

  .docs-article pre {
    font-size: 0.8125rem;
  }
}

@media (max-width: 400px) {
  .masthead__ver {
    display: none;
  }
}

/* ------------------------------------------------------------ 9. motion */

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  .masthead__nav a,
  .masthead__nav .masthead__install {
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
  }
}
