/* Header – aufgeräumt und mit Variablen */

/* Grundlayout des Headers */
#_header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 12vh; /* Basis-Höhe; tatsächliche Höhe wird per JS ermittelt */
  margin: 0;
  padding: 0;
  display: block;
  transition: top var(--transition-fast, 0.2s ease), background-color var(--transition-base, 0.3s ease);
  background-color: var(--color-surface-0);
  z-index: 1000;
}

/* Container für den Header-Inhalt */
.header_Content {
  height: 100%;
  width: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-rows: 1fr 1.5fr;
}

/* Obere Reihe des Headers */
.header_top_row {
  grid-row: 1;
  display: grid;
  grid-template-columns: 1fr;
}

/* Untere Reihe des Headers */
.header_bottom_row {
  grid-row: 2;
  display: grid;
  grid-template-columns: 1fr 3fr 18fr 4fr;
}

/* Elemente der unteren Reihe */
#header_bottom_row_item_1,
#header_bottom_row_item_2,
#header_bottom_row_item_3,
#header_bottom_row_item_4 {
  display: flex;
  align-items: center;
  justify-content: center;
}

#header_bottom_row_item_2 {
  min-width: 15vw;
}

/* Impulsleiste (Marken-Akzent) */
.impulse-bar {
  height: 1px;
  width: 100%;
  background-color: var(--color-accent);
}

/* Header-Logo */
#header_logo {
  width: 80%;
  max-width: 260px; /* ca. 30% größer */
  transition: transform var(--transition-base, 0.3s ease);
  padding: 1vw;
}

/* Hover- und Aktiv-Effekte für das Header-Logo */
#header_logo:hover { transform: scale(1.05); }
#header_logo:active { transform: scale(0.95); }

/* Navigation – Liste */
.header_ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Navigation – Einträge */
.header_li { margin: 0 1vw; }

.header_li a {
  position: relative;
  text-decoration: none;
  margin: 0 0.5vw; /* Seitliche Abstände reduziert */
  text-wrap: nowrap;
  white-space: nowrap; /* Verhindert den Umbruch des Textes */
  color: var(--color-primary);
  font-size: var(--font-size-lg);
  transition: transform var(--transition-base, 0.3s ease);
  display: inline-block;
}

/* Hover- und Aktiv-Effekte für Navigationslinks */
.header_li a:hover { transform: scale(1.1); }
.header_li a:active { transform: scale(0.9); }

/* Unterstreichung in Akzentfarbe */
.header_li a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px; /* Abstand von der Schrift */
  width: 100%;
  height: 2px;
  background-color: var(--color-accent);
  transform: scaleX(0); /* Anfangsbreite auf 0 setzen */
  transform-origin: bottom right;
  transition: transform var(--transition-base, 0.3s ease);
}

/* Aktivierter Link (mit Akzent-Unterstreichung) */
.header_li a.active::after,
.header_li a:hover::after {
  transform: scaleX(1); /* Breite auf 100% erweitern */
  transform-origin: bottom left;
}

/* Hamburger Menu Button */
.header_menu_toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 1001;
}

.header_menu_toggle span {
  display: block;
  width: 28px;
  height: 3px;
  background-color: var(--color-primary);
  margin: 5px 0;
  transition: all var(--transition-base);
  border-radius: 2px;
}

/* Hamburger Animation when open */
.header_menu_toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(8px, 8px);
}

.header_menu_toggle.active span:nth-child(2) {
  opacity: 0;
}

.header_menu_toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(8px, -8px);
}

/* Responsive Anpassungen */
@media (max-width: 768px) {
  #_header {
    height: 60px;
  }

  .header_Content {
    grid-template-rows: 1fr;
  }

  .header_top_row {
    display: none;
  }

  .header_bottom_row {
    grid-row: 1;
    grid-template-columns: auto 1fr auto;
    padding: 0 1rem;
  }

  #header_bottom_row_item_1 {
    justify-content: flex-start;
    order: 1;
  }

  #header_bottom_row_item_2 {
    min-width: auto;
    order: 2;
    justify-content: center;
  }

  #header_bottom_row_item_3 {
    justify-content: flex-start;
    order: 1;
  }

  #header_bottom_row_item_4 {
    display: none;
  }

  #header_logo {
    max-width: 120px;
    padding: 0.5rem;
  }

  .impulse-bar {
    display: none;
  }

  .header_menu_toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .header_nav {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background-color: var(--color-surface-0);
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-base);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    z-index: 999;
  }

  .header_nav.active {
    max-height: 400px;
  }

  .header_ul {
    flex-direction: column;
    padding: 1rem 0;
  }

  .header_li {
    margin: 0;
    width: 100%;
    text-align: center;
  }

  .header_li a {
    display: block;
    padding: 1rem;
    margin: 0;
    font-size: 1.1rem;
  }

  .header_li a::after {
    display: none;
  }

  .header_li a.active {
    background-color: rgba(244,146,0,0.1);
  }
}

@media (min-width: 769px) and (max-width: 1080px) {
  .header_nav { display: none; }
  .header_bottom_row { grid-template-columns: 1fr 3fr 5fr 4fr; }
  #header_logo { max-width: 130px; }
}
