/* Top tabs: bolden the active tab (the active class sits on the <li> item). */
.md-tabs__item--active .md-tabs__link {
  opacity: 1;
  font-weight: 700;
}

/* Header, announcement bar and tabs follow the colour scheme (light in light
   mode, dark in dark), matching the MATVIS dashboard, instead of the green
   primary. !important beats Material's .md-header{background:primary} rule. A
   hairline bottom border keeps the header separated from the content. */
.md-header,
.md-banner,
.md-tabs {
  background-color: var(--md-default-bg-color) !important;
  color: var(--md-typeset-color);
}
.md-header {
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
  box-shadow: none;
}
/* Light mode: warm the header and sidebars with a whisper of brand green so the
   page isn't all-white; the content column stays clean white so text pops. */
[data-md-color-scheme="default"] .md-header {
  background-color: var(--mx-surface) !important;
  border-bottom-color: color-mix(in srgb, var(--md-primary-fg-color) 20%, transparent);
}

/* Show the logo variant that stays legible on the current header background.
   The media query covers the initial OS-preference render; the attribute rules
   win once Material resolves the active scheme (including manual toggles).
   Light header -> dark-ink wordmark; dark header -> light wordmark. */
.md-logo-img {
  display: none;
  height: 1rem;
  width: auto;
}
/* Show a SINGLE wordmark that matches the active scheme, everywhere (header AND
   drawer): light -> dark-ink, dark -> white. The `!important` on the hide beats
   Material's `.md-nav__title .md-nav__button.md-logo img { display: block }`
   (specificity 0-4-1), which otherwise forced BOTH variants on in the mobile
   drawer, doubling the logo when the browser is narrow. */
[data-md-color-scheme="default"] .md-logo-img--for-light {
  display: inline-block;
}
[data-md-color-scheme="default"] .md-logo-img--for-dark {
  display: none !important;
}
[data-md-color-scheme="slate"] .md-logo-img--for-light {
  display: none !important;
}
[data-md-color-scheme="slate"] .md-logo-img--for-dark {
  display: inline-block;
}

/* Version selector: Material appends its native mike selector to the header
   title (far left). Hide it; our own selector (partials/version-select.html)
   sits next to the palette toggle instead. */
.md-header__title .md-version {
  display: none;
}
/* Keep our selector vertically centred in the header row, with a little air
   before the light/dark toggle. */
[data-md-component="matvis-version"]:not([hidden]) {
  display: flex;
  align-items: center;
  margin-left: 0.4rem;
}

/* --- Header controls polish (version pill, theme toggle, search) --- */

/* Version selector as plain text: the version, then the alias in Light Green, no pill. */
[data-md-component="matvis-version"] .md-version__current {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.4rem;
  border: none;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1;
  top: 0;
  opacity: 0.85;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}
[data-md-component="matvis-version"] .md-version__current:hover {
  opacity: 1;
  background-color: color-mix(in srgb, var(--md-default-fg-color) 6%, transparent);
}
/* The version menu: a small dropdown right below its button, aligned with it, items in the
   button's size. The transparent top border bridges the gap, so the menu stays open while the
   pointer moves down to it. */
[data-md-component="matvis-version"] {
  position: relative;
}
[data-md-component="matvis-version"] .md-version__list {
  top: 100%;
  left: auto;
  right: 0;
  width: max-content;
  min-width: 4rem;
  margin: 0;
  padding: 0.2rem 0;
  background-color: var(--md-default-bg-color);
  background-clip: padding-box;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-top: 0.25rem solid transparent;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}
[data-md-component="matvis-version"] .md-version__item {
  margin: 0;
}
[data-md-component="matvis-version"] .md-version__link {
  padding: 0.3rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

[data-md-component="matvis-version"] .md-version__alias {
  margin-left: 0.35rem;
  font-size: 0.7rem;
  font-weight: 500;
  opacity: 1;
  color: var(--md-primary-fg-color--light);
}
.md-header__button.md-icon:hover {
  background-color: color-mix(in srgb, var(--md-primary-fg-color) 10%, transparent);
  color: var(--md-primary-fg-color);
  opacity: 1;
}
/* Denser top bar: shrink the header icon buttons so the whole row is shorter,
   for a tighter, more app-like header rather than a tall airy one. */
.md-header__button.md-icon {
  /* Header icon buttons (theme toggle, search magnifier): rounded, with a soft
  accent hover, instead of the bare icon. */
  border-radius: 8px;
  transition: background-color 0.15s ease, color 0.15s ease;
  padding: 0.3rem;
  margin: 0.1rem;
}
.md-header__button.md-icon svg {
  width: 1.05rem;
  height: 1.05rem;
}

/* Search field: a bordered, rounded input that matches the version pill, with a
   brand accent when focused. */
.md-search__form {
  border-radius: 8px;
  border: 1px solid var(--md-default-fg-color--lightest);
  background-color: color-mix(in srgb, var(--md-default-fg-color--lightest) 45%, transparent);
  box-shadow: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.md-search__form:hover {
  background-color: color-mix(in srgb, var(--md-default-fg-color--lightest) 70%, transparent);
}
[data-md-toggle="search"]:checked ~ .md-header .md-search__form,
.md-search__form:focus-within {
  border-color: var(--md-primary-fg-color);
  background-color: var(--md-default-bg-color);
}
.md-search__input {
  border-radius: 8px;
}

/* Search field: rounded to match the brand shapes, brand focus ring. */
.md-search__form,
.md-search__input {
  border-radius: 8px;
  color: var(--md-default-fg-color);
}
/* The placeholder + search icon inherit a light header colour (white header in
   light mode), which reads white-on-white; force legible tones. */
.md-search__input::placeholder {
  color: var(--md-default-fg-color--light);
}
.md-search__icon,
.md-search__options .md-icon {
  color: var(--md-default-fg-color--light);
}
.md-search__icon svg,
.md-search__options .md-icon svg {
  fill: var(--md-default-fg-color--light);
}
/* Narrow the resting search on wide screens so the header row breathes; it
   still widens when focused. */
@media screen and (min-width: 76.25em) {
  .md-search__form {
    width: 11rem;
  }
  [data-md-toggle="search"]:checked ~ .md-header .md-search__form {
    width: 22rem;
  }
}

/* Centre the top navigation tabs (Home, Getting Started, Guides, ...). */
.md-tabs__list {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}
/* Tab hover: fade in a soft, muted MATVIS green pill behind the link, and back
   out when the pointer leaves. Translucent so it reads matte, not bright. */
.md-tabs__link {
  border-radius: 6px;
  padding: 0.1rem 0.4rem;
  transition: background-color 0.18s ease, opacity 0.18s ease;
}
.md-tabs__link:hover {
  background-color: color-mix(in srgb, var(--mx-muted) 24%, transparent);
  opacity: 1;
}

/* Single-row header: the top-nav tabs are rendered inline in the header row
   (overrides/partials/header.html) and shown only on wide screens; below the
   breakpoint they collapse into the drawer. */
.md-header__tabs {
  display: none;
}
@media screen and (min-width: 76.25em) {
  /* Material makes each item 2.4rem tall and top-aligns the link; centre it so
     the row lines up with the version selector / toggle / search. */
  .md-header__tabs .md-tabs__item {
    height: auto;
    display: flex;
    align-items: center;
  }
  .md-header__tabs .md-tabs__list {
    flex-wrap: nowrap;
    align-items: center;
    margin: 0;
    padding: 0;
    gap: 0.4rem;
  }
  .md-header__tabs .md-tabs__link {
    margin-top: 0;
    font-size: 0.62rem;
    opacity: 0.9;
    white-space: nowrap;
    font-size: 0.7rem;
  }
  /* The logo takes the free space, so version, theme and search sit at the right with or
     without the version selector. */
  .md-header__inner > .md-logo {
    margin-right: auto;
  }
  /* The current section in bold with a thin accent line under it, no fill; the pill is kept for
     the current page in the left navigation, so the two do not look the same. */
  .md-header__tabs .md-tabs__item--active .md-tabs__link {
    opacity: 1;
    font-weight: 700;
    color: var(--md-default-fg-color);
    background-color: transparent;
    border-radius: 0;
    box-shadow: inset 0 -2px 0 var(--md-primary-fg-color);
  }
  /* Hide the header title entirely on desktop: the logo already shows the brand,
     and the title holds an absolutely-positioned topic that was overlapping the
     first tab ("Home"). Removing it frees the space so the tabs sit clean after
     the logo. (On narrow screens the title still shows, below the breakpoint.) */
  .md-header__title {
    display: none;
  }
}

/* Footer surface (BOTH layouts): unified brand color so the standard two-band
   footer (non-home) shows no two-tone seam. A hairline top border separates it
   from the content. */
.md-footer,
.md-footer-meta {
  background-color: var(--mx-bg);
}
.md-footer {
  border-top: 1px solid color-mix(in srgb, var(--mx-muted) 22%, transparent);
}

/* Slim single-row footer, HOME ONLY (see overrides/partials/footer.html):
   copyright left, next link right, on one short row. All rules are scoped to
   `.md-footer__slim` so the standard stacked footer elsewhere is untouched. */
.md-footer__slim {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
  padding: 0.5rem 0.8rem;
}
.md-footer__slim .md-footer__copyright {
  flex: 1 1 16rem;
  min-width: 0;
}
.md-footer__slim .md-copyright {
  margin: 0;
  width: auto;
  font-size: 0.7rem;
  line-height: 1.4;
}
.md-footer__slim .md-footer__nav {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem 0.6rem;
}
.md-footer__slim .md-footer__link {
  width: auto;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  opacity: 0.9;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}
.md-footer__slim .md-footer__link:hover {
  opacity: 1;
  background-color: color-mix(in srgb, var(--mx-muted) 14%, transparent);
}
.md-footer__slim .md-footer__title {
  padding: 0;
  line-height: 1.2;
  max-width: none;
}
.md-footer__slim .md-footer__title .md-ellipsis {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}
.md-footer__slim .md-footer__button { margin: 0; }

/* Light mode: subtle light-green footer (both layouts) with dark text, so it
   blends with the warm-white page instead of dropping to near-black. */
[data-md-color-scheme="default"] .md-footer,
[data-md-color-scheme="default"] .md-footer-meta {
  background-color: var(--mx-surface);
  --md-footer-fg-color: var(--mx-bg);
  --md-footer-fg-color--light: color-mix(in srgb, var(--mx-bg) 72%, transparent);
  --md-footer-fg-color--lighter: color-mix(in srgb, var(--mx-bg) 45%, transparent);
}
[data-md-color-scheme="default"] .md-footer {
  border-top-color: color-mix(in srgb, var(--md-primary-fg-color) 22%, transparent);
}
[data-md-color-scheme="default"] .md-footer__slim .md-footer__link:hover {
  background-color: color-mix(in srgb, var(--md-primary-fg-color) 12%, transparent);
}
/* Header rows with room: a taller first row for the logo and controls, and the tabs row with
   space above and below. */
@media screen and (min-width: 76.25em) {
  .md-header__inner {
  /* Two rows: logo with version, theme and search on the first, the tabs on their own row below,
  with room between them. */
    flex-wrap: wrap;
    padding-top: 0.35rem;
  }
  .md-header__tabs {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
    align-self: stretch;
    padding-left: -8rem;
    order: 10;
    flex: 0 0 100%;
    justify-content: flex-start;
    border-top: 1px solid var(--md-default-fg-color--lightest);
    padding: 0.35rem 0;
    margin-top: 0.35rem;
    padding: 0.45rem 0;
  }
}

/* Tabs: on hover a thin underline, lighter than the active tab's, no pill. */
.md-tabs__link:hover {
  background-color: transparent;
}
@media screen and (min-width: 76.25em) {
  .md-header__tabs .md-tabs__item:not(.md-tabs__item--active) .md-tabs__link:hover {
    border-radius: 0;
    box-shadow: inset 0 -2px 0 var(--md-primary-fg-color--light);
  }
}
