/* ==========================================================
   navbar.css — TTC Rheindahlen 1950
   Navbar: fixed bar, logo, desktop links, dropdowns,
   hamburger, mobile menu, overlay.
   Depends on: variables.css
   ========================================================== */

/* ── Bar ────────────────────────────────────────────────── */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--nav-height);
  background: #111111;
  border-bottom: 1px solid var(--border);
  transition: background 0.3s var(--ease), box-shadow 0.3s var(--ease), height 0.3s var(--ease);
}

#navbar.scrolled {
  background: rgba(17, 17, 17, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  height: 62px;
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

/* ── Logo ────────────────────────────────────────────────── */
.nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.nav-logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
}

#navbar.scrolled .nav-logo-img { height: 40px; }

/* ── Desktop nav links ───────────────────────────────────── */
.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.nav-item { position: relative; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgb(var(--text-rgb) / 0.7);
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: color 0.2s;
}

span.nav-link { cursor: default; }

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 12px; right: 12px;
  height: 2px;
  background: var(--red);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s var(--ease);
}

.nav-link:hover,
.nav-link.active { color: var(--white); }

.nav-link:hover::after,
.nav-link.active::after { transform: scaleX(1); }

/* Shop button */
.nav-link--shop {
  background: var(--red);
  color: var(--white) !important;
  margin-left: 6px;
  transition: background 0.2s, transform 0.15s !important;
}
.nav-link--shop::after { display: none; }
.nav-link--shop:hover { background: var(--red-dark); transform: translateY(-1px); }

/* Chevron */
.nav-chevron {
  width: 9px; height: 5px;
  flex-shrink: 0;
  opacity: 0.65;
  transition: transform 0.25s var(--ease);
}
.nav-item.has-dropdown:hover .nav-chevron { transform: rotate(180deg); }

/* ── Desktop dropdown ────────────────────────────────────── */
.nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  min-width: 195px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 2px solid var(--red);
  border-radius: 6px;
  padding: 6px 0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  z-index: 100;
}

.nav-item.has-dropdown:hover .nav-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* Transparent bridge over the 8px gap so hover stays active */
.nav-dropdown::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
}

.dropdown-link {
  display: block;
  padding: 10px 18px;
  font-family: var(--font-display);
  font-size: 0.83rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgb(var(--text-rgb) / 0.6);
  transition: color 0.15s, background 0.15s, padding-left 0.15s;
}

.dropdown-link:hover,
.dropdown-link.active {
  color: var(--white);
  background: rgba(192, 57, 43, 0.12);
  padding-left: 24px;
}

/* ── Hamburger ───────────────────────────────────────────── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px; height: 40px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.nav-hamburger span {
  display: block;
  width: 20px; height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.2s;
  transform-origin: center;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Overlay ─────────────────────────────────────────────── */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  pointer-events: none;
}
.nav-overlay.visible { opacity: 1; pointer-events: auto; }

/* ── Mobile menu ─────────────────────────────────────────── */
.nav-mobile-menu {
  position: fixed;
  top: 0; right: -100%;
  width: min(320px, 90vw);
  height: 100dvh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 1001;
  overflow-y: auto;
  padding: calc(var(--nav-height) + 16px) 0 32px;
  transition: right 0.35s var(--ease);
}
.nav-mobile-menu.open { right: 0; }

.mobile-nav-list { display: flex; flex-direction: column; }

.mobile-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 24px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgb(var(--text-rgb) / 0.7);
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  transition: color 0.15s, background 0.15s;
}
.mobile-nav-link:hover,
.mobile-nav-link.active { color: var(--white); background: rgba(192, 57, 43, 0.1); }
.mobile-nav-link--shop { color: var(--red) !important; }

.mobile-nav-item.has-dropdown.open .nav-chevron { transform: rotate(180deg); }

.mobile-sub-list {
  max-height: 0;
  overflow: hidden;
  background: var(--sub-list-bg);
  transition: max-height 0.3s var(--ease);
}
.mobile-nav-item.has-dropdown.open .mobile-sub-list { max-height: 400px; }

.mobile-sub-list li a {
  display: block;
  padding: 11px 24px 11px 36px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgb(var(--text-rgb) / 0.5);
  border-bottom: 1px solid var(--border);
  transition: color 0.15s, padding-left 0.15s;
}
.mobile-sub-list li a:hover,
.mobile-sub-list li a.active { color: var(--white); padding-left: 42px; }

/* Mobile split (link + chevron button) */
.mobile-nav-link-split {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
}

.mobile-nav-link-split .mobile-nav-link {
  flex: 1;
  border-bottom: none;
}

.mobile-chevron-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  background: none;
  border: none;
  border-left: 1px solid var(--border);
  cursor: pointer;
  color: rgb(var(--text-rgb) / 0.5);
  padding: 0;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.mobile-chevron-btn:hover {
  color: var(--white);
  background: rgba(192, 57, 43, 0.1);
}

/* ── Keep navbar dark in light mode ─────────────────────── */
[data-theme="light"] #navbar,
[data-theme="light"] #nav-mobile-menu,
[data-theme="light"] .nav-dropdown {
  --text-rgb:   245 245 245;
  --white:      #F5F5F5;
  --text-muted: #888888;
  --border:     rgba(255, 255, 255, 0.07);
  --surface:    #181818;
  --sub-list-bg: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] #nav-mobile-menu {
  background: #181818;
}

/* ── Theme toggle ────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--white);
  flex-shrink: 0;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease);
}

.theme-toggle:hover {
  border-color: rgba(192, 57, 43, 0.5);
  background: rgba(192, 57, 43, 0.08);
}

.theme-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Dark mode: show sun (switch to light) */
.theme-icon--moon { display: none; }

/* Light mode: show moon (switch to dark) */
[data-theme="light"] .theme-icon--sun  { display: none; }
[data-theme="light"] .theme-icon--moon { display: block; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .nav-link { padding: 8px 10px; font-size: 0.82rem; }
}

@media (max-width: 860px) {
  .nav-links    { display: none; }
  .nav-hamburger { display: flex; }
  .nav-overlay  { display: block; }
}
