/* Shared top nav */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 -8px 8px;
  padding: 12px 8px;
  background: var(--nav-bg, rgba(6, 7, 10, 0.88));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft, rgba(42, 37, 32, 0.85));
}

.site-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text, #f0ebe5);
  text-decoration: none;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.site-nav-brand img {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 7px;
  object-fit: cover;
  background: var(--surface2, #161a20);
}

.site-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border, #2a2520);
  border-radius: 10px;
  color: var(--text, #f0ebe5);
  cursor: pointer;
}

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

.site-nav-links {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  flex-shrink: 0;
}

.site-nav-links > a,
.site-nav-drop > summary {
  padding: 8px 10px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted, #9a8f82);
  text-decoration: none;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
  list-style: none;
  cursor: pointer;
  white-space: nowrap;
}

.site-nav-links > a:hover,
.site-nav-drop > summary:hover {
  color: var(--text, #f0ebe5);
  background: var(--hover-wash, rgba(255, 255, 255, 0.04));
}

.site-nav-links > a.active,
.site-nav-drop.active > summary {
  color: var(--accent-bright, #e8a84a);
}

.site-nav-drop {
  position: relative;
}

.site-nav-drop > summary::-webkit-details-marker {
  display: none;
}

.site-nav-drop > summary::after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 6px;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-top: 4px solid currentColor;
  vertical-align: middle;
  opacity: 0.7;
  transition: transform 0.18s ease;
}

.site-nav-drop[open] > summary::after {
  transform: rotate(180deg);
}

.site-nav-drop-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 168px;
  max-height: min(70vh, 420px);
  overflow-y: auto;
  padding: 6px;
  background: var(--drop-bg, #0e1014);
  border: 1px solid var(--border, #2a2520);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  z-index: 120;
  transform-origin: top left;
  animation: nav-drop-in 0.18s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes nav-drop-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.site-nav-drop-panel--mega {
  min-width: 200px;
  padding: 8px;
}

.site-nav-drop-section {
  margin: 8px 8px 4px;
  padding: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint, #6b635a);
}

.site-nav-drop-section:first-child {
  margin-top: 2px;
}

.site-nav-drop-panel a {
  display: block;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted, #9a8f82);
  text-decoration: none;
  border-radius: 7px;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.site-nav-drop-panel a:hover,
.site-nav-drop-panel a.active {
  color: var(--accent-bright, #e8a84a);
  background: rgba(var(--accent-rgb), 0.08);
}

.site-nav-cta {
  display: inline-flex !important;
  align-items: center;
  margin-left: 4px;
  padding: 7px 12px !important;
  color: #06070a !important;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent-dim)) !important;
  border-radius: 999px !important;
  font-weight: 700 !important;
  font-size: 0.82rem !important;
}

.site-nav-theme {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-left: 2px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border, #2a2520);
  border-radius: 10px;
  color: var(--text-muted, #9a8f82);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.site-nav-jump {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-left: 2px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border, #2a2520);
  border-radius: 10px;
  color: var(--text-muted, #9a8f82);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.site-nav-jump:hover,
.site-nav-theme:hover {
  color: var(--accent-bright, #e8a84a);
  border-color: var(--accent, #d4943c);
  background: var(--hover-wash, rgba(255, 255, 255, 0.04));
}

.site-nav-jump svg,
.site-nav-theme svg {
  width: 18px;
  height: 18px;
}

.site-jump {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 24px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
}

.site-jump-panel {
  width: min(520px, 100%);
  background: var(--drop-bg, #0e1014);
  border: 1px solid var(--border, #2a2520);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.site-jump-form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, #2a2520);
}

.site-jump-input {
  flex: 1;
  min-width: 0;
  padding: 8px 0;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text, #f0ebe5);
  background: transparent;
  border: 0;
  outline: none;
}

.site-jump-kbd {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted, #9a8f82);
  border: 1px solid var(--border, #2a2520);
  border-radius: 6px;
  padding: 3px 7px;
}

.site-jump-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  max-height: min(50vh, 360px);
  overflow-y: auto;
}

.site-jump-item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.site-jump-item:hover,
.site-jump-item.active {
  background: rgba(var(--accent-rgb), 0.1);
}

.site-jump-group {
  flex: 0 0 64px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint, #6b635a);
}

.site-jump-label {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text, #f0ebe5);
}

.site-jump-hint {
  margin: 0;
  padding: 8px 16px 12px;
  font-size: 0.75rem;
  color: var(--text-faint, #6b635a);
}

.tool-badge-new {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: middle;
  color: #06070a;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent-dim));
  border-radius: 999px;
}

.site-nav-cta:hover {
  filter: brightness(1.06);
  color: #06070a !important;
}

/* Hide brand text on tablet+mobile so icon + controls stay visible */
@media (max-width: 960px) {
  .site-nav-brand span {
    display: none;
  }
}

@media (max-width: 720px) {
  .site-nav-toggle {
    display: inline-flex;
    flex-shrink: 0;
  }

  .site-nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 2px;
    margin-left: 0;
    padding: 12px 16px 18px;
    background: var(--drop-bg, rgba(10, 12, 16, 0.98));
    border-bottom: 1px solid var(--border, #2a2520);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
    /* Sticky nav keeps this panel fixed — it must scroll itself */
    max-height: calc(100vh - 56px);
    max-height: calc(100dvh - 56px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .site-nav-theme {
    align-self: flex-start;
    margin: 4px 0 0;
  }

  .site-nav.open .site-nav-links {
    display: flex;
  }

  .site-nav-links > a,
  .site-nav-drop > summary {
    padding: 12px 14px;
  }

  .site-nav-drop-panel {
    position: static;
    margin: 0 8px 8px;
    box-shadow: none;
    max-height: none;
    overflow: visible;
    animation: none;
  }

  .site-nav-cta {
    margin: 8px 0 0;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-nav-drop-panel {
    animation: none !important;
  }
  .site-nav-drop > summary::after {
    transition: none !important;
  }
}
