/* ========== BODY OFFSET FOR FIXED NAV ========== */
body {
  padding-top: 90px !important;
}

@media (max-width: 768px) {
  body {
    padding-top: 52px !important;
  }
}

/* Push down any existing in-page fixed/sticky navs */
body > nav:not(.site-nav),
.sticky-nav,
.topnav {
  top: 90px !important;
  z-index: 99 !important;
}

@media (max-width: 768px) {
  body > nav:not(.site-nav),
  .sticky-nav,
  .topnav {
    top: 52px !important;
  }
}

/* ========== SITE NAVIGATION BAR ========== */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.site-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- Logo ---- */
.site-nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: 16px;
}

.site-nav-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2997ff, #bf5af2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: #fff;
}

.site-nav-logo-text {
  font-size: 0.82rem;
  font-weight: 700;
  color: #f5f5f7;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.site-nav-logo-text span {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  color: #86868b;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---- Top-Level Nav Links Area ---- */
.site-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

/* ---- Home Link (top-level direct link) ---- */
.sn-home-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #86868b;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s;
}

.sn-home-link:hover {
  color: #f5f5f7;
  background: rgba(255, 255, 255, 0.06);
}

.sn-home-link.active {
  font-weight: 700;
}

.sn-home-link .nav-home-icon {
  font-size: 1rem;
  line-height: 1;
}

/* Divider between Home and dropdowns */
.site-nav-links .nav-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 6px;
  flex-shrink: 0;
}

/* ========== DROPDOWN WRAPPER ========== */
.sn-dropdown {
  position: relative;
}

/* ---- Dropdown Trigger Button ---- */
.sn-dd-trigger {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  color: #86868b;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s;
  font-family: inherit;
}

.sn-dd-trigger:hover {
  color: #f5f5f7;
  background: rgba(255, 255, 255, 0.06);
}

/* When this group contains the active page, highlight the trigger */
.sn-dd-trigger-active {
  color: #f5f5f7;
}

/* Chevron caret */
.sn-dd-caret {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

/* Rotate caret when open */
.sn-dd-open > .sn-dd-trigger .sn-dd-caret {
  transform: rotate(180deg);
}

/* ========== DROPDOWN PANEL ========== */
.sn-dd-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  min-width: 240px;
  background: rgba(15, 15, 20, 0.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 1001;
}

/* Open state */
.sn-dd-open > .sn-dd-panel {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* Category label inside dropdown */
.sn-dd-category {
  font-size: 0.6rem;
  font-weight: 700;
  color: #636366;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 6px 10px 8px;
}

/* ---- Dropdown Grid (single column for narrow, two-col for wider) ---- */
.sn-dd-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ========== WIDE PANEL (for groups with many items, e.g. Labs) ========== */
/* Two columns + bounded height so the panel fits on-screen no matter
   how many items the group contains. */
.sn-dd-panel--wide {
  min-width: 460px;
  /* Cap the panel so it never outgrows the viewport. Leaves room for
     the top nav (~100px) and a small margin at the bottom. */
  max-height: min(560px, calc(100vh - 140px));
}
.sn-dd-panel--wide .sn-dd-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 6px;
  /* If the list is still taller than the cap, scroll inside the grid
     instead of pushing the panel off-screen. */
  max-height: calc(min(560px, 100vh - 140px) - 54px);  /* minus category header */
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}
.sn-dd-panel--wide .sn-dd-grid::-webkit-scrollbar {
  width: 6px;
}
.sn-dd-panel--wide .sn-dd-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

/* When the viewport is narrower than the wide panel, fall back to
   a single column so it still fits. */
@media (max-width: 900px) {
  .sn-dd-panel--wide {
    min-width: 280px;
    max-height: calc(100vh - 120px);
  }
  .sn-dd-panel--wide .sn-dd-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Individual dropdown link ---- */
.sn-dd-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #b0b0b4;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
  border: 1px solid transparent;
}

.sn-dd-link:hover {
  color: #f5f5f7;
  background: rgba(255, 255, 255, 0.06);
}

/* Active link inside dropdown */
.sn-dd-link.active {
  font-weight: 700;
  /* background + color + border set inline by JS */
}

/* Number badge */
.sn-dd-link .nav-num,
.sn-home-link .nav-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* ---- Hamburger ---- */
.site-nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.site-nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: #f5f5f7;
  border-radius: 2px;
  transition: all 0.3s;
}

.site-nav-toggle span + span {
  margin-top: 5px;
}

/* Hamburger animation when open */
.site-nav-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.site-nav-toggle.open span:nth-child(2) {
  opacity: 0;
}

.site-nav-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ========== MOBILE SIDEBAR ========== */
.site-nav-mobile {
  display: none;
  position: fixed;
  top: 52px;
  right: 0;
  width: 290px;
  max-height: calc(100vh - 52px);
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 999;
  padding: 12px 16px 20px;
  overflow-y: auto;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0 0 0 16px;
}

.site-nav-mobile.open {
  display: block;
}

/* Category headers in mobile */
.sn-mobile-category {
  font-size: 0.6rem;
  font-weight: 700;
  color: #636366;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 16px 14px 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 4px;
}

.site-nav-mobile a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #86868b;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 10px;
  transition: all 0.2s;
}

.site-nav-mobile a:hover {
  color: #f5f5f7;
  background: rgba(255, 255, 255, 0.06);
}

/* Active link in mobile */
.site-nav-mobile a.active {
  font-weight: 700;
}

/* Home icon in mobile */
.site-nav-mobile .nav-home-icon {
  font-size: 1.2rem;
  line-height: 1;
  width: 26px;
  text-align: center;
  flex-shrink: 0;
}

.site-nav-mobile .nav-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* ========== TABLET ========== */
@media (max-width: 1024px) {
  .site-nav-logo {
    margin-right: 10px;
  }
}

/* ========== MOBILE ========== */
@media (max-width: 768px) {
  .site-nav-links {
    display: none;
  }

  .site-nav-toggle {
    display: flex;
    flex-direction: column;
  }

  .site-nav-inner {
    flex-wrap: nowrap;
    padding: 10px 16px;
  }
}
