/* The translucent surface lets the night photograph show through. */
.topbar {
  position: absolute;
  --dock-fallback-anchor: calc(36.45vw + 38px);
  --dock-x: var(--dock-anchor, var(--dock-fallback-anchor));
  --dock-spring: cubic-bezier(.16, 1, .3, 1);
  --dock-closed-size: 68px;
  --dock-expanded-size: min(434px, calc(100vw - var(--dock-x) + 22px), calc(100vw - 24px));
  left: var(--dock-x);
  top: calc(48px + env(safe-area-inset-top, 0px));
  bottom: auto;
  transform: translateX(-34px);
  z-index: 30;
  width: 68px;
  max-width: calc(100% - 24px);
  height: 68px;
  margin: 0;
  padding: 9px;
  justify-content: flex-start;
  gap: 0;
  overflow: hidden;
  border: 1px solid rgba(201, 231, 249, .17);
  border-radius: 23px;
  background: linear-gradient(115deg,
    rgba(193, 224, 248, .10),
    rgba(10, 26, 39, .30) 32%,
    rgba(7, 22, 34, .25) 72%,
    rgba(48, 126, 181, .15));
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  backdrop-filter: blur(24px) saturate(140%);
  box-shadow: 0 12px 36px rgba(0, 0, 0, .18),
    inset 0 1px 0 rgba(235, 248, 255, .08),
    inset 0 -1px 0 rgba(100, 177, 223, .04);
  isolation: isolate;
  transition: width .56s var(--dock-spring), border-color .35s ease, box-shadow .45s ease;
}

.topbar.is-open {
  width: var(--dock-expanded-size);
  border-color: rgba(211, 237, 255, .27);
  box-shadow: 0 16px 44px rgba(0, 0, 0, .24), inset 0 1px 0 rgba(240, 250, 255, .13), inset 0 -1px 0 rgba(100, 177, 223, .06);
}
.hero-first-word { display: inline-block; white-space: nowrap; }
.dock-letter-measure { position: absolute; visibility: hidden; pointer-events: none; white-space: pre; }
.workspace { padding-top: 132px; padding-bottom: 70px; }
html { scroll-padding-top: calc(138px + env(safe-area-inset-top, 0px)); scroll-padding-bottom: 24px; }
.toast { bottom: calc(25px + env(safe-area-inset-bottom, 0px)); z-index: 40; }

.topbar::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(130deg, rgba(223, 242, 255, .035), transparent 42%);
  pointer-events: none;
  z-index: -1;
}

.topbar::after {
  content: '';
  position: absolute;
  top: -1px;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(197, 231, 253, .36) 28%, rgba(142, 209, 250, .15) 68%, transparent);
  pointer-events: none;
}

.topbar .brand {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(190, 230, 255, .14);
  border-radius: 15px;
  background: linear-gradient(145deg, rgba(198, 233, 255, .09), rgba(64, 143, 198, .035));
  box-shadow: inset 0 1px 0 rgba(232, 248, 255, .08), 0 4px 14px rgba(0, 8, 17, .1);
  filter: none;
  transition: background .28s ease, border-color .28s ease, box-shadow .35s ease;
}

.topbar .brand:hover {
  background: rgba(116, 201, 255, .12);
  border-color: rgba(168, 226, 255, .35);
  box-shadow: inset 0 1px 0 rgba(232, 248, 255, .12), 0 0 20px rgba(49, 163, 234, .12);
  filter: none;
}

.topbar .brand-paw {
  width: 35px;
  height: 38px;
  margin: 0;
  filter: drop-shadow(0 2px 6px rgba(0, 126, 225, .18));
}

.topbar > .brand,
.topbar > .main-nav {
  z-index: 1;
}

.header-sheen {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.header-sheen::before {
  content: '';
  position: absolute;
  inset: -20% -5%;
  background: linear-gradient(108deg,
    transparent 40%,
    rgba(119, 207, 255, .025) 45%,
    rgba(227, 248, 255, .16) 49%,
    rgba(255, 255, 255, .30) 50%,
    rgba(167, 225, 255, .11) 52%,
    transparent 58%);
  filter: blur(2px);
  opacity: 0;
  transform: translate3d(-115%, 0, 0);
  animation: header-glint 10s ease-in-out infinite;
}

@keyframes header-glint {
  0%, 84% { opacity: 0; transform: translate3d(-115%, 0, 0); }
  86% { opacity: 1; }
  98% { opacity: 1; transform: translate3d(115%, 0, 0); }
  100% { opacity: 0; transform: translate3d(115%, 0, 0); }
}

.main-nav {
  position: absolute;
  top: 11px;
  left: 66px;
  right: 10px;
  bottom: auto;
  transform: none;
  gap: 4px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  box-shadow: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, visibility 0s linear .22s;
}

.topbar.is-open .main-nav {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transition: opacity .24s ease .04s, visibility 0s;
}

.main-nav .nav-button {
  --entry-delay: 0s;
  width: auto;
  min-width: 0;
  height: 44px;
  flex: 1 1 0;
  gap: 0;
  border: 1px solid transparent;
  border-radius: 13px;
  background: rgba(185, 223, 249, .035);
  box-shadow: none;
  color: #d8e5ee;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: .1px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .28);
  opacity: 0;
  transform: translate3d(-16px, 3px, 0) scale(.94);
  transform-origin: left center;
  filter: blur(5px);
  transition: opacity .14s ease, transform .22s var(--dock-spring), filter .16s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.topbar.is-open .nav-button {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  filter: blur(0);
  transition: opacity .28s ease var(--entry-delay), transform .48s var(--dock-spring) var(--entry-delay), filter .34s ease var(--entry-delay), background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.topbar.is-open .nav-button:nth-child(1) { --entry-delay: .07s; }
.topbar.is-open .nav-button:nth-child(2) { --entry-delay: .13s; }
.topbar.is-open .nav-button:nth-child(3) { --entry-delay: .19s; }

/* Proximity changes the clipping window while the links keep their full width. */
.topbar.is-proximity {
  width: calc(var(--dock-closed-size) + (var(--dock-expanded-size) - var(--dock-closed-size)) * var(--dock-progress, 0));
  transition: width .14s linear, border-color .25s ease, box-shadow .3s ease;
}
.topbar.is-proximity .main-nav {
  right: auto;
  width: calc(var(--dock-expanded-size) - 76px);
  opacity: var(--dock-progress, 0);
  visibility: visible;
  transition: opacity .14s linear;
}
.topbar.is-proximity:not(.is-open) .main-nav { pointer-events: none; }
.topbar.is-proximity .nav-button {
  opacity: clamp(0, calc(var(--dock-progress, 0) * 1.35 - .1), 1);
  transform: translate3d(calc((1 - var(--dock-progress, 0)) * -10px), 0, 0);
  filter: blur(calc((1 - var(--dock-progress, 0)) * 3px));
  transition: opacity .14s linear, transform .14s linear, filter .14s linear, background .18s ease, border-color .18s ease;
}

.main-nav .nav-button::before {
  content: none;
}

.main-nav .nav-button:hover {
  color: #fff;
  background: rgba(180, 223, 255, .08);
  border-color: rgba(199, 235, 255, .09);
  box-shadow: inset 0 1px 0 rgba(239, 250, 255, .05);
}

.main-nav .nav-button[aria-current="page"] {
  color: #f4fbff;
  background: linear-gradient(135deg, rgba(63, 161, 222, .24), rgba(40, 117, 173, .13));
  border-color: rgba(135, 212, 255, .24);
  box-shadow: inset 0 1px 0 rgba(205, 239, 255, .10), 0 3px 12px rgba(0, 9, 18, .13);
}

.topbar a:focus-visible,
.topbar button:focus-visible {
  outline: 2px solid #a9e2ff;
  outline-offset: 3px;
}

@media (max-width: 750px) {
  .topbar {
    height: 66px;
    width: 66px;
    --dock-fallback-anchor: 42px;
    --dock-closed-size: 66px;
    --dock-expanded-size: min(414px, calc(100vw - var(--dock-x) + 21px), calc(100vw - 24px));
    top: calc(34px + env(safe-area-inset-top, 0px));
    bottom: auto;
    margin: 0;
    padding: 8px;
    transform: translateX(-33px);
    gap: 0;
    border-radius: 21px;
  }
  .topbar.is-open {
    width: var(--dock-expanded-size);
  }
  .workspace { padding-top: calc(104px + env(safe-area-inset-top, 0px)); padding-bottom: 36px; }
  .toast { bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
  .main-nav { top: 10px; left: 64px; right: 8px; }
  .topbar.is-proximity .main-nav { width: calc(var(--dock-expanded-size) - 72px); }
  .topbar .brand { width: 48px; height: 48px; border-radius: 15px; }
  .topbar .brand-paw { width: 34px; height: 37px; }
  .main-nav .nav-button { width: auto; height: 44px; font-size: clamp(14px, 4vw, 17px); border-radius: 13px; }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar { background: rgba(5, 18, 29, .88); }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar { background: rgba(5, 18, 29, .94); }
}

@media (prefers-reduced-motion: reduce) {
  .header-sheen { display: none; }
  .header-sheen::before { animation: none; }
}
