/* Localgauge docs: tokens from the app's design system ("Bench log, after dark").
   Dark is the default theme. Data colours (local, frontier) never fill page chrome. */

:root,
[data-md-color-scheme="default"] {
  --lg-bg: oklch(97% 0.003 265);
  --lg-surface: oklch(98.8% 0.002 265);
  --lg-raise: oklch(95.4% 0.005 258);
  --lg-chip: oklch(94.8% 0.005 258);
  --lg-line: oklch(90.5% 0.008 254);
  --lg-ink: oklch(20.4% 0.011 261);
  --lg-ink2: oklch(37.3% 0.021 259);
  --lg-muted: oklch(48.6% 0.024 258);
  --lg-local: oklch(48.9% 0.189 263);
  --lg-local-hover: oklch(38% 0.17 263);
  --lg-sel: oklch(92.1% 0.028 265);
  --lg-ctl: oklch(61.4% 0.022 257);
  --lg-caution: oklch(47.8% 0.101 75);
}

[data-md-color-scheme="slate"] {
  --lg-bg: oklch(17.5% 0.006 237);
  --lg-surface: oklch(20.7% 0.01 248);
  --lg-raise: oklch(23.6% 0.012 248);
  --lg-chip: oklch(25.7% 0.014 248);
  --lg-line: oklch(29% 0.015 252);
  --lg-ink: oklch(93.9% 0.005 248);
  --lg-ink2: oklch(80.5% 0.014 252);
  --lg-muted: oklch(66.6% 0.019 253);
  --lg-local: oklch(75.9% 0.106 264);
  --lg-local-hover: oklch(84% 0.08 264);
  --lg-sel: oklch(29.5% 0.053 264);
  --lg-ctl: oklch(51.4% 0.022 256);
  --lg-caution: oklch(79.4% 0.11 84);
  --md-hue: 248;
}

[data-md-color-scheme] {
  --md-default-bg-color: var(--lg-bg);
  --md-default-fg-color: var(--lg-ink);
  --md-default-fg-color--light: var(--lg-ink2);
  --md-default-fg-color--lighter: var(--lg-muted);
  --md-default-fg-color--lightest: var(--lg-line);
  --md-primary-fg-color: var(--lg-surface);
  --md-primary-fg-color--light: var(--lg-raise);
  --md-primary-fg-color--dark: var(--lg-bg);
  --md-primary-bg-color: var(--lg-ink);
  --md-primary-bg-color--light: var(--lg-ink2);
  --md-accent-fg-color: var(--lg-local-hover);
  --md-accent-fg-color--transparent: var(--lg-sel);
  --md-accent-bg-color: var(--lg-bg);
  --md-typeset-color: var(--lg-ink);
  --md-typeset-a-color: var(--lg-local);
  --md-typeset-table-color: var(--lg-line);
  --md-typeset-table-color--light: var(--lg-raise);
  --md-code-bg-color: var(--lg-surface);
  --md-code-fg-color: var(--lg-ink);
  --md-footer-bg-color: var(--lg-surface);
  --md-footer-bg-color--dark: var(--lg-bg);
  --md-footer-fg-color: var(--lg-ink);
  --md-footer-fg-color--light: var(--lg-ink2);
  --md-footer-fg-color--lighter: var(--lg-muted);
  --md-admonition-bg-color: var(--lg-raise);
  --md-admonition-fg-color: var(--lg-ink);
  --md-shadow-z1: none;
  --md-shadow-z2: none;
  --md-shadow-z3: none;
}

/* Type: one system sans, one system mono. Nothing fetched. */
body,
input,
.md-typeset {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

code,
kbd,
pre,
.md-typeset code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

.md-typeset h1 {
  color: var(--lg-ink);
  font-size: 2.25em;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin-bottom: 0.6em;
}

.md-typeset h2 {
  font-size: 1.5em;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.md-typeset h3 {
  font-size: 1.15em;
  font-weight: 650;
}

/* The tagline directly under the H1 reads as a lead, not as another bold line. */
.md-typeset h1 + p > strong:only-child {
  color: var(--lg-ink2);
  font-size: 1.2em;
  font-weight: 500;
}

/* Prose measure: about 72 characters (ch is the width of "0", so 66ch). Tables, code
   and charts keep the full column. */
.md-typeset > p,
.md-typeset > ul,
.md-typeset > ol,
.md-typeset > details,
.md-typeset > .admonition {
  max-width: 66ch;
}

.md-typeset > p:has(> picture) {
  max-width: none;
}

/* Header: a dim surface band with a 1px rule, not a coloured bar. */
.md-header {
  background-color: var(--lg-surface);
  border-bottom: 1px solid var(--lg-line);
  color: var(--lg-ink);
}

.md-header__button.md-logo svg {
  fill: none;
  height: 1.4rem;
  stroke: currentColor;
  width: 1.4rem;
}

.md-header__topic:first-child {
  font-weight: 700;
}

/* Logo and wordmark sit together, as in the app header. */
.md-header__button.md-logo {
  margin-right: 0;
  padding-right: 0.2rem;
}

.md-header__title {
  margin-left: 0.2rem;
}

/* Top-level sections read as part of the header band, like the app's nav. */
.md-header:has(+ .md-container .md-tabs),
.md-header {
  border-bottom: 0;
}

.md-tabs {
  background-color: var(--lg-surface);
  border-bottom: 1px solid var(--lg-line);
  color: var(--lg-ink2);
}

.md-tabs__link {
  font-size: 0.7rem;
  margin-top: 0.5rem;
  opacity: 1;
}

.md-tabs__item--active .md-tabs__link {
  color: var(--lg-ink);
  font-weight: 600;
}

.md-tabs__link:is(:hover, :focus) {
  color: var(--lg-local);
}

.md-search__form {
  background-color: var(--lg-chip);
  border: 1px solid var(--lg-line);
  border-radius: 6px;
}

.md-search__input,
.md-search__input::placeholder,
.md-search__icon {
  color: var(--lg-ink2);
}

.md-search__form:hover {
  background-color: var(--lg-raise);
}

/* Navigation: section titles as labels; the current page in ink, marked by weight. */
.md-nav__item--section > .md-nav__link,
.md-nav__title {
  color: var(--lg-muted);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.md-nav__link--active,
.md-nav__item .md-nav__link--active {
  color: var(--lg-local);
  font-weight: 600;
}

/* Tables: panel with 1px rules, tabular figures, sticky first column when scrolling. */
.md-typeset table:not([class]) {
  border: 1px solid var(--lg-line);
  border-radius: 8px;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  /* Material makes the table its own (non-scrolling) scroll box, which would pin
     sticky cells to it; let them stick to the scrolling wrapper instead. */
  overflow: visible;
}

.md-header--shadow {
  box-shadow: none;
}

.md-typeset table:not([class]) th {
  background-color: var(--lg-raise);
  color: var(--lg-ink);
  font-weight: 600;
}

.md-typeset table:not([class]) th:first-child,
.md-typeset table:not([class]) td:first-child {
  background-color: var(--lg-surface);
  box-shadow: inset -1px 0 0 var(--lg-line);
  left: 0;
  position: sticky;
  z-index: 1;
}

.md-typeset table:not([class]) th:first-child {
  background-color: var(--lg-raise);
}

.md-typeset table:not([class]) td:first-child {
  min-width: 10ch;
}

.md-typeset .lg-rate {
  white-space: nowrap;
}

/* A trailing notes column stays readable instead of stretching rows to six lines. */
.md-typeset table:not([class]) td:last-child:not(:first-child) {
  min-width: 18ch;
}

/* Keep numbers with their units ("313.490 s"); right-aligned columns are numeric. */
.md-typeset table:not([class]) td[style*="right"] {
  white-space: nowrap;
}

.md-typeset table:not([class]) tbody tr:hover {
  background-color: var(--lg-sel);
}

/* Notes and fold-outs: tonal fill and a full 1px rule, never a coloured stripe. */
.md-typeset :is(.admonition, details)[class] {
  background-color: var(--lg-raise);
  border: 1px solid var(--lg-line);
  border-radius: 8px;
  box-shadow: none;
  font-size: 0.8rem;
}

.md-typeset .admonition-title,
.md-typeset summary {
  background-color: transparent !important;
  color: var(--lg-ink);
  font-weight: 600;
}

.md-typeset .admonition-title::before,
.md-typeset summary::before {
  background-color: var(--lg-muted) !important;
}

.md-typeset summary::after {
  color: var(--lg-muted);
}

/* Glyph plus label, as in the app: a caution triangle instead of Material's pencil. */
.md-typeset :is(.admonition.note > .admonition-title, details.note > summary)::before {
  -webkit-mask-image: none;
  background-color: transparent !important;
  color: var(--lg-caution);
  content: "▲";
  font-size: 0.7rem;
  line-height: 1.25rem;
  mask-image: none;
  text-align: center;
}

/* Code */
.md-typeset .md-code__button,
.md-typeset .md-clipboard {
  color: var(--lg-muted);
}

.md-typeset .md-code__button:hover,
.md-typeset .md-clipboard:hover {
  color: var(--lg-ink2);
}

.md-typeset pre > code {
  border: 1px solid var(--lg-line);
  border-radius: 8px;
}

/* Footer */
.md-footer,
.md-footer-meta {
  background-color: var(--lg-surface);
  border-top: 1px solid var(--lg-line);
  color: var(--lg-ink2);
}

.md-footer-meta {
  background-color: var(--lg-bg);
}

.md-copyright {
  color: var(--lg-muted);
}

.md-footer__direction {
  color: var(--lg-ink2);
  opacity: 1;
}

/* Keep the copy button off the first line of code on narrow screens. */
@media screen and (max-width: 44.984375em) {
  .md-typeset pre > code {
    padding-right: 2.4rem;
  }
}

/* Charts */
.md-typeset picture img,
.md-typeset img {
  height: auto;
  max-width: 100%;
}

.md-typeset picture + em,
.md-typeset p:has(> picture) + p > em:only-child {
  color: var(--lg-ink2);
  font-size: 0.9em;
  font-style: normal;
}

.md-typeset .md-button {
  border: 1px solid var(--lg-ctl);
  border-radius: 6px;
  color: var(--lg-ink);
}

.md-typeset .md-button--primary {
  background-color: var(--lg-chip);
}

.md-typeset .md-button:is(:hover, :focus) {
  background-color: var(--lg-raise);
  border-color: var(--lg-local);
  color: var(--lg-ink);
}

/* The header already carries the wordmark; on desktop the nav title only repeats it. */
@media screen and (min-width: 76.25em) {
  .md-nav--primary > .md-nav__title {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
