/* =============================================================================
   ZOTH STUDIO — UNIVERSAL UNIFIED MASTER NAVBAR & MOBILE DRAWER (v5.1)
   ============================================================================= */

:root {
  --zoth-ribbon: 0px;
  --zoth-header-h: 54px;
  --nav-cyan: #00f0ff;
  --nav-gold: #fbbf24;
  --nav-purple: #a855f7;
  --nav-surface: rgba(10, 14, 28, 0.96);
  --nav-border: rgba(0, 240, 255, 0.22);
}

body {
  padding-top: calc(var(--zoth-header-h, 54px) + var(--zoth-ribbon, 0px));
}

html {
  scroll-padding-top: calc(var(--zoth-header-h, 54px) + var(--zoth-ribbon, 0px) + 12px);
}

html.zoth-preview {
  --zoth-ribbon: 38px;
  scroll-padding-top: calc(54px + 38px + 12px);
}
html.zoth-preview body {
  padding-top: calc(54px + 38px) !important;
}
html.zoth-preview header.bar,
html.zoth-preview header.topbar,
html.zoth-preview .comic-topbar,
html.zoth-preview header[role="banner"],
html.zoth-preview #topbar {
  top: 38px !important;
}
html.zoth-preview nav.drawer,
html.zoth-preview #drawer {
  top: calc(54px + 38px) !important;
}

@media (max-width: 768px) {
  :root {
    --zoth-header-h: 54px;
  }
  body {
    padding-top: calc(var(--zoth-header-h, 54px) + var(--zoth-ribbon, 0px));
  }
  html.zoth-preview {
    --zoth-ribbon: 40px;
    scroll-padding-top: calc(54px + 40px + 8px);
  }
  html.zoth-preview body {
    padding-top: calc(54px + 40px) !important;
  }
  html.zoth-preview header.bar,
  html.zoth-preview header.topbar,
  html.zoth-preview .comic-topbar,
  html.zoth-preview header[role="banner"],
  html.zoth-preview #topbar {
    top: 40px !important;
  }
  html.zoth-preview nav.drawer,
  html.zoth-preview #drawer {
    top: calc(54px + 40px) !important;
  }
}

/* Master Topbar */
header.bar,
header#topbar,
.comic-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 clamp(14px, 2.5vw, 32px);
  background: rgba(5, 6, 12, 0.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  transition: top 0.2s ease, background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  height: var(--zoth-header-h, 54px);
  min-height: var(--zoth-header-h, 54px);
  max-height: var(--zoth-header-h, 54px);
  box-sizing: border-box;
  width: 100%;
}

header.bar.on,
header#topbar.on {
  background: rgba(5, 6, 12, 0.96);
  border-bottom-color: rgba(0, 240, 255, 0.16);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  flex-shrink: 0;
  min-width: 0;
}
.brand img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(251, 191, 36, 0.45);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.25);
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.brand:hover img {
  transform: scale(1.05);
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.4);
}
.brand span {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  min-width: 0;
}
.brand strong {
  display: block;
  font-family: "Syne", sans-serif;
  font-size: 1.05rem;
  letter-spacing: -0.025em;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.05;
  white-space: nowrap;
}
.brand small {
  display: block;
  color: var(--nav-gold);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.52rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  line-height: 1.05;
  white-space: nowrap;
  margin-top: 1px;
}

/* Desktop Menu Links */
nav.menu {
  display: flex;
  gap: 4px;
  margin-left: auto;
  align-items: center;
  height: 100%;
}

.nav-link {
  text-decoration: none;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #cbd5e1;
  padding: 6px 10px;
  border-radius: 6px;
  position: relative;
  transition: all 0.18s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}
.nav-link:hover,
.nav-link.on {
  color: #ffffff;
  background: rgba(0, 240, 255, 0.09);
  box-shadow: inset 0 0 0 1px rgba(0, 240, 255, 0.25);
}

/* Dropdown Container */
.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 100%;
}

.nav-dropdown-btn {
  background: none;
  border: none;
  color: #cbd5e1;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.nav-dropdown-btn:hover,
.nav-dropdown:hover .nav-dropdown-btn,
.nav-dropdown:focus-within .nav-dropdown-btn,
.nav-dropdown.active .nav-dropdown-btn,
.nav-dropdown.open .nav-dropdown-btn,
.nav-dropdown-btn.on {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}
.nav-dropdown-btn.on {
  color: var(--nav-cyan);
  box-shadow: inset 0 0 0 1px rgba(0, 240, 255, 0.25);
}
.dropdown-chevron {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0.7;
}
.nav-dropdown:hover .dropdown-chevron,
.nav-dropdown:focus-within .dropdown-chevron,
.nav-dropdown.open .dropdown-chevron {
  transform: rotate(180deg);
  opacity: 1;
  color: var(--nav-cyan);
}

/* Dropdown Menu Panel */
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  min-width: 270px;
  background: rgba(8, 10, 20, 0.96);
  border: 1px solid rgba(0, 240, 255, 0.18);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.75), 0 0 20px rgba(0, 240, 255, 0.08);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  pointer-events: none;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.nav-dropdown-menu a {
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  transition: all 0.14s ease;
}
.nav-dropdown-menu a:hover,
.nav-dropdown-menu a.on {
  background: rgba(0, 240, 255, 0.1);
  transform: translateX(2px);
}
.nav-dropdown-menu a strong {
  color: #ffffff;
  font-family: "Figtree", sans-serif;
  font-size: 0.83rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.25;
}
.nav-dropdown-menu a small {
  color: #94a3b8;
  font-family: "Figtree", sans-serif;
  font-size: 0.71rem;
  font-weight: 400;
  line-height: 1.25;
}
.nav-dropdown-menu a:hover strong,
.nav-dropdown-menu a.on strong {
  color: var(--nav-cyan);
}
.nav-dropdown-menu a:hover small,
.nav-dropdown-menu a.on small {
  color: #e2e8f0;
}

/* Action Pills (Right) */
.nav-pill {
  text-decoration: none;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.nav-pill.js-deck {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
}
.nav-pill.js-deck:hover {
  background: rgba(16, 185, 129, 0.22);
  border-color: #34d399;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.35);
  color: #ffffff;
}
.deck-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 7px #34d399;
}
.nav-pill.git {
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f1f5f9;
}
.nav-pill.git:hover {
  border-color: var(--nav-cyan);
  color: var(--nav-cyan);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.25);
}

/* Mobile Burger Button */
.burger {
  display: none;
  margin-left: auto;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f8fafc;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: all 0.18s ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.burger:hover,
body.menu-open .burger,
.burger[aria-expanded="true"] {
  border-color: var(--nav-gold);
  color: var(--nav-gold);
  background: rgba(251, 191, 36, 0.12);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.25);
}

/* Universal Mobile Drawer */
nav.drawer,
#drawer {
  display: flex !important;
  position: fixed !important;
  inset: var(--zoth-header-h, 54px) 0 0 !important;
  z-index: 9998 !important;
  background: rgba(5, 6, 12, 0.98) !important;
  backdrop-filter: blur(28px) !important;
  -webkit-backdrop-filter: blur(28px) !important;
  padding: 14px clamp(14px, 4vw, 28px) 50px !important;
  flex-direction: column !important;
  gap: 12px !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(-6px) !important;
  transition: opacity 0.22s ease, transform 0.22s ease !important;
  box-sizing: border-box !important;
}

body.menu-open nav.drawer,
body.menu-open #drawer {
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: translateY(0) !important;
}

.drawer-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding-bottom: 10px;
}
.drawer-section:last-child {
  border-bottom: none;
}

.drawer-heading {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--nav-gold);
  padding: 3px 0 5px;
}

.drawer-hero-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--nav-cyan);
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 3px;
  transition: all 0.18s ease;
}
.drawer-hero-link:hover {
  background: rgba(0, 240, 255, 0.18);
  color: #ffffff;
}

nav.drawer a,
#drawer a {
  display: flex;
  align-items: center;
  text-decoration: none;
  font-family: "Figtree", sans-serif;
  font-size: 0.90rem;
  font-weight: 600;
  min-height: 38px;
  padding: 5px 8px;
  border-radius: 6px;
  color: #f1f5f9;
  transition: all 0.14s ease;
}
nav.drawer a:hover,
#drawer a:hover,
nav.drawer a.on,
#drawer a.on {
  color: var(--nav-cyan);
  background: rgba(255, 255, 255, 0.05);
  padding-left: 10px;
}

/* Breakpoints */
@media (max-width: 1024px) {
  nav.menu {
    display: none !important;
  }
  .burger {
    display: inline-flex !important;
  }
}

@media (max-width: 640px) {
  header.bar,
  header#topbar,
  .comic-topbar {
    padding: 0 12px;
    height: 52px;
    min-height: 52px;
    max-height: 52px;
    gap: 8px;
  }
  .brand img {
    width: 28px;
    height: 28px;
  }
  .brand strong {
    font-size: 1.00rem;
  }
  .brand small {
    font-size: 0.50rem;
  }
  .burger {
    min-height: 30px;
    padding: 4px 10px;
    font-size: 0.68rem;
  }
}
