/* ---------------------------------------------------------------------------
   Custom color palette for Material for MkDocs.
   See https://squidfunk.github.io/mkdocs-material/setup/changing-the-colors/

   Both schemes are tuned to be easier on the eyes than the defaults:

   - "default" (light): warm off-white background instead of pure white, a
     warm amber accent, and a header that matches the content area so it
     doesn't visually distract from the page. Body links use a muted teal
     via `--md-typeset-a-color`.
    - "slate" (dark): a slightly warmer hue, a softer near-black background,
     the same warm amber accent, and a header that blends into the page.

   Material uses CSS variables for its colors, so we override the built-in
   schemes here rather than picking a fully custom scheme name. That keeps
   every default that we do not explicitly change.
   --------------------------------------------------------------------------- */

/* ---- Light mode ------------------------------------------------------- */
[data-md-color-scheme="default"] {
  /* Default surfaces – warm paper, not pure white. */
  --md-default-fg-color: #2b2b2b;
  --md-default-fg-color--light: #5a5a5a;
  --md-default-fg-color--lighter: #8a8a8a;
  --md-default-fg-color--lightest: #b0b0b0;
  --md-default-bg-color: #faf7f1;

  /* Primary – matches the page background so the header blends into the
     content area instead of being a distinct colored band. The --dark and
     --light variants are subtle bg-tones for header hover states. */
  --md-primary-fg-color: #faf7f1;
  --md-primary-fg-color--light: #f5efe2;
  --md-primary-fg-color--dark: #ece6d8;
  /* Header text/icons – page foreground so they read on the page bg. */
  --md-primary-bg-color: #2b2b2b;

  /* Accent – warm amber for links and hover states. */
  --md-accent-fg-color: #b8741a;

  /* Code blocks – surface recessed a touch below the page. */
  --md-code-fg-color: #2b2b2b;
  --md-code-bg-color: #f1ede4;

  /* Body links follow the primary color so they sit quietly in prose. */
  --md-typeset-a-color: #2f6f7e;
}

/* ---- Dark mode -------------------------------------------------------- */
[data-md-color-scheme="slate"] {
  /* Slightly warmer hue than default slate (232) for a friendlier dark. */
  --md-hue: 220;

  /* Default surfaces – soft near-black, not pure black. */
  --md-default-fg-color: #e6e6e6;
  --md-default-fg-color--light: #a8a8a8;
  --md-default-fg-color--lighter: #767676;
  --md-default-fg-color--lightest: #444;
  --md-default-bg-color: #1c1d22;

  /* Primary – matches the page background so the header blends into the
     content area. The variants are subtle bg-tones for header hover. */
  --md-primary-fg-color: #1c1d22;
  --md-primary-fg-color--light: #25272d;
  --md-primary-fg-color--dark: #2e3138;
  /* Header text/icons – page foreground. */
  --md-primary-bg-color: #e6e6e6;

  /* Accent – warm amber, matching the light mode. */
  --md-accent-fg-color: #d4a05a;

  /* Code blocks – barely recessed surface. */
  --md-code-fg-color: #e6e6e6;
  --md-code-bg-color: #262830;

  /* Body links follow the primary color. */
  --md-typeset-a-color: #9db8d8;
}

/* Audit reports use the existing theme colors and retain text status labels. */
.md-typeset .audit-finding {
  border-inline-start: 0.2rem solid var(--md-typeset-a-color);
  padding: 0.1rem 0 0.1rem 1rem;
  margin-bottom: 1.5rem;
}

.md-typeset .audit-illustration {
  margin: 1.2rem 0;
  text-align: start;
}

.md-typeset .audit-illustration img {
  display: block;
  max-height: 32rem;
  width: auto;
  max-width: 100%;
  border: 1px solid var(--md-default-fg-color--light);
}

.md-typeset .audit-illustration figcaption {
  max-width: 65ch;
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  font-style: normal;
  color: var(--md-default-fg-color);
}

@media print {
  .md-typeset .audit-finding {
    border: 0;
    padding: 0;
  }
}

/* Native table semantics plus a named keyboard-scrollable region on narrow screens. */
.md-typeset .audit-table-scroll {
  overflow-x: auto;
  margin-block: 1rem;
}

.md-typeset .audit-table-scroll:focus-visible {
  outline: 2px solid var(--md-typeset-a-color);
  outline-offset: 2px;
}

.md-typeset .audit-table-scroll caption {
  text-align: start;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--md-default-fg-color);
}

.md-typeset .audit-table-scroll tbody th {
  font-weight: 400;
  background: transparent;
  color: var(--md-default-fg-color);
}

/* Material adds its own wrappers; keep one scroll owner for keyboard users. */
.md-typeset .audit-table-scroll .md-typeset__scrollwrap {
  overflow: visible;
  margin: 0;
}

.md-typeset .audit-table-scroll .md-typeset__table {
  display: block;
  padding: 0;
  margin: 0;
}

.md-typeset .audit-table-scroll table:not([class]) {
  display: table;
  overflow: visible;
}

/* Keep a dismissed Material tooltip hidden while its trigger still has focus. */
.md-tooltip[data-audit-dismissed],
.md-tooltip2[data-audit-dismissed] {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none;
}

/* Material's tooltip hover tracking needs a hit-testable inner panel. */
body:has(.audit-guideline) .md-tooltip2[role="tooltip"] .md-tooltip2__inner {
  pointer-events: auto;
}

body:has(.audit-guideline)
  .md-tooltip2[data-audit-dismissed]
  .md-tooltip2__inner {
  pointer-events: none;
}
