:root {
  --nav-h: 56px;
  --topnav-h: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

html[data-theme="light"] {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --border: #d0d7de;
  --text: #1f2328;
  --muted: #656d76;
  --blue: #0969da;
  --green: #1a7f37;
  --red: #cf222e;
  --amber: #9a6700;
}

html[data-theme="light"] header.site-topbar,
html[data-theme="light"] nav.site-menu-panel {
  background: #ffffff;
  border-color: #d0d7de;
}

.site-theme-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid #30363d;
  color: inherit;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 16px;
}

body.has-site-nav {
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 12px) !important;
}

body.has-site-topnav {
  padding-top: calc(var(--topnav-h) + var(--safe-t)) !important;
}

/* Top bar + hamburger menu */
header.site-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 400;
  height: calc(var(--topnav-h) + var(--safe-t));
  padding-top: var(--safe-t);
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 12px;
  padding-right: 16px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
}

.site-menu-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #21262d;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.site-menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: #e6edf3;
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}

.site-menu-btn[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.site-menu-btn[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.site-menu-btn[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.site-topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: #e6edf3;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-menu-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 401;
  background: rgba(1, 4, 9, 0.55);
}

.site-menu-backdrop.open {
  display: block;
}

nav.site-menu-panel {
  position: fixed;
  top: calc(var(--topnav-h) + var(--safe-t));
  left: 0;
  right: 0;
  z-index: 402;
  max-height: 0;
  overflow: hidden;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
  transition: max-height 0.25s ease;
}

nav.site-menu-panel.open {
  max-height: min(70vh, 420px);
  overflow-y: auto;
}

nav.site-menu-panel a {
  display: block;
  padding: 14px 20px;
  font-size: 15px;
  color: #e6edf3;
  text-decoration: none;
  border-bottom: 1px solid #21262d;
}

nav.site-menu-panel a:last-child {
  border-bottom: none;
}

nav.site-menu-panel a:hover {
  background: #21262d;
}

nav.site-menu-panel a.active {
  color: #58a6ff;
  background: rgba(88, 166, 255, 0.08);
}

nav.site-menu-panel .menu-section {
  padding: 10px 20px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8b949e;
}

/* Bottom tab bar */
nav.site-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 300;
  background: #161b22;
  border-top: 1px solid #30363d;
  display: flex;
  padding-bottom: var(--safe-b);
  height: calc(var(--nav-h) + var(--safe-b));
}

nav.site-nav a {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  font-size: 11px;
  color: #8b949e;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
}

nav.site-nav a.active {
  color: #58a6ff;
  font-weight: 500;
}
