/* AFANDI – eine einzige mobile Ebene für Ansichten bis 700 px. */
@media (max-width: 700px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }

  /* Die Tab-Bar ersetzt am Handy das Burger-Menü. */
  .hamburger,
  .nav-links {
    display: none !important;
  }

  .af-mobile-tabs {
    position: fixed;
    z-index: 2000;
    right: 9px;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 9px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    padding: 6px;
    border: 1px solid rgba(195, 215, 225, .94);
    border-radius: 16px;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 14px 40px rgba(0, 46, 72, .22);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
  }

  .af-mobile-tabs a {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    padding: 4px 1px;
    border-radius: 10px;
    color: #6b8290;
    font-size: 9.5px;
    font-weight: 650;
    line-height: 1.1;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }

  .af-mobile-tabs i {
    display: grid;
    place-items: center;
    width: 33px;
    height: 30px;
    border-radius: 9px;
    background: #f1f6f8;
    color: #607d8b;
    font-style: normal;
  }

  .af-mobile-tabs svg {
    width: 19px;
    height: 19px;
  }

  .af-mobile-tabs a:nth-child(1) i { background: #e8f3f8; color: #12627f; }
  .af-mobile-tabs a:nth-child(2) i { background: #e8f6f2; color: #278c7c; }
  .af-mobile-tabs a:nth-child(3) i { background: #fff5de; color: #b67b12; }
  .af-mobile-tabs a:nth-child(4) i { background: #eeeafd; color: #6d5bd0; }
  .af-mobile-tabs a:nth-child(5) i { background: #fff0ec; color: #d26455; }

  .af-mobile-tabs a.active {
    color: #002e48;
  }

  .af-mobile-tabs a.active i {
    background: linear-gradient(145deg, #002e48, #12627f);
    color: #fff;
    box-shadow: 0 6px 15px rgba(0, 46, 72, .25);
  }

  /* Wird per JS direkt nach dem Einleitungstext eingesetzt. */
  .hero-home {
    min-height: auto;
  }

  .hero-home__content > .hero-home__visual {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100%;
    justify-content: center;
    margin: 0;
    padding: 58px 8px 42px;
    overflow: visible;
  }

  .hero-home__visual .pHeroWrap,
  .hero-home__visual .hero-panel {
    width: 100%;
    max-width: 390px;
  }

  .hero-panel__main {
    padding: 18px;
    border-radius: 22px;
  }

  .hero-panel__title { font-size: 22px; }
  .hero-panel__sub { font-size: 12.5px; }
  .hero-panel__focus { padding: 13px; border-radius: 16px; }
  .hero-panel__item { padding: 9px 10px; }
  .hero-panel__tags { gap: 5px; }
  .hero-panel__tags span { padding: 5px 8px; font-size: 10px; }

  /* Der Cookie-Bereich bekommt den Bildschirm allein. */
  body.af-cookie-open {
    padding-bottom: 0;
  }

  body.af-cookie-open .af-mobile-tabs {
    display: none !important;
  }

  #cookie-bar {
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 10px;
    z-index: 3000;
    max-height: calc(100vh - 20px);
    max-height: calc(100svh - 20px - env(safe-area-inset-bottom));
    padding: 16px;
    overflow-y: auto;
    border: 1px solid #d8e5ec;
    border-radius: 16px;
    overscroll-behavior: contain;
  }

  #cookie-bar:not(.show) {
    transform: translateY(calc(100% + 30px));
  }

  #cookie-bar .cookie-btns {
    width: 100%;
    gap: 7px;
  }

  #cookie-modal {
    inset: 0;
    z-index: 3001;
    padding: 12px;
    align-items: center;
  }

  #cookie-modal .cookie-modal-box {
    max-height: calc(100vh - 24px);
    max-height: calc(100svh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  #totop {
    bottom: calc(96px + env(safe-area-inset-bottom));
    z-index: 1900;
  }

  /* Firefox: Das Seitenende bleibt vollständig über der Tab-Bar. */
  .footer {
    position: relative;
    padding-bottom: calc(108px + env(safe-area-inset-bottom));
  }
}

@media (min-width: 701px) {
  .af-mobile-tabs {
    display: none !important;
  }
}

/* KOMPASS: Die schwebende Kopfleiste behält am Handy das dezente Mehr-Menü.
   Die vorhandene Tab-Bar und alle bisherigen Ziele bleiben unverändert. */
@media (max-width: 700px) {
  .nav {
    top:8px;
    right:9px;
    left:9px;
    height:58px;
    border-radius:18px;
  }

  .nav-inner {
    height:58px;
    padding-right:10px;
    padding-left:12px;
  }

  .nav img[src*="logo-afandi"] {
    max-width:122px;
  }

  .hamburger {
    display:grid !important;
    width:38px;
    height:38px;
    border-radius:12px;
  }

  .nav-links.open {
    top:76px;
    right:9px;
    left:auto;
    display:flex !important;
    width:min(350px,calc(100vw - 18px));
    max-height:calc(100svh - 174px);
    overflow-y:auto;
    overscroll-behavior:contain;
    padding:8px;
    gap:2px;
    border:1px solid #c8dbe6;
    border-radius:18px;
    background:rgba(255,255,255,.985) !important;
    box-shadow:0 24px 60px rgba(0,32,52,.28),0 4px 16px rgba(0,32,52,.12);
    -webkit-backdrop-filter:blur(18px) saturate(130%);
    backdrop-filter:blur(18px) saturate(130%);
    opacity:1 !important;
  }

  .nav-links.open li {
    border-bottom:1px solid #e1eaf0 !important;
  }

  .nav-links.open li:last-child,
  .nav-links.open .pMenuCtaLi {
    border-bottom:0 !important;
  }

  .nav-links.open a {
    min-height:44px;
    padding:10px 12px;
    border:1px solid transparent;
    border-radius:11px;
    background:transparent;
    color:#183b50;
    font-size:14px;
    line-height:1.25;
  }

  .nav-links.open a::before {
    background:linear-gradient(180deg,#1a8ab8,#12627f);
  }

  .nav-links.open a::after {
    color:#78bcd9;
  }

  .nav-links.open a:hover,
  .nav-links.open a:active,
  .nav-links.open a.pOn {
    border-color:#d7e8f1;
    background:#eaf5fa;
    color:#002e48;
  }

  .nav-links.open a.pMenuCta {
    min-height:46px;
    margin-top:2px;
    border-color:#002e48;
    background:#002e48;
    color:#fff;
    box-shadow:0 9px 22px rgba(0,46,72,.20);
  }

  .nav-links.open a.pMenuCta:hover,
  .nav-links.open a.pMenuCta:active {
    border-color:#00415f;
    background:#00415f;
    color:#fff;
  }
}
