html {
  /* Reserve scrollbar gutter to prevent horizontal layout jump between pages. */
  scrollbar-gutter: stable;
  overflow-y: scroll;
}

html::-webkit-scrollbar {
  width: 6px;
}

html::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

html::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 99px;
}

html::-webkit-scrollbar-thumb:hover {
  background: var(--gold-soft, #f1d49d);
}

.site-nav {
  --site-nav-active: var(--gold-soft, #f1d49d);
  --site-nav-text: var(--text-soft, #94a3b8);
  --site-nav-text-hover: var(--text, #e9eef7);
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  padding: 2px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Keep top divider consistent across pages to avoid visual jump on navigation. */
.hero-top {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

:root[data-theme="light"] .hero-top {
  border-bottom: 1px solid rgba(36, 54, 84, 0.15);
}

.site-link {
  text-decoration: none;
  color: var(--site-nav-text);
  border: 0 !important;
  background: transparent !important;
  border-radius: 10px 10px 0 0;
  padding: 9px 12px 10px;
  font-size: 14px;
  letter-spacing: 0.02em;
  font-weight: 580;
  transition: color 0.2s ease;
  position: relative;
}

.site-link::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  border-radius: 999px;
  background: transparent;
  transition: background-color 0.2s ease;
}

.site-link:hover {
  color: var(--site-nav-text-hover);
  background: transparent !important;
}

.site-link.active {
  color: var(--site-nav-active);
  font-weight: 700;
  background: rgba(224, 185, 107, 0.08) !important;
  box-shadow: none !important;
}

.site-link.active::after {
  background: currentColor;
}

:root[data-theme="light"] .site-nav {
  border-bottom-color: rgba(36, 54, 84, 0.15);
}

:root[data-theme="light"] .site-link {
  color: #4c607f;
}

:root[data-theme="light"] .site-link:hover {
  color: #253653;
}

:root[data-theme="light"] .site-link.active {
  color: #d35400;
  background: rgba(255, 122, 26, 0.1) !important;
}

@media (max-width: 560px) {
  .site-nav {
    margin-top: 14px;
    gap: 0;
  }

  .site-link {
    font-size: 13px;
    padding: 8px 10px 9px;
  }

  .brand-logo {
    width: 90px;
  }

  .brand-title {
    font-size: 20px;
  }
}

@media (max-width: 980px) {
  /* Normalize top header spacing between pages (index/history/about). */
  .shell {
    width: 100%;
    margin: 0;
  }

  .hero {
    overflow: visible;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 0;
    border: none;
    box-shadow: none;
    background: #0f1218;
  }

  :root[data-theme="light"] .hero {
    background: #f4f8fd;
  }

  .hero::before,
  .hero::after {
    content: none;
  }

  .hero-top {
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    padding-bottom: 14px;
  }

  .hero-actions {
    margin-left: auto;
    gap: 8px;
  }

  .theme-switch-btn {
    width: 38px;
    height: 38px;
  }

  .hero-note {
    display: none;
  }

  .site-nav {
    margin-top: 14px;
  }
}

@media (max-width: 560px) {
  .theme-switch-btn {
    width: 36px;
    height: 36px;
  }
}
