/**
 * Ledger theme — System 52 SRD
 *
 * Black, white, and grey "pen and paper ledger" styling. The Rogue
 * Frontier site keeps its dark, flashy look; the SRD reads like the
 * account book of the engine: paper background, ink type, hairline
 * rules, and the accountant's double rule closing each page title.
 *
 * Enabled via extra_css in srd/mkdocs.yml.
 */

:root {
  --ledger-paper: #fcfcfb;
  --ledger-shade: #f1f1ef;
  --ledger-ink: #1a1a1a;
  --ledger-ink-soft: #595959;
  --ledger-grey: #6f6f6c;
  --ledger-rule: #cfcfcc;
}

/* Type roles: IBM Plex Sans headings, Serif body, Mono for data.
   Faces are declared in fonts.css (loaded first). */
:root {
  --md-text-font: "IBM Plex Serif";
  --md-code-font: "IBM Plex Mono";
}

.md-typeset {
  font-family: "IBM Plex Serif", Georgia, serif;
}

.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4,
.md-typeset h5,
.md-typeset h6 {
  font-family: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
}

[data-md-color-scheme="default"] {
  --md-default-bg-color: var(--ledger-paper);
  --md-default-fg-color: var(--ledger-ink);
  --md-default-fg-color--light: #454545;
  --md-default-fg-color--lighter: var(--ledger-ink-soft);
  --md-default-fg-color--lightest: #8a8a87;
  --md-accent-fg-color: var(--ledger-ink);
  --md-accent-fg-color--transparent: rgba(26, 26, 26, 0.06);
  --md-typeset-a-color: var(--ledger-ink);
  --md-code-bg-color: var(--ledger-shade);
  --md-code-fg-color: var(--ledger-ink);
  --md-footer-bg-color: var(--ledger-shade);
  --md-footer-bg-color--dark: var(--ledger-shade);
  --md-footer-fg-color: var(--ledger-ink);
  --md-footer-fg-color--light: var(--ledger-ink-soft);
  --md-footer-fg-color--lighter: #8a8a87;
}

/* Header: flat paper with a hairline rule, no shadow */
.md-header {
  background-color: var(--ledger-paper);
  color: var(--ledger-ink);
  border-bottom: 1px solid var(--ledger-rule);
  box-shadow: none;
}

/* Headings: the page title closes with a double rule, sections with a
   single ink rule — ledger totals and column heads */
.md-typeset h1 {
  color: var(--ledger-ink);
  font-weight: 600;
  padding-bottom: 0.3em;
  border-bottom: 4px double var(--ledger-ink);
}

.md-typeset h2 {
  color: var(--ledger-ink);
  font-size: 1.1em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--ledger-ink);
}

.md-typeset h3 {
  color: var(--ledger-ink);
  font-size: 1em;
  font-weight: 700;
}

/* Links: ink with a grey underline that darkens on hover */
.md-typeset a {
  text-decoration: underline;
  text-decoration-color: #a3a3a0;
  text-underline-offset: 0.2em;
}

.md-typeset a:hover,
.md-typeset a:focus {
  text-decoration-color: var(--ledger-ink);
}

.md-typeset a.headerlink {
  text-decoration: none;
}

/* Tables: ruled columns and rows, typed column heads */
.md-typeset table:not([class]) {
  border: 1px solid var(--ledger-rule);
  border-radius: 0;
  box-shadow: none;
  font-variant-numeric: tabular-nums;
}

.md-typeset table:not([class]) th {
  background-color: var(--ledger-shade);
  color: var(--ledger-ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.md-typeset table:not([class]) th + th,
.md-typeset table:not([class]) td + td {
  border-left: 1px solid var(--ledger-rule);
}

.md-typeset table:not([class]) td {
  border-top: 1px solid var(--ledger-rule);
}

/* Admonitions: no color coding — a double rule down the left edge.
   The [class] tie-breaker outranks Material's per-type color rules
   (e.g. .admonition.note) */
.md-typeset .admonition[class],
.md-typeset details[class] {
  background-color: var(--ledger-paper);
  border: 1px solid var(--ledger-rule);
  border-left: 5px double var(--ledger-ink);
  border-radius: 0;
  box-shadow: none;
}

.md-typeset .admonition > .admonition-title,
.md-typeset details > summary {
  background-color: var(--ledger-shade);
  color: var(--ledger-ink);
}

.md-typeset .admonition > .admonition-title::before,
.md-typeset details > summary::before {
  background-color: var(--ledger-ink);
}

/* Thematic break: a light double rule */
.md-typeset hr {
  border: none;
  border-bottom: 4px double var(--ledger-rule);
}

/* Left sidebar: the open page is the marked entry. Scoped to the primary
   sidebar so the right TOC's scroll tracker never bolds an entry */
.md-sidebar--primary .md-nav__link--active {
  font-weight: 700;
}

/* theme.logo (the solid "52" icon) is for the mobile drawer; on wide
   screens the header hides its logo slot and the wordmark title is the
   branding */
.md-header__button.md-logo {
  display: none;
}

/* Header title: show the wordmark in place of the "System 52 SRD" text.
   Paint it as a centered background on the site-name topic and hide the
   text (kept in the DOM for the tab and screen readers). Backgrounding
   the topic inherits Material's vertical centering, so the wordmark lines
   up with the hamburger. Only the first topic (site name) is replaced,
   not the page title Material swaps in on scroll. */
.md-header__title .md-header__topic:first-child {
  background: url("../brand-kit/system-52-wordmark-solid.svg") left center / auto 22px no-repeat;
}

.md-header__title .md-header__topic:first-child .md-ellipsis {
  visibility: hidden;
}

/* Index masthead: the wordmark as a restrained document letterhead,
   closed by the same double rule that underlines page titles */
.md-typeset p:has(> .srd-masthead) {
  margin: 0.8rem 0 0;
}

.md-typeset .srd-masthead {
  display: block;
  width: 100%;
  max-width: 340px;
  height: auto;
  margin: 0.4rem 0 1.4rem;
  padding-bottom: 1.4rem;
  border-bottom: 4px double var(--ledger-ink);
}

/* The masthead already names the engine; drop the redundant page title
   on the index while keeping it in the DOM for the sidebar and a11y.
   Markdown wraps the image in a <p>, so match that paragraph's sibling h1 */
.md-typeset p:has(> .srd-masthead) + h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* Branding page: preview the dark-background logo variants on ink. */
.md-typeset img.brand-on-dark {
  background: var(--ledger-ink);
  padding: 0.4rem;
}

/* Brand kit tables: center the name and links against the preview image */
.md-typeset table:has(img[src*="assets/brand-kit/"]) td {
  vertical-align: middle;
}
