/* ==========================================================================
   IMC Hauptnavigation — Darkmode-Variante
   Entspricht optisch dem freigegebenen HTML-Prototyp (nav-menu-darkmode.html),
   hier an TYPO3-HMENU-Markup angepasst (server-gerendertes <ul>/<li>/<button>).
   ========================================================================== */

:root {
  --heading: #004985;
  --bg: #ffffff;
  --surface: #f5f8fb;
  --text: #1a1a1a;
  --text-dim: #6b7580;
  --line: #e6ebf0;
  --icon-bg: #eaf2fa;
  --icon-color: #004985;
  --topbar-grad: linear-gradient(#323844, #004782);
  --shadow: 0 10px 26px rgba(0, 30, 60, 0.08);
  --accent-gold: #c9a227;
  --nav-dark: #323844;
  --nav-blue: #004782;
  --nav-blue-light: #0067a8;

  --text-muted: rgba(255, 255, 255, 0.68);

  --border: rgba(255, 255, 255, 0.12);
  --border-light: rgba(255, 255, 255, 0.2);

  --surface: rgba(255, 255, 255, 0.075);
  --surface-hover: rgba(255, 255, 255, 0.12);

  --radius: 12px;
  --transition: 180ms ease;

  --max-width: 1180px;
}

html[data-theme='dark'] {
  --bg: #12161c;
  --surface: #1a2029;
  --text: #dfe4ea;
  --text-dim: #8b96a3;
  --line: #262e39;
  --icon-bg: #223047;
  --icon-color: #6fb3ef;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  --heading: #4f9fe0;
}

#mainNav {
  position: fixed;
  top: 163px;
  width: 100%;
  z-index: 99;
}

/* ---------- Topbar ---------- */
.imc-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--topbar-grad);
  padding: 12px 16px;
  color: #fff;
  position: fixed;
  z-index: 5;
  width: 100%;
}

.imc-topbar-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--topbar-grad);
  padding: 12px 16px;
  color: #fff;
  z-index: 6;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}

.imc-lang-switch a {
  text-decoration: none;
  color: #fff;
  font-size: 13.5px;
}
.imc-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 18px;
}
.imc-brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6fd0c5;
  flex-shrink: 0;
}
.imc-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.imc-pill-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}
.imc-pill-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.imc-icon-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  cursor: pointer;
  position: relative;
  transition: background 0.2s ease;
}
.imc-icon-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.imc-theme-toggle svg {
  position: absolute;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}
.imc-theme-toggle .icon-sun {
  opacity: 1;
  transform: scale(1) rotate(0);
}
.imc-theme-toggle .icon-moon {
  opacity: 0;
  transform: scale(0.5) rotate(-40deg);
}
html[data-theme='dark'] .imc-theme-toggle .icon-sun {
  opacity: 0;
  transform: scale(0.5) rotate(40deg);
}
html[data-theme='dark'] .imc-theme-toggle .icon-moon {
  opacity: 1;
  transform: scale(1) rotate(0);
}

/* Sprachumschalter — Buttons kommen serverseitig aus lib.languageMenu */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 4px;
}

.lang-switch__item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  text-decoration: none;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.lang-switch__item:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.lang-switch__item.is-active {
  background: #fff;
  color: #0f3a5f; /* passend zum dunklen Blau des Headers */
}

.imc-burger {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  background: transparent;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.3s ease,
    border-color 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}
.imc-burger:hover {
  background: rgba(255, 255, 255, 0.22);
}
.imc-burger .imc-burger-lines {
  position: relative;
  width: 22px;
  height: 16px;
}
.imc-burger .imc-burger-lines span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: #fff;
  transition:
    top 0.25s ease,
    transform 0.25s ease,
    opacity 0.15s ease 0.1s;
}
.imc-burger .imc-burger-lines span:nth-child(1) {
  top: 0;
}
.imc-burger .imc-burger-lines span:nth-child(2) {
  top: 7px;
}
.imc-burger .imc-burger-lines span:nth-child(3) {
  top: 14px;
}

/* Aktiver Zustand: X */
body.nav-open .imc-burger.active .imc-burger-lines span {
  transition:
    top 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.25s ease,
    opacity 0.15s ease;
}
body.nav-open .imc-burger-lines span:nth-child(1) {
  top: 7px;
  transform: rotate(45deg);
}
body.nav-open .imc-burger-lines span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
body.nav-open .imc-burger-lines span:nth-child(3) {
  top: 7px;
  transform: rotate(-45deg);
}

.imc-burger .burger::before,
.nav-toggle .burger::after {
  content: '';
  position: absolute;
  left: 0;
  width: 19px;
  height: 2px;
  background: #fff;
  transition:
    transform 0.25s ease,
    opacity 0.2s ease;
}

/* ---------- Menü-Container (vom HMENU erzeugt) ---------- */
.nav-wrap {
  max-height: 0;
  overflow: hidden;
  overflow-y: hidden;
  transition:
    max-height 0.35s ease,
    background 0.3s ease;
  background: var(--bg);
  box-shadow: var(--shadow);
}
body.nav-open .nav-wrap {
  max-height: calc(100dvh - 163px);
  box-shadow: 0 16px 28px rgba(0, 10, 20, 0.3);
  overflow-y: auto; /* während der Öffnen-Animation noch kein Scroll */
  transition:
    max-height 0.35s ease,
    background 0.3s ease;
}

/* Scrollbar erst aktivieren, wenn die Öffnen-Animation fertig ist */
body.nav-open.nav-fully-open .nav-wrap {
  overflow-y: auto;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 10px 10px 22px;
}

.nav-row {
  position: relative;
}

.nav-row-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: none;
  border: none;
  padding: 13px 12px;
  margin: 2px 0;
  border-radius: 14px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--heading);
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease;
}
.nav-row-btn:hover {
  background: var(--surface);
}
.nav-row.expanded > .nav-row-btn {
  background: var(--surface);
}

.row-label {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  width: 100%;
}

.icon-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--icon-bg);
  color: var(--icon-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    background 0.3s ease,
    color 0.3s ease;
}
.icon-badge svg {
  width: 18px;
  height: 18px;
}
.depth-1 .icon-badge,
.depth-2 .icon-badge,
.depth-3 .icon-badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}
.depth-1 .icon-badge svg,
.depth-2 .icon-badge svg,
.depth-3 .icon-badge svg {
  width: 15px;
  height: 15px;
}

.label-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chevron-trail {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-dim);
  transition: transform 0.25s ease;
}
.nav-row.expanded > .nav-row-btn > .chevron-trail {
  transform: rotate(90deg);
  color: var(--heading);
}

/* Blätter (Seiten ohne Unterseiten) erkennt CSS selbst: kein .nav-sublist-Kind
   vorhanden -> Chevron ausblenden. Kein JS-Flag nötig, das HMENU liefert für
   Blattseiten schlicht kein verschachteltes <ul>. */
.nav-row:not(:has(.nav-sublist)) > .nav-row-btn > .chevron-trail {
  visibility: hidden;
}

.nav-sublist {
  list-style: none;
  margin: 4px 0 6px;
  padding: 0 0 0 14px;
  max-height: 0;
  overflow: hidden;
  border-left: 2px solid var(--line);
  margin-left: 28px;
  transition: max-height 0.35s cubic-bezier(0.65, 0, 0.35, 1);
}
.nav-row.expanded > .nav-sublist {
  max-height: 99999px;
  overflow-y: scroll;
}

.depth-1 > .nav-row-btn {
  font-size: 15px;
  padding: 11px 10px;
}
.depth-2 > .nav-row-btn {
  font-size: 14.5px;
  padding: 10px 10px;
}
.depth-3 > .nav-row-btn {
  font-size: 14px;
  padding: 9px 10px;
  font-weight: 500;
}
.depth-2 .nav-sublist,
.depth-3 .nav-sublist {
  margin-left: 22px;
}

/* aktuelle Seite im Pfad optisch hervorheben */
.nav-current > .nav-row-btn {
  background: var(--surface);
}

.nav-row-btn:focus-visible,
.imc-burger:focus-visible,
.imc-pill-btn:focus-visible,
.imc-icon-btn:focus-visible,
.imc-lang-switch button:focus-visible {
  outline: 2px solid var(--heading);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .nav-wrap,
  .nav-sublist,
  .chevron-trail,
  .imc-burger-lines span,
  .imc-lang-thumb,
  .imc-theme-toggle svg {
    transition: none !important;
  }
}

/* Fallback für Browser ohne :has()-Unterstützung (sehr selten, < 2%):
   Chevron bleibt sichtbar, wirkt bei Blattseiten optisch neutral, da er
   ohnehin nicht rotiert/reagiert. Kein funktionaler Nachteil. */

/* ########### HAUPTNAVIGATION ########### */
/* =========================================================
   RESET
   ========================================================= */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* ============ HOVER-EFFEKT FÜR ALLE EBENEN ============ */

.nav-row-btn {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  transition:
    background 0.2s ease,
    transform 0.15s ease,
    padding-left 0.2s ease;
}

/* Sanfter Hintergrund-Fade beim Hover, Farbe je nach Ebene */
.nav-row.depth-0 > .nav-row-btn:hover {
  /* background: rgba(47, 180, 163, 0.1); /* Teal-Ton, Ebene 1 */
  box-shadow: 0 6px 14px rgba(0, 20, 40, 0.14);

  transition: border 0.25s ease;
}

.nav-row.depth-1 > .nav-row-btn:hover {
  background: rgba(15, 58, 95, 0.06); /* Navy-Ton, Ebene 2 */
}

.nav-row.depth-2 > .nav-row-btn:hover {
  background: rgba(15, 58, 95, 0.04); /* noch dezenter, Ebene 3 */
}

[data-theme='dark'] .nav-row.depth-0 > .nav-row-btn:hover {
  background: rgba(55, 205, 185, 0.14);
}
[data-theme='dark'] .nav-row.depth-1 > .nav-row-btn:hover,
[data-theme='dark'] .nav-row.depth-2 > .nav-row-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* Leichtes Einrücken beim Hover — verstärkt das Gefühl von "hier geht's weiter" */

/* Icon-Badge reagiert mit: */
.icon-badge {
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

/* Chevron dreht sich sanft und rutscht leicht mit */
.chevron-trail {
  transition:
    transform 0.25s ease,
    opacity 0.2s ease;
  opacity: 0.55;
}

.nav-row-btn:hover .chevron-trail {
  opacity: 1;
  transform: translateX(0px);
}

.nav-row.is-open > .nav-row-btn .chevron-trail {
  transform: rotate(90deg);
}

.nav-row.is-open > .nav-row-btn:hover .chevron-trail {
  transform: rotate(90deg) translateX(0px);
}

/* Linktext: feine Unterstreichung baut sich beim Hover auf */
.label-text a,
.label-text {
  position: relative;
  width: 100%;
  height: 100%;
}

.label-text a {
  text-decoration: none;
  color: inherit;
  width: 100%;
  height: 100%;
  display: inline-block;
}

.label-text a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1.5px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  opacity: 0.5;
  transition: transform 0.25s ease;
}

.nav-row-btn:hover .label-text a::after {
  transform: scaleX(1);
}

/* Aktiver Zustand bleibt klar erkennbar, auch ohne Hover */
.nav-row.nav-current > .nav-row-btn {
  background: rgba(47, 180, 163, 0.12);
}

.nav-row.nav-current > .nav-row-btn .icon-badge {
  background: var(--imc-teal, --accent-gold);
  color: #fff;
}

/* Sanfter Übergang beim Fokus (Tastatur) — gleiche Optik wie Hover */
.nav-row-btn:focus-visible {
  outline: 2px solid var(--imc-focus, --accent-gold);
  outline-offset: 2px;
}

/* =========================================================
   HEADER
   ========================================================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;

  background: linear-gradient(120deg, #323844 0%, #273d59 42%, #004782 100%);

  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.16);
}

/* =========================================================
   TOP BAR
   ========================================================= */

.top-bar {
  height: 38px;

  border-bottom: 1px solid rgba(255, 255, 255, 0.1);

  display: flex;
  align-items: center;
}

.imc-topbar {
  position: fixed;
  top: 0;
}

.top-bar-inner {
  width: min(1440px, calc(100% - 64px));
  margin: 0 auto;

  display: flex;
  justify-content: flex-end;
  align-items: center;

  gap: 24px;
}

.top-bar a {
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.02em;

  transition: color var(--transition);
}

.top-bar a:hover {
  color: #fff;
}

.imc-topbar img {
  height: 115px;
  width: auto;
}

#topBarMobileWrapper {
  display: none;
}

.imc-brand.mobile {
  display: none;
}

.frame-default {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
}

.frame-type-html {
  width: 100%;
  max-width: unset;
}

@media all and (max-width: 1000px) {
  .imc-topbar img {
    height: 80px;
  }
  main:not(.container) {
    margin-top: 124px;
  }
}

@media (max-width: 750px) {
  /*
  .imc-topbar-right {
    display: grid;
    grid-template-columns: repeat(3, auto); /* 3 Spalten */
  /*
    grid-template-rows: repeat(3, auto); /* 3 Zeilen */

  /*gap: 8px 12px;
    justify-content: end; /* schiebt das ganze Grid nach rechts */
  /*justify-items: center; /* zentriert Icons in ihrer Zelle */
  /*align-items: center;
    /*margin-left: auto; /* falls .icon-bar in einem größeren Flex-Container sitzt */
  /*max-width: 40%;
  } 
    */

  .imc-brand {
    width: 70%;
  }
  #topBarMobileWrapper {
    display: block;
  }
  .imc-brand {
    display: none;
  }
  .imc-brand.mobile {
    display: block;
  }

  .imc-topbar {
    padding: 0;
  }

  #mainNav {
    position: fixed;
    top: 118px;
    width: 100%;
    z-index: 99;
    height: 100%;
  }

  body.nav-open .nav-wrap {
    max-height: calc(100dvh - 118px);
  }
}
