.sticky-header-container {
  z-index: 30;
  position: sticky;
  top: 0;
}
.masthead-frame {
  display: grid;
  align-content: center;
  height: var(--masthead-visible-height, auto);
  flex: none;
}
.masthead-frame .masthead {
  width: 100%;
}
.masthead-frame .brand {
  transform: scale(var(--masthead-brand-scale, 1));
  transform-origin: left center;
}
.masthead-frame .brand img {
  transform: scale(var(--masthead-logo-scale, 1));
}
/* Keep the collapsed bar reachable while its contents scale with the scroll. */
@property --menu-restoration {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
body {
  --visible-menu-scale: calc(var(--menu-scale, 1) + (1 - var(--menu-scale, 1)) * var(--menu-restoration));
  --menu-reduction: calc((1 - var(--menu-restoration)) * min(var(--menu-collapse, 0px), max(0px, var(--menu-height, 44px) - 44px)));
}
/* Reserve the released height so content stays in place. */
.masthead-spacer {
  height: calc(var(--masthead-collapse, 0px) + var(--menu-reduction));
}
header.sticky-header .navigation-wrap {
  margin-bottom: calc(-1 * var(--menu-reduction));
}
@media (width > 800px) {
  header.sticky-header .navigation-wrap {
    transform: scale(var(--visible-menu-scale));
    transform-origin: center top;
  }
}
@media (max-width: 800px) {
  header.sticky-header .mobile-toggle .menu-caption {
    display: inline-block;
    transform: scale(var(--visible-menu-scale));
    transform-origin: left center;
  }
  header.sticky-header .mobile-toggle::before { content: none; }
  header.sticky-header .menu-caption::before {
    content: "☰";
    margin-right: 9px;
    color: var(--blue);
  }
  body:has(.navigation-disclosure[open]) {
    --menu-restoration: 1;
  }
}
body:has(.navigation :focus-visible, .navigation [data-submenu][open]) {
  --menu-restoration: 1;
}
@media (prefers-reduced-motion: no-preference) {
  body { transition: --menu-restoration 180ms ease-in-out; }
}
@media (hover: hover) {
  body:has(.navigation:hover) {
    --menu-restoration: 1;
  }
}
body .skip:focus {
  position: fixed;
  z-index: 31;
}
@media (max-width: 800px) {
  header.sticky-header {
    display: flex;
    flex-direction: column;
    max-height: 100dvh;
  }
  header.sticky-header .navigation {
    overflow-y: auto;
    overscroll-behavior-y: contain;
  }
}

.media-word { position: relative; }
.media-word .word-card {
  display: none;
  position: absolute;
  z-index: 1;
  top: 100%;
  right: -12px;
  padding-top: 6px;
}
.word-card img {
  display: block;
  width: 168px;
  height: auto;
  padding: 8px;
  background: var(--pale);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 6px 18px #17344926;
}
.media-word:focus-within .word-card { display: block; }
@media (hover: hover) {
  .media-word:hover .word-card { display: block; }
}
.masthead-frame:has(.media-word:is(:hover, :focus-within)) {
  position: relative;
  z-index: 12;
  pointer-events: none;
}
.masthead-frame:has(.media-word:is(:hover, :focus-within)) .masthead > * { pointer-events: auto; }

.home-discovery > .home-intro { margin-top: 0; }
main:has(> .breadcrumbs:first-child),
main > .breadcrumbs:first-child,
main > .section:first-child { padding-top: 0; }
@media (width > 800px) {
  .navigation .nav-items { padding-bottom: 12px; }
}
@media (max-width: 520px) {
  .masthead .home-header-actions { margin-inline-start: auto; }
}
.home-nav-media, .home-media-card { display: none; }
@media (max-width: 800px) {
  .navigation .mobile-toggle { anchor-name: --home-topic; }
  .home-nav-media {
    display: flex;
    position: absolute;
    position-anchor: --home-topic;
    top: anchor(top, 10px);
    right: 36px;
  }
  .home-media-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 4px;
    color: var(--blue);
    background: transparent;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
  }
  .home-media-toggle:hover, .home-media-toggle:focus-visible { background: var(--pale); }
  .home-media-card:popover-open {
    display: block;
    position: fixed;
    inset: auto 8px auto auto;
    top: anchor(bottom);
    right: max(8px, anchor(right, 176px) - 168px);
    margin: 4px 0 0;
    padding: 0;
    background: transparent;
    border: 0;
    overflow: visible;
  }
  .home-media-card a { display: block; border-radius: 12px; }
}

@media (max-width: 700px) {
  .home-nav-media { right: 20px; }
}

@media (700px < width <= 800px) {
  header.sticky-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content max-content;
    align-items: center;
    column-gap: 12px;
    padding-inline: 36px;
    border-bottom: 1px solid var(--line);
  }
  .sticky-header .masthead-frame {
    grid-area: 1 / 1 / 2 / -1;
    grid-template-columns: subgrid;
  }
  .sticky-header .masthead {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    gap: inherit;
    padding: 10px 0;
  }
  .sticky-header .masthead .brand img {
    width: 48px;
    height: 48px;
  }
  .sticky-header .masthead > .brand { justify-self: start; }
  .sticky-header .home-header-actions {
    grid-column: 3;
    align-self: start;
    margin-block-start: 3px;
  }
  header.sticky-header .navigation {
    grid-area: 1 / 2;
    align-self: start;
    margin-block-start: 13px;
    overflow: visible;
    border: 0;
    z-index: 1;
  }
  header.sticky-header .navigation-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    position: static;
    padding: 0;
  }
  .sticky-header .navigation .mobile-toggle {
    margin: 0;
    padding-inline: 12px;
  }
  .sticky-header .home-nav-media { position: static; }
  .sticky-header .navigation .nav-items {
    position: absolute;
    inset: 100% 0 auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    max-height: calc(100dvh - var(--masthead-visible-height, 68px) - 1px);
    overflow-y: auto;
    overscroll-behavior-y: contain;
    padding: 10px 36px 16px;
    background: var(--header-background, #fff);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 24px #17344926;
  }
}
