/* ============================================================
   MEDC Invitational — Split navigation (FACEIT / Challengermode style)
   Multi-category dropdown nav: Play, Tournament, Community, Tools
   ============================================================ */

/* --- Header shell: sticky, two variants (home vs inner) --- */
.header-event {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid transparent;
  transition: background 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

/* Accent line under nav (subtle gradient) */
.header-event::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(96, 165, 250, 0.15) 20%,
    rgba(139, 92, 246, 0.2) 50%,
    rgba(96, 165, 250, 0.15) 80%,
    transparent 100%
  );
  opacity: 0.9;
  pointer-events: none;
}

/* Homepage: cinematic, transparent over hero; solid on scroll */
.header-event--home {
  background: rgba(5, 8, 18, 0.35);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  border-bottom-color: rgba(255, 255, 255, 0.04);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02), 0 4px 24px rgba(0, 0, 0, 0.2);
}

.header-event--home.is-scrolled {
  background: rgba(5, 8, 18, 0.92);
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
  border-bottom-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05),
    0 8px 32px rgba(0, 0, 0, 0.45);
}

/* Inner pages: grounded, solid from the start */
.header-event--inner {
  background: rgba(8, 12, 24, 0.97);
  backdrop-filter: blur(20px) saturate(1.1);
  -webkit-backdrop-filter: blur(20px) saturate(1.1);
  border-bottom-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05),
    0 4px 24px rgba(0, 0, 0, 0.4);
}

.header-event--inner.is-scrolled {
  background: rgba(6, 10, 20, 0.98);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06),
    0 8px 32px rgba(0, 0, 0, 0.5);
}

/* --- 3-zone bar --- */
.navbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(200px, 1fr);
  align-items: center;
  gap: 32px;
  width: min(var(--max, 1180px), 94vw);
  margin-inline: auto;
  padding: 14px 24px;
  min-height: 72px;
}

/* --- LEFT: Brand --- */
.navbar__left {
  display: flex;
  align-items: center;
  min-width: 0;
  justify-self: start;
}

.navbar__brand {
  display: flex;
  align-items: center;
  gap: 20px;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.navbar__brand:hover {
  opacity: 1;
}

.navbar__brand:hover .navbar__logo {
  box-shadow:
    0 0 0 1px rgba(96, 165, 250, 0.2),
    0 0 24px rgba(96, 165, 250, 0.15),
    0 0 40px rgba(139, 92, 246, 0.08);
}

.navbar__brand:focus-visible {
  outline: 2px solid var(--accent2, #60A5FA);
  outline-offset: 4px;
  border-radius: 12px;
}

.navbar__logo {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(
    145deg,
    rgba(96, 165, 250, 0.12) 0%,
    rgba(139, 92, 246, 0.08) 50%,
    rgba(96, 165, 250, 0.06) 100%
  );
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 4px 16px rgba(0, 0, 0, 0.25),
    0 0 20px rgba(96, 165, 250, 0.06);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.25s ease;
}

.navbar__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.navbar__brand-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.navbar__title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(234, 240, 255, 0.98);
  line-height: 1.2;
}

.navbar__title-accent {
  color: var(--accent2, #60A5FA);
  text-shadow: 0 0 20px rgba(96, 165, 250, 0.25);
}

.navbar__subtitle {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(183, 195, 230, 0.65);
  text-transform: uppercase;
}

/* --- CENTER: Split nav categories (FACEIT-style) --- */
.navbar__center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 12px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 0 20px rgba(96, 165, 250, 0.06);
}

/* Category trigger + dropdown */
.navbar__category {
  position: relative;
}

.navbar__category-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(234, 240, 255, 0.9);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}

.navbar__category-btn::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.7;
  margin-left: 2px;
  transition: transform 0.2s ease;
}

.navbar__category-btn:hover,
.navbar__category-btn:focus-visible,
.navbar__category:hover .navbar__category-btn {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.navbar__category-btn[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

/* Active category: current page lives in this dropdown */
.navbar__category--active .navbar__category-btn {
  color: #fff;
  background: rgba(96, 165, 250, 0.12);
}

.navbar__category--active .navbar__category-btn::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 6px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent2, #60A5FA), rgba(139, 92, 246, 0.9));
  border-radius: 1px;
  opacity: 0.9;
}

.navbar__category-btn:focus-visible {
  outline: 2px solid var(--accent2, #60A5FA);
  outline-offset: 2px;
}

/* Dropdown panel: overlaps trigger, glowing box, generous spacing. Applies to all pages using .navbar--split. */
.navbar__dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: -6px;
  padding: 18px 0 16px;
  min-width: 220px;
  background: rgba(12, 16, 32, 0.98);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: 14px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 0 24px rgba(96, 165, 250, 0.15),
    0 0 48px rgba(139, 92, 246, 0.08),
    0 12px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, visibility 0.18s ease, box-shadow 0.2s ease;
  z-index: 200;
}

/* Visible when: hover, JS open class, or keyboard focus */
.navbar__category:hover .navbar__dropdown,
.navbar__category.is-dropdown-open .navbar__dropdown,
.navbar__category-btn[aria-expanded="true"] + .navbar__dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.navbar__dropdown-item {
  display: block;
  padding: 12px 24px;
  margin: 0 10px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(234, 240, 255, 0.92);
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.navbar__dropdown-item + .navbar__dropdown-item {
  margin-top: 2px;
}

.navbar__dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.navbar__dropdown-item[aria-current="page"] {
  position: relative;
  background: rgba(96, 165, 250, 0.14);
  color: #93c5fd;
  font-weight: 600;
  border-left: 3px solid var(--accent2, #60A5FA);
  padding-left: 21px;
  margin-left: 10px;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.08);
}

.navbar__dropdown-item:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 2px;
}

/* --- RIGHT: CTA + Login --- */
.navbar__right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  justify-self: end;
}

/* Primary CTA (Register) */
.navbar__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
  background-size: 200% 200%;
  border: none;
  border-radius: 8px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 4px 20px rgba(59, 130, 246, 0.35);
  transition: transform 0.2s ease, box-shadow 0.25s ease, background-position 0.4s ease;
}

.navbar__cta:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.18),
    0 8px 28px rgba(59, 130, 246, 0.45),
    0 0 40px rgba(139, 92, 246, 0.2);
  background-position: 100% 50%;
}

.navbar__cta:active {
  transform: translateY(0);
}

.navbar__cta:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 2px;
}

/* Secondary (Login / Logout) */
.navbar__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: rgba(183, 195, 230, 0.95);
  text-decoration: none;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.navbar__btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
}

.navbar__btn:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 2px;
}

/* --- Hamburger (mobile) --- */
.navbar__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: rgba(234, 240, 255, 0.95);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
}

.navbar__toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}

.navbar__toggle[aria-expanded="true"] .navbar__icon-menu {
  display: none;
}

.navbar__toggle[aria-expanded="true"] .navbar__icon-close {
  display: block;
}

.navbar__icon-close {
  display: none;
}

.navbar__backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.navbar__backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.3s ease;
}

/* --- Mobile menu panel (same glowing-box style as desktop dropdown) --- */
.navbar__mobile {
  display: none;
  position: fixed;
  top: calc(60px + env(safe-area-inset-top));
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(12, 16, 32, 0.98);
  backdrop-filter: blur(24px);
  z-index: 98;
  overflow-y: auto;
  padding: 24px;
  border-top: 1px solid rgba(96, 165, 250, 0.2);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 0 32px rgba(96, 165, 250, 0.12),
    0 0 64px rgba(139, 92, 246, 0.06),
    0 12px 40px rgba(0, 0, 0, 0.5);
}

.navbar__mobile.is-open {
  display: block;
  animation: navbarMobileIn 0.25s ease-out;
}

@keyframes navbarMobileIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.navbar__mobile-inner {
  max-width: 400px;
  margin: 0 auto;
}

.navbar__mobile-category {
  margin-bottom: 12px;
  padding: 12px 16px;
  background: rgba(10, 14, 28, 0.6);
  border: 1px solid rgba(96, 165, 250, 0.15);
  border-radius: 14px;
  box-shadow: 0 0 16px rgba(96, 165, 250, 0.06);
}

.navbar__mobile-category:last-child {
  margin-bottom: 0;
}

.navbar__mobile-category-btn {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(234, 240, 255, 0.95);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.2s ease;
}

.navbar__mobile-category-btn::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  opacity: 0.8;
  transition: transform 0.25s ease;
}

.navbar__mobile-category-btn[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

.navbar__mobile-category--active .navbar__mobile-category-btn {
  color: #93c5fd;
  font-weight: 800;
}

.navbar__mobile-category--active .navbar__mobile-category-btn::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: linear-gradient(180deg, var(--accent2, #60A5FA), rgba(139, 92, 246, 0.9));
  border-radius: 0 2px 2px 0;
}

.navbar__mobile-dropdown {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.navbar__mobile-category.is-open .navbar__mobile-dropdown {
  max-height: 320px;
}

.navbar__mobile-dropdown a {
  display: block;
  padding: 12px 20px 12px 20px;
  margin: 4px 0;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(234, 240, 255, 0.92);
  text-decoration: none;
  border-radius: 8px;
  border-left: 3px solid transparent;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.navbar__mobile-dropdown a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-left-color: var(--accent2, #60A5FA);
}

.navbar__mobile-dropdown a[aria-current="page"] {
  background: rgba(96, 165, 250, 0.14);
  color: #93c5fd;
  font-weight: 600;
  border-left-color: var(--accent2, #60A5FA);
}

/* --- Responsive: tablet --- */
@media (max-width: 1024px) {
  .navbar {
    gap: 16px;
    padding: 12px 20px;
    min-height: 64px;
  }

  .navbar__category-btn {
    padding: 8px 14px;
    font-size: 12px;
  }

  .navbar__cta {
    padding: 9px 18px;
    font-size: 12px;
  }
}

/* --- Responsive: mobile --- */
@media (max-width: 880px) {
  .header-event {
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  .navbar {
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    padding: 12px 16px;
    min-height: 60px;
  }

  .navbar__center {
    display: none !important;
  }

  .navbar__right {
    gap: 8px;
  }

  .navbar__toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
  }

  .navbar__icon-menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
  }

  .navbar__icon-menu span {
    display: block;
    width: 20px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
  }

  .navbar__icon-menu span:nth-child(2) {
    width: 14px;
    margin-left: auto;
  }

  .navbar__icon-close {
    position: relative;
    width: 20px;
    height: 20px;
  }

  .navbar__icon-close::before,
  .navbar__icon-close::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 20px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
  }

  .navbar__icon-close::before {
    transform: translate(-50%, -50%) rotate(45deg);
  }

  .navbar__icon-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
  }
}

@media (max-width: 480px) {
  .navbar {
    padding: 10px 14px;
    min-height: 56px;
  }

  .navbar__logo {
    width: 42px;
    height: 42px;
  }

  .navbar__title {
    font-size: 14px;
  }

  .navbar__subtitle {
    font-size: 9px;
  }

  .navbar__cta {
    padding: 12px 18px;
    font-size: 12px;
    min-height: 44px;
  }

  .navbar__btn {
    padding: 12px 18px;
    font-size: 12px;
    min-height: 44px;
  }

  .navbar__toggle {
    width: 48px;
    height: 48px;
    -webkit-tap-highlight-color: rgba(96, 165, 250, 0.2);
  }

  .navbar__mobile-category-btn {
    padding: 18px 0;
    min-height: 52px;
  }

  .navbar__mobile-dropdown a {
    padding: 14px 20px;
    min-height: 48px;
    display: flex;
    align-items: center;
  }
}

@media (max-width: 390px) {
  .navbar__right { gap: 6px; }
  .navbar__cta, .navbar__btn { padding: 10px 14px; font-size: 11px; min-height: 42px; }
  .navbar__subtitle { display: none; }
}
