:root {
  /* Dark Theme (Default) */
  --bg: #10131a;
  --surface: #181d27;
  --surface-2: #212836;
  --border: #2a3141;
  --text: #e8e6df;
  --text-dim: #c8cedb;
  --text-faint: #5b6376;
  --accent: #e8a33d;
  --accent-dim: #a8792f;
  --mongo: #5fbf8f;
  --express: #c9cdd6;
  --react: #6fc3e0;
  --node: #7fc27a;
  --radius: 3px;
  --mono: 'JetBrains Mono', monospace;
  --sans: 'Inter', 'Hind Siliguri', sans-serif;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme */
[data-theme="light"] {
  --bg: #faf9f6;
  --surface: #ffffff;
  --surface-2: #f4f2ed;
  --border: #e6e3db;
  --text: #1a1815;
  --text-dim: #57534e;
  --text-faint: #a8a29e;
  --accent: #b45309;
  --accent-dim: #92400e;
  --mongo: #047857;
  --express: #44403c;
  --react: #0369a1;
  --node: #15803d;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 28px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.13;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 30%, transparent 80%);
}

/* ========== NAV ========== */
nav.topnav {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(16, 19, 26, 0.85);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s ease, border-color 0.3s ease;
}

[data-theme="light"] nav.topnav {
  background: rgba(248, 250, 252, 0.85);
}

nav.topnav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.logo span {
  color: var(--accent);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-icons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.18s, transform 0.18s;
  padding: 0;
}

.icon-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  stroke: var(--text);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn:hover svg {
  stroke: var(--accent);
}

.hamburger-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hamburger-box .bar {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  transition: 0.2s;
}

.icon-btn:hover .bar {
  background: var(--accent);
}

/* Theme Toggle Icons */
.theme-toggle-btn .icon-sun {
  display: none;
}

.theme-toggle-btn .icon-moon {
  display: block;
}

[data-theme="light"] .theme-toggle-btn .icon-sun {
  display: block;
}

[data-theme="light"] .theme-toggle-btn .icon-moon {
  display: none;
}

/* ========== MEGA MENU ========== */
.menu-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 100vw;
  z-index: 100;
  background: var(--surface);
  border-left: 1px solid var(--border);
  opacity: 0;
  visibility: hidden;
  transform: translateX(100%);
  transition: opacity 0.35s ease, visibility 0.35s, transform 0.35s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.menu-overlay.active {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

.menu-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.menu-logo {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-dim);
}

.close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: transparent;
  padding: 0;
  transition: border-color 0.18s;
}

.close-btn svg {
  width: 16px;
  height: 16px;
  stroke: var(--text);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.close-btn:hover {
  border-color: var(--accent);
}

.close-btn:hover svg {
  stroke: var(--accent);
}

.menu-content {
  flex: 1;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.menu-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-section-title {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.12em;
  margin-bottom: 10px;
  font-weight: 600;
}

.menu-section a {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--text-dim);
  padding: 10px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  transition: color 0.2s, padding-left 0.2s;
}

.menu-section a:last-child {
  border-bottom: none;
}

.menu-section a:hover {
  color: var(--text);
  padding-left: 6px;
}

.menu-section a:hover .arrow {
  color: var(--accent);
}

.menu-section .arrow {
  color: var(--text-faint);
  font-size: 13px;
  transition: color 0.2s;
}

.menu-section .external {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-faint);
  transition: color 0.2s;
}

.menu-section a:hover .external {
  color: var(--accent);
}

.menu-bottom {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-faint);
  flex-shrink: 0;
}

.menu-bottom a {
  color: var(--text-dim);
}

.menu-bottom a:hover {
  color: var(--accent);
}

.menu-social {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

body.no-scroll {
  overflow: hidden;
}

/* ========== BUTTONS ========== */
.btn {
  font-family: var(--mono);
  font-size: 13px;
  padding: 11px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: border-color 0.15s, transform 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
}

.btn.primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 600;
}

.btn.primary:hover {
  transform: translateY(-2px);
}

.btn.ghost {
  background: transparent;
  color: var(--text);
}

.btn.ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ========== FOOTER ========== */
footer {
  border-top: 1px solid var(--border);
  padding: 26px 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-faint);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .nav-icons {
    display: none;
  }

  .menu-overlay {
    width: 100%;
    max-width: 100%;
    border-left: none;
  }

  .wrap {
    padding: 0 20px;
  }
}

@media (max-width: 480px) {
  .menu-top {
    padding: 16px 18px;
  }

  .menu-content {
    padding: 20px 18px;
    gap: 24px;
  }

  .menu-section a {
    font-size: 14px;
  }

  .menu-bottom {
    padding: 16px 18px;
  }
}