/* =====================================================================
   Header (mobile) — scoped overrides for base.html
   Safe: affects only header on small screens, desktop intact.
   ===================================================================== */

/* --- defaults (desktop): do nothing --- */
.menu-toggle { display: none; }    /* shown only on mobile */
#mobile-menu { display: none; }

/* --- minor spacing so the button isn’t glued to the edge --- */
.site-header .header__inner { padding: 10px 16px; }

/* --- always let brand text be visible on mobile --- */
.site-header .logo span { font-weight: 800; }

/* ---------------------------------------------------------------------
   Mobile layout (<= 820px)
   --------------------------------------------------------------------- */
@media (max-width: 820px) {

  /* hide desktop nav, we’ll use the button + panel */
  .topnav { display: none !important; }

  /* keep header flexible */
  .site-header .header__inner {
    height: auto !important;
    padding: 10px 16px;
    gap: 10px;
  }

  /* rectangular menu button that fits “Schließen” */
  .menu-toggle{
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    position: static !important;   /* no absolute positioning from old rules */
    height: 44px;
    min-width: 132px;              /* гарантирует влезание “Schließen” */
    padding: 0 16px;
    margin-left: auto;             /* push to the right */

    border: 1px solid rgba(0,0,0,.08);
    border-radius: 10px;
    background: #fff;
    color: #0b1020;

    font: 800 15px/44px Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    letter-spacing: .02em;

    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,.12);
    transition: background .2s ease, color .2s ease, box-shadow .2s ease, transform .18s ease, letter-spacing .18s ease;
  }

  /* label fills the button width */
  .menu-toggle .menu-label{
    display: block;
    width: 100%;
    text-align: center;
    white-space: nowrap;
    pointer-events: none; /* click area = button */
  }

  /* remove old “three lines” if any existed */
  .menu-toggle .line { display: none !important; }

  /* Closed state (text = “Menü”): slightly stretch letters to fill the button */
  body:not(.menu-open) .menu-toggle .menu-label { letter-spacing: .12em; }

  /* Open state (text = “Schließen”): normal kerning + inverted colors */
  body.menu-open .menu-toggle{
    background: #0b1020;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(0,0,0,.22);
  }
  body.menu-open .menu-toggle .menu-label { letter-spacing: .02em; }

  /* brand text must remain visible on mobile */
  .site-header .logo span { display: inline-block !important; }
}

/* ---------------------------------------------------------------------
   Very small screens (<= 380px): slightly tighter but still fits
   --------------------------------------------------------------------- */
@media (max-width: 380px){
  .menu-toggle{
    height: 40px;
    min-width: 120px;
    padding: 0 12px;
    font-size: 14px;
    line-height: 40px;
  }
}

/* ---------------------------------------------------------------------
   Mobile panel
   --------------------------------------------------------------------- */
#mobile-menu{
  background: #fff;
  border-top: 1px solid #e5e7eb;
  animation: menuFade .22s ease both;
}
#mobile-menu[hidden] { display: none !important; } /* respect the hidden attribute */

#mobile-menu nav{
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px;
}
#mobile-menu a.btn{ border-radius: 10px; }

/* show panel when body has the flag from JS */
body.menu-open #mobile-menu{ display: block; }

/* tiny attention ping when idle (not intrusive) */
@keyframes menuFade { from { opacity: 0; transform: translateY(-4px);} to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------------
   Defensive overrides against old/global rules (low-impact)
   --------------------------------------------------------------------- */
@media (max-width: 820px){
  .site-header .menu-toggle { float: none !important; right: auto !important; left: auto !important; }
  .site-header .logo, .site-header .menu-toggle { vertical-align: middle; }
}
