/* Mallard brand: plum (logo background), flame orange, mallard teal */
:root {
  --mallard-plum: #2b1a22;
  --mallard-plum-2: #3d2632;
  --mallard-flame: #f28b1d;
  --mallard-teal: #12655f;
}

[data-md-color-primary="custom"] {
  --md-primary-fg-color: var(--mallard-plum);
  --md-primary-fg-color--light: var(--mallard-plum-2);
  --md-primary-fg-color--dark: #1d1117;
  --md-primary-bg-color: #f6eee9;
  --md-primary-bg-color--light: #f6eee9b3;
}

[data-md-color-accent="custom"] {
  --md-accent-fg-color: var(--mallard-flame);
  --md-accent-fg-color--transparent: #f28b1d1a;
}

[data-md-color-scheme="default"] {
  --md-typeset-a-color: var(--mallard-teal);
}

[data-md-color-scheme="slate"] {
  --md-default-bg-color: #171114;
  --md-default-bg-color--light: #1d151a;
  --md-code-bg-color: #241b20;
  --md-typeset-a-color: #5fcfc1;
}

.md-typeset h1,
.md-typeset h2 {
  font-family: "Source Serif 4", Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Home hero */
.mallard-hero {
  background: radial-gradient(1200px 500px at 85% -10%, #4a2b37 0%, var(--mallard-plum) 55%, #1f1218 100%);
  color: #f6eee9;
  padding: 3.2rem 0 3.6rem;
}
.mallard-hero .md-grid { padding: 0 0.8rem; }
.mallard-hero__inner {
  display: grid;
  gap: 2.4rem;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: center;
}
.mallard-hero__wordmark { width: min(360px, 80%); display: block; margin-bottom: 1.4rem; }
.mallard-hero h1 {
  font-family: "Source Serif 4", Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.6rem, 2.8vw, 2.3rem);
  line-height: 1.2;
  color: #fff;
  margin: 0 0 1rem;
}
.mallard-hero p { font-size: 0.95rem; color: #e3d4cd; margin: 0 0 1.6rem; max-width: 46ch; }
.mallard-hero .md-button { margin: 0 0.6rem 0.6rem 0; }
.mallard-hero .md-button--primary {
  background: var(--mallard-flame);
  border-color: var(--mallard-flame);
  color: #24130a;
}
.mallard-hero .md-button--primary:hover { background: #ffa140; border-color: #ffa140; color: #24130a; }
.mallard-hero .md-button:not(.md-button--primary) { color: #f6eee9; border-color: #f6eee966; }
.mallard-hero .md-button:not(.md-button--primary):hover { color: var(--mallard-flame); border-color: var(--mallard-flame); }
.mallard-hero__media video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
  border: 1px solid #ffffff1f;
  box-shadow: 0 18px 50px #00000066;
  background: #000;
}
.mallard-hero__caption { font-size: 0.7rem; color: #c9b8b1; margin-top: 0.6rem; }
.mallard-version { font-size: 0.7rem; color: #c9b8b1; margin-top: 0.2rem; }

@media screen and (max-width: 60em) {
  .mallard-hero__inner { grid-template-columns: 1fr; }
}

/* Gallery */
.mallard-gallery figure { margin: 0 0 2.4rem; }
.mallard-gallery img, .mallard-gallery video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  border: 1px solid var(--md-default-fg-color--lightest);
  background: #000;
}
.mallard-gallery figcaption { max-width: none; text-align: left; font-size: 0.75rem; }
.mallard-gallery figure.mallard-gallery__pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.2rem;
  align-items: start;
}
.mallard-gallery figure.mallard-gallery__pair figcaption { margin-top: 0; }
@media screen and (max-width: 44.9375em) {
  .mallard-gallery figure.mallard-gallery__pair { grid-template-columns: 1fr; }
}

/* Validation figures and tables */
.mallard-figure img, .mallard-figure video {
  width: 100%;
  height: auto;
  display: block;
  background: #fff;
  border-radius: 6px;
  border: 1px solid var(--md-default-fg-color--lightest);
}
.mallard-figure figcaption { max-width: none; text-align: left; font-size: 0.75rem; }
.md-typeset table:not([class]) td.num, .md-typeset .mallard-num { font-variant-numeric: tabular-nums; }
.mallard-hero.md-typeset, .mallard-hero .md-typeset { color: #f6eee9; }
.mallard-hero .md-typeset h1 { margin-top: 0; }

/* Home: headline validation numbers */
.md-typeset .mallard-stats > ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(max(11rem, calc((100% - 1.6rem) / 3)), 1fr));
  gap: 0.8rem;
  list-style: none;
  margin: 1em 0;
  padding: 0;
}
.md-typeset .mallard-stats > ul > li {
  margin: 0;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-left: 3px solid var(--mallard-flame);
  border-radius: 6px;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--md-default-fg-color--light);
}
.md-typeset .mallard-stats > ul > li > p:first-child {
  margin: 0 0 0.35rem;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.25;
  color: var(--md-default-fg-color);
}
.md-typeset .mallard-stats > ul > li > p:first-child strong { font-weight: 600; }
.md-typeset .mallard-stats > ul > li > p { margin: 0; }

/* Accessibility: links in running text are underlined, not told apart by color alone */
.md-typeset p a:not(.md-button):not(.headerlink),
.md-typeset li a:not(.md-button),
.md-typeset td a,
.md-typeset figcaption a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
.md-typeset .md-nav a, .md-typeset .headerlink { text-decoration: none; }

/* Footer copyright at AA contrast */
.md-copyright { color: var(--md-footer-fg-color--light); }
.md-copyright__highlight { color: var(--md-footer-fg-color--light); }

.mallard-figure video { background: #000; }

.md-typeset figure.mallard-fun { max-width: 36rem; margin-left: 0; }

.md-typeset img.mallard-still {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--md-default-fg-color--lightest);
  background: #fff;
}

/* Home hero: facts */
.md-typeset .mallard-facts {
  list-style: none;
  margin: 0 0 1.6rem;
  padding: 0;
  display: grid;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: #e3d4cd;
}
.md-typeset .mallard-facts li { margin: 0; padding-left: 1rem; position: relative; }
.md-typeset .mallard-facts li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--mallard-flame);
}
.md-typeset .mallard-facts strong { color: #fff; font-weight: 600; }
.md-typeset .mallard-facts a { color: #fff; text-decoration: underline; text-decoration-color: #f28b1d99; text-underline-offset: 0.18em; }
.md-typeset .mallard-facts a:hover { color: var(--mallard-flame); }

/* Home: feature cards */
.md-typeset .grid.cards.mallard-features { grid-template-columns: repeat(auto-fit, minmax(max(14rem, calc((100% - 1.6rem) / 3)), 1fr)); }
.md-typeset .mallard-features > ul > li { display: flex; flex-direction: column; }
.md-typeset .mallard-features > ul > li > ul { font-size: 0.72rem; line-height: 1.45; margin: 0 0 0.6rem; flex-grow: 1; }
.md-typeset .mallard-features > ul > li > ul > li { margin: 0 0 0.3rem 1rem; }
.md-typeset .mallard-features > ul > li > p:last-child { font-size: 0.72rem; margin: 0; }

/* Gallery: two stills side by side, and plots on white */
.mallard-gallery__duo-media {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.8rem;
}
.mallard-gallery__duo-media a { display: block; }
@media screen and (max-width: 44.9375em) {
  .mallard-gallery__duo-media { grid-template-columns: 1fr; }
}
.mallard-gallery img.mallard-gallery__plot { background: #fff; }

/* Home: featured run */
.md-typeset figure.mallard-featured { max-width: none; margin: 1em 0 2em; }
.md-typeset figure.mallard-featured video { background: #000; }

/* Validation: the release or commit behind each result */
.md-typeset p.mallard-provenance {
  display: inline-block;
  margin: -0.4em 0 0.8em;
  padding: 0.15em 0.6em;
  border-radius: 999px;
  border: 1px solid var(--md-default-fg-color--lightest);
  font-size: 0.68rem;
  color: var(--md-default-fg-color--light);
}
.md-typeset .mallard-nowrap { white-space: nowrap; }

/* Performance dashboard (docs/dashboard.md, drawn by hooks/performance.py) */
.perf {
  --perf-ink: #3b2d33;
  --perf-muted: #7a6a70;
  --perf-grid: #e8e0dc;
  --perf-band: #12655f14;
  --perf-baseline: #8a7a80;
  --perf-line: #12655f;
  --perf-release: #b4a6ab;
  --perf-slower: #c62828;
  --perf-card: var(--md-default-bg-color);
  --perf-border: #e5dcd8;
  --perf-c0: #008f84;
  --perf-c1: #d06a00;
  --perf-c2: #7b5ea7;
}
[data-md-color-scheme="slate"] .perf {
  --perf-ink: #e8dcd6;
  --perf-muted: #a8979d;
  --perf-grid: #2f2429;
  --perf-band: #5fcfc11c;
  --perf-baseline: #9b8a90;
  --perf-line: #5fcfc1;
  --perf-release: #6b5a61;
  --perf-slower: #ff6b6b;
  --perf-card: var(--md-default-bg-color--light);
  --perf-border: #33272d;
  --perf-c0: #2fa89b;
  --perf-c1: #c96f12;
  --perf-c2: #9b80d0;
}
.md-typeset .perf-grid-cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
  margin: 1rem 0 1.6rem;
}
.md-typeset .perf-grid-cards--wide { grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr)); }
.md-typeset .perf-card {
  margin: 0;
  padding: 0.7rem 0.75rem 0.4rem;
  border: 1px solid var(--perf-border);
  border-radius: 8px;
  background: var(--perf-card);
  min-width: 0;
}
.md-typeset .perf-card figcaption {
  max-width: none;
  margin: 0 0 0.3rem;
  text-align: left;
  font-size: 0.72rem;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.md-typeset .perf-card figcaption code { font-size: 0.8rem; align-self: flex-start; }
.md-typeset .perf-card figcaption, .md-typeset .perf-card figcaption * { font-style: normal; }
.md-typeset .perf-card figcaption span { color: var(--perf-muted); font-style: normal; }
.md-typeset .perf td code { white-space: nowrap; }
.md-typeset .perf-card figcaption .perf-latest { color: var(--perf-ink); font-variant-numeric: tabular-nums; }
.perf-svg { width: 100%; height: auto; display: block; overflow: visible; font-family: var(--md-text-font-family, Inter), sans-serif; }
.md-typeset .perf-card--scaling { container-type: inline-size; width: auto; }
.md-typeset .perf-svg--compact { max-width: 360px; margin: 0 auto; }
.md-typeset .perf-svg--wide { display: none; max-width: 630px; }
@container (min-width: 560px) {
  .md-typeset .perf-svg--compact { display: none; }
  .md-typeset .perf-svg--wide { display: block; }
}
.perf-grid { stroke: var(--perf-grid); stroke-width: 1; }
.perf-axis { stroke: var(--perf-muted); stroke-width: 1; }
.perf-tick { fill: var(--perf-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.perf-band { fill: var(--perf-band); }
.perf-baseline { stroke: var(--perf-baseline); stroke-width: 1.25; stroke-dasharray: 4 3; }
.perf-release { stroke: var(--perf-release); stroke-width: 1; stroke-dasharray: 2 3; }
.perf-release-label { fill: var(--perf-muted); font-size: 11px; }
.perf-line { fill: none; stroke: var(--perf-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.perf-dot { fill: var(--perf-line); stroke: var(--perf-card); stroke-width: 1.5; }
.perf-dot--slower { fill: var(--perf-slower); }
.perf-slower-label { fill: var(--perf-slower); font-size: 10px; font-weight: 600; }
.perf-target { fill: transparent; }
.perf-hit { cursor: pointer; outline: none; }
.perf-hit:hover .perf-dot, .perf-hit:focus .perf-dot, .perf-hit:hover .perf-marker, .perf-hit:focus .perf-marker { r: 5.5; }
.perf-hit:hover .perf-target, .perf-hit:focus .perf-target { fill: var(--perf-grid); fill-opacity: 0.35; }
.perf-series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.perf-series.perf-c0 { stroke: var(--perf-c0); }
.perf-series.perf-c1 { stroke: var(--perf-c1); }
.perf-series.perf-c2 { stroke: var(--perf-c2); }
.perf-marker { stroke: var(--perf-card); stroke-width: 2; }
.perf-marker.perf-c0, .perf-key.perf-c0 { fill: var(--perf-c0); background: var(--perf-c0); }
.perf-marker.perf-c1, .perf-key.perf-c1 { fill: var(--perf-c1); background: var(--perf-c1); }
.perf-marker.perf-c2, .perf-key.perf-c2 { fill: var(--perf-c2); background: var(--perf-c2); }
.perf-direct { fill: var(--perf-ink); font-size: 11.5px; }
.perf-direct-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.md-typeset ul.perf-legend {
  list-style: none;
  margin: 0.4rem 0 0.2rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1rem;
  font-size: 0.7rem;
  color: var(--perf-muted);
}
.md-typeset ul.perf-legend li { margin: 0; display: flex; align-items: center; gap: 0.35rem; }
.perf-key { display: inline-block; width: 1.1rem; height: 0.6rem; border-radius: 2px; }
.perf-key--line { height: 2px; background: var(--perf-line); }
.perf-key--band { background: var(--perf-band); border-top: 1.25px dashed var(--perf-baseline); border-radius: 0; }
.perf-key--release { width: 0; height: 0.8rem; border-left: 1px dashed var(--perf-release); border-radius: 0; }
.perf-key--slower { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--perf-slower); }
.perf-key--series { height: 3px; }
.md-typeset .perf-meta { color: var(--perf-muted); font-size: 0.72rem; }
.md-typeset .perf table { font-size: 0.72rem; }
.md-typeset .perf td.num { font-variant-numeric: tabular-nums; text-align: right; }
.md-typeset details.perf-table { margin: 0.3rem 0 0.2rem; font-size: 0.72rem; border: none; box-shadow: none; background: none; padding: 0; }
.md-typeset details.perf-table > summary { color: var(--perf-muted); cursor: pointer; padding: 0; background: none; font-weight: 400; font-size: 0.72rem; }
.md-typeset details.perf-table > summary::before, .md-typeset details.perf-table > summary::after { display: none; }
.perf-tooltip {
  position: fixed;
  z-index: 10;
  max-width: min(22rem, calc(100vw - 2rem));
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  background: #2b1a22f2;
  color: #f6eee9;
  font-size: 0.66rem;
  line-height: 1.4;
  pointer-events: none;
  box-shadow: 0 6px 20px #0000004d;
}

/* User guide figures (docs/images/guide): centered, at most their natural size */
.md-typeset img[src*="images/guide/"] {
  display: block;
  margin: 1.2em auto 0.6em;
}
.md-typeset p:has(> img[src*="images/guide/"]) + p > em:only-child {
  display: block;
  text-align: center;
  font-size: 0.85em;
  color: var(--md-default-fg-color--light);
}
.mallard-branch-note { margin-top: 0; }
/* ...keeping Material's light/dark image switch, which the rule above would override */
[data-md-color-scheme="default"] .md-typeset img[src*="images/guide/"][src$="#only-dark"],
[data-md-color-scheme="slate"] .md-typeset img[src*="images/guide/"][src$="#only-light"] {
  display: none;
}
