/* Fonts: Noto Sans (text) and Source Code Pro (code) come from the theme
   (mkdocs.yml). The Traditional Chinese pages add Noto Sans TC after Noto Sans,
   so Latin text keeps Noto Sans and only the CJK glyphs come from Noto Sans TC.
   Google serves the font in unicode-range slices, so pages without Chinese
   text download none of it. */
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;700&display=swap");

:root { --pyhisto-code: "Source Code Pro", SFMono-Regular, Consolas, Menlo, monospace; }
[lang^="zh"] {
  --md-text-font-family: "Noto Sans", "Noto Sans TC", -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;
  --md-code-font-family: var(--pyhisto-code), "Noto Sans TC";
}

/* -- colours: Oxford-Zeiss CoE palette, as the Wavu guide (light theme only)
   Header and footer are Oxford blue (no Material purple). */
:root > * {
  --md-primary-fg-color: #002147;          /* Oxford blue: top bar */
  --md-primary-fg-color--light: #1d4f8c;
  --md-primary-fg-color--dark: #00152e;
  --md-primary-bg-color: #ffffff;           /* text/icons on the top bar */
  --md-accent-fg-color: #ef6c00;            /* orange accent */
  --md-accent-fg-color--transparent: #ef6c001a;
  --md-footer-bg-color: #002147;            /* bottom bar = top bar */
  --md-footer-bg-color--dark: #002147;
}
:root > * { --md-typeset-a-color: #1d5fae; --md-default-bg-color: #fbfcfe; }   /* links + page bg as Wavu */
/* Active/hover tab underline and nav highlights use the accent, not purple. */
.md-tabs { background-color: var(--md-primary-fg-color); }

/* -- logo + title ------------------------------------------------------- */
.md-header__title { font-weight: 700; }

/* -- diagrams: readable Mermaid labels ------------------------------------
   Material draws labels in a light grey, too faint on the pale classDef fills.
   Dark slate text, white label boxes, darker lines: WCAG AA (as Wavu). */
:root > * {
  --md-mermaid-label-fg-color: #263238;
  --md-mermaid-label-bg-color: #ffffff;
  --md-mermaid-edge-color: #37474f;
  --md-mermaid-node-fg-color: #263238;
}

/* -- footer: one row = previous | logos + licence | next (Wavu layout) -- */
.md-footer .md-footer__inner.ph-footer-row {
  box-sizing: border-box; width: 100%; display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center; gap: 1.2rem; padding: .8rem .8rem;
}
.ph-footer-side { display: flex; min-width: 0; }
.ph-footer-side--next { justify-content: flex-end; }
.ph-footer-row .md-footer__link { padding-top: .4rem; padding-bottom: .4rem; }
.ph-footer-center { text-align: center; color: var(--md-footer-fg-color--light); font-size: .64rem; }
.ph-footer-center a { color: var(--md-footer-fg-color); }
.ph-logos { display: flex; justify-content: center; align-items: center; gap: 1.4rem; margin-bottom: .45rem; }
.ph-logos img { height: 2rem; width: auto; display: block; opacity: .95; }
.ph-logos a:hover img { opacity: 1; }
.ph-credits { white-space: normal; line-height: 1.5; }
.ph-dot { margin: 0 .4em; }
@media screen and (max-width: 59.9375em) {
  .md-footer .md-footer__inner.ph-footer-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .6rem; }
  .md-footer .ph-footer-side { overflow: hidden; }
  .md-footer .ph-footer-center { grid-column: 1 / -1; order: 3; }
  .md-footer .ph-logos { flex-wrap: wrap; gap: .9rem; }
  .md-footer .ph-logos img { height: 1.6rem; }
}
.md-content .md-typeset .mermaid { text-align: center; }

/* -- top tabs: dropdown menus (guide_overrides/partials/tabs-item.html) ---
   Shown on hover and on keyboard focus (:focus-within).  Material clips the
   tab bar (overflow:auto, contain:content); from 76.25em (where tabs are
   shown at all) the bar is made overflow-visible so the panel is not cut off.
   White panel, Oxford-blue text (#002147 on #fff: 16:1, WCAG AAA). */
@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: #ffffff; color: #002147; border-radius: .4rem;
    border: 1px solid #00214726;
    box-shadow: 0 .2rem .5rem #0000001f, 0 .6rem 1.4rem #00214726;
    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__link {
    display: block; padding: .3rem .9rem; color: #002147; 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: #e8eef7; color: #002147; outline: none;
  }
  .ph-tabs-dropdown__link:focus-visible { box-shadow: inset 3px 0 0 var(--md-accent-fg-color); }
  .ph-tabs-dropdown__link--active { font-weight: 700; box-shadow: inset 3px 0 0 #1d5fae; }
  .ph-tabs-dropdown__heading {
    display: block; padding: .45rem .9rem .15rem; font-weight: 700; color: #4a5a70;
    font-size: .6rem; text-transform: uppercase; letter-spacing: .04em;
  }
  .ph-tabs-dropdown__item--section + .ph-tabs-dropdown__item,
  .ph-tabs-dropdown__item + .ph-tabs-dropdown__item--section { border-top: 1px solid #0021471a; margin-top: .2rem; }
}
@media screen and (max-width: 76.2344em) {
  .ph-tabs-dropdown { display: none; }
}

/* -- logo: the layers icon, big enough to read (as Wavu) ----------------- */
.md-header__button.md-logo { padding: .2rem; margin: .1rem .4rem; }
.md-header__button.md-logo img, .md-header__button.md-logo svg {
  height: 2.2rem; width: auto; border-radius: .45rem; box-shadow: 0 1px 3px #0003;
}

/* -- side-by-side: image left, table/text right (stacks on narrow screens) -- */
.md-typeset .ph-side { display: flex; gap: 1.2rem; align-items: center; margin: 1em 0; }
.md-typeset .ph-side__img { flex: 0 0 42%; }
.md-typeset .ph-side__img img { width: 100%; height: auto; margin: 0; }
.md-typeset .ph-side__body { flex: 1 1 auto; min-width: 0; }
.md-typeset .ph-side__body table:not([class]) { font-size: .7rem; }
@media screen and (max-width: 59.9375em) {
  .md-typeset .ph-side { flex-direction: column; align-items: stretch; }
  .md-typeset .ph-side__img { flex-basis: auto; }
}
.md-typeset .ph-side--wide .ph-side__img { flex: 0 0 32%; }
.md-typeset .ph-side--wide .ph-side__body img { width: 100%; height: auto; margin: 0; }
.md-typeset .ph-caption { font-size: .68rem; color: var(--md-default-fg-color--light); margin-top: -.3em; }
