/* =============================================================
   Kukuk Kandel — Navigation + Topbar
   ============================================================= */

/* ══════════════════════════════════════════════
   TOPBAR (scrollt weg, nicht sticky)
   ══════════════════════════════════════════════ */
#topbar {
  background: #fff4ba;
  border-bottom: 1px solid rgba(254,153,1,0.3);
  width: 100%;
}

#topbar-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 32px;
  max-width: 1400px;
  margin: 0 auto;
  height: 80px;
  box-sizing: border-box;
}

/* ── Logo mittig (Spalte 2) ── */
#topbar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

#topbar-logo-link {
  position: absolute;
  inset: 0;
  z-index: 10;
  cursor: pointer;
}

/* Widget-Wrapper neutralisieren */
#topbar-logo .widget,
#topbar-logo section.widget {
  margin: 0 !important;
  padding: 0 !important;
  background: none !important;
  border: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#topbar-logo .widget-title {
  display: none !important;
}

#topbar-logo img {
  max-height: 60px !important;
  width: auto !important;
  height: auto !important;
  display: block !important;
}

#topbar-logo a {
  display: flex;
  align-items: center;
  line-height: 0;
  text-decoration: none;
}

/* ── Social Icons ── */
#topbar-social {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: flex-start;
}

.topbar-social-link {
  display: flex;
  align-items: center;
  color: rgba(0,0,0,0.38);
  text-decoration: none;
  transition: color 0.2s;
}
.topbar-social-link:hover { color: #fe9901; }

/* ── Buttons ── */
#topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Roboto', sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 4px;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  box-sizing: border-box;
}

.topbar-btn-ghost {
  color: rgba(0,0,0,0.55);
  border: 1px solid rgba(0,0,0,0.2);
  background: transparent;
}
.topbar-btn-ghost:hover { color: #fe9901; border-color: #fe9901; }

.topbar-btn-primary,
.topbar-btn-primary:link,
.topbar-btn-primary:visited {
  color: #fff !important;
  background: #fe9901;
  border: 1px solid #fe9901;
}
.topbar-btn-primary:hover { background: #e08800; border-color: #e08800; color: #fff !important; }

/* ══════════════════════════════════════════════
   STICKY: #site-header klebt, nicht #site-nav
   Topbar scrollt weg weil max-height → 0
   ══════════════════════════════════════════════ */
#site-header {
  position: sticky;
  top: 0;
  z-index: 500;
  width: 100%;
}

#topbar {
  overflow: hidden;
  max-height: 120px;
  transition: max-height 0.35s ease, opacity 0.35s ease, border-color 0.35s ease;
  opacity: 1;
}

#site-header.nav-scrolled #topbar {
  max-height: 0;
  opacity: 0;
}

#site-nav {
  background: #ffffff;
  width: 100%;
  box-shadow: 0 1px 0 rgba(0,0,0,0.09);
  transition: background 0.35s ease, box-shadow 0.35s ease;
}

#site-nav.nav-scrolled {
  background: #fe9901;
  box-shadow: 0 2px 16px rgba(254,153,1,0.35);
}

#site-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  max-width: 1400px;
  margin: 0 auto;
  height: 52px;
  box-sizing: border-box;
}

/* ── Hamburger ── */
#nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: transparent;
  border: none;
  padding: 10px 4px;
  cursor: pointer;
  margin: 0;
  align-items: flex-end;
}
#nav-toggle:hover {
  background: transparent;
  border: none;
  color: inherit;
}
#nav-toggle .nav-bar {
  display: block;
  background: #fe9901;
  height: 2px;
  border-radius: 2px;
  transition: width 0.25s, transform 0.25s, opacity 0.25s;
}
#nav-toggle .nav-bar:nth-child(1) { width: 26px; }
#nav-toggle .nav-bar:nth-child(2) { width: 18px; }
#nav-toggle .nav-bar:nth-child(3) { width: 22px; }
#nav-toggle[aria-expanded="true"] .nav-bar:nth-child(1) { width:26px; transform:translateY(7px) rotate(45deg); }
#nav-toggle[aria-expanded="true"] .nav-bar:nth-child(2) { opacity:0; width:0; }
#nav-toggle[aria-expanded="true"] .nav-bar:nth-child(3) { width:26px; transform:translateY(-7px) rotate(-45deg); }

/* ── Menü-Liste ── */
#nav-menu-list {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  justify-content: center;
  height: 52px;
}

/* ── Top-Level Links ── */
#nav-menu-list > li {
  position: relative;
  height: 52px;
  display: flex;
  align-items: center;
}

#nav-menu-list > li > a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 52px;
  padding: 0 14px;
  color: #fe9901;
  text-decoration: none;
  font-family: 'Roboto', sans-serif;
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.25s;
  box-sizing: border-box;
}

/* Animierter Unterstrich */
#nav-menu-list > li > a::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  right: 50%;
  height: 3px;
  background: #fe9901;
  transition: left 0.25s ease, right 0.25s ease;
}

#nav-menu-list > li:hover > a::before,
#nav-menu-list > li:focus-within > a::before,
#nav-menu-list > li.current-menu-item > a::before,
#nav-menu-list > li.current-menu-ancestor > a::before {
  left: 0;
  right: 0;
}

#nav-menu-list > li:hover > a { color: #c97a00; }
#nav-menu-list > li.current-menu-item > a,
#nav-menu-list > li.current-menu-ancestor > a { color: #fe9901; }

/* Scrolled */
#site-nav.nav-scrolled #nav-menu-list > li > a { color: #fff; }
#site-nav.nav-scrolled #nav-menu-list > li:hover > a,
#site-nav.nav-scrolled #nav-menu-list > li.current-menu-item > a,
#site-nav.nav-scrolled #nav-menu-list > li.current-menu-ancestor > a { color: #fff; }
#site-nav.nav-scrolled #nav-menu-list > li > a::before { background: #fff; }
#site-nav.nav-scrolled #nav-menu-list > li.menu-item-has-children:hover > a::after,
#site-nav.nav-scrolled #nav-menu-list > li.menu-item-has-children:focus-within > a::after {
  border-top-color: rgba(255,255,255,0.9);
}

/* Pfeil */
#nav-menu-list > li.menu-item-has-children > a::after {
  content: '';
  display: inline-block;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid rgba(254,153,1,0.5);
  flex-shrink: 0;
  transition: border-top-color 0.2s, transform 0.25s;
}
#site-nav.nav-scrolled #nav-menu-list > li.menu-item-has-children > a::after {
  border-top-color: rgba(255,255,255,0.6);
}
#nav-menu-list > li.menu-item-has-children:hover > a::after,
#nav-menu-list > li.menu-item-has-children:focus-within > a::after {
  border-top-color: #fe9901;
  transform: rotate(180deg);
}

/* ══════════════════════════════════════════════
   DROPDOWN 1. EBENE
   — erscheint direkt unter dem Parent-Link
   ══════════════════════════════════════════════ */
#nav-menu-list .sub-menu {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  position: absolute;
  top: 52px;           /* bündig mit Unterkante der Nav-Zeile */
  left: 0;
  min-width: 220px;
  background: #fff;
  border-top: 3px solid #fe9901;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 10px 32px rgba(0,0,0,0.16);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 600;
}

#nav-menu-list > li:hover > .sub-menu,
#nav-menu-list > li:focus-within > .sub-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

#nav-menu-list .sub-menu > li {
  position: relative;
}

#nav-menu-list .sub-menu > li > a {
  display: flex;
  align-items: center;
  color: #444;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  text-transform: none;
  padding: 10px 20px;
  border-left: 3px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s, border-color 0.15s, padding-left 0.15s;
}
#nav-menu-list .sub-menu > li > a:hover {
  color: #fe9901;
  background: #fffaf2;
  border-left-color: #fe9901;
  padding-left: 24px;
}
#nav-menu-list .sub-menu > li.current-menu-item > a {
  color: #fe9901;
  background: #fffaf2;
  border-left-color: #fe9901;
  font-weight: 500;
}

/* ══════════════════════════════════════════════
   DROPDOWN 2. EBENE (Flyout rechts)
   — erscheint auf gleicher Höhe wie Parent-Item
   ══════════════════════════════════════════════ */
#nav-menu-list .sub-menu .sub-menu {
  top: 0;              /* bündig mit Oberkante des Parent-Items */
  left: 100%;
  border-top: none;
  border-left: 3px solid #fe9901;
  border-radius: 0 6px 6px 6px;
  transform: translateX(-6px);
}
#nav-menu-list .sub-menu > li:hover > .sub-menu,
#nav-menu-list .sub-menu > li:focus-within > .sub-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

/* Pfeil rechts bei Items mit Sub-Sub-Menü */
#nav-menu-list .sub-menu > li.menu-item-has-children > a::after {
  content: '';
  display: inline-block;
  width: 0; height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid rgba(100,100,100,0.35);
  margin-left: auto;
  transition: border-left-color 0.2s;
}
#nav-menu-list .sub-menu > li.menu-item-has-children:hover > a::after {
  border-left-color: #fe9901;
}

#nav-menu-list .sub-menu .sub-menu > li > a {
  border-left: none;
  border-right: 3px solid transparent;
  padding: 10px 20px;
}
#nav-menu-list .sub-menu .sub-menu > li > a:hover {
  color: #fe9901;
  background: #fffaf2;
  border-right-color: #fe9901;
  padding-left: 24px;
}

/* ══════════════════════════════════════════════
   RESPONSIVE ≤ 900px
   ══════════════════════════════════════════════ */
@media (max-width: 900px) {
  #nav-toggle { display: flex; }

  #site-nav-inner {
    justify-content: space-between;
    position: relative;
  }

  #nav-menu-list {
    display: none;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    height: auto;
    width: 100%;
    position: absolute;
    top: 52px;
    left: 0;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    padding: 8px 0 16px;
    max-height: calc(100vh - 52px);
    overflow-y: auto;
    z-index: 600;
  }
  #nav-menu-list.nav-open { display: flex; }
  #site-nav.nav-scrolled #nav-menu-list { background: #e08800; }

  /* Mobile Links */
  #nav-menu-list > li { height: auto; display: block; }
  #nav-menu-list > li > a {
    height: auto;
    padding: 13px 20px;
    font-size: 0.88rem;
    letter-spacing: 0.06em;
    border-left: 3px solid transparent;
    justify-content: space-between;
    color: #fe9901;
  }
  #nav-menu-list > li > a::before { display: none; }
  #nav-menu-list > li > a:hover,
  #nav-menu-list > li.current-menu-item > a {
    border-left-color: #fe9901;
    color: #fe9901;
    background: rgba(254,153,1,0.07);
  }
  #site-nav.nav-scrolled #nav-menu-list > li > a { color: rgba(255,255,255,0.85); }

  /* Pfeil auf Mobile */
  #nav-menu-list > li.menu-item-has-children > a::after {
    border-top-color: rgba(254,153,1,0.5);
  }
  #nav-menu-list > li.submenu-open > a::after {
    transform: rotate(180deg);
    border-top-color: #fe9901;
  }

  /* Mobile Submenü eingeklappt */
  #nav-menu-list .sub-menu {
    position: static;
    top: auto; left: auto;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    box-shadow: none;
    border-top: none;
    border-left: 3px solid #fe9901;
    border-radius: 0;
    background: #f9f5ec;
    padding: 0;
    display: none;
    transition: none;
  }
  #site-nav.nav-scrolled #nav-menu-list .sub-menu { background: #252525; }
  #nav-menu-list > li.submenu-open > .sub-menu,
  #nav-menu-list .sub-menu > li.submenu-open > .sub-menu { display: block; }

  #nav-menu-list .sub-menu > li > a {
    padding: 11px 20px 11px 28px;
    color: #b37000;
    border-left: none;
    font-size: 0.84rem;
    white-space: normal;
    justify-content: space-between;
  }
  #site-nav.nav-scrolled #nav-menu-list .sub-menu > li > a { color: rgba(255,255,255,0.65); }
  #nav-menu-list .sub-menu > li > a:hover { color: #fe9901; background: rgba(254,153,1,0.1); padding-left: 32px; }

  /* Mobile Sub-Sub */
  #nav-menu-list .sub-menu .sub-menu {
    left: auto; top: auto;
    border-left: none;
    border-top: 1px solid rgba(0,0,0,0.08);
    background: #f0ead9;
  }
  #site-nav.nav-scrolled #nav-menu-list .sub-menu .sub-menu { background: #2e2e2e; }
  #nav-menu-list .sub-menu .sub-menu > li > a {
    padding: 10px 20px 10px 36px;
    border-right: none;
  }

  /* Topbar Mobile */
  #topbar-inner {
    grid-template-columns: 1fr auto;
    padding: 0 16px;
    height: 68px;
  }
  #topbar-social { display: none; }
  #topbar-logo { grid-column: 1; justify-content: flex-start; }
}

@media (max-width: 480px) {
  #site-nav-inner { padding: 0 12px; }
  #topbar-logo img { max-height: 40px !important; }
}
