/**
 * Cambridge IGCSE Science Ecosystem - Universal Navigation Bar
 * Global Design Tokens & Glassmorphism TopBar Stylesheet
 * 
 * Production CDN: https://igcse.xyz/ecosystem-nav.css
 * Zero External Dependencies (pure CSS)
 */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  /* Global Design Tokens */
  --igcse-font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --igcse-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Color Palette */
  --igcse-bg-base: #0b1120;
  --igcse-nav-bg: rgba(11, 17, 32, 0.85);
  --igcse-nav-border: rgba(255, 255, 255, 0.08);
  --igcse-nav-text-bright: #ffffff;
  --igcse-nav-text-main: #f1f5f9;
  --igcse-nav-text-muted: #94a3b8;
  --igcse-nav-text-dim: #64748b;

  /* Brand Accents & Glowing States */
  --igcse-accent-blue: #0ea5e9;
  --igcse-accent-cyan: #38bdf8;
  --igcse-accent-glow: 0 0 16px rgba(14, 165, 233, 0.38);
  --igcse-accent-bg: rgba(14, 165, 233, 0.15);
  --igcse-accent-border: rgba(56, 189, 248, 0.55);

  /* Nav Pill Tokens */
  --igcse-pill-bg: rgba(255, 255, 255, 0.035);
  --igcse-pill-border: rgba(255, 255, 255, 0.08);
  --igcse-pill-hover-bg: rgba(255, 255, 255, 0.08);
  --igcse-pill-hover-border: rgba(255, 255, 255, 0.2);

  /* Dimensions & Z-Index */
  --igcse-nav-height: 52px;
  --igcse-nav-z: 99990;
}

/* Base custom element and wrapper */
igcse-nav,
#igcse-ecosystem-nav {
  display: block;
  width: 100%;
  position: relative;
  z-index: var(--igcse-nav-z);
  font-family: var(--igcse-font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

igcse-nav[sticky],
#igcse-ecosystem-nav[data-sticky="true"] {
  position: sticky;
  top: 0;
}

/* Glassmorphism Bar */
.igcse-nav-wrapper {
  width: 100%;
  height: var(--igcse-nav-height);
  background: var(--igcse-nav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--igcse-nav-border);
  box-sizing: border-box;
  position: relative;
}

.igcse-nav-container {
  max-width: 1380px;
  height: 100%;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-sizing: border-box;
}

/* Left Brand & Logo */
.igcse-nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  user-select: none;
  cursor: pointer;
  flex-shrink: 0;
}

.igcse-nav-brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.25) 0%, rgba(99, 102, 241, 0.25) 100%);
  border: 1px solid rgba(56, 189, 248, 0.4);
  font-size: 16px;
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.igcse-nav-brand:hover .igcse-nav-brand-badge {
  transform: scale(1.06);
  box-shadow: 0 0 16px rgba(14, 165, 233, 0.4);
}

.igcse-nav-brand-text {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}

.igcse-nav-brand-title {
  color: var(--igcse-nav-text-bright);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.igcse-nav-brand-tagline {
  color: var(--igcse-nav-text-muted);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* Desktop Navigation Pills */
.igcse-nav-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.igcse-nav-pill-item {
  display: inline-flex;
}

.igcse-nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 22px;
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  color: var(--igcse-nav-text-muted);
  background: var(--igcse-pill-bg);
  border: 1px solid var(--igcse-pill-border);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.igcse-nav-pill:hover {
  background: var(--igcse-pill-hover-bg);
  border-color: var(--igcse-pill-hover-border);
  color: var(--igcse-nav-text-bright);
  transform: translateY(-1px);
}

/* Active Highlight & Luminous Glow */
.igcse-nav-pill.is-active {
  background: var(--igcse-accent-bg);
  border-color: var(--igcse-accent-border);
  color: var(--igcse-accent-cyan);
  box-shadow: var(--igcse-accent-glow);
  font-weight: 600;
}

.igcse-nav-active-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--igcse-accent-cyan);
  box-shadow: 0 0 8px var(--igcse-accent-cyan);
  display: inline-block;
  animation: igcse-nav-dot-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes igcse-nav-dot-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.8);
  }
}

/* Mobile Hamburger Button */
.igcse-nav-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--igcse-nav-border);
  border-radius: 8px;
  color: var(--igcse-nav-text-bright);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.igcse-nav-hamburger:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.18);
}

.igcse-nav-hamburger svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

/* Mobile Drawer & Overlay */
.igcse-nav-backdrop {
  display: none;
  position: fixed;
  top: var(--igcse-nav-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: calc(var(--igcse-nav-z) - 1);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.igcse-nav-backdrop.is-open {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.igcse-nav-drawer {
  display: none;
  position: fixed;
  top: var(--igcse-nav-height);
  left: 0;
  right: 0;
  background: rgba(11, 17, 32, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--igcse-nav-border);
  padding: 16px 20px 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  z-index: var(--igcse-nav-z);
  transform: translateY(-10px);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  pointer-events: none;
  box-sizing: border-box;
}

.igcse-nav-drawer.is-open {
  display: block;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.igcse-nav-drawer-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--igcse-nav-text-dim);
  margin-bottom: 12px;
  padding-left: 4px;
}

.igcse-nav-drawer-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.igcse-nav-drawer-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--igcse-nav-text-main);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all 0.18s ease;
}

.igcse-nav-drawer-link:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateX(3px);
}

.igcse-nav-drawer-link.is-active {
  background: var(--igcse-accent-bg);
  border-color: var(--igcse-accent-border);
  color: var(--igcse-accent-cyan);
  box-shadow: var(--igcse-accent-glow);
}

.igcse-nav-drawer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.igcse-nav-drawer-emoji {
  font-size: 20px;
  line-height: 1;
}

.igcse-nav-drawer-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.igcse-nav-drawer-title {
  font-size: 14px;
  font-weight: 600;
}

.igcse-nav-drawer-desc {
  font-size: 11.5px;
  color: var(--igcse-nav-text-muted);
}

.igcse-nav-drawer-link.is-active .igcse-nav-drawer-desc {
  color: rgba(56, 189, 248, 0.8);
}

/* Responsive Breakpoints */
@media (max-width: 960px) {
  .igcse-nav-brand-tagline {
    display: none;
  }
}

@media (max-width: 820px) {
  .igcse-nav-pills {
    display: none;
  }
  .igcse-nav-hamburger {
    display: inline-flex;
  }
}

@media (max-width: 480px) {
  .igcse-nav-container {
    padding: 0 12px;
  }
  .igcse-nav-brand-title {
    font-size: 13px;
  }
}
