/* ISCC theme for Zensical: maps the identity tokens from iscc.css onto the
 * Material/Zensical variables and styles the components the tokens do not
 * reach. Light scheme is the paper canvas; the slate scheme is near-black
 * with raised graphite fields and code blocks. Coral marks calls to action, the active navigation
 * marker, text selection and the logo circle; blue marks links. */

/* ---------- Fonts ---------- */

:root {
  --md-text-font: "Readex Pro";
  --md-code-font: "JetBrains Mono";
}

/* ---------- Light scheme ---------- */

:root,
[data-md-color-scheme="default"] {
  --md-default-fg-color: var(--iscc-ink);
  --md-default-fg-color--light: var(--iscc-muted);
  --md-default-fg-color--lighter: #9aa1a6;
  --md-default-fg-color--lightest: #21252914;
  --md-default-bg-color: var(--iscc-paper);
  --md-default-bg-color--light: #f8f9fab3;
  --md-default-bg-color--lighter: #f8f9fa4d;
  --md-default-bg-color--lightest: #f8f9fa1f;

  --md-primary-fg-color: var(--iscc-blue);
  --md-primary-fg-color--light: var(--iscc-sky);
  --md-primary-fg-color--dark: var(--iscc-navy);
  --md-primary-bg-color: var(--iscc-white);
  --md-primary-bg-color--light: #ffffffb3;
  --md-accent-fg-color: var(--iscc-blue);
  --md-accent-fg-color--transparent: #0054b214;
  --md-accent-bg-color: var(--iscc-white);
  --md-accent-bg-color--light: #ffffffb3;

  --md-typeset-a-color: var(--iscc-blue);
  --md-typeset-mark-color: #ffc30066;
  --md-typeset-table-color: var(--iscc-rule);
  --md-typeset-table-color--light: #21252908;
  --md-typeset-kbd-color: var(--iscc-white);
  --md-typeset-kbd-accent-color: var(--iscc-white);
  --md-typeset-kbd-border-color: var(--iscc-rule);

  --md-code-fg-color: var(--iscc-ink);
  --md-code-bg-color: var(--iscc-white);
  --md-code-bg-color--light: #ffffffb3;
  --md-code-bg-color--lighter: #ffffff4d;
  --md-code-hl-color: var(--iscc-sky);
  --md-code-hl-color--light: #4596f526;
  --md-code-hl-keyword-color: var(--iscc-blue);
  --md-code-hl-function-color: var(--iscc-navy);
  --md-code-hl-constant-color: var(--iscc-navy);
  --md-code-hl-string-color: #3f7a10;
  --md-code-hl-number-color: #a34b00;
  --md-code-hl-special-color: #b3364a;
  --md-code-hl-comment-color: var(--iscc-muted);

  --md-footer-bg-color: var(--iscc-navy);
  --md-footer-bg-color--dark: var(--iscc-navy);
  --md-footer-fg-color: #ffffff;
  --md-footer-fg-color--light: #ffffffc7;
  --md-footer-fg-color--lighter: #ffffff73;

  --md-shadow-z1: 0 0 0 1px var(--iscc-rule);
  --md-shadow-z2: 0 0.2rem 0.5rem #2125291f, 0 0 0 1px var(--iscc-rule);
  --md-shadow-z3: 0 0.4rem 1.2rem #21252933, 0 0 0 1px var(--iscc-rule);

  --iscc-field: var(--iscc-white);
  --iscc-code-block-bg: var(--iscc-white);
  --iscc-code-block-fg: var(--iscc-ink);
}

/* ---------- Dark scheme ---------- */

[data-md-color-scheme="slate"] {
  --md-hue: 210deg;
  --md-default-fg-color: #f8f9faeb;
  --md-default-fg-color--light: #f8f9fab3;
  --md-default-fg-color--lighter: #f8f9fa73;
  --md-default-fg-color--lightest: #f8f9fa1f;
  --md-default-bg-color: var(--iscc-ink);
  --md-default-bg-color--light: #212529b3;
  --md-default-bg-color--lighter: #2125294d;
  --md-default-bg-color--lightest: #2125291f;

  --md-primary-fg-color: var(--iscc-sky);
  --md-primary-fg-color--light: var(--iscc-cyan);
  --md-primary-fg-color--dark: var(--iscc-blue);
  --md-primary-bg-color: var(--iscc-ink);
  --md-primary-bg-color--light: #212529b3;
  --md-accent-fg-color: var(--iscc-sky);
  --md-accent-fg-color--transparent: #4596f51f;
  --md-accent-bg-color: var(--iscc-ink);
  --md-accent-bg-color--light: #212529b3;

  --md-typeset-a-color: var(--iscc-sky);
  --md-typeset-mark-color: #ffc3004d;
  --md-typeset-table-color: #f8f9fa29;
  --md-typeset-table-color--light: #f8f9fa0a;
  --md-typeset-kbd-color: #f8f9fa1f;
  --md-typeset-kbd-accent-color: #f8f9fa33;
  --md-typeset-kbd-border-color: #16181b;

  --md-code-fg-color: var(--iscc-paper);
  --md-code-bg-color: #f8f9fa14;
  --md-code-bg-color--light: #f8f9fa0f;
  --md-code-bg-color--lighter: #f8f9fa0a;
  --md-code-hl-color: var(--iscc-sky);
  --md-code-hl-color--light: #4596f533;
  --md-code-hl-keyword-color: var(--iscc-cyan);
  --md-code-hl-function-color: #f8f9fa;
  --md-code-hl-constant-color: var(--iscc-cyan);
  --md-code-hl-string-color: var(--iscc-lime);
  --md-code-hl-number-color: var(--iscc-yellow);
  --md-code-hl-special-color: var(--iscc-yellow);
  --md-code-hl-comment-color: #adb5bd;
  --md-code-hl-operator-color: #adb5bd;
  --md-code-hl-punctuation-color: #adb5bd;
  --md-code-hl-generic-color: #adb5bd;
  --md-code-hl-variable-color: #dee2e6;

  --md-admonition-fg-color: var(--md-default-fg-color);
  --md-admonition-bg-color: transparent;
  --md-footer-bg-color: var(--iscc-navy);
  --md-footer-bg-color--dark: var(--iscc-navy);
  --md-footer-fg-color: #ffffff;
  --md-footer-fg-color--light: #ffffffc7;
  --md-footer-fg-color--lighter: #ffffff73;

  --md-shadow-z1: 0 0 0 1px #f8f9fa1f;
  --md-shadow-z2: 0 0.2rem 0.5rem #00000059, 0 0 0 1px #f8f9fa1f;
  --md-shadow-z3: 0 0.4rem 1.2rem #00000080, 0 0 0 1px #f8f9fa1f;

  --iscc-rule: #f8f9fa29;
  --iscc-field: #2b3035;
  --iscc-code-block-bg: var(--iscc-field);
  --iscc-code-block-fg: var(--iscc-paper);
  color-scheme: dark;
}

/* Dark-scheme headings stay on the paper foreground rather than pure white */
[data-md-color-scheme="slate"] .md-header__title,
[data-md-color-scheme="slate"] h1,
[data-md-color-scheme="slate"] h2,
[data-md-color-scheme="slate"] h3,
[data-md-color-scheme="slate"] h4,
[data-md-color-scheme="slate"] h5,
[data-md-color-scheme="slate"] h6 {
  color: var(--iscc-paper);
}

/* ---------- Base ---------- */

::selection {
  background: var(--iscc-coral);
  color: var(--iscc-ink);
}

:focus-visible {
  outline: 2px solid var(--iscc-blue);
  outline-offset: 2px;
}

[data-md-color-scheme="slate"] :focus-visible {
  outline-color: var(--iscc-sky);
}

/* Content width: cap at 1385px on large screens, capped to 90vw to keep margins. */
@media screen and (min-width: 76.25em) {
  .md-grid {
    max-width: min(1385px, 90vw);
  }
}

/* ---------- Typography ---------- */

/* Zensical raises the root size from 125% to 137.5% and 150% on wide screens.
 * The content column stops at 1385px, so the theme keeps 125% (1rem = 20px at
 * the browser default) and type stays in proportion to the column. */
html {
  font-size: 125%;
}

/* Body copy is Readex Pro Light at 16px, a step lighter than Regular for a
 * quieter page; the lead paragraph shares the weight and stands
 * apart by size. Headings, emphasis and the current page use Medium or Semibold. */
.md-typeset {
  font-size: 0.8rem;
  font-weight: 300;
  line-height: 1.6;
  letter-spacing: 0;
}

.md-typeset h1 {
  font-weight: 400;
  font-size: 2em;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 1em;
  color: var(--md-default-fg-color);
}

.md-typeset h2 {
  font-weight: 500;
  font-size: 1.5em;
  line-height: 1.3;
  letter-spacing: -0.005em;
  margin: 1.8em 0 0.6em;
}

.md-typeset h3 {
  font-weight: 500;
  font-size: 1.2em;
  line-height: 1.4;
  margin: 1.5em 0 0.5em;
}

.md-typeset h4,
.md-typeset h5,
.md-typeset h6 {
  font-weight: 500;
}

.md-typeset strong,
.md-typeset b {
  font-weight: 600;
}

/* Running text stops at about 75 characters per line, the upper end of a
 * 45-75 measure. Tables, code, cards, tabs and paragraphs holding images
 * keep the full column. */
.md-content__inner > :is(p, ul, ol, dl, blockquote, .admonition, details):not(:has(img)) {
  max-width: 36rem;
}

.md-typeset a {
  text-decoration-thickness: 1px;
  text-decoration-color: #0054b266;
  text-underline-offset: 0.18em;
}

.md-typeset a:hover,
.md-typeset a:focus {
  text-decoration-color: currentColor;
}

[data-md-color-scheme="slate"] .md-typeset a {
  text-decoration-color: #4596f580;
}

.md-typeset hr {
  border-bottom: 1px solid var(--iscc-rule);
}

.md-typeset blockquote {
  border-left: 2px solid var(--iscc-ink);
  color: var(--md-default-fg-color);
}

[data-md-color-scheme="slate"] .md-typeset blockquote {
  border-left-color: var(--iscc-paper);
}

/* Small mono labels: table headers, sidebar titles, badges */
.iscc-label,
.md-typeset table:not([class]) th,
.md-nav__title,
.md-nav--secondary .md-nav__title,
.md-copyright__highlight small {
  font-family: var(--md-code-font-family);
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--md-default-fg-color--light);
}

/* ---------- Code ---------- */

.md-typeset code {
  font-size: 0.86em;
  font-weight: 400;
  border-radius: 0.15rem;
  padding: 0.15em 0.35em;
  box-shadow: 0 0 0 1px var(--iscc-rule);
}

.md-typeset pre > code {
  border-radius: 0.2rem;
  padding: 0.9em 1.1em;
  box-shadow: none;
  background-color: var(--iscc-code-block-bg);
  color: var(--iscc-code-block-fg);
  border: 1px solid var(--iscc-rule);
  line-height: 1.55;
}

.md-typeset .highlight span.filename {
  background-color: var(--iscc-code-block-bg);
  border: 1px solid var(--iscc-rule);
  border-bottom: 0;
  border-radius: 0.2rem 0.2rem 0 0;
  font-family: var(--md-code-font-family);
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.md-typeset .highlight span.filename + pre > code {
  border-radius: 0 0 0.2rem 0.2rem;
}


[data-md-color-scheme="slate"] .md-typeset pre a,
[data-md-color-scheme="slate"] .md-typeset pre a:hover {
  color: var(--iscc-cyan);
}

[data-md-color-scheme="slate"] .md-typeset .highlight span.filename {
  color: var(--md-default-fg-color--light);
}

.md-clipboard {
  color: var(--md-default-fg-color--lighter);
}

[data-md-color-scheme="slate"] .md-clipboard {
  color: #f8f9fa8c;
}

.md-typeset .md-clipboard:hover,
.md-typeset .md-clipboard:focus {
  color: var(--md-accent-fg-color);
}

/* ---------- Tables ---------- */

.md-typeset table:not([class]) {
  border: 0;
  border-top: 2px solid var(--iscc-ink);
  border-bottom: 1px solid var(--iscc-rule);
  border-radius: 0;
  box-shadow: none;
  font-size: 0.875em;
}

[data-md-color-scheme="slate"] .md-typeset table:not([class]) {
  border-top-color: var(--iscc-paper);
}

.md-typeset table:not([class]) th {
  background: transparent;
  border-bottom: 1px solid var(--iscc-rule);
  padding: 0.6em 0.8em;
  vertical-align: bottom;
}

.md-typeset table:not([class]) td {
  border-top: 1px solid var(--iscc-rule);
  padding: 0.6em 0.8em;
  vertical-align: top;
}

.md-typeset table:not([class]) tbody tr:hover {
  background-color: var(--md-typeset-table-color--light);
  box-shadow: none;
}

/* ---------- Admonitions ---------- */

/* Light scheme: tinted field with a coloured left rule and labelled title.
 * Dark scheme: rule and coloured title only, so navy stays the code signal. */
.md-typeset .admonition,
.md-typeset details {
  border: 0;
  border-left: 3px solid var(--iscc-blue);
  border-radius: 0 0.2rem 0.2rem 0;
  box-shadow: none;
  font-size: 0.92em;
  background-color: var(--iscc-field);
}

[data-md-color-scheme="slate"] .md-typeset .admonition,
[data-md-color-scheme="slate"] .md-typeset details {
  background-color: transparent;
  padding-left: 1rem;
}

.md-typeset .admonition-title,
.md-typeset summary {
  font-weight: 500;
  background-color: transparent;
}

.md-typeset .admonition.note,
.md-typeset details.note,
.md-typeset .admonition.info,
.md-typeset details.info,
.md-typeset .admonition.abstract,
.md-typeset details.abstract,
.md-typeset .admonition.question,
.md-typeset details.question {
  border-left-color: var(--iscc-sky);
  background-color: #4596f51a;
}

.md-typeset .admonition.tip,
.md-typeset details.tip,
.md-typeset .admonition.success,
.md-typeset details.success {
  border-left-color: var(--iscc-lime);
  background-color: #a6db5026;
}

.md-typeset .admonition.warning,
.md-typeset details.warning {
  border-left-color: var(--iscc-yellow);
  background-color: #ffc30026;
}

.md-typeset .admonition.danger,
.md-typeset details.danger,
.md-typeset .admonition.failure,
.md-typeset details.failure,
.md-typeset .admonition.bug,
.md-typeset details.bug {
  border-left-color: var(--iscc-coral);
  background-color: #f5616914;
}

.md-typeset .admonition.example,
.md-typeset details.example {
  border-left-color: var(--iscc-navy);
  background-color: #12366312;
}

.md-typeset .admonition.quote,
.md-typeset details.quote {
  border-left-color: var(--iscc-muted);
  background-color: #636b7114;
}

[data-md-color-scheme="slate"] .md-typeset .admonition,
[data-md-color-scheme="slate"] .md-typeset details {
  background-color: transparent !important;
}

.md-typeset .note > .admonition-title,
.md-typeset .info > .admonition-title,
.md-typeset .abstract > .admonition-title,
.md-typeset .question > .admonition-title,
.md-typeset .note > summary,
.md-typeset .info > summary,
.md-typeset .abstract > summary,
.md-typeset .question > summary {
  color: var(--iscc-blue);
}

.md-typeset .tip > .admonition-title,
.md-typeset .success > .admonition-title,
.md-typeset .tip > summary,
.md-typeset .success > summary {
  color: #3f7a10;
}

.md-typeset .warning > .admonition-title,
.md-typeset .warning > summary {
  color: #7a5a00;
}

.md-typeset .danger > .admonition-title,
.md-typeset .failure > .admonition-title,
.md-typeset .bug > .admonition-title,
.md-typeset .danger > summary,
.md-typeset .failure > summary,
.md-typeset .bug > summary {
  color: #b3364a;
}

[data-md-color-scheme="slate"] .md-typeset .note > .admonition-title,
[data-md-color-scheme="slate"] .md-typeset .info > .admonition-title,
[data-md-color-scheme="slate"] .md-typeset .abstract > .admonition-title,
[data-md-color-scheme="slate"] .md-typeset .question > .admonition-title,
[data-md-color-scheme="slate"] .md-typeset .note > summary,
[data-md-color-scheme="slate"] .md-typeset .info > summary,
[data-md-color-scheme="slate"] .md-typeset .abstract > summary,
[data-md-color-scheme="slate"] .md-typeset .question > summary {
  color: var(--iscc-sky);
}

[data-md-color-scheme="slate"] .md-typeset .tip > .admonition-title,
[data-md-color-scheme="slate"] .md-typeset .success > .admonition-title,
[data-md-color-scheme="slate"] .md-typeset .tip > summary,
[data-md-color-scheme="slate"] .md-typeset .success > summary {
  color: var(--iscc-lime);
}

[data-md-color-scheme="slate"] .md-typeset .warning > .admonition-title,
[data-md-color-scheme="slate"] .md-typeset .warning > summary {
  color: var(--iscc-yellow);
}

[data-md-color-scheme="slate"] .md-typeset .danger > .admonition-title,
[data-md-color-scheme="slate"] .md-typeset .failure > .admonition-title,
[data-md-color-scheme="slate"] .md-typeset .bug > .admonition-title,
[data-md-color-scheme="slate"] .md-typeset .danger > summary,
[data-md-color-scheme="slate"] .md-typeset .failure > summary,
[data-md-color-scheme="slate"] .md-typeset .bug > summary {
  color: var(--iscc-coral);
}

/* Admonition icons take the title colour */
.md-typeset .admonition-title::before,
.md-typeset summary::before {
  background-color: currentColor;
}

/* ---------- Buttons ---------- */

/* The ISCC button system. Labels are JetBrains Mono Medium capitals.
 * The primary button is a pointed near-black block with a white label
 * (15.43:1), followed by a coral chevron; text never sits on coral. In the
 * dark scheme the block turns white with a near-black label. The secondary
 * button is a 1.5px outline in the text colour. Height is the standard 46px
 * with a 14px label; padding, point and chevron are fractions of the height.
 * On hover the chevron moves forward by its gap and the outline thickens.
 * `.iscc-btn` styles a plain link the same way, for rows of calls to action:
 * [Start](start.md){ .iscc-btn .iscc-btn--primary } */
.md-typeset .md-button,
.md-typeset .iscc-btn {
  --iscc-btn-height: 2.3rem;
  --iscc-btn-padding: calc(var(--iscc-btn-height) * 0.43);
  --iscc-btn-point: calc(var(--iscc-btn-height) * 0.3);
  --iscc-btn-chevron: calc(var(--iscc-btn-height) * 0.26);
  --iscc-btn-gap: calc(var(--iscc-btn-height) * 0.09);
  display: inline-flex;
  align-items: center;
  height: var(--iscc-btn-height);
  padding: 0 var(--iscc-btn-padding);
  border: 0;
  border-radius: 0;
  background-color: transparent;
  box-shadow: inset 0 0 0 1.5px currentColor;
  color: var(--md-default-fg-color);
  font-family: var(--md-code-font-family);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: box-shadow var(--iscc-motion-fast) var(--iscc-motion-easing);
}

.md-typeset .md-button:hover,
.md-typeset .md-button:focus,
.md-typeset .iscc-btn:hover,
.md-typeset .iscc-btn:focus {
  background-color: transparent;
  box-shadow: inset 0 0 0 2.5px currentColor;
  color: var(--md-default-fg-color);
  text-decoration: none;
}

.md-typeset .md-button:focus-visible,
.md-typeset .iscc-btn:focus-visible {
  outline: 2px solid var(--iscc-blue);
  outline-offset: 4px;
}

[data-md-color-scheme="slate"] .md-typeset .md-button:focus-visible,
[data-md-color-scheme="slate"] .md-typeset .iscc-btn:focus-visible {
  outline-color: var(--iscc-white);
}

.md-typeset .md-button--primary,
.md-typeset .iscc-btn--primary,
.md-typeset .md-button--primary:hover,
.md-typeset .md-button--primary:focus,
.md-typeset .iscc-btn--primary:hover,
.md-typeset .iscc-btn--primary:focus {
  --iscc-btn-block: var(--iscc-ink);
  position: relative;
  isolation: isolate;
  padding-right: calc(var(--iscc-btn-padding) + var(--iscc-btn-gap) + var(--iscc-btn-chevron) + var(--iscc-btn-point));
  background-color: transparent;
  box-shadow: none;
  color: var(--iscc-white);
}

[data-md-color-scheme="slate"] .md-typeset .md-button--primary,
[data-md-color-scheme="slate"] .md-typeset .iscc-btn--primary {
  --iscc-btn-block: var(--iscc-white);
  color: var(--iscc-ink);
}

/* The pointed block behind the label */
.md-typeset .md-button--primary::before,
.md-typeset .iscc-btn--primary::before {
  content: "";
  position: absolute;
  inset: 0 calc(var(--iscc-btn-gap) + var(--iscc-btn-chevron)) 0 0;
  z-index: -1;
  background-color: var(--iscc-btn-block);
  clip-path: polygon(
    0 0,
    calc(100% - var(--iscc-btn-point)) 0,
    100% 50%,
    calc(100% - var(--iscc-btn-point)) 100%,
    0 100%
  );
}

/* The coral chevron after the block */
.md-typeset .md-button--primary::after,
.md-typeset .iscc-btn--primary::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: calc(var(--iscc-btn-chevron) + var(--iscc-btn-point));
  z-index: -1;
  background-color: var(--iscc-coral);
  clip-path: polygon(
    0 0,
    var(--iscc-btn-chevron) 0,
    100% 50%,
    var(--iscc-btn-chevron) 100%,
    0 100%,
    var(--iscc-btn-point) 50%
  );
  transition: transform var(--iscc-motion-fast) var(--iscc-motion-easing);
}

.md-typeset .md-button--primary:hover::after,
.md-typeset .md-button--primary:focus::after,
.md-typeset .iscc-btn--primary:hover::after,
.md-typeset .iscc-btn--primary:focus::after {
  transform: translateX(var(--iscc-btn-gap));
}

.md-typeset .iscc-btn {
  margin: 0.4em 0.8em 0.4em 0;
}

/* ---------- Header ---------- */

/* A Deep Navy bar with grain in both schemes, with quiet white controls
 * (78% white, 8.6:1 on navy). It leads with the ISCC project logo in white/coral, written by
 * `zensical-iscc build`; without it, and on phones, the plain signature and
 * the site name in spaced Light capitals take its place. The bar is 72px
 * high, and its content sits on the columns below: the logo starts on the
 * coral marker of the navigation, the search field ends with the content
 * column, and the repository widget spans the table of contents, its icon
 * above the contents' text. */
:root {
  --iscc-header-height: 3.6rem;
}

/* The footer bar shares the ground of the header */
.md-header,
.md-footer-meta {
  background-color: var(--iscc-navy);
  background-image: url("grain.png");
  background-size: 256px 256px;
  background-blend-mode: overlay;
}

.md-header {
  --iscc-on-dark: #ffffff;
  --iscc-on-dark-quiet: #ffffffc7;
  color: var(--iscc-on-dark);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

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

.md-header__inner {
  height: var(--iscc-header-height);
  padding: 0 0.8rem;
}

/* 0.2rem is the inset of the navigation links, where the coral marker sits */
@media screen and (min-width: 76.25em) {
  .md-header__inner {
    padding-left: 0.2rem;
  }
}

/* Sidebars stick below the taller bar where they sit beside the content;
 * the phone drawer and the floating table of contents keep Zensical's offsets */
@media screen and (min-width: 60em) {
  .md-sidebar--secondary {
    top: var(--iscc-header-height);
  }
}

@media screen and (min-width: 76.25em) {
  .md-sidebar--primary {
    top: var(--iscc-header-height);
  }
}

.md-header__button.md-logo {
  display: flex;
  align-items: center;
  padding: 0;
  margin: 0;
}

/* The plain signature at the project logo's size: its symbol, 162.5 of the
 * file's 217.92 units, is 24px high */
.md-header__button.md-logo img,
.md-nav__button.md-logo img {
  height: calc(1.2rem * 217.92 / 162.5);
  width: auto;
}

.md-header__title {
  display: flex;
  align-items: center;
  margin-left: 0.8rem;
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0;
}

.md-header__ellipsis {
  flex: 1;
  min-width: 0;
}

[data-md-color-scheme] .md-header__title,
.md-header__topic {
  color: var(--iscc-on-dark);
  font-weight: 400;
}

/* The site name and the page title share the baseline of the logo's letters,
 * 48px down the bar: centred text would sit 5.2px higher */
.md-header__topic .md-ellipsis {
  position: relative;
  top: 0.26rem;
}

/* The site name; the page title that replaces it on scroll keeps its case */
.md-header__topic:first-child {
  font-weight: 300;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* On phones the site name gives way to the logo and keeps its space */
@media screen and (max-width: 35.9375em) {
  .md-header__ellipsis {
    visibility: hidden;
  }
}

/* The project logo, sized by its own file so that 1 h is 24px, from 720px
 * up; below that it would crowd the menu button, so the signature stands in.
 * The drawer always shows the signature. */
.md-logo img.iscc-project-logo,
.md-nav .md-nav__title[for="__drawer"] .md-logo img.iscc-project-logo {
  display: none;
}

@media screen and (min-width: 45em) {
  .md-header__button.md-logo img.iscc-project-logo {
    display: block;
    height: auto;
  }

  .md-header__button.md-logo:has(.iscc-project-logo) img.iscc-logo {
    display: none;
  }

  /* The project logo names the project; the page title still replaces it on scroll */
  .md-header__inner:has(.iscc-project-logo) .md-header__topic:first-child {
    visibility: hidden;
  }
}

.md-header__button.md-icon,
.md-header__source .md-source {
  color: var(--iscc-on-dark-quiet);
}

.md-header__button.md-icon:hover,
.md-header__button.md-icon:focus,
.md-header__source .md-source:hover,
.md-header__source .md-source:focus {
  color: var(--iscc-on-dark);
}

.md-header :focus-visible {
  outline-color: var(--iscc-on-dark);
}

/* The repository widget takes the width of the table of contents column
 * (12.1rem) less the column's 0.2rem inset and the bar's 0.8rem padding.
 * Zensical's margin before it (1rem, 1.4rem from 76.25em) equals the gutter
 * between content and contents plus that inset, so the search field ends
 * where the content column ends. */
@media screen and (min-width: 60em) {
  .md-header__source {
    width: 11.1rem;
    max-width: none;
    margin-right: 0;
  }
}

/* Related projects menu: the grid icon, with a "Projects" label from 960px
 * up, opens Zensical's dropdown, widened to rows of name and one-line
 * description. The current site carries the navigation's coral marker. */
.md-header__button.iscc-projects__button {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font: inherit;
  font-size: 0.75rem;
}

.iscc-projects__label {
  display: none;
}

@media screen and (min-width: 60em) {
  .iscc-projects__label {
    display: inline;
  }
}

.iscc-projects .md-select__inner {
  width: max-content;
  max-width: min(20rem, calc(100vw - 1.6rem));
}

.iscc-projects .md-select__list {
  padding: 0.3rem 0;
  white-space: normal;
}

.iscc-projects .md-select__item {
  line-height: 1.35;
}

.md-select__link.iscc-projects__link {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.45rem 0.8rem;
}

.iscc-projects__name {
  font-weight: 500;
}

.iscc-projects__description {
  color: var(--md-default-fg-color--light);
  font-size: 0.7rem;
}

.iscc-projects__link[aria-current] {
  box-shadow: inset 2px 0 0 var(--iscc-coral);
}

/* On phones the button sits too far right for a panel hung from it, so the
 * panel spans the screen below the bar, inside the page gutters */
@media screen and (max-width: 44.9375em) {
  .iscc-projects .md-select {
    position: static;
  }

  .iscc-projects .md-select .md-select__inner {
    position: fixed;
    top: var(--iscc-header-height);
    left: 0.8rem;
    right: 0.8rem;
    width: auto;
    max-width: none;
    transform: translate3d(0, 0.3rem, 0);
  }

  .iscc-projects .md-select:hover .md-select__inner,
  .iscc-projects .md-select:focus-within .md-select__inner {
    transform: none;
  }

  .iscc-projects .md-select__inner::after {
    display: none;
  }
}

/* At Zensical's spacing the logo and its controls need 332px, and 376px with
 * the Projects menu. Below 376px the controls drop their outer margins, which
 * lie outside their tap areas, and the hidden site name drops its margins, so
 * either header fits a 320px screen. */
@media screen and (max-width: 23.4375em) {
  .md-header__button,
  .md-header__title {
    margin-left: 0;
    margin-right: 0;
  }
}

/* The header always carries the white/coral signature; the drawer follows the scheme */
.md-header__button.md-logo img.iscc-logo--light,
.md-nav .md-nav__title[for="__drawer"] .md-logo img.iscc-logo--dark,
[data-md-color-scheme="slate"] .md-nav .md-nav__title[for="__drawer"] .md-logo img.iscc-logo--light {
  display: none;
}

.md-header__button.md-logo img.iscc-logo--dark,
[data-md-color-scheme="slate"] .md-nav .md-nav__title[for="__drawer"] .md-logo img.iscc-logo--dark {
  display: block;
}

/* Search field: white field with a thin rule */
.md-search__form {
  background-color: var(--iscc-field);
  border: 1px solid var(--iscc-rule);
  border-radius: 0.2rem;
  box-shadow: none;
}

.md-search__form:hover {
  background-color: var(--iscc-field);
}

[data-md-search-toggle]:checked ~ .md-search .md-search__form,
.md-search__form:focus-within {
  border-color: var(--iscc-blue);
}

.md-search__input {
  color: var(--md-default-fg-color);
}

.md-search__input::placeholder {
  color: var(--md-default-fg-color--light);
}

/* The search button in the bar: a translucent field on navy */
.md-search__button {
  border-radius: 0.2rem;
  border: 1px solid #ffffff3d;
  color: var(--iscc-on-dark-quiet);
  background-color: #ffffff14;
}

/* Zensical paints the magnifier in the page's foreground colour */
.md-search__button::before {
  background-color: currentColor;
}

.md-search__button:hover,
.md-search__button:focus {
  border-color: #ffffff80;
  color: var(--iscc-on-dark);
  background-color: #ffffff1f;
}

/* The keyboard shortcut hint */
.md-search__button::after {
  background-color: #ffffff1f;
  color: var(--iscc-on-dark-quiet);
}

.md-search__output {
  border-radius: 0 0 0.2rem 0.2rem;
}

.md-search-result__meta {
  font-family: var(--md-code-font-family);
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---------- Tabs ---------- */

.md-tabs {
  background-color: var(--md-default-bg-color);
  color: var(--md-default-fg-color--light);
  border-bottom: 1px solid var(--iscc-rule);
}

.md-tabs__link {
  font-weight: 500;
}

.md-tabs__link--active,
.md-tabs__link:hover {
  color: var(--md-default-fg-color);
}

.md-tabs__item--active .md-tabs__link {
  box-shadow: inset 0 -2px 0 var(--iscc-coral);
}

/* ---------- Content tabs ---------- */

/* A bordered panel under a tinted tab bar. Labels take the link colour so they
 * read as clickable; the active tab opens onto the panel and carries the coral
 * current-item marker. The marker is the theme's sliding indicator, restyled
 * from an underline into the active tab's field. */
.md-typeset .tabbed-set {
  border: 1px solid var(--iscc-rule);
  border-radius: 0;
  background-color: var(--iscc-field);
}

.md-typeset .tabbed-labels {
  background-color: var(--md-default-bg-color);
  box-shadow: inset 0 -1px 0 var(--iscc-rule);
}

.md-typeset .tabbed-labels > label {
  position: relative;
  z-index: 1;
  border-bottom: 0;
  border-right: 1px solid var(--iscc-rule);
  border-radius: 0;
  color: var(--md-typeset-a-color);
  font-weight: 500;
}

.md-typeset .tabbed-labels > label:hover {
  color: var(--md-default-fg-color);
  background-color: var(--md-accent-fg-color--transparent);
}

.js .md-typeset .tabbed-labels::before {
  top: 0;
  bottom: 0;
  z-index: 0;
  height: auto;
  background: var(--iscc-field);
  box-shadow: inset 0 2px 0 var(--iscc-coral);
}

.md-typeset .tabbed-set > input.focus-visible ~ .tabbed-labels::before {
  background-color: var(--iscc-field);
  box-shadow: inset 0 2px 0 var(--iscc-coral), inset 0 0 0 2px var(--md-accent-fg-color);
}

.md-typeset .tabbed-content {
  padding: 0 1.2rem;
}

/* A tab that holds only a code block shows the code flush to the panel edges,
 * framed by the panel border instead of a box of its own. */
.md-typeset .tabbed-block > .highlight:only-child {
  margin: 0 -1.2rem;
}

.md-typeset .tabbed-block > .highlight:only-child pre {
  margin: 0;
}

.md-typeset .tabbed-block > .highlight:only-child pre > code {
  border: 0;
  border-radius: 0;
}

.md-typeset .tabbed-block > .highlight:only-child span.filename {
  border: 0;
  border-bottom: 1px solid var(--iscc-rule);
  border-radius: 0;
}

/* ---------- Navigation ---------- */

.md-nav {
  font-size: 0.7rem;
  font-weight: 400;
}

.md-nav__link:hover,
.md-nav__link:focus {
  font-weight: 400;
}

.md-nav__link {
  border-radius: 0.15rem;
  transition: color var(--iscc-motion-fast) var(--iscc-motion-easing),
    background-color var(--iscc-motion-fast) var(--iscc-motion-easing);
}

.md-nav__item .md-nav__link--active,
.md-nav__item .md-nav__link--active code,
.md-nav--primary .md-nav__item .md-nav__link--active {
  color: var(--md-default-fg-color);
  font-weight: 500;
  background-color: transparent;
}

/* Coral marker for the current page in the primary navigation */
.md-nav--primary .md-nav__item .md-nav__link--active {
  box-shadow: inset 2px 0 0 var(--iscc-coral);
  border-radius: 0;
}

.md-nav--secondary .md-nav__item .md-nav__link--active {
  box-shadow: none;
  color: var(--md-default-fg-color);
}

.md-nav__link:hover,
.md-nav__link:focus {
  color: var(--md-accent-fg-color);
}

.md-nav__item--section > .md-nav__link,
.md-nav__item--section > label.md-nav__link {
  font-family: var(--md-code-font-family);
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--md-default-fg-color--light);
}

.md-nav__title .md-nav__button.md-logo {
  padding-bottom: 0.4rem;
}

@media screen and (max-width: 76.1875em) {
  .md-nav--primary .md-nav__title {
    background-color: var(--md-default-bg-color);
    color: var(--md-default-fg-color);
    border-bottom: 1px solid var(--iscc-rule);
    box-shadow: none;
  }

  .md-nav--primary .md-nav__title[for="__drawer"] {
    background-color: var(--md-default-bg-color);
    color: var(--md-default-fg-color);
    font-family: var(--md-text-font-family);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
  }

  .md-nav--primary .md-nav__title .md-nav__icon {
    color: var(--md-default-fg-color);
  }
}

/* ---------- Table of contents ---------- */

.md-nav--secondary .md-nav__list {
  border-left: 1px solid var(--iscc-rule);
}

/* ---------- Content column ---------- */

/* The first lines of the three columns share one line: the cap tops of the
 * page title, the first navigation link and the contents label. */
.md-content__inner {
  padding-top: 0.95rem;
}

@media screen and (min-width: 60em) {
  .md-sidebar--secondary .md-nav--secondary > .md-nav__title {
    padding-top: 0.4rem;
  }
}

.md-content__button {
  color: var(--md-default-fg-color--light);
}

/* ---------- Footer ---------- */

.md-footer {
  background-color: var(--md-default-bg-color);
  border-top: 1px solid var(--iscc-rule);
  color: var(--md-default-fg-color);
}

.md-footer__link {
  color: var(--md-default-fg-color--light);
}

.md-footer__link:hover,
.md-footer__link:focus {
  color: var(--md-default-fg-color);
}

.md-footer__direction {
  font-family: var(--md-code-font-family);
  font-size: 0.55rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.md-footer__title {
  font-weight: 400;
}

/* The footer bar closes the page as the iscc-web footer does: one row on
 * the header's Deep Navy with grain, in both schemes. The plain white ISCC
 * logo and the site's copyright text start it; the links that all ISCC
 * sites share, a divider and the social links end it
 * (partials/copyright.html). Its ends line up with the header's: the logo
 * starts on the coral marker of the navigation. The bar is 52px high, and
 * its content wraps on narrow screens. Links and icons are 78% white (8:1
 * on navy) and turn white on hover and focus; the copyright line is 65%
 * white (6.1:1). */
.md-footer-meta__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1.2rem;
  padding: 0.7rem 0.8rem;
}

@media screen and (min-width: 76.25em) {
  .md-footer-meta__inner {
    padding-left: 0.2rem;
  }
}

/* The wrapper from partials/copyright.html steps aside for the row */
html .md-footer-meta .iscc-footer {
  display: contents;
  font-size: 0.65rem;
  font-weight: 300;
  line-height: 1rem;
}

html .md-footer-meta .iscc-footer__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.8rem;
  margin: 0;
  color: #ffffffa6;
}

/* The logo is 24px high. Its file holds clear space of 25 of its 217.92
 * units on each side; the negative margins put the visible edge on the
 * column edge and close the gap to the copyright text to 8px. */
.iscc-footer__logo {
  --iscc-footer-logo: 1.2rem;
  --iscc-footer-clear: calc(var(--iscc-footer-logo) * -25 / 217.92);
  margin: 0 calc(var(--iscc-footer-clear) - 0.4rem) 0 var(--iscc-footer-clear);
  line-height: 0;
}

.iscc-footer__logo img {
  display: block;
  width: auto;
  height: var(--iscc-footer-logo);
}

.iscc-footer__end,
.iscc-footer__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1.2rem;
}

.iscc-footer__divider {
  width: 1px;
  height: 0.7rem;
  background-color: #ffffff40;
}

/* On phones the social links wrap to a line of their own */
@media screen and (max-width: 44.9375em) {
  .iscc-footer__divider {
    display: none;
  }
}

.md-footer-meta .md-social {
  display: flex;
  gap: 0.8rem;
  margin: 0;
  padding: 0;
}

.md-footer-meta .md-social__link {
  display: block;
  width: auto;
  height: auto;
}

.md-footer-meta .md-social__link svg {
  display: block;
  width: 0.7rem;
  height: 0.7rem;
  max-height: none;
}

/* Zensical colours footer links with `a:not(:focus, :hover)`, whose :not()
 * adds a pseudo-class's weight, so the theme matches that selector. */
html .md-footer-meta.md-typeset a,
html .md-footer-meta.md-typeset a:not(:focus, :hover) {
  color: var(--md-footer-fg-color--light);
  text-decoration: none;
}

html .md-footer-meta.md-typeset .iscc-footer__meta a:not(:focus, :hover) {
  color: inherit;
}

html .md-footer-meta.md-typeset a:focus,
html .md-footer-meta.md-typeset a:hover {
  color: var(--md-footer-fg-color);
}

.md-social__link svg {
  fill: var(--md-footer-fg-color--light);
}

.md-social__link:hover svg,
.md-social__link:focus svg {
  fill: var(--md-footer-fg-color);
}

/* ---------- Back to top ---------- */

.md-top {
  background-color: var(--iscc-field);
  color: var(--md-default-fg-color);
  border: 1px solid var(--iscc-rule);
  box-shadow: var(--md-shadow-z2);
}

.md-top:hover,
.md-top:focus {
  background-color: var(--iscc-blue);
  border-color: var(--iscc-blue);
  color: var(--iscc-white);
}

/* ---------- Mermaid ---------- */

.md-typeset .mermaid {
  --md-mermaid-font-family: var(--md-text-font-family);
  --md-mermaid-edge-color: var(--iscc-muted);
  --md-mermaid-node-bg-color: var(--iscc-field);
  --md-mermaid-node-fg-color: var(--md-default-fg-color);
  --md-mermaid-label-bg-color: var(--md-default-bg-color);
  --md-mermaid-label-fg-color: var(--md-default-fg-color);
}

[data-md-color-scheme="slate"] .md-typeset .mermaid {
  --md-mermaid-edge-color: #adb5bd;
}

/* ---------- Copy page split button ---------- */

.copy-page-heading {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
}

.copy-page-heading > h1 {
  flex: 1;
  min-width: 0;
}

/* Centred on the cap height of the page title */
.copy-page {
  flex-shrink: 0;
  position: relative;
  margin-top: 0.175rem;
  z-index: 2;
}

.copy-page__split {
  display: inline-flex;
  border: 1px solid var(--iscc-rule);
  border-radius: 0.2rem;
  overflow: hidden;
  transition: border-color var(--iscc-motion-fast) var(--iscc-motion-easing);
}

.copy-page__split:hover {
  border-color: var(--md-default-fg-color--lighter);
}

.copy-page__action,
.copy-page__toggle {
  display: inline-flex;
  align-items: center;
  border: 0;
  background: var(--iscc-field);
  color: var(--md-default-fg-color--light);
  font-family: inherit;
  cursor: pointer;
  transition: background-color var(--iscc-motion-fast) var(--iscc-motion-easing),
    color var(--iscc-motion-fast) var(--iscc-motion-easing);
}

.copy-page__action {
  gap: 0.3rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.65rem;
  line-height: 1.4;
  white-space: nowrap;
}

.copy-page__toggle {
  padding: 0.3rem 0.3rem;
  border-left: 1px solid var(--iscc-rule);
}

.copy-page__action:hover,
.copy-page__toggle:hover {
  color: var(--md-default-fg-color);
  background: var(--md-default-fg-color--lightest);
}

.copy-page__action svg {
  flex-shrink: 0;
}

.copy-page__menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.3rem);
  right: 0;
  min-width: 14rem;
  background: var(--iscc-field);
  border: 1px solid var(--iscc-rule);
  border-radius: 0.2rem;
  box-shadow: var(--md-shadow-z3);
  overflow: hidden;
  z-index: 10;
}

.copy-page--open .copy-page__menu {
  display: block;
}

.copy-page__item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 0;
  background: none;
  color: var(--md-default-fg-color);
  font-family: inherit;
  font-size: 0.65rem;
  line-height: 1.4;
  cursor: pointer;
  text-align: left;
  transition: background-color var(--iscc-motion-fast) var(--iscc-motion-easing);
}

.copy-page__item:hover {
  background: var(--md-default-fg-color--lightest);
}

.copy-page__item + .copy-page__item {
  border-top: 1px solid var(--iscc-rule);
}

.copy-page__item-icon {
  flex-shrink: 0;
  margin-top: 0.1rem;
  color: var(--md-default-fg-color--light);
}

.copy-page__item-text {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.copy-page__item-title {
  font-weight: 500;
}

.copy-page__item-desc {
  color: var(--md-default-fg-color--light);
  font-size: 0.6rem;
}

@media screen and (max-width: 44.9375em) {
  .copy-page {
    display: none;
  }
}

/* ---------- Page components ---------- */

/* Opening paragraph set apart from the body copy by size, at the same light
 * weight. Applied with { .iscc-lead } on the line after the paragraph. */
.md-typeset .iscc-lead {
  font-size: 1.2em;
  font-weight: 300;
  line-height: 1.5;
  color: var(--md-default-fg-color);
  margin-bottom: 1.4em;
}

/* Audience cards: stacked on narrow screens, three across once there is room.
 * Markup: <div class="iscc-cards" markdown> holding <div class="iscc-card" markdown>
 * blocks, each with an h3, a paragraph and a closing paragraph with one link. */
.iscc-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.2rem;
  margin: 1.5em 0;
}

@media screen and (min-width: 60em) {
  .iscc-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

.md-typeset .iscc-card {
  display: flex;
  flex-direction: column;
  padding: 1.2rem 1.2rem 1rem;
  border: 1px solid var(--iscc-rule);
  border-top: 2px solid var(--iscc-ink);
  border-radius: 0;
  background-color: var(--iscc-field);
  font-size: 0.875em;
  line-height: 1.55;
  transition: border-color var(--iscc-motion-fast) var(--iscc-motion-easing);
}

[data-md-color-scheme="slate"] .md-typeset .iscc-card {
  border-top-color: var(--iscc-paper);
}

.md-typeset .iscc-card:hover {
  border-color: var(--iscc-blue);
}

.md-typeset .iscc-card h3 {
  margin: 0 0 0.5rem;
  font-weight: 500;
}

/* Pin the call-to-action to the bottom so cards in a row line up */
.md-typeset .iscc-card p:last-child {
  margin-top: auto;
  margin-bottom: 0;
  padding-top: 0.7rem;
}

.md-typeset .iscc-card p:last-child a {
  font-weight: 500;
  text-decoration: none;
}

.md-typeset .iscc-card p:last-child a:hover {
  text-decoration: underline;
}

/* ---------- ISCC-UNIT colour helpers ---------- */

/* One fixed colour per ISCC-UNIT for tables, badges and diagrams. Always pair
 * the colour with the unit name; colour never carries the meaning alone. */
.iscc-unit {
  display: inline-block;
  font-family: var(--md-code-font-family);
  font-size: 0.85em;
  padding: 0.1em 0.5em;
  border-radius: 0.15rem;
  color: var(--iscc-ink);
}

.iscc-unit--meta {
  background-color: var(--iscc-unit-meta);
}

.iscc-unit--semantic {
  background-color: var(--iscc-unit-semantic);
}

.iscc-unit--content {
  background-color: var(--iscc-unit-content);
  color: var(--iscc-white);
}

.iscc-unit--data {
  background-color: var(--iscc-unit-data);
  color: var(--iscc-white);
}

.iscc-unit--instance {
  background-color: var(--iscc-unit-instance);
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .md-nav__link,
  .md-typeset .md-button,
  .md-typeset .iscc-btn,
  .md-typeset .md-button--primary::after,
  .md-typeset .iscc-btn--primary::after,
  .md-typeset .iscc-card,
  .copy-page__split,
  .copy-page__action,
  .copy-page__toggle,
  .copy-page__item {
    transition: none;
  }
}
