/* Layout: page shell, topbar & navigation, footer, refraction enhancement */

.page-shell {
  position: relative;
  isolation: isolate;
  padding-bottom: 36px;
}

.topbar {
  position: sticky;
  top: 20px;
  z-index: 30;
  padding-top: 20px;
  isolation: isolate;
}

.topbar .container {
  position: relative;
  display: flex;
  justify-content: center;
}

.topbar.is-condensed .nav-shell {
  padding: 6px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.16) inset,
    0 0.5px 0 rgba(255, 255, 255, 0.92) inset,
    0 16px 40px rgba(41, 54, 77, 0.1);
}

.topbar.is-condensed .site-nav {
  padding: 2px;
}

.topbar.is-condensed .nav-link {
  min-height: 38px;
}

.nav-shell {
  width: min(100%, 980px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.26);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.2) inset,
    0 0.5px 0 rgba(255, 255, 255, 0.95) inset,
    1px 0 0 rgba(255, 90, 140, 0.05) inset,
    -1px 0 0 rgba(60, 170, 255, 0.05) inset,
    0 20px 48px rgba(28, 33, 40, 0.12);
  backdrop-filter: blur(40px) saturate(150%) brightness(1.04);
  -webkit-backdrop-filter: blur(40px) saturate(150%) brightness(1.04);
  transition:
    padding 260ms cubic-bezier(0.22, 1, 0.36, 1),
    border-radius 260ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 260ms ease,
    background 260ms ease;
}

.nav-shell::before {
  z-index: 1;
  opacity: 0.5;
}

.nav-shell > * {
  z-index: 2;
}

/* Scroll progress: thin gradient line pinned to the nav-shell bottom edge */
.scroll-progress {
  position: absolute;
  left: 26px;
  right: 26px;
  bottom: 1px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    rgba(116, 146, 194, 0),
    rgba(116, 146, 194, 0.7),
    rgba(60, 170, 255, 0.7),
    rgba(116, 146, 194, 0)
  );
  transform: scaleX(0);
  transform-origin: left center;
  pointer-events: none;
  z-index: 3;
}

.site-nav {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 4px;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.site-nav::-webkit-scrollbar {
  display: none;
}

.nav-indicator {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 10px 24px rgba(45, 58, 80, 0.08);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  transition:
    transform 360ms cubic-bezier(0.22, 1, 0.36, 1),
    width 360ms cubic-bezier(0.22, 1, 0.36, 1),
    height 360ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 220ms ease;
}

.nav-indicator.is-visible {
  opacity: 1;
}

.nav-link {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  width: 8.4em;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
  box-shadow: none;
  z-index: 1;
  transition:
    color 220ms ease,
    transform 220ms ease,
    min-height 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-link::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.05)),
    rgba(255, 255, 255, 0.04);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.14) inset,
    0 1px 0 rgba(255, 255, 255, 0.3) inset;
  opacity: 0;
  transition:
    opacity 220ms ease,
    box-shadow 220ms ease;
  z-index: 0;
}

.nav-link:hover::before,
.nav-link:focus-visible::before {
  opacity: 1;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.22) inset,
    0 1px 0 rgba(255, 255, 255, 0.4) inset,
    0 10px 18px rgba(45, 58, 80, 0.08);
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--text-1);
}

.nav-link.active {
  color: var(--text-1);
  background: transparent;
  box-shadow: none;
}

.site-footer {
  display: grid;
  gap: 14px;
  padding-top: 14px;
}

.back-to-top {
  justify-self: center;
}

@supports (backdrop-filter: url("#lg-refract")) or (-webkit-backdrop-filter: url("#lg-refract")) {
  .nav-shell,
  .glass-button,
  .publication-badge {
    backdrop-filter: url(#lg-refract) blur(28px) saturate(170%) brightness(1.05);
    -webkit-backdrop-filter: url(#lg-refract) blur(28px) saturate(170%) brightness(1.05);
  }
}
