[data-sticky-nav] {
  position: relative;
  z-index: 100;
}

.sticky-nav-spacer {
  display: block;
  height: 0;
}

[data-sticky-nav].is-stuck {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  /* Fit the content (a signed-in avatar makes the row longer) instead of a fixed 720px that wrapped every label. */
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 8px 10px 8px 14px !important;
  border: 1px solid var(--line, #e9e7e1);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface, #fff) 90%, transparent);
  box-shadow: 0 8px 28px rgba(14, 14, 18, 0.14);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  transform: translateX(-50%);
  animation: sticky-nav-in 180ms ease-out;
}

[data-sticky-nav].is-stuck .logo {
  gap: 7px;
  font-size: 18px;
}

[data-sticky-nav].is-stuck .mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 11px;
}

[data-sticky-nav].is-stuck ul {
  gap: 18px;
  font-size: 13.5px;
}

[data-sticky-nav].is-stuck .btn,
[data-sticky-nav].is-stuck .button {
  min-height: 38px;
  padding: 8px 15px;
  font-size: 13.5px;
}

@keyframes sticky-nav-in {
  from {
    opacity: 0;
    transform: translate(-50%, -10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

/* Nav labels and the CTA never break onto two lines ("How to / convert", "Add to / Chrome"). */
[data-sticky-nav] ul a,
[data-sticky-nav] .btn,
[data-sticky-nav] .button {
  white-space: nowrap;
}

/* Between phone and wide desktop the compact pill has no room for everything: drop the links that only jump
   within this page (they are one scroll away) and keep the ones that go somewhere else. */
@media (min-width: 761px) and (max-width: 1060px) {
  [data-sticky-nav].is-stuck ul li:has(> a[href^="#"]) {
    display: none;
  }
}

/* Menu button: hidden on wide screens, replaces the link row on phones. */
.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--line, #e9e7e1);
  border-radius: 12px;
  background: var(--surface, #fff);
  color: var(--ink, #0e0e12);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.nav-toggle:focus-visible {
  outline: 3px solid var(--yellow, #ffd23f);
  outline-offset: 3px;
}

.nav-toggle svg {
  width: 20px;
  height: 20px;
  display: block;
}

.nav-toggle .icon-close,
[data-sticky-nav].is-open .nav-toggle .icon-open {
  display: none;
}

[data-sticky-nav].is-open .nav-toggle .icon-close {
  display: block;
}

@media (max-width: 760px) {
  [data-sticky-nav].is-stuck {
    width: min(360px, calc(100vw - 24px));
    padding: 7px 8px 7px 12px !important;
  }

  .nav-toggle {
    display: inline-flex;
  }

  [data-sticky-nav].is-stuck .nav-toggle {
    width: 38px;
    height: 38px;
    border-radius: 999px;
  }

  /* The link row becomes a panel under the bar; only shown when the button opens it. */
  [data-sticky-nav] ul {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 8px;
    border: 1px solid var(--line, #e9e7e1);
    border-radius: 18px;
    background: var(--surface, #fff);
    box-shadow: 0 12px 32px rgba(14, 14, 18, 0.16);
    font-size: 15px;
  }

  [data-sticky-nav].is-open ul {
    display: flex;
  }

  [data-sticky-nav] ul li {
    margin: 0;
  }

  [data-sticky-nav] ul a {
    display: block;
    padding: 12px 14px;
    border-radius: 12px;
    min-height: 44px;
    box-sizing: border-box;
  }

  [data-sticky-nav] ul a:hover,
  [data-sticky-nav] ul a:focus-visible {
    background: var(--grey-block, #efeeea);
  }

  [data-sticky-nav].is-stuck ul {
    left: 4px;
    right: 4px;
    gap: 0;
    font-size: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-sticky-nav].is-stuck {
    animation: none;
  }
}

/*
 * The signed-in avatar navlite.js injects after the "Add to Chrome" CTA. Kept to 32px so the stuck nav
 * (sized to its content) stays compact; the ::after pseudo-element grows the actual tap target to the
 * 44px accessibility minimum without taking any extra layout space.
 */
.avatar-lite {
  /* No overflow:hidden here — it would clip the ::after below along with everything else. The circular
     crop is done per-child (the border-radius on the image, the box's own border-radius under the text)
     instead, so the pseudo-element can extend past the 32px box to reach the 44px tap target. */
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-left: 10px;
  border-radius: 999px;
  background: var(--grey-block, #efeeea);
  color: var(--ink, #0e0e12);
  font: 600 12px/1 inherit;
  text-decoration: none;
}

.avatar-lite::after {
  content: "";
  position: absolute;
  inset: -6px;
}

.avatar-lite img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  object-fit: cover;
}

.avatar-lite:focus-visible {
  outline: 3px solid var(--yellow, #ffd23f);
  outline-offset: 3px;
}
