/* sanierungsprofi-hamburg.de — mobiles Menue.
   Uebernommen von der Schwesterseite kuechen-montage-hamburg.de: eine feste
   Lasche am rechten Bildschirmrand ("MENUE") oeffnet die Navigation als
   Vollbild-Blatt mit klebendem Markenkopf. Der Punkt "Dachausbau" klappt sein
   Untermenue als Akkordeon auf, statt wie auf dem Desktop zu schweben.

   Bewusst NICHT uebernommen: die Kontaktleiste und der Nach-oben-Knopf der
   Schwesterseite — hier gibt es dafuer bereits .sticky-cta.

   Aufbau (js/mobile-menu.js): die Lasche und die geoeffnete <nav> haengen
   direkt an <body>. Grund: .header hat backdrop-filter und wird damit zum
   Containing Block fuer position:fixed — die Lasche wuerde sonst je nach
   Scrollposition wandern. */

/* Alle drei baut das JS auf jeder Seite; ausserhalb des Telefons sind sie
   unsichtbar. Ohne diese Zeile zeichnet der Browser die Aufklapp-Schaltflaeche
   als leere Kapsel neben "Leistungen" in die Desktop-Kopfzeile. */
.nav-drawer-head { display: none; }
.nav-toggle { display: none; }
.nav-sub-toggle { display: none; }

@media (max-width: 980px) {

  /* -- 1. Die Lasche -- */
  .nav-toggle {
    display: flex !important;
    position: fixed; z-index: 60;
    right: 0; top: 52%; transform: translateY(-50%);
    flex-direction: column; align-items: center; justify-content: center; gap: 5px;
    width: 52px; height: 94px; padding: 8px 5px;
    border: 1px solid rgba(255, 255, 255, .7); border-right: 0;
    border-radius: 16px 0 0 16px;
    background: var(--ink-2, #13243b); color: #fff;
    font: inherit; font-size: 25px; line-height: 1; cursor: pointer;
    box-shadow: 0 12px 28px rgba(10, 21, 37, .28);
  }
  .nav-toggle::after {
    content: "MENÜ";
    font-size: 10px; font-weight: 800; line-height: 1; letter-spacing: .09em;
  }
  .nav-toggle:focus-visible { outline: 3px solid var(--gold, #f4c770); outline-offset: 3px; }

  /* Solange offen: Seite dahinter friert ein, und der Kopf verliert seinen
     Filter (siehe Kommentar oben — sonst wandert alles Feste mit ihm). */
  body.nav-drawer-lock { overflow: hidden; }
  body.nav-drawer-lock .header {
    backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
  }

  /* Geschlossen gibt es keine Laufschrift-Leiste mehr: der Kopf zeigt nur noch
     das Logo, die Punkte stehen alle im Blatt hinter der Lasche. */
  .header .nav { display: none; }

  /* -- 2. Das geoeffnete Blatt -- */
  .nav.nav-drawer-open {
    box-sizing: border-box;
    display: block !important;
    position: fixed !important; z-index: 50;
    inset: 0 !important;
    width: 100% !important; height: auto !important;
    /* Rechts bleibt die Breite der Lasche frei: sie liegt ueber dem Blatt, und
       auf ihrer Hoehe steht sonst ein Zeilenende oder der Akkordeon-Pfeil
       unerreichbar darunter. */
    margin: 0 !important; padding: 0 62px 24px 18px !important;
    border-top: 0 !important;
    background: var(--paper, #faf7f2);
    overflow-x: hidden !important; overflow-y: auto !important;
    overscroll-behavior: contain;
    font-size: 16px;
    /* Die Laufschrift-Maske und der negative Rand der ≤640px-Zeile duerfen
       nicht in das Blatt lecken. */
    -webkit-mask-image: none !important; mask-image: none !important;
    box-shadow: 0 18px 50px rgba(10, 21, 37, .18);
  }

  /* -- 3. Klebender Markenkopf, identisch zum Kopf der Startseite -- */
  .nav-drawer-open .nav-drawer-head {
    box-sizing: border-box; display: block;
    position: sticky; top: 0; z-index: 4;
    margin: 0 -62px 0 -18px; padding: 12px 18px 11px;
    border-bottom: 1px solid var(--line, #e4dccd);
    background: var(--paper, #faf7f2);
  }
  .nav-drawer-brand {
    display: flex !important; align-items: center; gap: 10px;
    min-height: 44px; padding: 0 !important;
    color: var(--ink, #0a1525) !important; text-decoration: none !important;
    white-space: nowrap;
  }
  .nav-drawer-brand__mark {
    display: grid; place-items: center;
    flex: 0 0 38px; width: 38px; height: 38px;
    border-radius: 10px; background: var(--brand, #e23b33);
    color: #fff; font-size: 19px; font-weight: 800; line-height: 1;
    box-shadow: 0 2px 10px -2px rgba(226, 59, 51, .45);
  }
  .nav-drawer-brand__copy { display: grid; min-width: 0; gap: 2px; text-align: left; }
  .nav-drawer-brand__copy strong {
    font-size: 15.5px; font-weight: 800; line-height: 1.1; letter-spacing: -.01em;
  }
  .nav-drawer-brand__copy strong span { color: var(--brand-ink, #a8271f); }
  .nav-drawer-brand__copy small {
    color: var(--mute, #5e6779);
    font-size: 10.5px; font-weight: 700; line-height: 1.1;
    letter-spacing: .05em; text-transform: uppercase;
  }

  /* -- 4. Die Punkte: volle Zeilenbreite statt Laufschrift -- */
  .nav.nav-drawer-open > a,
  .nav.nav-drawer-open .has-sub > a {
    box-sizing: border-box;
    display: flex !important; align-items: center; justify-content: flex-start;
    width: 100% !important; min-width: 0; min-height: 48px;
    margin: 0 !important; padding: 11px 12px !important;
    border: 0 !important; border-bottom: 1px solid var(--line, #e4dccd) !important;
    border-radius: 0 !important;
    color: var(--ink-2, #13243b) !important;
    font-size: 16px !important; font-weight: 700 !important; line-height: 1.2;
    white-space: normal !important;
  }
  .nav.nav-drawer-open > a:hover,
  .nav.nav-drawer-open > a:focus-visible {
    background: var(--brand-soft, #fdeceb); color: var(--brand-ink, #a8271f) !important;
  }
  .nav.nav-drawer-open > a[aria-current="page"] {
    background: var(--paper-2, #f1ece3);
    color: var(--brand-ink, #a8271f) !important; font-weight: 800 !important;
    box-shadow: inset 3px 0 var(--brand, #e23b33);
  }

  /* -- 5. Dachausbau als Akkordeon -- */
  .nav.nav-drawer-open .has-sub {
    display: block !important; width: 100%; position: static !important;
  }
  /* Der Punkt bleibt ein Link auf die Seite; der Pfeil daneben ist die
     Schaltflaeche zum Aufklappen. Ein Punkt, zwei klar getrennte Ziele. */
  .nav.nav-drawer-open .has-sub > a { padding-right: 56px !important; }
  .nav.nav-drawer-open .has-sub { position: relative !important; }
  .nav-sub-toggle {
    display: none;
    position: absolute; z-index: 2; right: 10px; top: 9px;
    box-sizing: border-box;
    width: 32px; height: 32px; padding: 0;
    border: 1px solid var(--line-2, #d3c9b6); border-radius: 50%;
    background: #fff no-repeat center / 13px 9px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 16'%3E%3Cpath d='m3 4 9 8 9-8' fill='none' stroke='%2313243b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    cursor: pointer;
    transition: transform .2s cubic-bezier(.22, 1, .36, 1);
  }
  .nav.nav-drawer-open .nav-sub-toggle { display: block; }
  .nav-sub-toggle[aria-expanded="true"] {
    transform: rotate(180deg);
    border-color: var(--line-2, #d3c9b6); background-color: var(--paper-2, #f1ece3);
  }
  .nav-sub-toggle:focus-visible { outline: 3px solid var(--gold, #f4c770); outline-offset: 2px; }

  .nav.nav-drawer-open .has-sub > .sub { display: none; }
  .nav.nav-drawer-open .has-sub.is-open > .sub {
    display: block !important;
    position: static !important;
    width: auto !important; min-width: 0 !important;
    margin: 0 0 6px !important; padding: 4px 0 10px !important;
    border: 0 !important; border-bottom: 1px solid var(--line, #e4dccd) !important;
    border-radius: 0 !important;
    background: #fff !important; box-shadow: none !important;
    animation: nav-sub-in .22s cubic-bezier(.22, 1, .36, 1) both;
  }
  .nav.nav-drawer-open .has-sub.is-open > .sub a {
    display: flex !important; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 44px; padding: 10px 12px 10px 24px !important;
    border-bottom: 1px solid var(--paper-2, #f1ece3);
    color: var(--body, #37455c) !important;
    font-size: 15px !important; font-weight: 600 !important;
  }
  .nav.nav-drawer-open .has-sub.is-open > .sub a::after {
    content: "→"; flex: none; color: var(--brand, #e23b33); font-size: 16px;
  }
  .nav.nav-drawer-open .has-sub.is-open > .sub a:last-child { border-bottom: 0; }
  .nav.nav-drawer-open .has-sub.is-open > .sub .sub-label {
    display: block; margin: 10px 0 2px; padding: 10px 12px 0 24px;
    border-top: 1px solid var(--line, #e4dccd);
    color: var(--mute, #5e6779);
    font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  }
  .nav.nav-drawer-open .has-sub.is-open > .sub .sub-label + a { border-top: 0; }
}

/* Auf schmalen Geraeten steht unten die .sticky-cta — das Blatt endet darueber,
   damit der letzte Punkt ("Kontakt") nicht unter der Leiste liegt. */
@media (max-width: 640px) {
  .nav.nav-drawer-open { inset: 0 0 78px 0 !important; }
  .nav-toggle { top: 46%; }
}

@media (max-width: 350px) {
  .nav.nav-drawer-open { padding: 0 58px 24px 14px !important; }
  .nav-drawer-open .nav-drawer-head { margin: 0 -58px 0 -14px; padding-inline: 14px; }
  .nav.nav-drawer-open > a,
  .nav.nav-drawer-open .has-sub > a { min-height: 44px; font-size: 15px !important; }
  .nav-drawer-brand__copy strong { font-size: 14.5px; }
}

@keyframes nav-sub-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .nav.nav-drawer-open .has-sub.is-open > .sub { animation: none; }
  .nav-sub-toggle { transition: none; }
}
