/* AMFP Enhanced guide: an industrial-Victorian look built from CSS alone (no game art).
   Two schemes (mkdocs.yml palette): "slate" = soot and brass (default), "default" = parchment.
   Fonts (Google Fonts): Cinzel for headings, Source Serif 4 for text, Source Code Pro for
   code, Noto Serif TC for Chinese (Google serves it in unicode-range slices, so pages without
   Chinese download none of it). */
@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=Noto+Serif+TC:wght@400;600;700&family=Source+Code+Pro:wght@400;600&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;1,8..60,400&display=swap");

:root {
  --md-text-font: "Source Serif 4";
  --md-code-font: "Source Code Pro";
  --amfp-display: "Cinzel", "Noto Serif TC", Georgia, serif;
  --amfp-radius: 3px;
}
[lang^="zh"] {
  /* Latin keeps Source Serif 4; only the Chinese glyphs come from Noto Serif TC. */
  --md-text-font: "Source Serif 4", "Noto Serif TC";
  --md-code-font: "Source Code Pro", "Noto Serif TC";
}

/* ---------------------------------------------------------------- soot and brass (dark) */
[data-md-color-scheme="slate"] {
  --amfp-bg: #14110d;
  --amfp-surface: #1c1813;
  --amfp-surface-2: #241f18;
  --amfp-ink: #d9cbb0;
  --amfp-ink-muted: #a8987a;
  --amfp-brass: #c9a25c;
  --amfp-brass-dim: #8c6d3a;
  --amfp-rust: #c0603a;
  --amfp-verdigris: #6f9e8c;
  --amfp-rule: #3a3125;

  --md-hue: 35;
  --md-default-bg-color: var(--amfp-bg);
  --md-default-bg-color--light: #14110dcc;
  --md-default-bg-color--lighter: #14110d99;
  --md-default-bg-color--lightest: #14110d33;
  --md-default-fg-color: var(--amfp-ink);
  --md-default-fg-color--light: #d9cbb0b3;
  --md-default-fg-color--lighter: #d9cbb066;
  --md-default-fg-color--lightest: #d9cbb01f;
  --md-typeset-color: var(--amfp-ink);
  --md-typeset-a-color: #d8b06c;
  --md-code-bg-color: #1f1a14;
  --md-code-fg-color: #e4d6bb;
  --md-code-hl-color: #c9a25c33;
  --md-typeset-mark-color: #c9a25c40;
  --md-typeset-table-color: #d9cbb01f;
  --md-typeset-table-color--light: #d9cbb00d;
  --md-footer-bg-color: #0f0d0a;
  --md-footer-bg-color--dark: #0b0907;
  --md-shadow-z1: 0 .2rem .5rem #0006;
  --md-shadow-z2: 0 .2rem .5rem #0008;
}
[data-md-color-scheme="slate"][data-md-color-primary="custom"] {
  --md-primary-fg-color: #1a1611;
  --md-primary-fg-color--light: #2a231a;
  --md-primary-fg-color--dark: #0f0d0a;
  --md-primary-bg-color: #e8dcc2;
  --md-primary-bg-color--light: #e8dcc2b3;
}
[data-md-color-scheme="slate"][data-md-color-accent="custom"] {
  --md-accent-fg-color: #e0b56a;
  --md-accent-fg-color--transparent: #e0b56a1a;
  --md-accent-bg-color: #14110d;
}
/* A faint vignette, as from a lamp in a dark room. */
[data-md-color-scheme="slate"] body {
  background:
    radial-gradient(ellipse at 50% 0%, #2a2219 0%, transparent 60%),
    radial-gradient(ellipse at 50% 120%, #000 0%, transparent 55%),
    var(--amfp-bg);
  background-attachment: fixed;
}

/* ------------------------------------------------------------------- parchment (light) */
[data-md-color-scheme="default"] {
  --amfp-bg: #f2e9d6;
  --amfp-surface: #eadfc7;
  --amfp-surface-2: #e2d4b6;
  --amfp-ink: #2b2118;
  --amfp-ink-muted: #6b5a45;
  --amfp-brass: #8a5f22;
  --amfp-brass-dim: #b08a50;
  --amfp-rust: #9a3d22;
  --amfp-verdigris: #3f6f5f;
  --amfp-rule: #cdb88f;

  --md-default-bg-color: var(--amfp-bg);
  --md-default-fg-color: var(--amfp-ink);
  --md-default-fg-color--light: #2b2118b3;
  --md-default-fg-color--lighter: #2b211866;
  --md-default-fg-color--lightest: #2b21181f;
  --md-typeset-color: var(--amfp-ink);
  --md-typeset-a-color: #7a4a14;
  --md-code-bg-color: #e8dcc1;
  --md-code-fg-color: #2b2118;
  --md-code-hl-color: #8a5f2233;
  --md-typeset-mark-color: #c9a25c55;
  --md-typeset-table-color: #2b21181f;
  --md-footer-bg-color: #2a2219;
  --md-footer-bg-color--dark: #1d1812;
}
[data-md-color-scheme="default"][data-md-color-primary="custom"] {
  --md-primary-fg-color: #2a2219;
  --md-primary-fg-color--light: #3b3024;
  --md-primary-fg-color--dark: #1d1812;
  --md-primary-bg-color: #f2e9d6;
  --md-primary-bg-color--light: #f2e9d6b3;
}
[data-md-color-scheme="default"][data-md-color-accent="custom"] {
  --md-accent-fg-color: #9a3d22;
  --md-accent-fg-color--transparent: #9a3d221a;
  --md-accent-bg-color: #f2e9d6;
}
[data-md-color-scheme="default"] body {
  background:
    radial-gradient(ellipse at 50% 0%, #fbf5e8 0%, transparent 55%),
    radial-gradient(ellipse at 50% 120%, #d9c7a2 0%, transparent 60%),
    var(--amfp-bg);
  background-attachment: fixed;
}

/* ------------------------------------------------------------------------ header, tabs */
.md-header {
  border-bottom: 1px solid var(--amfp-brass-dim);
  box-shadow: 0 1px 0 #0000, 0 3px 0 -1px var(--amfp-rule);
}
.md-header__topic:first-child, .md-header__title {
  font-family: var(--amfp-display);
  letter-spacing: .08em;
  font-weight: 600;
}
/* The site name is a link to the home page of the current language (guide_overrides/partials/header.html). */
.md-header__home { color: inherit; text-decoration: none; }
.md-header__home:hover, .md-header__home:focus-visible { color: var(--md-accent-fg-color); }
.md-tabs {
  background-color: var(--md-primary-fg-color);
  border-bottom: 1px solid var(--amfp-rule);
}
.md-tabs__link { font-family: var(--amfp-display); letter-spacing: .06em; font-size: .68rem; }
.md-tabs__link--active, .md-tabs__link:hover { color: var(--amfp-brass); }
[data-md-color-scheme="default"] .md-tabs__link--active,
[data-md-color-scheme="default"] .md-tabs__link:hover { color: #e0b56a; }
.md-nav__title { font-family: var(--amfp-display); letter-spacing: .04em; }

/* ---------------------------------------------------------------------------- type */
.md-typeset { font-size: .86rem; line-height: 1.7; }
[lang^="zh"] .md-typeset { line-height: 1.85; }
.md-typeset h1, .md-typeset h2, .md-typeset h3 {
  font-family: var(--amfp-display);
  color: var(--amfp-ink);
  letter-spacing: .04em;
}
.md-typeset h1 { font-weight: 600; font-size: 1.85em; margin-bottom: .9em; }
.md-typeset h2 {
  font-weight: 600;
  padding-bottom: .3em;
  /* an engraved rule with a rivet at each end */
  background:
    radial-gradient(circle, var(--amfp-brass-dim) 0 2.5px, transparent 3px) left bottom / 7px 7px no-repeat,
    radial-gradient(circle, var(--amfp-brass-dim) 0 2.5px, transparent 3px) right bottom / 7px 7px no-repeat,
    linear-gradient(var(--amfp-rule), var(--amfp-rule)) center calc(100% - 3px) / calc(100% - 16px) 1px no-repeat;
}
.md-typeset h3 { font-weight: 500; font-size: 1.12em; }
[lang^="zh"] .md-typeset h1, [lang^="zh"] .md-typeset h2, [lang^="zh"] .md-typeset h3 { letter-spacing: .02em; }
.md-typeset a { text-decoration: underline; text-decoration-color: var(--amfp-brass-dim); text-underline-offset: .18em; }
.md-typeset a:hover { text-decoration-color: currentColor; }
.md-typeset .headerlink, .md-typeset .md-button { text-decoration: none; }
.md-typeset blockquote { border-left-color: var(--amfp-brass-dim); color: var(--amfp-ink-muted); font-style: italic; }
.md-typeset hr { border-bottom-color: var(--amfp-rule); }
.md-typeset kbd {
  font-family: var(--md-code-font-family);
  background: var(--amfp-surface-2);
  color: var(--amfp-ink);
  box-shadow: 0 2px 0 var(--amfp-rule), 0 0 0 1px var(--amfp-rule) inset;
}
.md-typeset table:not([class]) { border: 1px solid var(--amfp-rule); border-radius: var(--amfp-radius); font-size: .8rem; }
.md-typeset table:not([class]) th { background: var(--amfp-surface); color: var(--amfp-ink); font-family: var(--md-text-font-family); }

/* A quiet lead paragraph and the "unofficial" plate on the home page. */
.md-typeset .amfp-lead { font-size: 1.12em; color: var(--amfp-ink-muted); font-style: italic; }
[lang^="zh"] .md-typeset .amfp-lead { font-style: normal; }
.md-typeset .amfp-plate {
  border: 1px solid var(--amfp-brass-dim);
  outline: 1px solid var(--amfp-rule);
  outline-offset: 3px;
  border-radius: var(--amfp-radius);
  background: var(--amfp-surface);
  padding: .8em 1.1em;
  margin: 1.6em 0;
  font-size: .92em;
}
.md-typeset .amfp-plate > :first-child { margin-top: 0; }
.md-typeset .amfp-plate > :last-child { margin-bottom: 0; }

/* The home page banner (guide/assets/img/hero.webp): our own render of the game's pig mask
   model (tools: Blender, no cover art or logos), the same in both schemes. The page heading
   stays for screen readers. */
.md-typeset .amfp-hero { margin: 0 0 1.4em; }
.md-typeset .amfp-hero p { margin: 0; }
.md-typeset .amfp-hero img { display: block; width: 100%; max-width: 100%; height: auto; border-radius: var(--amfp-radius); }
.md-typeset .amfp-visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Buttons: brass plates. */
.md-typeset .md-button {
  font-family: var(--amfp-display);
  letter-spacing: .06em;
  color: var(--amfp-brass);
  border-color: var(--amfp-brass-dim);
  border-radius: var(--amfp-radius);
}
.md-typeset .md-button--primary, .md-typeset .md-button:hover {
  background: var(--amfp-brass);
  border-color: var(--amfp-brass);
  color: var(--amfp-bg);
}

/* Admonitions in the palette: note brass, tip verdigris, warning rust. */
.md-typeset .admonition, .md-typeset details {
  border-width: 0 0 0 3px;
  border-radius: var(--amfp-radius);
  background: var(--amfp-surface);
  box-shadow: none;
  font-size: .82rem;
}
.md-typeset .admonition.note, .md-typeset details.note,
.md-typeset .admonition.info, .md-typeset details.info { border-color: var(--amfp-brass); }
.md-typeset .note > .admonition-title, .md-typeset .note > summary,
.md-typeset .info > .admonition-title, .md-typeset .info > summary { background: color-mix(in srgb, var(--amfp-brass) 14%, transparent); }
.md-typeset .note > .admonition-title::before, .md-typeset .note > summary::before,
.md-typeset .info > .admonition-title::before, .md-typeset .info > summary::before { background-color: var(--amfp-brass); }
.md-typeset .admonition.tip, .md-typeset details.tip { border-color: var(--amfp-verdigris); }
.md-typeset .tip > .admonition-title, .md-typeset .tip > summary { background: color-mix(in srgb, var(--amfp-verdigris) 14%, transparent); }
.md-typeset .tip > .admonition-title::before, .md-typeset .tip > summary::before { background-color: var(--amfp-verdigris); }
.md-typeset .admonition.warning, .md-typeset details.warning { border-color: var(--amfp-rust); }
.md-typeset .warning > .admonition-title, .md-typeset .warning > summary { background: color-mix(in srgb, var(--amfp-rust) 14%, transparent); }
.md-typeset .warning > .admonition-title::before, .md-typeset .warning > summary::before { background-color: var(--amfp-rust); }

/* ------------------------------------------------------------------------- figures */
.md-typeset .amfp-figure { display: block; width: 100%; max-width: 100%; margin: 1.6em 0; }
.md-typeset .amfp-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--amfp-rule);
  border-radius: var(--amfp-radius);
  background: #000;
}
.md-typeset .amfp-figure figcaption {
  max-width: none;
  margin: .6em 0 0;
  color: var(--amfp-ink-muted);
  font-size: .8rem;
  font-style: italic;
  text-align: left;
}
[lang^="zh"] .md-typeset .amfp-figure figcaption { font-style: normal; }
/* Captions over the bottom of a screenshot (single shots and the live slider). */
.md-typeset .amfp-figure--overlay,
.md-typeset .amfp-figure.amfp-compare--live { position: relative; }
/* A pair whose subject is at the bottom (the loading label) keeps its caption below. */
.md-typeset .amfp-compare--caption-below.amfp-compare--live > figcaption {
  position: static;
  padding: .6em .2em 0;
  background: none;
  color: var(--md-default-fg-color--light);
  text-shadow: none;
}
.md-typeset .amfp-figure--overlay > figcaption,
.md-typeset .amfp-compare--live > figcaption {
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: 1px;
  margin: 0;
  padding: 2.2em .9em .6em;
  border-radius: 0 0 var(--amfp-radius) var(--amfp-radius);
  background: linear-gradient(to top, #0a0806e6 0%, #0a0806b3 55%, transparent 100%);
  color: #eadfca;
  text-shadow: 0 1px 2px #000;
  pointer-events: none; /* the slider stays draggable under it */
}

/* A shot that is not captured yet: a marked box, never a stand-in picture. */
.md-typeset .amfp-placeholder {
  aspect-ratio: 16 / 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .4em;
  border: 1px dashed var(--amfp-brass-dim);
  border-radius: var(--amfp-radius);
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, color-mix(in srgb, var(--amfp-brass) 7%, transparent) 14px 15px),
    var(--amfp-surface);
  color: var(--amfp-ink-muted);
  text-align: center;
  padding: 1em;
}
.md-typeset .amfp-placeholder__tag { font-family: var(--amfp-display); letter-spacing: .08em; color: var(--amfp-brass); font-size: .95em; }
.md-typeset .amfp-placeholder__id { font-family: var(--md-code-font-family); font-size: .75em; opacity: .75; }

/* Before / after: side by side without JavaScript (stacked on phones). */
.md-typeset .amfp-figure.amfp-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5em;
}
.md-typeset .amfp-compare > figcaption { grid-column: 1 / -1; }
.md-typeset .amfp-compare__label {
  font-family: var(--amfp-display);
  font-size: .7rem;
  letter-spacing: .08em;
  color: var(--amfp-brass);
}
.md-typeset .amfp-compare:not(.amfp-compare--live) .amfp-compare__label--before { grid-row: 2; grid-column: 1; }
.md-typeset .amfp-compare:not(.amfp-compare--live) .amfp-compare__label--after { grid-row: 2; grid-column: 2; }
@media screen and (max-width: 44.9375em) {
  .md-typeset .amfp-compare:not(.amfp-compare--live) { grid-template-columns: 1fr; }
  .md-typeset .amfp-compare:not(.amfp-compare--live) .amfp-compare__label { grid-row: auto; grid-column: auto; }
}

/* With JavaScript (compare.js): one frame, the "after" side clipped at the divider. */
.md-typeset .amfp-figure.amfp-compare--live { display: block; }
.md-typeset .amfp-compare__stage {
  --pos: 50%;
  position: relative;
  overflow: hidden;
  border-radius: var(--amfp-radius);
  user-select: none;
  -webkit-user-select: none;
}
.md-typeset .amfp-compare__stage img { margin: 0; }
.md-typeset .amfp-compare__stage .amfp-compare__after {
  position: absolute;
  inset: 0;
  height: 100%;
  object-fit: cover;
  clip-path: inset(0 0 0 var(--pos));
}
.md-typeset .amfp-compare__stage .amfp-compare__label {
  position: absolute;
  top: .5em;
  padding: .15em .55em;
  border-radius: var(--amfp-radius);
  background: #14110dcc;
  color: #e0c48c;
  pointer-events: none;
}
.md-typeset .amfp-compare__stage .amfp-compare__label--before { left: .5em; }
.md-typeset .amfp-compare__stage .amfp-compare__label--after { right: .5em; }
.md-typeset .amfp-compare__divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 2px;
  margin-left: -1px;
  background: #e0b56a;
  box-shadow: 0 0 0 1px #14110d99;
  pointer-events: none;
}
.md-typeset .amfp-compare__divider::after {
  /* the handle: a brass rivet */
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.6rem;
  height: 1.6rem;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f0d39a, #a37a3a 60%, #5c4320);
  box-shadow: 0 0 0 2px #14110d, 0 2px 6px #000a;
}
.md-typeset .amfp-compare__range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  touch-action: pan-y;
}
.md-typeset .amfp-compare__range:focus-visible + * { outline: none; }
.md-typeset .amfp-compare__stage:has(.amfp-compare__range:focus-visible) {
  outline: 2px solid var(--md-accent-fg-color);
  outline-offset: 2px;
}

/* API pages (mkdocstrings): headings in the text face, not the display face. */
.md-typeset .doc-heading, .md-typeset .doc-heading code { font-family: var(--md-code-font-family); letter-spacing: 0; }
.md-typeset h2.doc-heading { background: none; }

/* Footer */
.md-footer-meta { border-top: 1px solid var(--amfp-rule); }
.md-copyright { font-size: .62rem; }

/* ------------------------------------------------------------- top tabs: dropdown menus
   guide_overrides/partials/tabs-item.html (as in pyHisto). Shown on hover and on keyboard
   focus. Material clips the tab bar (overflow:auto, contain:content); where tabs are shown
   (76.25em and wider) the bar is made overflow-visible so the panel is not cut off. Colours
   come from the theme, so the soot and parchment schemes both work. */
@media screen and (min-width: 76.25em) {
  .md-tabs, .md-tabs__list { overflow: visible; contain: none; }
  .md-tabs__item.ph-tabs-item--dropdown { position: relative; }
  .ph-tabs-dropdown {
    display: none; position: absolute; top: 100%; left: 0; z-index: 10;
    min-width: 13rem; max-width: 22rem; max-height: calc(100vh - 6rem); overflow-y: auto;
    margin: 0; padding: .4rem 0; list-style: none; white-space: normal;
    background: var(--amfp-surface); color: var(--amfp-ink);
    border: 1px solid var(--amfp-rule); border-radius: var(--amfp-radius);
    box-shadow: 0 .2rem .5rem #0000002e, 0 .6rem 1.4rem #00000040;
    font-size: .68rem; line-height: 1.35;
  }
  .ph-tabs-item--dropdown:hover > .ph-tabs-dropdown,
  .ph-tabs-item--dropdown:focus-within > .ph-tabs-dropdown { display: block; }
  .md-tabs[hidden] .ph-tabs-dropdown { display: none !important; }
  .ph-tabs-dropdown__sublist { margin: 0; padding: 0; list-style: none; }
  .ph-tabs-dropdown__heading {
    display: block; padding: .45rem .9rem .2rem; color: var(--amfp-brass);
    font-family: var(--amfp-display); letter-spacing: .06em; font-size: .62rem; text-transform: uppercase;
  }
  .ph-tabs-dropdown__link {
    display: block; padding: .3rem .9rem; color: var(--amfp-ink); text-decoration: none;
  }
  .ph-tabs-dropdown__sublist .ph-tabs-dropdown__link { padding-left: 1.5rem; }
  .ph-tabs-dropdown__link:hover, .ph-tabs-dropdown__link:focus-visible {
    background: color-mix(in srgb, var(--amfp-brass) 16%, transparent); color: var(--amfp-ink); outline: none;
  }
  .ph-tabs-dropdown__link:focus-visible { box-shadow: inset 3px 0 0 var(--amfp-brass); }
  .ph-tabs-dropdown__link--active { font-weight: 700; box-shadow: inset 3px 0 0 var(--amfp-brass); }
}
