/* =============================================================================
   rauMKult — Handy-Menü als App-Menü (rk-mobilmenue.css)
   Version: 1.1 | 2026-10-01 | Spec 014: Kopf des Blatts nutzt --rk-sicher-oben (Rückfall env(safe-area-inset-top)).
   Version: 1.0 | 2026-09-30 | Runde 10 M2
   Vollbild-Blatt (Handy) bzw. Seitenblatt 420 px (ab 600 px), gruppierte Zeilen wie in einer App,
   Bereiche zum Hineintippen, Akkordeons darunter, Kontakt-Kurzwege unten.
   Eigenständig: hängt nur an den globalen Tokens (main-v2.css :root) — keine Abhängigkeit von
   anderen Runde-10-Änderungen. Überschreibt die alte Schubladen-Optik (.site-nav-overlay*) gezielt.
   Stapel: liegt über Cookie-Hinweis (9000), Schwebeknöpfen und Fortschrittsbalken (9100),
   unter dem Cookie-Einstellungsfenster (10000).
   ============================================================================= */

.rk-mm {
  --rk-mm-bg: color-mix(in srgb, var(--text-primary) 4%, var(--surface-app));
  --rk-mm-card: var(--surface-card);
  --rk-mm-sub: color-mix(in srgb, var(--text-primary) 3%, var(--surface-card));
  --rk-mm-line: color-mix(in srgb, var(--text-primary) 12%, transparent);
  --rk-mm-row: 56px;
  --rk-mm-row-main: 64px;
  --rk-mm-radius: var(--rk-radius-lg, 16px);
  --rk-mm-dauer: .34s;
  --rk-mm-ease: var(--rk-ease-out, cubic-bezier(.23, 1, .32, 1));
}

/* ── Rahmen: Vollbild, keine Schubladen-Optik mehr ── */
.site-nav-overlay.rk-mm {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  animation: none;
}
.site-nav-overlay.rk-mm[hidden] { display: none; }

.rk-mm .rk-mm__sheet {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  display: flex;
  flex-direction: column;
  background: var(--rk-mm-bg);
  color: var(--text-primary);
  border: 0;
  box-shadow: none;
  font-family: var(--font-ui);
  /* Spec 014: gemeinsamer Sicherheitsabstand oben (rk-app.css --rk-sicher-oben); ohne App-Ansicht gilt die Statusleiste selbst */
  padding-top: var(--rk-sicher-oben, env(safe-area-inset-top, 0px));
  overflow: hidden;
  animation: rk-mm-auf var(--rk-mm-dauer) var(--rk-mm-ease) both;
}
@keyframes rk-mm-auf {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

/* Ab 600 px: Seitenblatt rechts mit abgedunkeltem Hintergrund */
@media (min-width: 600px) {
  .site-nav-overlay.rk-mm { background: var(--rk-backdrop, rgba(10, 10, 12, .45)); }
  .rk-mm .rk-mm__sheet {
    left: auto;
    width: min(420px, 100%);
    border-left: 1px solid var(--rk-mm-line);
    box-shadow: var(--rk-shadow-card-hover);
    animation-name: rk-mm-rein;
  }
  @keyframes rk-mm-rein { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* ── Kopfleiste: Logo links, Hell/Dunkel + Schließen rechts ── */
.rk-mm__bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 8px max(12px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--rk-mm-line);
  background: var(--rk-mm-bg);
}
.rk-mm__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  border-radius: 50%;
}
.rk-mm__logo-img { width: 40px; height: 40px; display: block; }
.rk-mm__logo-img--dark { display: none; }
[data-theme="dark"] .rk-mm__logo-img--light { display: none; }
[data-theme="dark"] .rk-mm__logo-img--dark { display: block; }
.rk-mm__tools { display: flex; align-items: center; gap: 8px; }

.rk-mm .rk-mm__tool {
  width: 48px;
  height: 48px;
  display: inline-grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 1px solid var(--rk-mm-line);
  border-radius: 50%;
  background: var(--rk-mm-card);
  color: var(--text-primary);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .2s ease, border-color .2s ease;
}
.rk-mm .rk-mm__tool:hover { background: var(--surface-hover); border-color: var(--rk-line-strong); }
.rk-mm .rk-mm__tool:focus-visible,
.rk-mm__logo:focus-visible { outline: 2px solid var(--rk-focus-color); outline-offset: 2px; }

.rk-mm__ico {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}
.rk-mm__ico--sun { display: none; }
[data-theme="dark"] .rk-mm__ico--sun { display: block; }
[data-theme="dark"] .rk-mm__ico--moon { display: none; }

/* ── Bühne und Ebenen ── */
.rk-mm__stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.rk-mm__level {
  position: absolute;
  inset: 0;
  background: var(--rk-mm-bg);
  transform: translateX(100%);
  transition: transform var(--rk-mm-dauer) var(--rk-mm-ease), opacity var(--rk-mm-dauer) ease;
  will-change: transform;
}
.rk-mm__level[data-rk-mm-level="root"] { transform: translateX(-24%); opacity: .4; }
.rk-mm__level.is-aktiv { transform: none; opacity: 1; }
.rk-mm__level[hidden] { display: none; }
.rk-mm__stage--sofort .rk-mm__level { transition: none !important; }

.rk-mm__scroll {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px));
}

.rk-mm__kicker {
  margin: 4px 4px 10px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.rk-mm__title {
  margin: 4px 4px 16px;
  font-family: var(--font-ui);
  font-size: clamp(1.625rem, 7vw, 2rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -.012em;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.rk-mm__back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 48px;
  margin: -6px 0 2px -8px;
  padding: 0 14px 0 6px;
  border: 0;
  border-radius: var(--rk-radius-pill, 999px);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 17px;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.rk-mm__back:hover { background: var(--surface-hover); }
.rk-mm__back:focus-visible { outline: 2px solid var(--rk-focus-color); outline-offset: 2px; }

/* ── Gruppierte Liste (wie App-Einstellungen) ── */
.rk-mm__group,
.rk-mm__sub {
  list-style: none;
  margin: 0;
  padding: 0;
}
.rk-mm__group {
  margin-bottom: 20px;
  background: var(--rk-mm-card);
  border: 1px solid var(--rk-mm-line);
  border-radius: var(--rk-mm-radius);
  box-shadow: var(--rk-shadow-card-rest);
  overflow: hidden;
}
.rk-mm__group > li + li,
.rk-mm__sub > li + li { border-top: 1px solid var(--rk-mm-line); }
.rk-mm__group > li,
.rk-mm__sub > li { margin: 0; padding: 0; list-style: none; }
.rk-mm__group > li::marker,
.rk-mm__sub > li::marker { content: none; }

.rk-mm .rk-mm__row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: var(--rk-mm-row);
  margin: 0;
  padding: 12px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color .18s ease;
}
.rk-mm .rk-mm__row:hover { background: var(--surface-hover); }
.rk-mm .rk-mm__row:active { background: var(--surface-active); }
.rk-mm .rk-mm__row:focus-visible { outline: 2px solid var(--rk-focus-color); outline-offset: -3px; }

.rk-mm .rk-mm__row--main { min-height: var(--rk-mm-row-main); font-size: 18px; font-weight: 500; }
.rk-mm__text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.rk-mm__label { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.rk-mm__hint {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rk-mm .rk-mm__row--lead { font-weight: 500; }

/* Aktuelle Seite / Pfad: feine orange Linie links (Farbregel: Orange nur als Linie) */
.rk-mm .rk-mm__row.is-current,
.rk-mm .rk-mm__row.is-on-path { box-shadow: inset 3px 0 0 var(--accent-orange); }
.rk-mm .rk-mm__row.is-current .rk-mm__label { font-weight: 600; }

.rk-mm__chev,
.rk-mm__arrow,
.rk-mm__plus {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .26s var(--rk-mm-ease);
}
.rk-mm__arrow { width: 18px; height: 18px; opacity: .8; }
.rk-mm .rk-mm__row:hover .rk-mm__arrow { transform: translateX(2px); }
.rk-mm .rk-mm__row[aria-expanded="true"] .rk-mm__plus { transform: rotate(180deg); }

/* ── Akkordeon-Unterpunkte ── */
.rk-mm__acc-panel { background: var(--rk-mm-sub); border-top: 1px solid var(--rk-mm-line); }
.rk-mm__acc-panel[hidden] { display: none; }
.rk-mm__sub .rk-mm__row { min-height: 52px; padding-left: 28px; font-size: 16px; }
.rk-mm__sub .rk-mm__sub .rk-mm__row { padding-left: 40px; }
.rk-mm__sub .rk-mm__sub .rk-mm__sub .rk-mm__row { padding-left: 52px; }
.rk-mm .rk-mm__row--acc[aria-expanded="true"] { font-weight: 500; }

/* „Rechtliches“: kleine, zurückhaltende Zeile */
.rk-mm .rk-mm__row--recht { min-height: 48px; font-size: 15px; color: var(--text-secondary); }

/* Service-Gruppe (Impressum, Datenschutz, Cookie, Barrierefreiheit) */
.rk-mm .rk-mm__row--meta { min-height: 52px; font-size: 16px; color: var(--text-secondary); }

/* ── Kontakt-Kurzwege unten (fest) ── */
.rk-mm__quick {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px max(12px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  border-top: 1px solid var(--rk-mm-line);
  background: var(--rk-mm-bg);
}
.rk-mm__q {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 60px;
  padding: 8px 4px;
  border: 1px solid var(--rk-mm-line);
  border-radius: 14px;
  background: var(--rk-mm-card);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color .18s ease, border-color .18s ease;
}
.rk-mm__q:hover { background: var(--surface-hover); border-color: var(--rk-line-strong); }
.rk-mm__q:active { background: var(--surface-active); }
.rk-mm__q:focus-visible { outline: 2px solid var(--rk-focus-color); outline-offset: 2px; }
.rk-mm__q .rk-mm__ico { width: 22px; height: 22px; }

/* Sehr niedrige Bildschirme (Querformat, iPhone SE): Kurzwege einzeilig */
@media (max-height: 520px) {
  .rk-mm__q { flex-direction: row; min-height: 48px; }
  .rk-mm__bar { min-height: 56px; }
}

/* ── Ruhige Darstellung: Systemeinstellung und Barrierefreiheits-Menü ── */
@media (prefers-reduced-motion: reduce) {
  .rk-mm .rk-mm__sheet,
  .rk-mm__level,
  .rk-mm__chev, .rk-mm__arrow, .rk-mm__plus { animation: none !important; transition: none !important; }
}
html.no-motion .rk-mm .rk-mm__sheet,
html.no-motion .rk-mm__level,
[data-motion="reduced"] .rk-mm .rk-mm__sheet,
[data-motion="reduced"] .rk-mm__level { animation: none !important; transition: none !important; }

/* Druck: Menü nie mitdrucken */
@media print { .rk-mm { display: none !important; } }
