:root,
[data-md-color-scheme="default"],
[data-md-color-scheme="slate"] {
  --md-primary-fg-color: #1F40C8;
  --md-primary-fg-color--light: #8F9FE3;
  --md-primary-fg-color--dark: #1834A0;
  --md-primary-bg-color: #FFFFFF;
  --md-primary-bg-color--light: #ffffffb3;
  --md-accent-fg-color: #1F40C8;
  --md-accent-fg-color--transparent: #1F40C81a;
  --md-accent-bg-color: #FFFFFF;
  --md-accent-bg-color--light: #ffffffb3;
  --md-typeset-a-color: #1F40C8;
  --md-typeset-mark-color: #1F40C84d; /* search.highlight */
  /* Match language md-select caret (.md-select__inner:after uses .2rem). */
  --md-tooltip-tail: 0.2rem;
}

/*
 * Title tooltips (palette + PDF via content.tooltips) should match the
 * language selector dropdown: .md-select__list is .8rem / normal weight.
 * Keep role=dialog content tooltips on Material defaults.
 */
[role="tooltip"] > .md-tooltip2__inner {
  font-size: 0.8rem;
  font-weight: 400;
  padding: 0.2rem 0.6rem;
}

.md-tooltip--inline .md-tooltip__inner,
.md-tooltip__inner {
  font-size: 0.8rem;
  font-weight: 400;
}

/*
 * .md-tooltip has no built-in caret; md-tooltip2 tails only show with
 * --top/--bottom. Mirror .md-select__inner:after so palette/PDF tips
 * point at their icon like the language dropdown.
 */
.md-tooltip::after,
.md-tooltip2[role="tooltip"]::after {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 1;
  width: 0;
  height: 0;
  margin-top: -0.2rem;
  margin-left: -0.2rem;
  content: "";
  border: 0.2rem solid transparent;
  border-top: 0;
  border-bottom-color: var(--md-default-bg-color);
}

/* Avoid a second Material host-x caret on short title tips. */
.md-tooltip2[role="tooltip"]::before {
  content: none;
}

/* mkdocs-to-pdf injects a legacy class; match Material header button spacing. */
.md-header a.md-header-nav__button.md-icon {
  margin: 0.2rem;
  padding: 0.4rem;
}

/*
 * Desired header order (right side): mode, language, PDF, search.
 * PDF control is in overrides/partials/header.html (locale-aware href).
 * Flex order keeps PDF before search. Icon: white chrome, red PDF label.
 * Use .guide-pdf (not title=) so content.tooltips can rewrite title on hover.
 */
.md-header__inner > a.guide-pdf {
  order: 9;
  color: var(--md-primary-bg-color);
}

/* Material sets fill on .md-icon svg; keep the red label + white letters. */
.md-header__inner > a.guide-pdf svg path[fill="#F15642"] {
  fill: #F15642 !important;
}

.md-header__inner > a.guide-pdf svg g[fill="#fff"] path {
  fill: #fff !important;
}

.md-header__inner > label[for="__search"],
.md-header__inner > .md-search {
  order: 10;
}

/* Website: play the video; hide the PDF-only caption box. */
.guide-video-fallback,
.guide-video-fallback[hidden] {
  display: none !important;
}

/* PDF / print: WeasyPrint cannot play video — show a caption box instead. */
@media print {
  .guide-video video {
    display: none !important;
  }

  .guide-video-fallback,
  .guide-video-fallback[hidden] {
    display: block !important;
    margin: 0.75rem 0;
    padding: 0.75rem 1rem;
    border: 1px solid #8F9FE3;
    border-radius: 0.25rem;
    background: #f7f8fc;
  }
}
