/* THDDEV-1987, THDDEV-1996: the top navigation bar. The frame is still "Framed sheet", but the bar itself
   is GRAPHITE and carries its depth at rest (owner decision 2026-11-26, superseding the stone bar of
   2026-11-24): a stone bar on a stone page left the page with no top edge, which was the complaint.
   The Home Depot orange is still kept to the logo, the avatar chip and the current-page mark.

   Standalone on purpose: plain CSS, px units and explicit resets, so the same bar renders alike under
   the Thd.Web.UI shell (thd-ui.css, tokens present), the Bootstrap 5 pages and the Bootstrap 3 pages
   (html font-size 10px, global a/ul/p/input/button rules). Every colour is a THD token with its light
   value as the fallback for pages that do not load the tokens (the legacy pages: graphite bar, light panels,
   no dark theme). On the token pages the bar ground goes darker in the dark theme and the panels go dark.

   Sizes (THDDEV-1996): the bar is 48px tall in a row (768px and up) and 52px with the drawer (below), the
   1px edge included. Row links are 32px tall (40px for a coarse pointer); the menu button, the phone account
   button and every drawer row are at least 44px.

   Behaviour: wwwroot/js/thd-topnav.js. Served fingerprinted as /dist/thd-ui/css/thd-topnav.<hash>.css
   (<thd-stylesheet name="thd-topnav.css" />). */

.thd-topnav,
.thd-topnav *,
.thd-topnav *::before,
.thd-topnav *::after {
  box-sizing: border-box;
}

.thd-topnav {
  /* Graphite bar: it is the frame, not the sheet, so it takes bar-ground rather than ground. */
  --thd-topnav-bg: var(--thd-color-bar-ground, #232323);
  --thd-topnav-bg-2: var(--thd-color-bar-ground-2, #171717);
  --thd-topnav-surface: var(--thd-color-surface, #FFFFFF);
  --thd-topnav-hover: rgba(255, 255, 255, 0.08);
  --thd-topnav-border: rgba(255, 255, 255, 0.14);
  --thd-topnav-rule: rgba(255, 255, 255, 0.10);
  --thd-topnav-control: rgba(255, 255, 255, 0.22);
  --thd-topnav-text: var(--thd-color-on-bar, #FFFFFF);
  --thd-topnav-muted: var(--thd-color-on-bar-muted, #D6D4D0);
  /* The sheet's ink and rules, held here as the one source a light subtree takes back from. The bar's
     chrome went graphite above; its panels, drawers and fields did not, because they are white
     surfaces. These are the values the vars above carried before the bar went graphite. */
  --thd-topnav-sheet-bg: var(--thd-color-ground, #F4F4F2);
  --thd-topnav-sheet-hover: var(--thd-color-active, #EBEAE7);
  --thd-topnav-sheet-border: var(--thd-color-border, #E3E2DE);
  --thd-topnav-sheet-rule: var(--thd-color-rule, #EEEDEA);
  --thd-topnav-sheet-control: var(--thd-color-control, #8A847A);
  --thd-topnav-sheet-text: var(--thd-color-text, #1A1A1A);
  --thd-topnav-sheet-muted: var(--thd-color-text-muted, #5B6470);
  --thd-topnav-sheet-focus: var(--thd-color-focus-ring, #1B62CF);
  --thd-topnav-brand: var(--thd-color-brand, #F96302);
  /* Chip, hover mark and focus ring are bar tokens: the dark-theme brand-soft is a brown that vanishes on
     graphite, the control grey is a 22% white that is 1.5:1, and the standard ring is 2.8:1 on the bar. */
  --thd-topnav-chip: var(--thd-color-bar-chip, #FDE7D6);
  --thd-topnav-on-chip: var(--thd-color-on-bar-chip, #A84200);
  --thd-topnav-mark: var(--thd-color-bar-control, #8F8F8F);
  --thd-topnav-focus: var(--thd-color-focus-ring-on-bar, #7CB2FF);
  --thd-topnav-shadow: var(--thd-elevation-menu, 0 4px 16px rgba(26, 26, 26, 0.12));
  /* THDDEV-2007: the scrolled bar uses the quiet bar shadow; menus and panels keep the menu shadow. */
  --thd-topnav-bar-shadow: var(--thd-elevation-bar, 0 1px 0 rgba(26, 26, 26, 0.10), 0 6px 20px -10px rgba(26, 26, 26, 0.45));
  --thd-topnav-fast: var(--thd-motion-duration-fast, 120ms);
  --thd-topnav-base: var(--thd-motion-duration-base, 200ms);
  --thd-topnav-ease: var(--thd-motion-ease-standard, cubic-bezier(0.2, 0, 0, 1));
  /* The bar's content height; the 1px edge is added to it. */
  --thd-topnav-height: 51px;
  /* The height of a link in the row. */
  --thd-topnav-link: 32px;

  position: sticky;
  top: 0;
  z-index: 1030;
  margin: 0;
  /* isolate: the texture overlay below must not escape the bar. */
  isolation: isolate;
  background: var(--thd-topnav-bg);
  background-image: linear-gradient(180deg, var(--thd-topnav-bg) 0%, var(--thd-topnav-bg-2) 100%);
  border-bottom: 1px solid var(--thd-topnav-border);
  /* Depth at rest, not only once scrolled: the inset bevel gives the bar its own moulded edge and
     elevation.bar casts it over the page, so the page has a top edge before you touch it. */
  box-shadow: var(--thd-elevation-bevel-on-dark, inset 0 1px 0 rgba(255, 255, 255, 0.10), inset 0 -1px 0 rgba(0, 0, 0, 0.45)),
              var(--thd-topnav-bar-shadow);
  color: var(--thd-topnav-text);
  font-family: var(--thd-font-family-sans, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
  letter-spacing: 0;
  text-align: start;
  transition: box-shadow var(--thd-topnav-base) var(--thd-topnav-ease);
}

/* Monochrome fractal noise at 3.5% (owner decision 2026-11-26): it stops a large flat graphite area
   reading as dead pixels. Deliberately almost subliminal. It lives in this stylesheet, not a style
   attribute, because the shell runs a strict CSP. No mix-blend-mode: that would create a stacking
   context, and the drawer scrim depends on this bar's stacking staying predictable. */
.thd-topnav::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  background-size: 140px 140px;
  opacity: 0.035;
}

@media (prefers-reduced-transparency: reduce) {
  .thd-topnav::after { display: none; }
}

/* Deeper cast while the page is scrolled under it (set by the script). The bevel is kept so the bar
   keeps its moulded edge in both states. */
.thd-topnav.is-scrolled {
  box-shadow: var(--thd-elevation-bevel-on-dark, inset 0 1px 0 rgba(255, 255, 255, 0.10), inset 0 -1px 0 rgba(0, 0, 0, 0.45)),
              0 2px 0 rgba(26, 26, 26, 0.10),
              0 10px 24px -12px rgba(26, 26, 26, 0.55);
}

/* ---- the light subtrees ----
   Each root below is painted with --thd-topnav-surface (white), so it takes the sheet's ink and rules
   back instead of inheriting the bar's graphite ones. Each is listed only where it is actually white:
   the account and jump panels always, the nav as a drawer on a phone, the row's dropdowns and the jump
   field from 768px up. Miss one and its text is white on white. */
.thd-topnav__menu--panel {
  --thd-topnav-bg: var(--thd-topnav-sheet-bg);
  --thd-topnav-hover: var(--thd-topnav-sheet-hover);
  --thd-topnav-border: var(--thd-topnav-sheet-border);
  --thd-topnav-rule: var(--thd-topnav-sheet-rule);
  --thd-topnav-control: var(--thd-topnav-sheet-control);
  --thd-topnav-text: var(--thd-topnav-sheet-text);
  --thd-topnav-muted: var(--thd-topnav-sheet-muted);
  --thd-topnav-focus: var(--thd-topnav-sheet-focus);
}

@media (max-width: 767.98px) {
  /* The nav is a white drawer at this width, and its nested menus sit inside it. */
  .thd-topnav__nav {
    --thd-topnav-bg: var(--thd-topnav-sheet-bg);
    --thd-topnav-hover: var(--thd-topnav-sheet-hover);
    --thd-topnav-border: var(--thd-topnav-sheet-border);
    --thd-topnav-rule: var(--thd-topnav-sheet-rule);
    --thd-topnav-control: var(--thd-topnav-sheet-control);
    --thd-topnav-text: var(--thd-topnav-sheet-text);
    --thd-topnav-muted: var(--thd-topnav-sheet-muted);
  --thd-topnav-focus: var(--thd-topnav-sheet-focus);
  }
}

@media (min-width: 768px) {
  /* The row itself is on the bar; only its dropdowns and the jump field are white. */
  .thd-topnav__nav .thd-topnav__menu,
  .thd-topnav__jump .thd-topnav__jumpbtn {
    --thd-topnav-bg: var(--thd-topnav-sheet-bg);
    --thd-topnav-hover: var(--thd-topnav-sheet-hover);
    --thd-topnav-border: var(--thd-topnav-sheet-border);
    --thd-topnav-rule: var(--thd-topnav-sheet-rule);
    --thd-topnav-control: var(--thd-topnav-sheet-control);
    --thd-topnav-text: var(--thd-topnav-sheet-text);
    --thd-topnav-muted: var(--thd-topnav-sheet-muted);
  --thd-topnav-focus: var(--thd-topnav-sheet-focus);
  }

  /* Except in the tight row, where the jump button loses its fill and is back on the graphite:
     there it keeps the bar's ink and hover. */
  .thd-topnav.is-tight .thd-topnav__jump .thd-topnav__jumpbtn {
    --thd-topnav-hover: rgba(255, 255, 255, 0.08);
    --thd-topnav-text: var(--thd-color-on-bar, #FFFFFF);
    --thd-topnav-muted: var(--thd-color-on-bar-muted, #D6D4D0);
    --thd-topnav-focus: var(--thd-color-focus-ring-on-bar, #7CB2FF);
  }
}

/* An author display value must not bring back a part the markup or the script has hidden. */
.thd-topnav [hidden] {
  display: none !important;
}

/* The pages that used a fixed navbar reserved its height on <body>; this bar is in the flow. */
body.thd-topnav-page {
  padding-top: 0;
}

body.thd-topnav-page > .body-content {
  padding-top: 16px;
}

/* The skip link and in-page anchors land below the sticky bar, not under it. */
body.thd-topnav-page #main,
body.thd-topnav-page :target {
  scroll-margin-top: 64px;
}

body.thd-topnav-page .thd-dashboard {
  margin-top: -16px;
}

.thd-topnav-skip {
  position: absolute;
  left: 8px;
  top: -100px;
  z-index: 1080;
  /* 44px tall (20px line + 24px): the target size of the sign-in pages and of phone widths. */
  padding: 12px 16px;
  border-radius: 6px;
  background: var(--thd-color-surface, #FFFFFF);
  color: var(--thd-color-text, #1A1A1A);
  font: 600 14px/20px var(--thd-font-family-sans, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  text-decoration: underline;
}

.thd-topnav-skip:focus,
.thd-topnav-skip:focus-visible {
  top: 8px;
  color: var(--thd-color-text, #1A1A1A);
  outline: 3px solid var(--thd-color-focus-ring, #1B62CF);
  /* Inset: the link floats over the graphite bar, where the standard ring is 2.8:1; inside its own
     white box the ring sits on the sheet colour it is measured against. */
  outline-offset: -3px;
}

.thd-topnav__bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: var(--thd-topnav-height);
  margin: 0 auto;
  padding: 0 8px 0 12px;
}

/* ---- brand ---- */
.thd-topnav__brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-height: 44px;
  margin: 0 auto 0 0;
  padding: 4px 8px 4px 4px;
  border-radius: 6px;
  color: var(--thd-topnav-text);
  text-decoration: none;
}

.thd-topnav__brand:hover,
.thd-topnav__brand:focus {
  color: var(--thd-topnav-text);
  text-decoration: none;
}

/* The site logo file is the orange square followed by a dark "SALVAGE" slab drawn for a dark bar.
   Only the square (the left 80 of 241 px) is shown; the site name is live text beside it. */
.thd-topnav__logo {
  display: block;
  flex: none;
  width: 28px;
  height: 28px;
  max-width: none;
  border: 0;
  border-radius: 4px;
  object-fit: cover;
  object-position: 0 0;
  transition: transform var(--thd-topnav-base) var(--thd-topnav-ease);
}

.thd-topnav__brand:hover .thd-topnav__logo {
  transform: scale(1.06);
}

.thd-topnav__wordmark {
  font-size: 15px;
  line-height: 20px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* ---- lists ---- */
.thd-topnav__list,
.thd-topnav__menu,
.thd-topnav__jumplist,
.thd-topnav__roles {
  margin: 0;
  padding: 0;
  list-style: none;
}

.thd-topnav__item {
  position: relative;
  margin: 0;
  padding: 0;
}

.thd-topnav__menu > li,
.thd-topnav__jumplist > li {
  margin: 0;
  padding: 0;
}

/* ---- links and disclosure buttons ---- */
.thd-topnav__link,
.thd-topnav__menulink,
.thd-topnav__toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  background-image: none;
  box-shadow: none;
  color: var(--thd-topnav-text);
  font: inherit;
  font-weight: 500;
  text-align: start;
  text-decoration: none;
  text-shadow: none;
  text-transform: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color var(--thd-topnav-fast) var(--thd-topnav-ease), color var(--thd-topnav-fast) var(--thd-topnav-ease);
}

.thd-topnav__link {
  position: relative;
  width: 100%;
  min-height: 44px;
  padding: 12px;
  font-size: 15px;
  line-height: 20px;
}

.thd-topnav__menulink {
  position: relative;
  width: 100%;
  min-height: 44px;
  padding: 12px;
  font-size: 15px;
  line-height: 20px;
  font-weight: 400;
}

.thd-topnav__link:hover,
.thd-topnav__link:focus,
.thd-topnav__menulink:hover,
.thd-topnav__menulink:focus,
.thd-topnav__toggle:hover,
.thd-topnav__toggle:focus {
  background-color: var(--thd-topnav-hover);
  color: var(--thd-topnav-text);
  text-decoration: none;
}

.thd-topnav__link:active,
.thd-topnav__menulink:active,
.thd-topnav__toggle:active {
  background-color: var(--thd-topnav-border);
}

.thd-topnav__trigger[aria-expanded="true"] {
  background-color: var(--thd-topnav-hover);
}

/* One focus treatment, an outline (forced colours removes box-shadows). */
.thd-topnav a:focus,
.thd-topnav button:focus,
.thd-topnav input:focus {
  outline: none;
}

.thd-topnav a:focus-visible,
.thd-topnav button:focus-visible,
.thd-topnav input:focus-visible {
  outline: 3px solid var(--thd-topnav-focus);
  outline-offset: -3px;
}

/* The brand keeps the inset ring too: an outside ring would leave the 48px graphite and meet the page ground (1.97:1). */

/* Current page: weight plus an orange mark, so it is never carried by colour alone. A bar at the start of
   the row here (drawer, dropdowns, "More"); an underline on the bar's edge for the links of the row. */
.thd-topnav__link[aria-current="page"],
.thd-topnav__link.is-current,
.thd-topnav__menulink[aria-current="page"] {
  font-weight: 700;
}

.thd-topnav__link[aria-current="page"]::after,
.thd-topnav__link.is-current::after,
.thd-topnav__menulink[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 2px;
  background: var(--thd-topnav-brand);
}

.thd-topnav .thd-icon {
  flex: none;
  width: 16px;
  height: 16px;
  vertical-align: middle;
  fill: currentColor;
}

.thd-topnav__chevron,
.thd-topnav__groupicon,
.thd-topnav__icon-open,
.thd-topnav__icon-close {
  display: inline-flex;
  flex: none;
}

.thd-topnav__groupicon {
  color: var(--thd-topnav-muted);
}

.thd-topnav__chevron {
  color: var(--thd-topnav-muted);
  transition: transform var(--thd-topnav-fast) var(--thd-topnav-ease);
}

.thd-topnav__chevron .thd-icon {
  width: 12px;
  height: 12px;
}

.thd-topnav__trigger[aria-expanded="true"] .thd-topnav__chevron {
  transform: rotate(180deg);
}

/* ---- dropdown panels ---- */
@keyframes thd-topnav-pop {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes thd-topnav-fade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes thd-topnav-mark {
  from {
    transform: scaleX(0);
  }

  to {
    transform: scaleX(1);
  }
}

.thd-topnav__menu {
  display: none;
}

.thd-topnav__trigger[aria-expanded="true"] + .thd-topnav__menu {
  display: block;
}

.thd-topnav__menu--panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 2;
  /* As wide as its longest line (a user name on one line when it fits), within limits. */
  width: max-content;
  min-width: 232px;
  max-width: calc(100vw - 16px);
  max-width: min(360px, calc(100vw - 16px));
  padding: 4px;
  border: 1px solid var(--thd-topnav-border);
  border-radius: 8px;
  background: var(--thd-topnav-surface);
  box-shadow: var(--thd-topnav-shadow);
  /* Taller than the window (a wrapped name and badges on a short landscape phone): it scrolls inside itself. */
  max-height: calc(100vh - var(--thd-topnav-height) - 16px);
  max-height: calc(100dvh - var(--thd-topnav-height) - 16px);
  overflow-y: auto;
  overscroll-behavior: contain;
  transform-origin: top right;
  animation: thd-topnav-pop var(--thd-topnav-fast) var(--thd-topnav-ease);
}

/* The group's name, shown only where its button is not: inside "More". */
.thd-topnav__menuhead {
  display: none;
}

/* ---- account ---- */
.thd-topnav__account {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}

.thd-topnav__account .thd-topnav__link {
  width: auto;
}

/* The account button: an initials chip, the short name and a chevron. The full user name is not cut
   anywhere: it is the button's accessible name and title, and the menu's header wraps it. */
.thd-topnav__user {
  gap: 8px;
  min-height: 44px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
}

.thd-topnav__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--thd-topnav-chip);
  color: var(--thd-topnav-on-chip);
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: box-shadow var(--thd-topnav-fast) var(--thd-topnav-ease);
}

.thd-topnav__user:hover .thd-topnav__avatar,
.thd-topnav__user[aria-expanded="true"] .thd-topnav__avatar {
  box-shadow: 0 0 0 2px var(--thd-topnav-text);
}

.thd-topnav__shortname {
  white-space: nowrap;
}

.thd-topnav__menulabel {
  margin: 0;
  padding: 8px 12px 10px;
  color: var(--thd-topnav-muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
}

/* The whole user name, on as many lines as it needs. */
.thd-topnav__menulabel strong {
  display: block;
  color: var(--thd-topnav-text);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.thd-topnav__roles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 12px 10px;
}

.thd-topnav__badge {
  margin: 0;
  padding: 2px 8px;
  border: 1px solid var(--thd-topnav-border);
  border-radius: 999px;
  background: var(--thd-topnav-bg);
  color: var(--thd-topnav-muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  /* A long role name wraps inside the menu instead of widening it. */
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.thd-topnav__menulabel ~ .thd-topnav__menulink,
.thd-topnav__menulabel ~ .thd-topnav__form {
  border-top: 1px solid var(--thd-topnav-rule);
  border-radius: 0;
}

.thd-topnav__form {
  display: block;
  float: none;
  width: auto;
  margin: 0;
  padding: 0;
}

.thd-topnav__form .thd-topnav__menulink {
  border-radius: 0 0 6px 6px;
}

/* ---- quick jump (row only; shown by the script) ---- */
.thd-topnav__jump {
  display: none;
}

.thd-topnav__jumpinput {
  display: block;
  width: 100%;
  height: 40px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid var(--thd-topnav-control);
  border-radius: 6px;
  background: var(--thd-topnav-surface);
  background-image: none;
  box-shadow: none;
  color: var(--thd-topnav-text);
  font: inherit;
  /* 16px: the minimum for a text field (and no zoom on focus on iOS). */
  font-size: 16px;
  line-height: 24px;
  -webkit-appearance: none;
  appearance: none;
}

.thd-topnav__jumplabel {
  display: block;
  max-width: none;
  margin: 0;
  padding: 4px 4px 6px;
  color: var(--thd-topnav-muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
}

.thd-topnav__jumpinput:focus-visible {
  outline-offset: -1px;
}

.thd-topnav__jumplist {
  max-height: 264px;
  margin-top: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.thd-topnav__jumpgroup {
  margin-left: auto;
  padding-left: 16px;
  color: var(--thd-topnav-muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
}

.thd-topnav__jumpempty,
.thd-topnav__jumphint {
  margin: 0;
  padding: 8px 10px;
  color: var(--thd-topnav-muted);
  font-size: 12px;
  line-height: 16px;
}

.thd-topnav__jumphint {
  margin-top: 4px;
  border-top: 1px solid var(--thd-topnav-rule);
}

/* ---- menu button (drawer widths) ---- */
.thd-topnav__toggle {
  flex: none;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
}

.thd-topnav__toggle .thd-icon {
  width: 22px;
  height: 22px;
}

.thd-topnav__toggle .thd-topnav__icon-close,
.thd-topnav__toggle[aria-expanded="true"] .thd-topnav__icon-open {
  display: none;
}

.thd-topnav__toggle[aria-expanded="true"] .thd-topnav__icon-close {
  display: inline-flex;
}

.thd-topnav__toggle[aria-expanded="true"] {
  background-color: var(--thd-topnav-hover);
}

.thd-topnav__backdrop {
  display: none;
}

/* Read by assistive technology, not drawn. The account button's full user name is one of these at every
   width: the button shows the short identity, and the UAT sign-in check reads the name from the markup. */
.thd-topnav-sr,
.thd-topnav__username {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============ drawer: under 768px ============
   From 768px the bar is one row at every width and for every set of links: what does not fit is moved
   into "More" by the script (THDDEV-1996; the first version needed 1120px for the widest row). */
@media (max-width: 767.98px) {
  .thd-topnav__nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 2;
    /* Capped so a band of the page is always left showing beneath the drawer: a sheet allowed the
       whole viewport below the bar reads as "it took the page", which was the complaint. The drawer
       scrolls inside itself, so the cap hides nothing, and the band is covered by the backdrop,
       whose click handler closes the drawer (thd-topnav.js). */
    max-height: calc(100vh - var(--thd-topnav-height) - 64px);
    max-height: calc(100dvh - var(--thd-topnav-height) - 64px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px 8px 12px;
    border-bottom: 1px solid var(--thd-topnav-border);
    background: var(--thd-topnav-surface);
    box-shadow: var(--thd-topnav-shadow);
  }

  .thd-topnav.is-open .thd-topnav__nav {
    display: block;
    animation: thd-topnav-pop var(--thd-topnav-base) var(--thd-topnav-ease);
  }

  .thd-topnav.is-open .thd-topnav__backdrop {
    display: block;
    position: fixed;
    /* Below the bar's row. A small positive value, under the panel (z-index 2): a negative value is hidden
       by any stacking or isolation context an ancestor creates (the frame texture), which killed the scrim. */
    top: calc(var(--thd-topnav-height) + 1px);
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    background: rgba(26, 26, 26, 0.45);
    animation: thd-topnav-fade var(--thd-topnav-base) var(--thd-topnav-ease);
  }

  .thd-topnav__item + .thd-topnav__item {
    border-top: 1px solid var(--thd-topnav-rule);
  }

  .thd-topnav__nav .thd-topnav__trigger {
    justify-content: flex-start;
  }

  .thd-topnav__nav .thd-topnav__trigger .thd-topnav__chevron {
    margin-left: auto;
  }

  .thd-topnav__nav .thd-topnav__trigger .thd-topnav__chevron .thd-icon {
    width: 14px;
    height: 14px;
  }

  .thd-topnav__nav .thd-topnav__trigger[aria-expanded="true"] {
    background-color: transparent;
  }

  .thd-topnav__nav .thd-topnav__trigger[aria-expanded="true"]:hover {
    background-color: var(--thd-topnav-hover);
  }

  /* Groups open in place inside the drawer. */
  .thd-topnav__nav .thd-topnav__menu {
    padding: 0 0 6px 12px;
  }

  /* Phone: the account button is the chip alone, in a 44px target; the name is in its menu. */
  .thd-topnav__account .thd-topnav__user {
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
  }

  .thd-topnav__user .thd-topnav__shortname,
  .thd-topnav__user .thd-topnav__chevron {
    display: none;
  }

  .thd-topnav__account .thd-topnav__link:not(.thd-topnav__user) {
    padding-left: 10px;
    padding-right: 10px;
    font-size: 14px;
  }
}

@media (max-width: 359.98px) {
  /* 320px (WCAG reflow): tighter gutters so the logo, the menu button and the account controls stay on one row. */
  .thd-topnav__bar {
    gap: 2px;
    padding: 0 4px 0 8px;
  }

  .thd-topnav__brand {
    gap: 6px;
    padding-right: 4px;
  }

  .thd-topnav__account .thd-topnav__link:not(.thd-topnav__user) {
    padding-left: 6px;
    padding-right: 6px;
  }
}

/* ============ one row: 768px and up ============ */
@media (min-width: 768px) {
  .thd-topnav {
    --thd-topnav-height: 47px;
  }

  .thd-topnav__bar {
    gap: 8px;
    padding: 0 16px;
  }

  /* The brand keeps its automatic right margin: with no navigation (Home, the sign-in pages) it is what
     holds the account at the far end; with navigation the list takes the free space instead. */
  .thd-topnav__nav {
    flex: 1 1 0;
    min-width: 0;
    margin-left: 4px;
  }

  .thd-topnav__list {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 2px;
  }

  .thd-topnav__list > .thd-topnav__item {
    flex: none;
  }

  /* Until the script has measured the row, whatever would not fit wraps out of sight below it: the bar
     never overflows sideways and never jumps. The script then moves those entries into "More". */
  .thd-topnav:not([data-thd-topnav="ready"]) .thd-topnav__list {
    flex-wrap: wrap;
    max-height: var(--thd-topnav-link);
    overflow: hidden;
  }

  .thd-topnav__nav .thd-topnav__link,
  .thd-topnav__account .thd-topnav__link {
    width: auto;
    min-height: var(--thd-topnav-link);
    padding: 6px 10px;
    font-size: 14px;
    line-height: 20px;
  }

  /* The row's mark: a line on the bar's lower edge that grows from the middle on hover, focus and while a
     dropdown is open (grey), and stays for the current page (orange). */
  .thd-topnav__list > .thd-topnav__item > .thd-topnav__link::after {
    content: "";
    position: absolute;
    top: auto;
    left: 10px;
    right: 10px;
    bottom: calc((var(--thd-topnav-link) - var(--thd-topnav-height)) / 2);
    width: auto;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: var(--thd-topnav-mark);
    transform: scaleX(0);
    transition: transform var(--thd-topnav-base) var(--thd-topnav-ease);
  }

  .thd-topnav__list > .thd-topnav__item > .thd-topnav__link:hover::after,
  .thd-topnav__list > .thd-topnav__item > .thd-topnav__link:focus-visible::after,
  .thd-topnav__list > .thd-topnav__item > .thd-topnav__trigger[aria-expanded="true"]::after {
    transform: scaleX(1);
  }

  .thd-topnav__list > .thd-topnav__item > .thd-topnav__link[aria-current="page"]::after,
  .thd-topnav__list > .thd-topnav__item > .thd-topnav__link.is-current::after {
    height: 3px;
    background: var(--thd-topnav-brand);
    transform: scaleX(1);
    animation: thd-topnav-mark var(--thd-topnav-base) var(--thd-topnav-ease);
  }

  /* Dropdowns of the row. */
  .thd-topnav__nav .thd-topnav__menu {
    position: absolute;
    top: calc(100% + (var(--thd-topnav-height) - var(--thd-topnav-link)) / 2 + 5px);
    left: 0;
    z-index: 2;
    min-width: 208px;
    max-width: calc(100vw - 16px);
    padding: 4px;
    border: 1px solid var(--thd-topnav-border);
    border-radius: 8px;
    background: var(--thd-topnav-surface);
    box-shadow: var(--thd-topnav-shadow);
    transform-origin: top left;
    animation: thd-topnav-pop var(--thd-topnav-fast) var(--thd-topnav-ease);
  }

  .thd-topnav__menu--panel {
    top: calc(100% + (var(--thd-topnav-height) - var(--thd-topnav-link)) / 2 + 5px);
  }

  /* A panel taller than the window (a long "More" on a short landscape screen) scrolls inside itself. */
  .thd-topnav__nav .thd-topnav__menu,
  .thd-topnav__menu--panel {
    max-height: calc(100vh - var(--thd-topnav-height) - 16px);
    max-height: calc(100dvh - var(--thd-topnav-height) - 16px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .thd-topnav__menulink,
  .thd-topnav__menu--more .thd-topnav__link {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 20px;
  }

  .thd-topnav__menulink .thd-icon {
    color: var(--thd-topnav-muted);
  }

  /* "More": the entries that did not fit, in the menu order. It hangs from the right so it stays on screen. */
  .thd-topnav__nav .thd-topnav__menu--more {
    left: auto;
    right: 0;
    transform-origin: top right;
  }

  .thd-topnav__menu--more .thd-topnav__link {
    width: 100%;
    font-weight: 400;
  }

  .thd-topnav__menu--more .thd-topnav__link[aria-current="page"] {
    font-weight: 700;
  }

  /* A dropdown filed under "More" is listed open under its name; its own button is not shown. */
  .thd-topnav__menu--more .thd-topnav__trigger {
    display: none;
  }

  .thd-topnav__nav .thd-topnav__menu--more .thd-topnav__menu {
    display: block;
    position: static;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    animation: none;
    max-height: none;
    overflow: visible;
  }

  .thd-topnav__menu--more .thd-topnav__menuhead {
    display: block;
    padding: 8px 12px 2px;
    color: var(--thd-topnav-muted);
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
  }

  .thd-topnav__menu--more > .thd-topnav__item + .thd-topnav__item {
    border-top: 1px solid var(--thd-topnav-rule);
  }

  /* Register and Log in are the bar of the sign-in pages, where every control keeps a 44px target at
     every width (A11Y-27); the logo link keeps its 44px too. Both fit the 47px bar. */
  .thd-topnav__account .thd-topnav__link:not(.thd-topnav__user) {
    min-height: 44px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  /* Account. */
  .thd-topnav__account .thd-topnav__user {
    min-height: var(--thd-topnav-link);
    padding: 3px 8px 3px 3px;
  }

  .thd-topnav__avatar {
    width: 26px;
    height: 26px;
  }

  /* Quick jump: drawn as a small search field; the script narrows it to its icon when the row is tight. */
  .thd-topnav__jump {
    position: relative;
    display: block;
    flex: none;
  }

  .thd-topnav__jump .thd-topnav__jumpbtn {
    gap: 8px;
    width: 168px;
    min-height: var(--thd-topnav-link);
    padding: 5px 6px 5px 10px;
    border: 1px solid var(--thd-topnav-control);
    background-color: var(--thd-topnav-surface);
    color: var(--thd-topnav-muted);
    font-size: 14px;
    line-height: 20px;
    font-weight: 400;
    transition: border-color var(--thd-topnav-fast) var(--thd-topnav-ease), background-color var(--thd-topnav-fast) var(--thd-topnav-ease);
  }

  .thd-topnav__jump .thd-topnav__jumpbtn:hover,
  .thd-topnav__jump .thd-topnav__jumpbtn:focus,
  .thd-topnav__jump .thd-topnav__jumpbtn[aria-expanded="true"] {
    border-color: var(--thd-topnav-text);
    background-color: var(--thd-topnav-surface);
    color: var(--thd-topnav-text);
  }

  .thd-topnav__jumpbtn .thd-icon {
    width: 14px;
    height: 14px;
  }

  .thd-topnav__jumptext::after {
    content: "\2026";
  }

  .thd-topnav__kbd {
    margin-left: auto;
    padding: 0 5px;
    border: 1px solid var(--thd-topnav-border);
    border-radius: 4px;
    background: var(--thd-topnav-bg);
    color: var(--thd-topnav-muted);
    font-size: 12px;
    line-height: 16px;
    font-weight: 500;
    white-space: nowrap;
  }

  .thd-topnav__menu--jump {
    width: 320px;
    padding: 6px;
  }

  /* Tight row (set by the script before anything is moved to "More"): quick jump is its icon, the
     account button is its chip. The names stay in the accessibility tree. */
  .thd-topnav.is-tight .thd-topnav__jump .thd-topnav__jumpbtn {
    justify-content: center;
    width: var(--thd-topnav-link);
    padding: 0;
    border-color: transparent;
    background-color: transparent;
    color: var(--thd-topnav-text);
  }

  .thd-topnav.is-tight .thd-topnav__jump .thd-topnav__jumpbtn:hover,
  .thd-topnav.is-tight .thd-topnav__jump .thd-topnav__jumpbtn:focus,
  .thd-topnav.is-tight .thd-topnav__jump .thd-topnav__jumpbtn[aria-expanded="true"] {
    background-color: var(--thd-topnav-hover);
  }

  .thd-topnav.is-tight .thd-topnav__jumpbtn .thd-icon {
    width: 16px;
    height: 16px;
  }

  .thd-topnav.is-tight .thd-topnav__jumptext {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .thd-topnav.is-tight .thd-topnav__kbd,
  .thd-topnav.is-tight .thd-topnav__shortname {
    display: none;
  }

  .thd-topnav__toggle {
    display: none;
  }
}

@media (min-width: 1280px) {
  .thd-topnav__bar {
    gap: 12px;
    padding: 0 24px;
  }
}

/* A finger or a stylus on a row-width screen (a tablet): taller targets, the bar keeps its height. */
@media (min-width: 768px) and (pointer: coarse) {
  .thd-topnav {
    --thd-topnav-link: 40px;
  }

  .thd-topnav__nav .thd-topnav__link,
  .thd-topnav__account .thd-topnav__link {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .thd-topnav__account .thd-topnav__user {
    padding: 6px 10px 6px 6px;
  }

  .thd-topnav__menulink,
  .thd-topnav__menu--more .thd-topnav__link {
    min-height: 44px;
    padding-top: 12px;
    padding-bottom: 12px;
  }
}

/* ---- no script: the disclosure buttons cannot open anything, so they are removed (display: none takes
   them out of the tab order and the accessibility tree) and every link and the account panel are laid
   out in the flow, as one flat list. "More" and quick jump are written hidden and stay hidden. ---- */
@media (scripting: none) {
  .thd-topnav__toggle,
  .thd-topnav__trigger,
  .thd-topnav__backdrop {
    display: none;
  }

  /* The flat list wraps over several rows: the bar scrolls away with the page instead of covering it. */
  /* relative, not static: the texture overlay is absolutely positioned and needs the bar as its box. */
  .thd-topnav {
    position: relative;
  }

  body.thd-topnav-page #main,
  body.thd-topnav-page :target {
    scroll-margin-top: 0;
  }

  .thd-topnav__bar {
    flex-wrap: wrap;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .thd-topnav__nav {
    display: block;
    position: static;
    flex: 1 1 100%;
    max-height: none;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  /* Laid out in the flow on the graphite, the nav, its menus and the account panel are the bar again: the
     light-subtree rules above would give them dark ink on a transparent ground. Inherit the bar's values. */
  .thd-topnav .thd-topnav__nav,
  .thd-topnav .thd-topnav__nav .thd-topnav__menu,
  .thd-topnav .thd-topnav__menu--panel {
    --thd-topnav-bg: inherit;
    --thd-topnav-hover: inherit;
    --thd-topnav-border: inherit;
    --thd-topnav-rule: inherit;
    --thd-topnav-control: inherit;
    --thd-topnav-text: inherit;
    --thd-topnav-muted: inherit;
    --thd-topnav-focus: inherit;
  }

  .thd-topnav__list,
  .thd-topnav:not([data-thd-topnav="ready"]) .thd-topnav__list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    max-height: none;
    overflow: visible;
  }

  .thd-topnav__item + .thd-topnav__item {
    border-top: 0;
  }

  .thd-topnav__nav .thd-topnav__menu,
  .thd-topnav__menu--panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    position: static;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    animation: none;
    width: auto;
    max-height: none;
    overflow: visible;
  }

  .thd-topnav__nav .thd-topnav__link,
  .thd-topnav__nav .thd-topnav__menulink,
  .thd-topnav__menu--panel .thd-topnav__menulink {
    width: auto;
    min-height: 44px;
    padding: 10px 12px;
    border-top: 0;
    font-size: 14px;
    font-weight: 500;
  }

  .thd-topnav__list > .thd-topnav__item > .thd-topnav__link::after {
    content: none;
  }

  .thd-topnav__menulabel {
    min-width: 0;
    max-width: 100%;
    padding: 0 12px;
  }

  .thd-topnav__roles {
    padding: 0 12px 0 0;
  }

  .thd-topnav__menulabel ~ .thd-topnav__menulink,
  .thd-topnav__menulabel ~ .thd-topnav__form {
    border-top: 0;
  }

  .thd-topnav__account,
  .thd-topnav__menu--panel {
    min-width: 0;
    max-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .thd-topnav,
  .thd-topnav *,
  .thd-topnav *::before,
  .thd-topnav *::after {
    transition: none !important;
    animation: none !important;
  }
}

@media (forced-colors: active) {
  /* The graphite gradient and the noise are not system colours: the bar is Canvas with system text. */
  .thd-topnav {
    background-image: none;
  }

  .thd-topnav::after {
    display: none;
  }

  .thd-topnav,
  .thd-topnav__menu--panel,
  .thd-topnav__nav .thd-topnav__menu {
    border-color: CanvasText;
  }

  .thd-topnav__avatar,
  .thd-topnav__badge {
    border: 1px solid CanvasText;
  }

  .thd-topnav__list > .thd-topnav__item > .thd-topnav__link::after {
    background: CanvasText;
  }

  .thd-topnav__link[aria-current="page"]::after,
  .thd-topnav__link.is-current::after,
  .thd-topnav__menulink[aria-current="page"]::after,
  .thd-topnav__list > .thd-topnav__item > .thd-topnav__link[aria-current="page"]::after,
  .thd-topnav__list > .thd-topnav__item > .thd-topnav__link.is-current::after {
    background: Highlight;
  }

  .thd-topnav a:focus-visible,
  .thd-topnav button:focus-visible,
  .thd-topnav input:focus-visible {
    outline-color: Highlight;
  }
}

@media print {
  .thd-topnav,
  .thd-topnav-skip {
    display: none;
  }
}
