/*
  Shared docs theme ("Glow"). The chrome, type, code, admonition and API
  furniture styling for every nanoblox docs site. Colour comes entirely from
  the --hd-* knobs each project defines in its own stylesheet (see
  projects/hd-admin/docs/stylesheets/hd-admin.css for the reference set), so
  retinting one site never touches this file.

  Synced into each project's docs/_shared/ by build.sh. Edit HERE, not the
  copies
*/

/* Always reserve the scrollbar gutter so a short page and a scrolling one
   keep the same content width. Without this the centred header and body jump
   sideways by the scrollbar's width when moving between them */
html {
  scrollbar-gutter: stable;
}
body[data-md-color-scheme="slate"][data-md-color-primary] {
  --md-default-bg-color: #0e1119;
  --md-default-fg-color: rgba(234, 240, 255, 0.92);
  --md-default-fg-color--light: #c3cde6;
  --md-default-fg-color--lighter: #8b9ab3;
  --md-default-fg-color--lightest: #232c3e;
  --md-primary-fg-color: #0e1119;
  --md-primary-fg-color--dark: #1a2560; /* mobile drawer repo card */
  --md-primary-bg-color: #ffffff;
  --md-primary-bg-color--light: #c3cde6;
  --md-accent-fg-color: var(--hd-accent);
  --md-accent-fg-color--transparent: rgba(var(--hd-tint), 0.14);
  --md-typeset-a-color: var(--hd-link);
  --md-code-bg-color: #182030;
  --md-code-fg-color: #e6ecff;
  --md-typeset-mark-color: rgba(var(--hd-tint), 0.28);
  --md-admonition-bg-color: #151a24;
  --md-footer-bg-color: #0a0e16;
  --md-footer-bg-color--dark: #070a10;
  --md-shadow-z1: none;
  --md-shadow-z2: 0 8px 30px rgba(0, 0, 0, 0.5);
  --hd-radius: 12px;
  color-scheme: dark;

  /* Luau-flavoured syntax colours */
  --md-code-hl-keyword-color: var(--hd-keyword);
  --md-code-hl-string-color: #a5e6a1;
  --md-code-hl-number-color: #ffcb6b;
  --md-code-hl-comment-color: #6b7894;
  --md-code-hl-function-color: var(--hd-function);
  --md-code-hl-constant-color: #f78c6c;
  --md-code-hl-operator-color: #89ddff;
  --md-code-hl-punctuation-color: #8b9ab3;
  --md-code-hl-special-color: #f07178;
  --md-code-hl-name-color: #e6ecff;
  --md-code-hl-variable-color: #e6ecff;
  --md-code-hl-generic-color: #e6ecff;
}

/* Announcement bar */

html.hda-announce-dismissed .md-banner {
  display: none;
}

/* The flat left-to-right gradient read as a plain strip, so the blue is lifted
   from underneath the text and the top edge catches a hairline of light. The
   glow sits at the centre because that's where the announcement is */
.md-banner {
  position: relative;
  overflow: hidden;
  background: radial-gradient(120% 320% at 50% 135%, rgba(var(--hd-tint), 0.38), transparent 62%),
    linear-gradient(90deg, var(--hd-bgrad-1), var(--hd-bgrad-2) 60%, var(--hd-bgrad-3));
  color: #c3cde6;
  border-bottom: 1px solid rgba(var(--hd-tint), 0.25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

/* A band of light crosses the bar every few seconds so it reads as something
   worth a glance rather than a static strip */
.md-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(
    100deg,
    transparent 38%,
    rgba(var(--hd-tint), 0.28) 47%,
    rgba(214, 226, 255, 0.22) 50%,
    rgba(var(--hd-tint), 0.28) 53%,
    transparent 62%
  );
  transform: translateX(-100%);
  animation: hda-announce-sweep 9s ease-in-out 3s infinite;
}

@keyframes hda-announce-sweep {
  0%,
  62% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* The sweep paints across the whole bar, so the content sits above it */
.md-banner__inner {
  position: relative;
  z-index: 1;
}

.md-banner a {
  color: var(--hd-pill-text);
  font-weight: 700;
}

.md-banner a:hover {
  color: #ffffff;
}

/* The bar's own background fades out over the landing hero, so the announcement
   carries its colour on the pieces themselves and still reads as a component */
.md-banner .hda-announce {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.1rem 0.45rem;
}

.md-banner .hda-announce__text {
  color: #dbe4ff;
  font-weight: 600;
}

.md-banner .hda-announce__link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.md-banner .hda-announce__link::after {
  content: "";
  width: 0.85em;
  height: 0.85em;
  margin-left: 0.15em;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13.172 12l-4.95-4.95 1.415-1.414L16 12l-6.364 6.364-1.414-1.414z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13.172 12l-4.95-4.95 1.415-1.414L16 12l-6.364 6.364-1.414-1.414z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  transition: transform 0.15s ease;
}

.md-banner .hda-announce__link:hover::after {
  transform: translateX(2px);
}

@media (prefers-reduced-motion: reduce) {
  .md-banner::after {
    animation: none;
  }

  .md-banner .hda-announce__link::after {
    transition: none;
  }
}

/* The family signature strip below every footer, in the slot the removed
   "Made with Material" meta bar used to occupy */
/* Near-black on doc pages. The landing instead continues its own navy so the
   bar never reads as a darker band under the CTA */
.nb-signature {
  background: rgba(5, 8, 14, 0.8);
  padding: 18px 0 22px;
}

.hda-home .nb-signature {
  background: #0b1120;
}

/* Signature left, legal links right, on the same measure as the page content */
.nb-signature-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 0.6rem;
}

.nb-signature-legal {
  display: flex;
  gap: 18px;
}

.nb-signature-legal a {
  font-size: 13px;
  color: var(--md-default-fg-color--lighter);
  transition: color 150ms ease;
}

.nb-signature-legal a:hover {
  color: #ffffff;
}

.nb-signature-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--md-default-fg-color--lighter);
  transition: color 150ms ease;
}

.nb-signature-link:hover {
  color: #ffffff;
}

.nb-signature-link img {
  width: 16px;
  height: 16px;
  display: block;
}

.nb-signature-link strong {
  font-weight: 700;
}

/* Header + tabs */

/* No "Made with Material for MkDocs" strip */
.md-footer-meta {
  display: none;
}

/* Pull the logo and site title together */
.md-header__button.md-logo {
  padding-right: 0.1rem;
}

.md-header__title {
  margin-left: 0.2rem;
}

.md-header {
  background: linear-gradient(
    90deg,
    var(--hd-grad-1) 0%,
    var(--hd-grad-2) 55%,
    var(--hd-grad-3) 100%
  );
  border-bottom: 1px solid rgba(var(--hd-tint), 0.25);
  box-shadow: 0 4px 24px rgba(var(--hd-strong-tint), 0.15);
}

.md-tabs {
  background: rgba(14, 17, 25, 0.6);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #232c3e;
}

.md-tabs__link--active {
  color: var(--hd-link);
  font-weight: 700;
}

/* Under the unified header the tabs take the apps' treatment instead: the
   others a touch dimmer, the open one white and a step heavier. :where keeps
   these light enough for the landing's transparent chrome to win */
:where(.nb-chrome ~ .md-container) .md-tabs__link {
  font-weight: 500;
  opacity: 0.6;
}

:where(.nb-chrome ~ .md-container) .md-tabs__link--active {
  color: #ffffff;
  font-weight: 600;
  opacity: 1;
}

/* Off-site links (like the Dashboard tab and hero button) carry Remixicon's
   external-link-line, drawn in the text colour via mask so it tints with state */
.hda-external-link::after {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-left: 0.4em;
  vertical-align: -0.08em;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 6v2H5v11h11v-5h2v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6zm11-3v8h-2V6.413l-7.793 7.794-1.414-1.414L17.585 5H13V3h8z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 6v2H5v11h11v-5h2v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6zm11-3v8h-2V6.413l-7.793 7.794-1.414-1.414L17.585 5H13V3h8z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.md-search__form {
  background: rgba(var(--hd-tint), 0.1);
  border: 1px solid rgba(var(--hd-tint), 0.2);
  border-radius: 8px;
}

/* Left nav. Every link gets the same padding so the active pill never shifts
   or clips, the background alone marks it */

/* Mobile drawer. Material paints the logo + title block in the flat primary
   colour, a stark black slab against the drawer. The same navy as the rest
   of the chrome sits softer here */
@media screen and (max-width: 76.1875em) {
  /* The [for] variant outguns Material's own attribute selector on the outer
     title block; the source card is the repo widget below it */
  .md-nav--primary .md-nav__title,
  .md-nav--primary .md-nav__title[for="__drawer"],
  .md-nav--primary .md-nav__source {
    background: var(--md-primary-fg-color--dark);
    color: #ffffff;
  }

  .md-nav--primary .md-nav__title,
  .md-nav--primary .md-nav__title[for="__drawer"] {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
}

.md-nav__link {
  border-radius: 8px;
  padding: 0.15em 0.6em;
  /* Plain entries sit a step greyer than the bold group headings */
  color: var(--md-default-fg-color--light);
}

/* Group headings ("Setup", "Using HD Admin") keep the full-strength colour */
.md-nav__item--section > .md-nav__link {
  color: var(--md-default-fg-color);
}

.md-nav__link--active {
  color: var(--hd-link);
  font-weight: 700;
}

/* A touch more air between the last page of one group and the next heading */
.md-nav__item + .md-nav__item--section {
  margin-top: 2.5em;
}

/* A loose page following a nav group otherwise inherits the group's full
   section margin and reads as a detached orphan */
@media screen and (min-width: 76.25em) {
  .md-nav__item--section + .md-nav__item:not(.md-nav__item--section) {
    margin-top: -0.6em;
  }
}

/* The sidebar repeats the active tab's name ("Get Started") as its first row,
   which is redundant next to the group headings. Desktop only, the mobile
   drawer needs that row for its back navigation */
@media screen and (min-width: 76.25em) {
  .md-nav--lifted > .md-nav__list > .md-nav__item--active > .md-nav__link {
    display: none;
  }
}

/* Type */

.md-typeset h1,
.md-typeset h2 {
  color: #ffffff;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* Code */

.md-typeset code {
  border-radius: 6px;
  padding: 0.15em 0.4em;
}

.md-typeset pre > code {
  border-radius: var(--hd-radius);
  padding: 1em 1.2em;
  border: 1px solid rgba(var(--hd-tint), 0.18);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

/* Admonitions, in the Fusion docs style: full coloured outline with a soft
   outer + inset glow, no title band, and the faintest tint of the type colour
   over the surface (adapted from dphfox/Fusion docs/assets/theme/admonition.css) */

.md-typeset .admonition-title,
.md-typeset summary {
  background: none !important;
}

.md-typeset :is(.admonition, details) {
  --admonition-color: #448aff;
  border-radius: 0.25rem;
  border-width: 0.1rem !important;
  box-shadow: 0 0.25em 1.5em -0.75em var(--admonition-color), inset 0 1em 2em -2.25em
    var(--admonition-color) !important;
  background: linear-gradient(var(--admonition-color) -99999%, transparent 5000%),
    var(--md-admonition-bg-color);
}

.md-typeset :is(.admonition, details) > :is(.admonition-title, summary)::before {
  background-color: currentColor;
}

.md-typeset .note {
  --admonition-color: #448aff;
}
.md-typeset .abstract {
  --admonition-color: #00b0ff;
}
.md-typeset .info {
  --admonition-color: #00b8d4;
}
.md-typeset .tip {
  --admonition-color: #00bfa5;
}
.md-typeset .success {
  --admonition-color: #00c853;
}
.md-typeset .question {
  --admonition-color: #64dd17;
}
.md-typeset .warning {
  --admonition-color: #ff9100;
}
.md-typeset .failure {
  --admonition-color: #ff5252;
}
.md-typeset .danger {
  --admonition-color: #ff1744;
}
.md-typeset .bug {
  --admonition-color: #f50057;
}
.md-typeset .example {
  --admonition-color: #7c4dff;
}
.md-typeset .quote {
  --admonition-color: #9e9e9e;
}

/* Our own type. Material has no colour for it, so give it the brand blue */
.md-typeset .important {
  --admonition-color: #5c7cff;
  border-color: #5c7cff;
}

/* The copy button only appears while hovering a code block (Fusion-style) */

.md-typeset .highlight .md-clipboard {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.md-typeset .highlight:hover .md-clipboard {
  opacity: 0.5;
}

.md-typeset .highlight .md-clipboard:hover {
  opacity: 1;
}

/* Smooth in-page scrolling. landing.js inhibits it for ordinary navigation so
   it only animates anchor jumps */

@media (prefers-reduced-motion: no-preference) {
  :root {
    scroll-behavior: smooth;
  }

  :root.hda-inhibit-smooth-scrolling {
    scroll-behavior: auto;
  }
}

.md-typeset img {
  border-radius: 0.25rem;
}

/* Content tabs sit on the code-block surface with an accent underline, so
   tabbed code reads as one connected component (Fusion-style) */

.md-typeset .tabbed-labels {
  background-color: var(--md-code-bg-color);
  box-shadow: none;
  border-top-left-radius: 0.25rem;
  border-top-right-radius: 0.25rem;
}

.js .md-typeset .tabbed-labels::before {
  background-color: transparent;
  height: 100%;
  box-shadow: 0 -0.325rem var(--md-code-bg-color) inset, 0 -0.4rem var(--hd-accent) inset;
}

.md-typeset .tabbed-labels > label {
  color: var(--md-code-fg-color);
  font-weight: 400;
  padding: 0;
  margin: 0.78125em 1.25em 0.625em;
}

.md-typeset .tabbed-set {
  box-shadow: var(--md-shadow-z2);
  border-radius: 0.25rem;
}

.tabbed-set .highlight > pre {
  box-shadow: none;
}

.md-typeset .tabbed-set > input:first-child:checked ~ .tabbed-labels > :first-child,
.md-typeset .tabbed-set > input:nth-child(2):checked ~ .tabbed-labels > :nth-child(2),
.md-typeset .tabbed-set > input:nth-child(3):checked ~ .tabbed-labels > :nth-child(3),
.md-typeset .tabbed-set > input:nth-child(4):checked ~ .tabbed-labels > :nth-child(4),
.md-typeset .tabbed-set > input:nth-child(5):checked ~ .tabbed-labels > :nth-child(5),
.md-typeset .tabbed-set > input:nth-child(6):checked ~ .tabbed-labels > :nth-child(6) {
  color: var(--hd-accent);
  font-weight: 700;
}

/* API reference furniture (Fusion-style): breadcrumbs, inline type signatures
   and the bento card grid on the API index */

.hd-api-breadcrumbs {
  display: flex;
  align-items: center;
  height: 2rem;
  opacity: 0.8;
}

.hd-api-breadcrumbs > *:not(:last-child)::after {
  content: "›";
  margin: 0 0.25rem;
}

/* Buttons in page content. Material paints these with the primary color,
   which is near-black in this theme, so restyle them from the accent knobs */
.md-typeset .md-button {
  border-radius: 10px;
  padding: 0.5em 1.6em;
  font-weight: 700;
  color: var(--hd-link, #7d97ff);
  border: 2px solid rgba(var(--hd-tint, 92, 124, 255), 0.45);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.md-typeset .md-button:hover,
.md-typeset .md-button:focus {
  background-color: rgba(var(--hd-tint, 92, 124, 255), 0.12);
  color: var(--hd-link, #7d97ff);
  border-color: var(--hd-accent, #5c7cff);
}
.md-typeset .md-button--primary {
  background-color: var(--hd-accent-strong, #335fff);
  border-color: var(--hd-accent-strong, #335fff);
  color: #fff;
}
.md-typeset .md-button--primary:hover,
.md-typeset .md-button--primary:focus {
  background-color: var(--hd-accent, #5c7cff);
  border-color: var(--hd-accent, #5c7cff);
  color: #fff;
}

.hd-api-tag {
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.5em;
  padding: 0.1em 0.6em;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hd-api-tag--available {
  background: rgba(0, 200, 83, 0.15);
  color: #4ade80;
  border: 1px solid rgba(0, 200, 83, 0.35);
}

.hd-api-tag--soon {
  background: rgba(var(--hd-tint), 0.12);
  color: var(--hd-pill-text);
  border: 1px solid rgba(var(--hd-tint), 0.3);
}

.hd-api-tag--server {
  background: rgba(96, 165, 250, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.3);
}

.hd-api-tag--client {
  background: rgba(0, 200, 83, 0.12);
  color: #4ade80;
  border: 1px solid rgba(0, 200, 83, 0.3);
}

.hd-api-tag--both {
  background: rgba(192, 132, 252, 0.12);
  color: #c084fc;
  border: 1px solid rgba(192, 132, 252, 0.3);
}

.hd-api-bento {
  column-width: 12rem;
  column-gap: 0.5rem;
}

.hd-api-bento > * {
  break-inside: avoid;
  background-color: var(--md-admonition-bg-color);
  border: 1px solid rgba(var(--hd-tint), 0.14);
  border-radius: 0.25rem;
  padding: 0.75rem 1rem 0.35rem;
  margin: 0 0 0.5rem;
}

.hd-api-bento > * > h4 {
  font-size: 0.7rem;
  color: var(--md-default-fg-color--lighter);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 0.4em;
}

.hd-api-bento ul {
  list-style: none;
  margin: 0 0 0.6em;
  padding: 0;
}

.hd-api-bento li {
  margin: 0.25em 0;
}

/* Tables + rules */

.md-typeset table:not([class]) {
  border-radius: var(--hd-radius);
  overflow: hidden;
}

.md-typeset hr {
  border-bottom-width: 1px;
}

/* Scrollbars */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: #39414f;
  border-radius: 4px;
}

/* ---------------------------------------------------------------------------
   Flat mobile navigation. Material renders nested nav levels as sliding
   panels on phones, so reaching a page takes a tap per level. Our navs are
   small enough to show the whole outline at once, like the desktop sidebar.
   Group labels become headers and their children render inline beneath */
@media screen and (max-width: 76.234375em) {
  .md-nav--primary .md-nav {
    position: static;
    height: auto;
    background-color: transparent;
  }

  /* Defeats the off-canvas slide and the collapsed-grid accordion in one go */
  .md-nav--primary .md-nav__toggle ~ .md-nav {
    display: block;
    opacity: 1;
    transform: none;
    visibility: visible;
    transition: none;
  }

  /* Nested panels carried a sticky back-header each. The root drawer title
     with the logo sits directly under .md-nav--primary, so it survives */
  .md-nav--primary .md-nav .md-nav__title {
    display: none;
  }

  /* Group labels read as headers now, not buttons: no drill arrow, no tap */
  .md-nav--primary .md-nav__item--nested > .md-nav__link {
    pointer-events: none;
    font-weight: 700;
    color: var(--md-default-fg-color);
  }

  .md-nav--primary .md-nav__item--nested > .md-nav__link .md-nav__icon {
    display: none;
  }

  /* Indentation carries the hierarchy the sliding panels used to */
  .md-nav--primary .md-nav .md-nav__link {
    padding-left: 1.4rem;
  }

  .md-nav--primary .md-nav .md-nav .md-nav__link {
    padding-left: 2rem;
  }

  /* One list means one scroll. Item snapping fought it on long outlines */
  .md-nav--primary .md-nav__title ~ .md-nav__list {
    scroll-snap-type: none;
  }

  /* The drawer lists pages only. The active page's own headings and the
     old slide-to-contents icon stay out of it */
  .md-nav--primary .md-nav__link[for="__toc"] .md-icon {
    display: none;
  }

  .md-nav--primary .md-nav__link[for="__toc"] ~ .md-nav {
    display: none;
  }
}

/* The five section links between the signature and the legal links, the same
   labels as the header tabs so every page repeats them */
.nb-signature-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.nb-signature-links a {
  font-size: 13px;
  color: var(--md-default-fg-color--lighter);
  transition: color 150ms ease;
}

.nb-signature-links a:hover {
  color: #ffffff;
}

/* The copies of the mobile-flagged links in the legal group only show once
   the row itself has folded away */
.nb-signature-legal-mobile {
  display: none;
}

/* On a phone the row of section links is too much, so it goes and only the
   links flagged mobile stay, beside the legal ones. The strip wraps rather
   than squeezing, so the legal group drops under the signature when the
   width runs out */
@media screen and (max-width: 59.9375em) {
  .nb-signature-links {
    display: none;
  }

  .nb-signature-legal-mobile {
    display: inline;
  }

  .nb-signature-inner {
    flex-wrap: wrap;
    row-gap: 10px;
  }

  .nb-signature-legal {
    gap: 14px;
  }
}

/* ---------------------------------------------------------------------------
   The unified header on the sites that set extra.chrome (HD Admin), see
   NAV-PLAN.md. chrome.css draws the rows the way the apps do, these rules
   marry them to Material's header, whose drawer button, search and sticky
   behaviour stay its own */
.nb-chrome .topbar-inner {
  height: 48px;
  gap: 16px;
}

.nb-chrome .md-search {
  flex-shrink: 0;
}

.nb-chrome .md-header__button[for="__search"] {
  margin-right: 0;
}

/* Material grows the root font past 1600px (22px, then 24px) and the header
   is built in rem, so on a wide screen the docs' bar ran a tenth larger than
   the apps' fixed 48px design and the family tab jumped between the sites.
   The unified header and its tabs row are pinned to px instead, the apps'
   measures exactly: the 48px rows, the 16px gap, Inter 14px, the 234px
   search field, and at desktop widths the apps' 1220px container with 20px
   sides. The docs' body keeps Material's scale */
.nb-chrome .topbar-inner {
  max-width: 1220px;
}

:where(.nb-chrome ~ .md-container) .md-tabs .md-grid {
  max-width: 1220px;
}

:where(.nb-chrome ~ .md-container) .md-tabs__item {
  height: 48px;
  padding: 0 12px;
}

/* Centred in the row like the apps' tabs, rather than Material's set-down */
:where(.nb-chrome ~ .md-container) .md-tabs__link {
  align-items: center;
  height: 48px;
  margin-top: 0;
  font-size: 14px;
  line-height: 20px;
}

/* The repository widget at the row's right-hand end, Material's own with
   its stars and forks, pinned to the row's 48px the same way. The list
   keeps its own scrolling on the left and the widget never shrinks */
:where(.nb-chrome ~ .md-container) .md-tabs .md-grid {
  display: flex;
  align-items: center;
}

:where(.nb-chrome ~ .md-container) .md-tabs__list {
  flex: 1 1 auto;
  min-width: 0;
}

.md-tabs__source {
  flex: none;
  display: flex;
  align-items: center;
  height: 48px;
  margin-left: 16px;
  /* Flush with the account chip's right edge in the bar above */
  margin-right: 20px;
}

.md-tabs__source .md-source {
  font-size: 13px;
  opacity: 0.6;
}

.md-tabs__source .md-source:hover {
  opacity: 1;
}

.md-tabs__source .md-source__icon {
  width: 40px;
  height: 48px;
}

.md-tabs__source .md-source__icon svg {
  width: 24px;
  height: 24px;
  margin: 12px;
}

.md-tabs__source .md-source__repository {
  margin-left: -40px;
  margin-right: 0;
  padding-left: 40px;
  padding-right: 0;
  max-width: none;
}

.md-tabs__source .md-source__facts {
  margin-top: 2px;
  font-size: 11px;
  gap: 8px;
}

.md-tabs__source .md-source__fact::before {
  width: 12px;
  height: 12px;
}

.nb-chrome .topbar-inner {
  padding: 0 20px;
}

.nb-chrome .brand-home {
  margin-left: 0;
}

/* The apps' container narrows to 16px sides on phones */
@media (max-width: 480px) {
  .nb-chrome .topbar-inner {
    padding: 0 16px;
  }
}

/* Below the desktop search the wrapper is an empty box beside its button,
   and the row's gap would still count it, setting the magnifier 16px off
   the apps' */
@media screen and (max-width: 59.9375em) {
  .nb-chrome .md-search {
    margin-left: -16px;
  }
}

/* A phone's bar runs on the apps' tighter 8px gap (chrome.css), and the
   empty search box gives back that much instead */
@media (max-width: 480px) {
  .nb-chrome .topbar-inner {
    gap: 8px;
  }

  .nb-chrome .md-search {
    margin-left: -8px;
  }

  .nb-chrome .md-header__button[for="__search"] {
    margin-left: 0;
  }
}

/* And its 6px gap on the narrowest phones */
@media (max-width: 374px) {
  .nb-chrome .topbar-inner {
    gap: 6px;
  }

  .nb-chrome .md-search {
    margin-left: -6px;
  }
}

/* The drawer button sits where the apps' menu button does, 10px in */
.nb-chrome .md-header__button[for="__drawer"] {
  margin: 0 0 0 -10px;
  padding: 8px;
}

.nb-chrome .md-header__button[for="__drawer"] svg {
  width: 24px;
  height: 24px;
}

/* Material's directional rule outranks a plain one, hence the prefix */
[dir="ltr"] :where(.nb-chrome ~ .md-container) .md-tabs__list {
  margin-left: 8px;
}

/* The desktop search field only. Below 60em Material's search is the
   full-screen sheet with its own 48px field, which these measures were
   cutting short */
@media screen and (min-width: 60em) {
  .nb-chrome .md-search__form {
    height: 36px;
  }

  .nb-chrome .md-search__inner {
    width: 234px;
    padding: 2px 0;
  }

  .nb-chrome .md-search__input {
    font-size: 16px;
  }

  .nb-chrome .md-search__icon {
    width: 24px;
    height: 24px;
  }

  .nb-chrome .md-search__icon[for="__search"] {
    top: 6px;
    left: 16px;
  }

  [dir="ltr"] .nb-chrome .md-search__input {
    padding-left: 44px;
    padding-right: 44px;
  }
}

/* The bar alone sticks. The tabs ride in the flow under it (hd-admin drops
   navigation.tabs.sticky) over the same gradient, so the two read as one
   block at the top, and leave with the page. The glow underline sits under
   the tabs while they show and moves up to the bar once they have gone,
   which is when Material marks the bar shadowed */
.nb-chrome {
  border-bottom: 0;
  box-shadow: none;
  transition: box-shadow 150ms ease;
}

.nb-chrome.md-header--shadow {
  box-shadow: 0 1px 0 rgba(var(--hd-tint), 0.25), 0 4px 24px rgba(var(--hd-strong-tint), 0.15);
}

:where(.nb-chrome ~ .md-container) .md-tabs {
  position: relative;
  background: linear-gradient(rgba(14, 17, 25, 0.6), rgba(14, 17, 25, 0.6)),
    linear-gradient(90deg, var(--hd-grad-1) 0%, var(--hd-grad-2) 55%, var(--hd-grad-3) 100%);
  backdrop-filter: none;
  box-shadow: 0 1px 0 rgba(var(--hd-tint), 0.25), 0 4px 24px rgba(var(--hd-strong-tint), 0.15);
}

/* The drawer on the unified-header sites is the apps' narrow-screen menu
   remade: the family with its marks, the docs' tabs stepped in under
   Explore, and the open tab's pages stepped in once more. Material's own
   list stays for the desktop sidebar and hides here, the drawer title with
   it, since the header already shows the mark. The measures are the apps'
   chrome.css ones */
.nb-drawer {
  display: none;
}

@media screen and (max-width: 76.1875em) {
  /* Under the unified header the drawer sits below the bar rather than over
     it, and so does the overlay, so the bar stays bright. Its top follows
     the bar's bottom edge, which chrome.js keeps current since the
     announcement bar above the header scrolls away */
  body:has(.nb-chrome) .md-sidebar--primary {
    top: var(--nb-drawer-top, 2.4rem);
    height: calc(100% - var(--nb-drawer-top, 2.4rem));
  }

  /* The repository card at the drawer's foot, a shade darker than the
     drawer rather than Material's bright navy, with its counts */
  body:has(.nb-chrome) .md-nav__source {
    background: #090c13;
    color: var(--md-default-fg-color--light);
    border-top: 1px solid rgba(var(--hd-tint), 0.18);
  }

  body:has(.nb-chrome) .md-nav__source .md-source__facts {
    opacity: 0.75;
  }

  body:has(.nb-chrome) .md-overlay {
    top: var(--nb-drawer-top, 2.4rem);
  }

  .nb-nav > .md-nav__title,
  .nb-nav > .md-nav__list {
    display: none;
  }

  .nb-drawer {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.4rem 1rem;
  }

  .nb-drawer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 10px;
    border-radius: 10px;
    color: var(--md-default-fg-color);
    font-family: var(--font-ui, "Inter", sans-serif);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
  }

  .nb-drawer-item:hover {
    background: rgba(var(--hd-tint), 0.08);
  }

  .nb-drawer-item-active,
  .nb-drawer-item-active:hover {
    color: var(--hd-link);
    background: rgba(var(--hd-tint), 0.14);
  }

  .nb-drawer-icon {
    flex: none;
    width: 20px;
    height: 20px;
    opacity: 0.9;
  }

  .nb-drawer-sub {
    display: flex;
    flex-direction: column;
    margin: 2px 0 6px 22px;
    padding-left: 18px;
    border-left: 1px solid rgba(var(--hd-tint), 0.3);
  }

  /* The open tab's pages sit one more step in, a smaller step so the third
     level keeps room for its titles */
  .nb-drawer-sub .nb-drawer-sub {
    margin-left: 10px;
    padding-left: 14px;
  }

  .nb-drawer-item-sub {
    padding: 10px;
    font-size: 14px;
    font-weight: 500;
  }
}
