/* Znanjograf: one stylesheet for every page.
   ASCII only: the build copies this file into the Cyrillic mirror untouched.
   The atlas is light-only: paper, ink and one ink-blue accent, no dark scheme.
   Every colour is a custom property; every control is at least 44 px high;
   nothing is wider than the viewport at 360 px. */

/* Inter (SIL OFL 1.1), vendored under site/vendor/inter/. One variable file per unicode-range
   subset, so a reader in the Latin tree fetches latin and latin-ext while the Cyrillic mirror
   fetches cyrillic only. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../vendor/inter/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../vendor/inter/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../vendor/inter/inter-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* Playfair Display (SIL OFL 1.1), vendored under site/vendor/playfair/; variable 400-900,
   normal and italic, same three unicode-range subsets as Inter. */
@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../vendor/playfair/playfair-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../vendor/playfair/playfair-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../vendor/playfair/playfair-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Playfair Display";
  font-style: italic;
  font-weight: 400 900;
  font-display: swap;
  src: url("../vendor/playfair/playfair-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Playfair Display";
  font-style: italic;
  font-weight: 400 900;
  font-display: swap;
  src: url("../vendor/playfair/playfair-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Playfair Display";
  font-style: italic;
  font-weight: 400 900;
  font-display: swap;
  src: url("../vendor/playfair/playfair-italic-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* IBM Plex Mono (SIL OFL 1.1), vendored under site/vendor/plexmono/; static 400, 500 and 600,
   same three unicode-range subsets. */
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../vendor/plexmono/plexmono-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../vendor/plexmono/plexmono-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../vendor/plexmono/plexmono-400-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../vendor/plexmono/plexmono-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../vendor/plexmono/plexmono-500-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../vendor/plexmono/plexmono-500-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../vendor/plexmono/plexmono-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../vendor/plexmono/plexmono-600-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../vendor/plexmono/plexmono-600-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
  color-scheme: light;

  --zg-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --zg-serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --zg-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --zg-bg: #faf7f0;
  --zg-surface: #fffdf8;
  --zg-surface-2: #f3efe6;
  --zg-ink: #1d1a14;
  --zg-muted: #6d6553;
  --zg-line: rgba(29, 26, 20, 0.22);
  --zg-accent: #0b5cab;
  --zg-on-accent: #faf7f0;
  --zg-accent-soft: #eef3fa;
  --zg-accent-ink: #0a4f92;
  --zg-ok: #17683f;
  --zg-ok-soft: #e6f4ec;
  --zg-bad: #a3241c;
  --zg-bad-soft: #fbeae8;
  --zg-warn: #754f00;
  --zg-warn-soft: #fdf3e2;
  --zg-focus: #0b5cab;

  /* One hue per grade, kept apart for colour-blind readers by lightness and hue order;
     the -ink variants are for text on paper, the plain ones for map nodes and bars. */
  --zg-g1: #f4a259;
  --zg-g1-ink: #a55a1e;
  --zg-g2: #e9c46a;
  --zg-g2-ink: #8a6d1d;
  --zg-g3: #8ab17d;
  --zg-g3-ink: #4a7440;
  --zg-g4: #2a9d8f;
  --zg-g4-ink: #146c60;
  --zg-g5: #4cc9f0;
  --zg-g5-ink: #0e6f94;
  --zg-g6: #4895ef;
  --zg-g6-ink: #1560b8;
  --zg-g7: #7b6cf6;
  --zg-g7-ink: #4d3dbd;
  --zg-g8: #b56cf0;
  --zg-g8-ink: #7c35b5;

  --zg-target: 44px;
  --zg-radius: 4px;
  --zg-radius-sm: 3px;
  --zg-radius-xs: 2px;
  --zg-radius-lg: 6px;
  --zg-shadow-card: 0 2px 10px rgba(29, 26, 20, 0.05), 0 0.8px 2.4px rgba(29, 26, 20, 0.04);
  --zg-shadow-deep: 0 1px 2px rgba(29, 26, 20, 0.05), 0 6px 16px rgba(29, 26, 20, 0.07), 0 18px 40px rgba(29, 26, 20, 0.06);
  --zg-shadow: var(--zg-shadow-card);
  --zg-display: clamp(2.5rem, 1.2rem + 5vw, 4rem);
  --zg-tracking-display: -0.015em;
  --zg-space-section: clamp(2rem, 1.25rem + 2.5vw, 4rem);
  --zg-wrap: 70rem;
}

/* ----- base ------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--zg-font);
  font-size: 1.0625rem;
  line-height: 1.55;
  background-color: var(--zg-bg);
  background-image:
    linear-gradient(rgba(29, 26, 20, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 26, 20, 0.045) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--zg-ink);
  font-feature-settings: "lnum" 1;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 0.5em;
  font-family: var(--zg-serif);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

p,
ul,
ol,
dl {
  margin: 0 0 1em;
}

ul,
ol {
  padding-left: 1.5em;
}

a {
  color: var(--zg-accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 0.14em;
}

/* A link inside a sentence keeps its line, but its target grows to the full height. */
.zg-main p > a:not(.zg-btn):not(.zg-topiclink),
.zg-main li > a:not(.zg-btn):not(.zg-topiclink):not(.zg-grade) {
  padding-block: 0.75rem;
  margin-block: -0.75rem;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

img,
svg {
  max-width: 100%;
}

:focus-visible {
  outline: 3px solid var(--zg-focus);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* The heading of a new screen, which only receives the focus: a lighter ring, a little further out. */
.zg-main [data-zg-focus]:focus-visible {
  outline: 2px solid var(--zg-focus);
  outline-offset: 6px;
  border-radius: 4px;
}

.katex {
  font-size: 1.08em;
}

.zg-tex-raw {
  font-family: var(--zg-mono);
  font-size: 0.95em;
  padding: 0 0.3em;
  border-radius: 4px;
  background: var(--zg-surface-2);
}

.zg-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.zg-noscript {
  margin: 1rem;
  padding: 1rem;
  border: 1px solid var(--zg-warn);
  border-radius: var(--zg-radius);
  background: var(--zg-warn-soft);
}

/* ----- layout ------------------------------------------------------------------------ */

.zg-main {
  padding: 1.25rem 0 3rem;
}

/* The notice about unfinished content, between the header and the page. */
.zg-draft {
  padding-block: 0.75rem 0;
}

.zg-wrap {
  max-width: var(--zg-wrap);
  margin-inline: auto;
  padding-inline: 1rem;
}

.zg-narrow {
  max-width: 46rem;
}

.zg-title {
  font-size: clamp(1.75rem, 1.2rem + 2.6vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 0.35em;
  overflow-wrap: anywhere;
}

.zg-subtitle {
  font-size: 1.5rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.zg-lead {
  max-width: 46rem;
  font-size: 1.125rem;
  color: var(--zg-muted);
}

.zg-muted {
  color: var(--zg-muted);
}

.zg-eyebrow {
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--zg-accent);
}

.zg-card {
  padding: 1.25rem;
  border: 1px solid var(--zg-line);
  border-radius: var(--zg-radius);
  background: var(--zg-surface);
  box-shadow: var(--zg-shadow-card);
}

.zg-section {
  margin-top: 2rem;
}

.zg-stack > * + * {
  margin-top: 1rem;
}

.zg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

/* What this browser already started, under the hero buttons; hidden until there is something. */
.zg-personal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 1rem;
}

.zg-personal[hidden] {
  display: none;
}

.zg-personal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.zg-personal .zg-pill a {
  color: inherit;
}

/* Nothing that is still empty takes room: a note, a hint or a count line that is filled
   in later shows as nothing until it has something to say. */
.zg-main p:empty,
.zg-main dd:empty,
.zg-main li:empty,
.zg-main h2:empty,
.zg-main h3:empty,
.zg-main h4:empty,
.zg-note:empty,
.zg-hint:empty,
.zg-badge:empty {
  display: none;
}

.zg-note {
  padding: 0.75rem 1rem;
  border: 1px solid var(--zg-line);
  border-radius: var(--zg-radius-sm);
  background: var(--zg-surface-2);
}

.zg-note-bad {
  border-color: var(--zg-bad);
  background: var(--zg-bad-soft);
}

.zg-note-warn {
  border-color: var(--zg-warn);
  background: var(--zg-warn-soft);
}

.zg-note-ok {
  border-color: var(--zg-ok);
  background: var(--zg-ok-soft);
}

.zg-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.05rem 0.6rem;
  border: 1px solid var(--zg-line);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.6;
  color: var(--zg-muted);
  background: var(--zg-surface-2);
}

.zg-badge-ok {
  border-color: transparent;
  color: var(--zg-ok);
  background: var(--zg-ok-soft);
}

.zg-badge-bad {
  border-color: transparent;
  color: var(--zg-bad);
  background: var(--zg-bad-soft);
}

.zg-badge-warn {
  border-color: transparent;
  color: var(--zg-warn);
  background: var(--zg-warn-soft);
}

/* ----- header ------------------------------------------------------------------------ */

/* Hidden above the page by its own height, not by a fixed number of pixels: with the text twice the size on a narrow
   screen the label wraps onto two lines, and a link pushed up by a hundred pixels then showed over the header. */
.zg-skip {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10;
  transform: translateY(calc(-100% - 1.5rem));
  display: inline-flex;
  align-items: center;
  min-height: var(--zg-target);
  padding: 0.5rem 1rem;
  border: 2px solid var(--zg-focus);
  border-radius: var(--zg-radius-sm);
  background: var(--zg-surface);
  color: var(--zg-accent);
}

.zg-skip:focus {
  transform: none;
}

.zg-header {
  border-bottom: 1px solid var(--zg-line);
  background: var(--zg-surface);
}

.zg-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding-block: 0.5rem;
}

.zg-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-height: var(--zg-target);
  color: var(--zg-ink);
  text-decoration: none;
}

.zg-brand-mark {
  width: 2.1rem;
  height: 2.1rem;
  flex: none;
}

.zg-brand-word {
  display: block;
  font-family: var(--zg-serif);
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1.1;
  text-transform: uppercase;
}

.zg-brand-tag {
  display: block;
  font-family: var(--zg-mono);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--zg-muted);
}

.zg-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}

/* The script choice is one toggle drawn as two segments: the current script is ink,
   the other is quiet, and the action label says where the button goes next. */
.zg-script {
  display: inline-flex;
  align-items: center;
  min-height: var(--zg-target);
  padding: 0.25rem;
  border: 1px solid var(--zg-ink);
  border-radius: var(--zg-radius-sm);
  background: var(--zg-surface);
  cursor: pointer;
}

.zg-script-opt {
  display: inline-flex;
  align-items: center;
  min-height: calc(var(--zg-target) - 0.5rem - 2px);
  padding: 0 0.8rem;
  font-family: var(--zg-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--zg-muted);
}

.zg-script-opt--on {
  border-radius: 2px;
  background: var(--zg-ink);
  color: var(--zg-bg);
}

.zg-script:hover .zg-script-opt--on {
  background: #000000;
}

.zg-script:focus-visible {
  outline: 2px solid var(--zg-focus);
  outline-offset: 2px;
}

/* Clearing the history is a quiet mono action behind a hairline, red on hover. */
.zg-tools [data-zg-clear] {
  position: relative;
  margin-left: 0.5rem;
  font-family: var(--zg-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--zg-muted);
}

.zg-clear-icon {
  width: 17px;
  height: 17px;
  flex: none;
}

/* What the clearing touches, as a paper card on hover or keyboard focus; the same sentence
   lives in aria-label for screens without a pointer. */
.zg-tools [data-zg-clear]::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 30;
  width: max-content;
  max-width: 15rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--zg-ink);
  border-radius: var(--zg-radius-sm);
  background: var(--zg-surface);
  box-shadow: var(--zg-shadow-deep);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1.45;
  text-transform: none;
  text-align: left;
  color: var(--zg-ink);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-2px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  pointer-events: none;
}

.zg-tools [data-zg-clear]:hover::after,
.zg-tools [data-zg-clear]:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.zg-tools [data-zg-clear]::before {
  content: "";
  position: absolute;
  left: -0.7rem;
  top: 25%;
  bottom: 25%;
  border-left: 1px solid var(--zg-line);
}

.zg-tools [data-zg-clear]:hover {
  color: var(--zg-bad);
}

.zg-nav-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.25rem;
}

.zg-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--zg-target);
  padding: 0 0.85rem;
  border-bottom: 3px solid transparent;
  font-family: var(--zg-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--zg-ink);
  text-decoration: none;
}

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

/* ----- buttons and forms ------------------------------------------------------------- */

.zg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--zg-target);
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--zg-radius-sm);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  background: var(--zg-surface-2);
  color: var(--zg-ink);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.zg-btn:hover {
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.zg-btn-primary {
  background: var(--zg-ink);
  color: var(--zg-bg);
}

.zg-btn-primary:hover {
  background: #000000;
}

.zg-btn-secondary {
  border-color: var(--zg-ink);
  background: var(--zg-surface);
  color: var(--zg-ink);
}

.zg-btn-quiet {
  padding-inline: 0.75rem;
  background: transparent;
  color: var(--zg-accent);
}

.zg-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  text-decoration: none;
}

.zg-fieldset {
  min-width: 0;
  margin: 0 0 1rem;
  padding: 1rem;
  border: 1px solid var(--zg-line);
  border-radius: var(--zg-radius);
}

.zg-fieldset > legend {
  padding-inline: 0.35rem;
  font-weight: 700;
}

.zg-field {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 1rem;
}

.zg-field > label,
.zg-label {
  font-family: var(--zg-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--zg-muted);
}

.zg-input,
.zg-select {
  width: 100%;
  min-height: var(--zg-target);
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--zg-line);
  border-radius: var(--zg-radius-xs);
  background: var(--zg-surface);
  color: var(--zg-ink);
}

.zg-input::placeholder {
  color: var(--zg-muted);
  opacity: 1;
}

.zg-invalid {
  border-color: var(--zg-bad);
}

.zg-error {
  margin: 0.35rem 0 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--zg-bad);
}

[hidden] {
  display: none !important;
}

.zg-hint {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--zg-muted);
}

.zg-radio {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-height: var(--zg-target);
  margin-bottom: 0.5rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--zg-line);
  border-radius: var(--zg-radius-sm);
  background: var(--zg-surface);
  cursor: pointer;
}

.zg-radio:has(input:checked) {
  border-color: var(--zg-accent);
  background: var(--zg-accent-soft);
}

.zg-radio input {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0.3rem 0 0;
}

.zg-radio-text {
  display: grid;
  gap: 0.1rem;
}

/* ----- home -------------------------------------------------------------------------- */

.zg-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 0.75rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.zg-steps > li {
  position: relative;
  padding: 1rem 1rem 1rem 3.6rem;
  border: 1px solid var(--zg-line);
  border-radius: var(--zg-radius);
  background: var(--zg-surface);
  box-shadow: var(--zg-shadow-card);
  counter-increment: step;
}

.zg-steps > li::before {
  content: counter(step);
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  font-weight: 700;
  background: var(--zg-accent);
  color: var(--zg-on-accent);
}

.zg-steps p {
  margin: 0;
}

.zg-grades {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr));
  gap: 0.8rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.zg-grades a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 5.5rem;
  padding: 1rem;
  border: 1px solid var(--zg-ink);
  background: var(--zg-surface);
  font-family: var(--zg-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--zg-ink);
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.zg-grades a:hover {
  transform: translateY(-3px);
  box-shadow: var(--zg-shadow-deep);
}

.zg-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  margin: 0;
}

.zg-stats > div {
  padding: 0.75rem 1rem;
  border: 1px solid var(--zg-line);
  border-radius: var(--zg-radius);
  background: var(--zg-surface);
}

.zg-stats dt {
  font-size: 0.9375rem;
  color: var(--zg-muted);
}

.zg-stats dd {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

/* ----- map --------------------------------------------------------------------------- */

.zg-toolbar {
  display: grid;
  gap: 0.25rem;
  margin: 1rem 0 1.25rem;
}

.zg-map-layout {
  display: grid;
  gap: 1rem;
  align-items: start;
}

.zg-map-list,
.zg-map-detail {
  min-width: 0;
  border: 1px solid var(--zg-line);
  border-radius: var(--zg-radius);
  background: var(--zg-surface);
}

.zg-map-list {
  padding: 0.5rem;
}

.zg-map-list summary {
  font-family: var(--zg-serif);
}

.zg-map-detail {
  padding: 1.25rem;
}

.zg-group > summary {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: var(--zg-target);
  padding: 0.35rem 0.6rem;
  border-radius: var(--zg-radius-sm);
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}

.zg-group > summary::-webkit-details-marker {
  display: none;
}

.zg-group > summary::before {
  content: "";
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  margin: 0 0.35rem 0 0.15rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}

.zg-group[open] > summary::before {
  transform: rotate(45deg);
}

.zg-group-inner > summary {
  padding-left: 1.6rem;
  font-weight: 600;
  color: var(--zg-muted);
}

.zg-group ul {
  margin: 0 0 0.35rem;
  padding: 0;
  list-style: none;
}

.zg-group a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--zg-target);
  padding: 0.35rem 0.75rem;
  border-radius: var(--zg-radius-sm);
  color: var(--zg-ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.zg-group a:hover {
  background: var(--zg-surface-2);
}

.zg-group a[aria-current="true"] {
  font-weight: 600;
  color: var(--zg-accent);
  background: var(--zg-accent-soft);
}

/* The graph around the selected topic. graph-view.js draws the svg (class zg-graph) with
   currentColor and the classes below; the colours and the rest live here. */
.zg-detail-graph {
  margin: 1.25rem 0;
}

.zg-graph-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
}

.zg-graph-buttons {
  display: inline-flex;
  gap: 0.25rem;
  margin-left: auto;
}

.zg-graph-note {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
}

.zg-graph-box {
  position: relative;
  overflow-x: auto;
  padding: 0.5rem;
  border: 1px solid var(--zg-line);
  border-radius: var(--zg-radius-sm);
  background: var(--zg-bg);
  scrollbar-width: thin;
  scrollbar-color: var(--zg-accent) var(--zg-surface-2);
}

.zg-graph-box::-webkit-scrollbar {
  height: 10px;
}

.zg-graph-box::-webkit-scrollbar-track {
  background: var(--zg-surface-2);
  border-radius: 999px;
}

.zg-graph-box::-webkit-scrollbar-thumb {
  background: var(--zg-accent);
  border-radius: 999px;
}

.zg-graph-box::-webkit-scrollbar-thumb:hover {
  background: var(--zg-focus);
}

html {
  scrollbar-width: thin;
  scrollbar-color: var(--zg-accent) var(--zg-bg);
}

html::-webkit-scrollbar {
  width: 12px;
}

html::-webkit-scrollbar-track {
  background: var(--zg-bg);
}

html::-webkit-scrollbar-thumb {
  background: var(--zg-accent);
  border: 3px solid var(--zg-bg);
  border-radius: 999px;
}

html::-webkit-scrollbar-thumb:hover {
  background: var(--zg-focus);
}

.zg-graph-box svg.zg-graph {
  display: block;
  max-width: none;
  font-family: var(--zg-mono);
  touch-action: pan-y;
  cursor: grab;
}

/* The plate around a graph canvas: the canvas keeps its own scrolling, the frame and the
   mono caption belong to the plate. */
.zg-graph-plate {
  padding: 0.7rem;
}

.zg-graph-plate .zg-graph-box {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.zg-graph-plate .zg-dash-canvas {
  margin-block: 0;
}

.zg-graph-plate .zg-graph-card {
  text-align: left;
}

.zg-graph-box--dragging svg.zg-graph {
  cursor: grabbing;
}

.zg-edge {
  fill: none;
  stroke: var(--zg-muted);
  stroke-width: 1.5;
}

.zg-node {
  cursor: pointer;
}

.zg-node rect {
  fill: var(--zg-surface);
  stroke: var(--zg-line);
  stroke-width: 1.5;
}

.zg-node text {
  fill: var(--zg-ink);
  user-select: none;
}

.zg-node:hover rect {
  stroke: var(--zg-accent);
}

.zg-node:focus {
  outline: none;
}

.zg-node:focus-visible rect {
  stroke: var(--zg-focus);
  stroke-width: 3;
}

.zg-node--focus rect {
  fill: var(--zg-accent-soft);
  stroke: var(--zg-accent);
  stroke-width: 3;
}

.zg-node--mastered rect {
  fill: var(--zg-ok-soft);
  stroke: var(--zg-ok);
}

.zg-node--shaky rect {
  fill: var(--zg-warn-soft);
  stroke: var(--zg-warn);
}

.zg-node--weak rect {
  fill: var(--zg-bad-soft);
  stroke: var(--zg-bad);
}

.zg-node--inferred rect {
  stroke-dasharray: 4 3;
}

/* A card that follows the pointer over a node: name and verdict, never in the way. */
.zg-graph-card {
  position: fixed;
  z-index: 40;
  max-width: 16rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--zg-line);
  border-radius: var(--zg-radius-sm);
  background: var(--zg-surface);
  box-shadow: var(--zg-shadow-deep);
  pointer-events: none;
  font-size: 0.9rem;
  display: grid;
  gap: 0.15rem;
}

.zg-graph-card[hidden] {
  display: none;
}

.zg-graph-card-name {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
}

/* The chain from a root to the selected topic stands out from the rest of the drawing. */
.zg-node--chain rect {
  stroke-width: 2.5;
}

.zg-edge--chain {
  stroke-width: 2.5;
  opacity: 1;
}

/* The unlock trail: a bridge whose prerequisite is mastered draws itself open once, and the
   mastered node gives one soft pulse. The final state is the plain rules above and below, so
   a still reader sees the same map without motion. */
.zg-edge--open {
  stroke: var(--zg-ok);
  stroke-width: 2.2;
  opacity: 1;
}

.zg-unlock {
  display: grid;
  gap: 0.5rem;
}

.zg-unlock-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.zg-unlock-lead,
.zg-unlock-try {
  margin: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .zg-edge--open {
    stroke-dasharray: 1;
    animation: zg-hero-draw 0.7s ease backwards;
  }

  .zg-spark rect {
    animation: zg-spark-pulse 0.9s ease;
  }
}

@keyframes zg-spark-pulse {
  0% {
    stroke-width: 1.5;
  }

  40% {
    stroke-width: 4;
  }

  100% {
    stroke-width: 1.5;
  }
}

.zg-props {
  margin: 0;
}

.zg-props dt {
  margin-top: 0.9rem;
  font-weight: 600;
}

.zg-props dd {
  margin: 0.15rem 0 0;
}

.zg-linklist {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.zg-topiclink {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: var(--zg-target);
  padding: 0.2rem 0.7rem;
  border: 1px solid var(--zg-line);
  border-radius: 999px;
  text-decoration: none;
  background: var(--zg-bg);
  overflow-wrap: anywhere;
}

.zg-topiclink:hover {
  border-color: var(--zg-accent);
}

.zg-edges {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.zg-edge {
  display: grid;
  gap: 0.2rem;
}

.zg-edge-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.zg-edge-reason {
  margin: 0 0 0 0.8rem;
}

.zg-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.15rem 0 0.4rem;
}

.zg-unit + .zg-unit {
  margin-top: 1.5rem;
}

.zg-unit > .zg-label {
  margin-bottom: 0.6rem;
}

.zg-unit-progress {
  margin: 0 0 0.75rem;
}

.zg-unit-bar {
  display: flex;
  height: 0.5rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--zg-line);
  margin-bottom: 0.35rem;
}

.zg-unit-bar-seg {
  display: block;
  height: 100%;
}

.zg-unit-bar-seg--mastered {
  background: var(--zg-ok);
}

.zg-unit-bar-seg--shaky {
  background: var(--zg-warn);
}

.zg-unit-bar-seg--weak {
  background: var(--zg-bad);
}

.zg-unit-bar-seg--untested {
  background: var(--zg-muted);
  opacity: 0.35;
}

.zg-unit-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin: 0;
  font-size: 0.85rem;
}

.zg-overview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.zg-overview-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.zg-overview-item > .zg-actions {
  margin-top: auto;
}

.zg-overview-name {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.3;
}

.zg-overview-name a {
  color: inherit;
}

.zg-overview-name a:hover {
  color: var(--zg-accent);
}

.zg-plan-days {
  display: grid;
  gap: 0.9rem;
}

.zg-plan-day--today {
  border-color: var(--zg-warn);
  box-shadow: 0 0 0 2px var(--zg-warn-soft);
}

.zg-plan-day--done {
  border-color: var(--zg-ok);
}

.zg-plan-day--retest {
  border-style: dashed;
}

.zg-plan-topics {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.zg-plan-topic {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--zg-line);
}

.zg-plan-topic:first-child {
  padding-top: 0;
  border-top: 0;
}

.zg-plan-topic-name {
  flex: 1 1 12rem;
}

.zg-plan-topic-name a {
  color: inherit;
}

.zg-plan-topic-name a:hover {
  color: var(--zg-accent);
}

.zg-plan-topic--done .zg-plan-topic-name a {
  color: var(--zg-muted);
  text-decoration: line-through;
}

.zg-sample {
  margin: 0;
}

.zg-sample summary {
  min-height: var(--zg-target);
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
}

.zg-sample > div {
  margin-bottom: 0.5rem;
}

.zg-bank > summary,
.zg-bank-item > details > summary {
  min-height: var(--zg-target);
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
}

.zg-bank > summary::before,
.zg-bank-item > details > summary::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  margin-right: 0.5rem;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.zg-bank[open] > summary::before,
.zg-bank-item > details[open] > summary::before {
  transform: rotate(45deg);
}

.zg-bank > summary::-webkit-details-marker,
.zg-bank-item > details > summary::-webkit-details-marker {
  display: none;
}

.zg-bank > summary,
.zg-bank-item > details > summary {
  list-style: none;
}

.zg-bank-group + .zg-bank-group {
  margin-top: 1.25rem;
}

.zg-bank-item {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--zg-line);
}

.zg-bank-item > details > p {
  margin-bottom: 0.5rem;
}

.zg-bank-choices {
  margin: 0 0 0.5rem;
  padding-left: 1.25rem;
}

.zg-scope {
  margin-top: 1rem;
}

.zg-scope > summary {
  min-height: var(--zg-target);
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
}

.zg-scope[open] > summary {
  margin-bottom: 1rem;
}

/* ----- landing: hero, story, explainer, bands ---------------------------------------- */

.zg-band {
  padding-block: var(--zg-space-section);
}

.zg-band--warm {
  background: var(--zg-surface-2);
}

.zg-band--dark {
  background: var(--zg-surface-2);
  border-block: 1px solid var(--zg-line);
  color: inherit;
}

.zg-band--dark .zg-subtitle {
  color: inherit;
}

.zg-band--dark .zg-metric {
  border-color: var(--zg-line);
  background: var(--zg-surface);
  box-shadow: none;
}

.zg-band--dark .zg-metric-label {
  color: var(--zg-muted);
}

.zg-display {
  font-family: var(--zg-serif);
  font-size: var(--zg-display);
  font-weight: 700;
  line-height: 1;
  letter-spacing: var(--zg-tracking-display);
  margin-bottom: 0.4em;
}

.zg-hero {
  padding-block: clamp(1.25rem, 0.5rem + 3vw, 3.5rem) clamp(1.5rem, 1rem + 2vw, 2.5rem);
}

.zg-hero-grid {
  display: grid;
  gap: 2rem;
  align-items: center;
}

.zg-hero-side {
  min-width: 0;
}

.zg-hero-figure {
  position: relative;
  margin: 0;
  padding: 0.75rem;
  border: 1px solid var(--zg-line);
  border-radius: var(--zg-radius-lg);
  background: var(--zg-surface);
  box-shadow: var(--zg-shadow-deep);
  overflow-x: auto;
}

.zg-hero-canvas {
  position: relative;
}

.zg-hero-graph {
  display: block;
  width: 100%;
  height: auto;
  --zg-graph-line: rgba(29, 26, 20, 0.45);
  --zg-graph-soft: rgba(29, 26, 20, 0.22);
}

/* A narrow screen pans the drawing instead of shrinking its text below reading size;
   the canvas stays the size of the board so the card's percentage positions still hold. */
@media (max-width: 47.99rem) {
  .zg-hero-canvas {
    width: max-content;
    min-width: 100%;
  }

  .zg-hero-graph {
    width: auto;
    max-width: none;
  }
}

.zg-hero-edge {
  fill: none;
  stroke: var(--zg-graph-line);
  stroke-width: 1.2;
}

.zg-hero-edge--soft {
  stroke: var(--zg-graph-soft);
  stroke-dasharray: 5 4;
}

.zg-hero-edge--chain {
  stroke: var(--zg-accent);
  stroke-width: 2.2;
  stroke-dasharray: none;
}

/* The drawing builds itself once; the final state is the plain rules above, so nothing is
   left frozen by a filled animation. pathLength="1" on each line makes the dash a single
   run of the whole edge. */
@media (prefers-reduced-motion: no-preference) {
  .zg-hero-edge--hard {
    stroke-dasharray: 1;
    animation: zg-hero-draw 0.7s ease backwards;
    animation-delay: calc(var(--i, 0) * 30ms);
  }

  .zg-hero-edge--soft {
    animation: zg-hero-fade 0.6s ease backwards;
    animation-delay: calc(var(--i, 0) * 30ms + 180ms);
  }
}

@keyframes zg-hero-draw {
  from {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
  }

  to {
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
  }
}

@keyframes zg-hero-fade {
  from {
    opacity: 0;
  }
}

.zg-hero-card {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, calc(-100% - 0.6rem));
  max-width: 16rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--zg-line);
  border-radius: var(--zg-radius-sm);
  background: var(--zg-surface);
  box-shadow: var(--zg-shadow-deep);
  pointer-events: none;
}

.zg-hero-card strong {
  display: block;
  font-size: 0.9375rem;
  line-height: 1.35;
}

.zg-hero-card-meta {
  font-size: 0.8125rem;
  color: var(--zg-muted);
}

.zg-hero-caption {
  margin-top: 0.5rem;
}

.zg-hero-details {
  font-size: 0.9375rem;
}

.zg-hero-details summary {
  cursor: pointer;
  color: var(--zg-muted);
}

.zg-hero-list {
  columns: 2;
  max-height: 12rem;
  overflow-y: auto;
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.zg-plate-more {
  margin: 0.75rem 0 0;
}

/* The atlas page: the plate and the topic panel side by side, the panel moving under the
   plate when the window is narrow. */
.zg-karta-layout {
  display: grid;
  gap: 1rem;
  align-items: start;
}

.zg-karta-main {
  min-width: 0;
}

@media (min-width: 64rem) {
  .zg-karta-layout {
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 24rem);
  }
}

/* The standalone atlas page: the plate fills the frame and the camera does the rest. */
.zg-karta-canvas {
  position: relative;
  height: clamp(24rem, 70vh, 46rem);
  overflow: hidden;
}

.zg-karta-canvas svg {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.zg-karta-canvas--dragging svg {
  cursor: grabbing;
}

.zg-karta-canvas .zg-plate-node {
  cursor: pointer;
}

.zg-karta-list {
  margin-top: 1rem;
}

@media (max-width: 40rem) {
  .zg-hero-list {
    columns: 1;
  }
}

.zg-story-stage {
  position: relative;
}

@media (min-width: 48rem) {
  .zg-story-stage {
    height: 180vh;
  }

  .zg-story-pin {
    position: sticky;
    top: 4.5rem;
    display: grid;
    gap: 1rem;
    padding-block: 1.5rem;
  }
}

.zg-story-flat .zg-story-stage {
  height: auto;
}

.zg-story-chain {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.zg-story-step {
  display: grid;
  gap: 0.25rem;
  max-width: 16rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--zg-line);
  border-radius: var(--zg-radius);
  background: var(--zg-surface);
  opacity: 0.55;
  transition: opacity 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.zg-story-step.is-path {
  opacity: 1;
}

.zg-story-step.is-now {
  border-color: var(--zg-accent);
  box-shadow: 0 0 0 1px var(--zg-accent);
}

.zg-story-step.is-miss {
  border-color: var(--zg-bad);
}

.zg-story-name {
  font-size: 0.9375rem;
  font-weight: 600;
}

.zg-story-caption {
  max-width: 46rem;
  min-height: 4.5rem;
  margin: 0;
  font-size: 1.125rem;
}

.zg-story-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.zg-story-dots {
  display: inline-flex;
  gap: 0.125rem;
}

.zg-story-dot {
  position: relative;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.zg-story-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 0.6rem;
  height: 0.6rem;
  margin: auto;
  border-radius: 50%;
  background: var(--zg-line);
}

.zg-story-dot[aria-current="true"]::after {
  background: var(--zg-accent);
  transform: scale(1.4);
}

.zg-shape-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.zg-shape-grid h3 {
  margin: 0.75rem 0 0.35rem;
  font-size: 1.0625rem;
}

.zg-shape-grid p {
  margin: 0;
  color: var(--zg-muted);
}

.zg-shape-mini {
  width: 100%;
  max-width: 12rem;
  height: auto;
}

.zg-shape-mini rect {
  fill: none;
  stroke: var(--zg-line);
  stroke-width: 1.5;
}

.zg-shape-line {
  fill: none;
  stroke: var(--zg-ink);
  stroke-width: 1.5;
}

.zg-shape-line--soft {
  stroke-dasharray: 5 4;
}

.zg-shape-head {
  fill: var(--zg-ink);
}

.zg-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: 0.75rem;
}

.zg-demo:empty {
  display: none;
}

/* ----- landing: the atlas plate, its legend and the grade index ---------------------- */

@media (min-width: 60rem) {
  .zg-hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  }
}

.zg-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem 2.5rem;
  margin-top: 1.6rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--zg-line);
}

.zg-hero-stats .zg-metric {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

.zg-hero-stats .zg-metric-value {
  font-family: var(--zg-serif);
  letter-spacing: 0;
  font-size: clamp(1.9rem, 1.4rem + 1.6vw, 2.6rem);
  text-align: right;
}

.zg-hero-stats .zg-metric-label {
  font-family: var(--zg-mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.zg-plate .zg-hero-figure {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.zg-plate-graph {
  display: block;
  width: 100%;
  height: auto;
}

.zg-plate-dot {
  stroke: var(--zg-surface);
  stroke-width: 0.8;
}

/* An invisible ring around the dot: the stylesheet grows it with the camera, so a tap is
   possible once the plate is zoomed in, and never larger than half the closest neighbour. */
.zg-plate-hit {
  fill: transparent;
  r: min(calc(22px / var(--zg-k, 1)), 8.5px);
}

.zg-plate-tag {
  display: none;
  transform: scale(calc(1 / var(--zg-k, 1)));
  transform-origin: 0 0;
  pointer-events: none;
}

.zg-plate-num,
.zg-plate-name {
  font-family: var(--zg-mono);
  font-size: 10px;
  fill: var(--zg-ink);
  stroke: var(--zg-surface);
  stroke-width: 3px;
  paint-order: stroke fill;
  user-select: none;
}

.zg-plate-name {
  display: none;
  font-size: 11px;
}

/* The zoom levels: the plate stays bare until the camera is close enough for labels to read. */
.zg-plate-graph--nums .zg-plate-tag {
  display: inline;
}

.zg-plate-graph--names .zg-plate-name {
  display: inline;
}

.zg-plate-graph--nums .zg-plate-node--nolabel .zg-plate-tag {
  display: none;
}

/* The grade of a column, pinned to the top of the canvas; it moves with its column but never
   with the vertical pan and never grows with the zoom. */
.zg-karta-axis {
  position: absolute;
  inset: 0 0 auto;
  height: 1.6rem;
  z-index: 2;
  pointer-events: none;
}

.zg-karta-axis span {
  position: absolute;
  top: 0.3rem;
  transform: translateX(-50%);
  padding: 0.05rem 0.45rem;
  border: 1px solid var(--zg-line);
  border-radius: 999px;
  background: var(--zg-surface);
  font-family: var(--zg-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--zg-muted);
  white-space: nowrap;
}

.zg-plate-node[data-grade="1"] { fill: var(--zg-g1); }
.zg-plate-node[data-grade="2"] { fill: var(--zg-g2); }
.zg-plate-node[data-grade="3"] { fill: var(--zg-g3); }
.zg-plate-node[data-grade="4"] { fill: var(--zg-g4); }
.zg-plate-node[data-grade="5"] { fill: var(--zg-g5); }
.zg-plate-node[data-grade="6"] { fill: var(--zg-g6); }
.zg-plate-node[data-grade="7"] { fill: var(--zg-g7); }
.zg-plate-node[data-grade="8"] { fill: var(--zg-g8); }

.zg-plate-node--active .zg-plate-dot {
  stroke: var(--zg-ink);
  stroke-width: 2;
}

.zg-plate-node--chain .zg-plate-dot {
  stroke: var(--zg-ink);
  stroke-width: 1.4;
}

.zg-hero-graph.zg-hero-graph--active .zg-plate-node:not(.zg-plate-node--active):not(.zg-plate-node--chain) {
  opacity: 0.35;
}

.zg-hero-graph.zg-hero-graph--active .zg-hero-edge:not(.zg-hero-edge--chain) {
  opacity: 0.3;
}

.zg-plate-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.9rem;
  margin-top: 0.7rem;
  font-family: var(--zg-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--zg-muted);
}

.zg-plate-legend-grades {
  display: inline-flex;
  gap: 0.3rem;
}

.zg-plate-legend-swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.zg-plate-legend-line {
  display: inline-block;
  width: 20px;
  border-top: 2px solid var(--zg-ink);
  vertical-align: 3px;
}

.zg-plate-legend-line--soft {
  border-top-style: dashed;
}

.zg-atlas-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.zg-atlas-card {
  border: 1px solid var(--zg-line);
  background: var(--zg-surface);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.zg-atlas-card:hover {
  transform: translateY(-3px);
  border-color: var(--zg-ink);
  box-shadow: var(--zg-shadow-deep);
}

.zg-atlas-card-main {
  display: block;
  min-height: 100%;
  padding: 1rem;
  color: inherit;
  text-decoration: none;
}

.zg-atlas-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.zg-atlas-card-grade {
  font-family: var(--zg-serif);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
}

.zg-atlas-card-meta {
  font-family: var(--zg-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--zg-muted);
  text-align: right;
}

.zg-atlas-card-units {
  list-style: none;
  margin: 0 0 0.8rem;
  padding: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--zg-muted);
}

.zg-atlas-card-units li {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zg-atlas-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--zg-muted);
}

.zg-section > .zg-actions:last-child,
.zg-card > .zg-actions:last-child {
  margin-bottom: 0;
}

/* ----- diagnosis: progress and question ---------------------------------------------- */

.zg-progress-track {
  height: 0.6rem;
  overflow: hidden;
  border: 1px solid var(--zg-line);
  border-radius: 999px;
  background: var(--zg-surface-2);
}

.zg-progress-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--zg-accent);
}

.zg-progress-text {
  margin: 0.35rem 0 0;
  font-size: 0.9375rem;
  color: var(--zg-muted);
  font-variant-numeric: tabular-nums;
}

.zg-question {
  margin-top: 1rem;
}

.zg-question .zg-eyebrow {
  overflow-wrap: anywhere;
}

.zg-prompt-text {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.5;
}

/* The figure figure.js draws carries the class zg-figure on the svg itself. Its strokes
   are currentColor and its fills use the accent, so it follows the theme as it is. */
.zg-fig {
  margin: 0 0 1rem;
}

/* The svg takes no pointer: the description in its <title> would otherwise pop up as a tooltip. */
.zg-fig svg.zg-figure {
  display: block;
  height: auto;
  pointer-events: none;
}

/* ----- teacher review sheet ----------------------------------------------------------- */

.zg-sheet-grades {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding: 0;
  list-style: none;
}

.zg-sheet-grades .zg-btn {
  width: 100%;
}

.zg-sheet-topics {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.zg-sheet-topic {
  break-inside: avoid;
}

.zg-sheet-topic > .zg-subtitle {
  margin-top: 0;
}

.zg-sheet-block {
  margin-top: 1rem;
}

.zg-sheet-block > h3,
.zg-sheet-block > .zg-label {
  margin-bottom: 0.4rem;
}

/* A third-level heading is larger than a fourth one in a browser; the four headings that were fourth-level
   keep the size and the weight they had, so that the order of levels costs nothing in the look. */
.zg-sheet-block > h3:not(.zg-label) {
  font-size: 1em;
  font-weight: 700;
}

.zg-sheet-meta {
  display: block;
  margin-top: 0.15rem;
  color: var(--zg-muted);
  font-size: 0.875rem;
}

.zg-sheet-question {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--zg-line);
  break-inside: avoid;
}

.zg-sheet-question > .zg-eyebrow {
  margin-bottom: 0.4rem;
}

.zg-sheet-choices {
  margin-block: 0.5rem;
}

.zg-sheet-correct {
  margin-left: 0.35rem;
}

.zg-sheet-answer,
.zg-sheet-explanation {
  margin-block: 0.5rem;
}

.zg-sheet-checks {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.8rem;
}

.zg-sheet-checks p {
  margin: 0;
}

.zg-sheet-note-line {
  display: inline-block;
  min-width: min(24rem, 70%);
  height: 1em;
  border-bottom: 1px solid currentColor;
  vertical-align: baseline;
}

.zg-answer {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.zg-answer-line {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.6rem;
}

.zg-input-lg {
  flex: 1 1 10rem;
  font-size: 1.25rem;
}

.zg-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.zg-choice {
  width: 100%;
  min-height: var(--zg-target);
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--zg-line);
  border-radius: var(--zg-radius-sm);
  text-align: left;
  cursor: pointer;
  background: var(--zg-surface);
  overflow-wrap: anywhere;
}

.zg-choice:hover:not(:disabled) {
  border-color: var(--zg-accent);
}

.zg-choice:disabled {
  color: var(--zg-muted);
  cursor: default;
}

.zg-choice.zg-picked.zg-right {
  border-color: var(--zg-ok);
  color: var(--zg-ink);
  background: var(--zg-ok-soft);
}

.zg-choice.zg-picked.zg-wrong {
  border-color: var(--zg-bad);
  color: var(--zg-ink);
  background: var(--zg-bad-soft);
}

.zg-feedback {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--zg-line);
  border-radius: var(--zg-radius);
  background: var(--zg-surface-2);
}

.zg-feedback-ok {
  border-color: var(--zg-ok);
  background: var(--zg-ok-soft);
}

.zg-feedback-bad {
  border-color: var(--zg-bad);
  background: var(--zg-bad-soft);
}

.zg-feedback-verdict {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
}

.zg-explain {
  margin: 0.75rem 0 0;
}

.zg-explain-title {
  margin: 0 0 0.15rem;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--zg-muted);
}

/* ----- diagnosis: result ------------------------------------------------------------- */

.zg-result {
  display: grid;
  gap: 1rem;
}

.zg-roots {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.zg-root {
  padding: 1rem 1.1rem;
  border: 1px solid var(--zg-bad);
  border-radius: var(--zg-radius);
  background: var(--zg-surface);
}

.zg-root-unconfirmed {
  border-color: var(--zg-warn);
}

.zg-root h3 {
  margin-bottom: 0.35rem;
  overflow-wrap: anywhere;
}

.zg-root-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.zg-missed {
  display: grid;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.zg-missed li {
  padding-left: 0.75rem;
  border-left: 3px solid var(--zg-line);
}

.zg-missed p {
  margin: 0;
}

.zg-chain-scroll {
  overflow-x: auto;
  padding: 0.25rem 0 0.75rem;
}

.zg-chain {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.zg-chain-step {
  position: relative;
  display: grid;
  gap: 0.25rem;
  flex: 0 0 auto;
  max-width: 15rem;
}

.zg-chain-step + .zg-chain-step::before {
  content: "";
  position: absolute;
  left: -1.5rem;
  top: 1.9rem;
  width: 1.5rem;
  border-top: 2px solid var(--zg-line);
}

.zg-chain-step.zg-chain-step--hole::before {
  border-top-style: dashed;
  border-top-color: var(--zg-bad);
}

.zg-chain-step.zg-chain-step--shaky::before {
  border-top-style: dashed;
  border-top-color: var(--zg-warn);
}

.zg-chain-band {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--zg-muted);
}

.zg-chain-name {
  display: block;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--zg-line);
  border-radius: 0.5rem;
  background: var(--zg-surface);
}

.zg-chain-step--hole .zg-chain-name {
  border-color: var(--zg-bad);
  background: var(--zg-bad-soft);
}

.zg-chain-step--shaky .zg-chain-name {
  border-color: var(--zg-warn);
  background: var(--zg-warn-soft);
}

.zg-chain-step--root .zg-chain-name a {
  font-weight: 700;
}

.zg-report {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
}

.zg-missed .zg-prompt-text {
  font-size: 1rem;
}

.zg-missed-wrap {
  margin-top: 0.75rem;
}

.zg-missed-wrap > .zg-label {
  margin-bottom: 0.35rem;
}

.zg-root-meta + .zg-hint,
.zg-root h3 {
  margin-top: 0;
}

.zg-outcomes .zg-hint {
  margin-top: 0.1rem;
}

.zg-counts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  margin: 0;
}

.zg-counts > div {
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--zg-line);
  border-radius: var(--zg-radius);
  background: var(--zg-surface);
}

.zg-counts dt {
  font-size: 0.875rem;
  color: var(--zg-muted);
}

.zg-counts dd {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.zg-outcomes {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.zg-outcomes li {
  padding-left: 0.75rem;
  border-left: 3px solid var(--zg-line);
}

.zg-outcomes p {
  margin: 0;
}

.zg-share {
  display: grid;
  gap: 0.4rem;
}

.zg-share input {
  font-family: var(--zg-mono);
  font-size: 0.875rem;
}

/* ----- wider screens ----------------------------------------------------------------- */

@media (min-width: 40rem) {
  .zg-stats {
    grid-template-columns: repeat(4, 1fr);
  }

  .zg-grades {
    grid-template-columns: repeat(4, 1fr);
  }

  .zg-counts {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (min-width: 48rem) {
  .zg-toolbar {
    grid-template-columns: minmax(12rem, 2fr) minmax(9rem, 1fr) minmax(11rem, 1fr);
    align-items: end;
    gap: 0.75rem;
  }
}

@media (min-width: 64rem) {
  .zg-map-layout {
    grid-template-columns: minmax(16rem, 22rem) 1fr;
  }
}

/* ----- learn loop: verdict colours, notebook, home summary ---------------------------- */

.zg-dot,
.zg-swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border: 2px solid var(--zg-line);
  border-radius: 50%;
  background: var(--zg-surface);
}

.zg-dot {
  margin-right: 0.4rem;
}

.zg-dot--mastered,
.zg-swatch--mastered {
  border-color: var(--zg-ok);
  background: var(--zg-ok-soft);
}

.zg-dot--shaky,
.zg-swatch--shaky {
  border-color: var(--zg-warn);
  background: var(--zg-warn-soft);
}

.zg-dot--weak,
.zg-swatch--weak {
  border-color: var(--zg-bad);
  background: var(--zg-bad-soft);
}

.zg-dot--inferred,
.zg-swatch--inferred {
  border-style: dashed;
  border-color: var(--zg-muted);
}

.zg-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  margin: 0.75rem 0;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--zg-line);
  border-radius: var(--zg-radius-sm);
  background: var(--zg-surface);
}

.zg-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9375rem;
}

.zg-legend .zg-hint {
  margin: 0;
}

.zg-legend-progress {
  border-color: var(--zg-accent);
  background: var(--zg-accent-soft);
}

.zg-notebook-list {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.zg-entry {
  margin: 0;
}

.zg-entry-prompt {
  margin: 0.5rem 0;
}

.zg-entry-answer {
  margin: 0.5rem 0;
}

.zg-entry-answer > summary {
  display: flex;
  align-items: center;
  min-height: var(--zg-target);
  cursor: pointer;
  font-weight: 600;
}

.zg-entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 0;
}

.zg-entry-actions {
  margin-top: 0.75rem;
}

.zg-learn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.zg-learn-item {
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--zg-line);
  border-radius: var(--zg-radius-sm);
  background: var(--zg-surface);
  font-weight: 600;
}

.zg-learn-item--due {
  border-color: var(--zg-warn);
  background: var(--zg-warn-soft);
  color: var(--zg-warn);
}

.zg-cal {
  --zg-cal-cell: 0.75rem;
  margin-top: 1rem;
}

@media (min-width: 40rem) {
  .zg-cal {
    --zg-cal-cell: 1rem;
  }
}

.zg-cal-scroll {
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.zg-cal-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem;
  min-width: max-content;
}

.zg-cal-dows {
  display: grid;
  grid-template-rows: repeat(7, var(--zg-cal-cell));
  gap: 2px;
  align-items: center;
  font-size: 0.65rem;
  color: var(--zg-muted);
}

.zg-cal-dow {
  display: flex;
  align-items: center;
  height: var(--zg-cal-cell);
}

.zg-cal-body {
  display: grid;
  gap: 2px;
}

.zg-cal-months {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--zg-cal-cell);
  gap: 2px;
  font-size: 0.7rem;
  color: var(--zg-muted);
}

.zg-cal-month {
  white-space: nowrap;
  overflow: visible;
}

.zg-cal-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, var(--zg-cal-cell));
  gap: 2px;
}

.zg-cal-day {
  display: block;
  width: var(--zg-cal-cell);
  height: var(--zg-cal-cell);
  border-radius: 2px;
  background: var(--zg-line);
  opacity: 0.45;
}

.zg-cal-day--on {
  background: var(--zg-ok);
  opacity: 1;
}

.zg-cal-day--today {
  outline: 2px solid var(--zg-focus);
  outline-offset: 1px;
}

.zg-cal-day--pad {
  background: transparent;
}

.zg-cal-legend {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--zg-muted);
}

.zg-cal-legend .zg-cal-day {
  width: 0.7rem;
  height: 0.7rem;
}

.zg-cal-details {
  margin-top: 0.5rem;
}

.zg-cal-details th,
.zg-cal-details td {
  padding: 0.15rem 0.5rem;
  border-bottom: 1px solid var(--zg-line);
  text-align: left;
}

@media print {
  .zg-cal {
    break-inside: avoid;
  }

  .zg-cal-scroll {
    overflow: visible;
  }

  .zg-cal-day--on {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

.zg-blind {
  margin: 0.75rem 0;
}

.zg-blind-list {
  display: grid;
  gap: 0.4rem;
  margin: 0.35rem 0 0;
  padding: 0;
  list-style: none;
}

.zg-blind-list > li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.zg-blind-list > li > a:not(.zg-btn) {
  flex: 1 1 10rem;
}

.zg-print-only {
  display: none;
}

/* ----- shared surfaces: pills, metric cards, reveal ---------------------------------- */

.zg-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.1rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.6;
  white-space: nowrap;
}

.zg-pill--neutral {
  border-color: var(--zg-line);
  background: var(--zg-surface-2);
  color: var(--zg-muted);
}

.zg-pill--accent {
  background: var(--zg-accent-soft);
  color: var(--zg-accent-ink);
}

.zg-pill--ok {
  background: var(--zg-ok-soft);
  color: var(--zg-ok);
}

.zg-pill--warn {
  background: var(--zg-warn-soft);
  color: var(--zg-warn);
}

.zg-pill--bad {
  background: var(--zg-bad-soft);
  color: var(--zg-bad);
}

.zg-metric {
  display: grid;
  align-content: start;
  gap: 0.35rem;
  padding: 1.25rem;
  border: 1px solid var(--zg-line);
  border-radius: var(--zg-radius);
  background: var(--zg-surface);
  box-shadow: var(--zg-shadow-card);
}

.zg-metric-value {
  font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: lining-nums tabular-nums;
}

.zg-metric-label {
  font-size: 0.875rem;
  color: var(--zg-muted);
}

/* The hidden state only exists for readers who allow motion; everyone else sees the page. */
@media (prefers-reduced-motion: no-preference) {
  .zg-reveal {
    opacity: 0;
    transform: translateY(0.75rem);
    transition: opacity 0.5s ease, transform 0.5s ease;
  }

  .zg-reveal-in {
    opacity: 1;
    transform: none;
  }
}

/* ----- dashboard: /graf/ -------------------------------------------------------------- */

.zg-dash-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
  gap: 0.75rem 1rem;
  align-items: end;
  margin: 1.5rem 0 2rem;
  padding: 1rem;
  border: 1px solid var(--zg-line);
  border-radius: var(--zg-radius);
  background: var(--zg-surface);
  box-shadow: var(--zg-shadow-card);
}

.zg-dash-filters .zg-field {
  margin-bottom: 0;
}

.zg-dash-filters .zg-actions {
  margin-top: 0;
}

.zg-dash-grid {
  display: grid;
  gap: 2rem;
}

@media (min-width: 64rem) {
  .zg-dash-grid {
    grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  }
}

.zg-dash-main {
  min-width: 0;
}

.zg-dash-canvas {
  max-height: 34rem;
  overflow: auto;
  margin-block: 0.5rem 1rem;
  padding: 0.5rem;
  border: 1px solid var(--zg-line);
  border-radius: var(--zg-radius);
  background: var(--zg-surface);
}

.zg-dash-canvas .zg-node {
  cursor: pointer;
}

.zg-dash-list {
  margin: 0;
  padding-left: 1.25rem;
  columns: 2;
}

@media (max-width: 40rem) {
  .zg-dash-list {
    columns: 1;
  }
}

.zg-dash-detail-card {
  margin-top: 1rem;
}

.zg-dash-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.zg-dash-links {
  margin: 0 0 0.75rem;
  padding-left: 1.25rem;
}

.zg-dash-links li {
  margin-bottom: 0.25rem;
}

.zg-dash-links li .zg-hint {
  display: block;
}

.zg-dash-ranked {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding-left: 1.25rem;
}

.zg-dash-table-wrap {
  overflow-x: auto;
  margin-top: 0.75rem;
}

.zg-dash-table {
  width: 100%;
  border-collapse: collapse;
}

.zg-dash-table th,
.zg-dash-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--zg-line);
  font-size: 0.9375rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.zg-dash-table th[scope="row"],
.zg-dash-table thead th:first-child {
  text-align: left;
}

.zg-dash-table thead th {
  font-family: var(--zg-serif);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--zg-ink);
}

.zg-dash-table td {
  font-family: var(--zg-mono);
  font-size: 0.84rem;
}

.zg-dash-table .zg-heat {
  background: rgba(11, 92, 172, calc(var(--zg-heat, 0) * 0.16));
}

.zg-wrap > section[data-zg-reveal] {
  margin-top: 2.5rem;
}

/* ----- print and motion -------------------------------------------------------------- */

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  :root {
    color-scheme: light;
    --zg-bg: #ffffff;
    --zg-surface: #ffffff;
    --zg-surface-2: #ffffff;
    --zg-ink: #000000;
    --zg-muted: #333333;
    --zg-line: #999999;
    --zg-accent: #000000;
    --zg-on-accent: #ffffff;
    --zg-accent-soft: #ffffff;
    --zg-ok: #000000;
    --zg-ok-soft: #ffffff;
    --zg-bad: #000000;
    --zg-bad-soft: #ffffff;
    --zg-warn: #000000;
    --zg-warn-soft: #ffffff;
    --zg-shadow-card: none;
    --zg-shadow-deep: none;
  }

  .zg-header,
  .zg-skip,
  .zg-draft,
  .zg-actions,
  .zg-btn,
  .zg-nav,
  .zg-share,
  #zg-live {
    display: none !important;
  }

  body {
    font-size: 11pt;
    color: #000000;
    background: #ffffff;
  }

  .zg-main {
    padding: 0;
  }

  .zg-wrap {
    max-width: none;
    padding: 0;
  }

  .zg-card,
  .zg-root,
  .zg-counts > div {
    border-color: #999999;
    box-shadow: none;
    break-inside: avoid;
  }

  .zg-sheet-topic {
    color: #000000;
    background: #ffffff;
  }

  .zg-print-only {
    display: block !important;
  }

  .zg-entry-answer {
    display: none !important;
  }

  .zg-print-answers li {
    break-inside: avoid;
  }

  .zg-chain-scroll {
    overflow: visible;
  }

  .zg-chain {
    display: block;
  }

  .zg-chain-step {
    max-width: none;
    margin: 0 0 0.5rem;
    padding-left: 0.75rem;
    border-left: 2px solid var(--zg-line);
  }

  .zg-chain-step::before {
    display: none;
  }

  .zg-report {
    display: none;
  }

  .zg-sheet-topic a {
    color: #000000;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}

/* ----- atlas plate: a framed map with a mono caption --------------------------------- */

.zg-plate {
  position: relative;
  border: 1px solid var(--zg-ink);
  background: var(--zg-surface);
  padding: 0.9rem;
  box-shadow: var(--zg-shadow-deep);
}

.zg-plate::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid var(--zg-line);
  pointer-events: none;
}

.zg-plate-cap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  margin: 0 0 0.6rem;
  font-family: var(--zg-mono);
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--zg-muted);
}

@media print {
  body {
    background-image: none;
  }

  .zg-plate {
    border-color: #000000;
    background: none;
    box-shadow: none;
  }

  .zg-plate::before {
    border-color: #000000;
  }
}

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

/* Public catalogue */
.zg-catalog-filters {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(10rem, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
.zg-catalog-grade, .zg-catalog-unit { margin-block: 1.5rem; }
.zg-catalog-unit ul { list-style: none; margin: 0; padding: 0; }
.zg-catalog-unit li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem; padding: 0.65rem 0; border-bottom: 1px solid var(--zg-line); }
.zg-catalog-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; }
@media (max-width: 36rem) {
  .zg-catalog-filters { grid-template-columns: 1fr; }
}
