/* ═══════════════════════════════════════════════════════════════════
   KULZER Mobile Layer — Bottom Nav · Page Transitions · Touch UX
   Shared across all pages. Only active at <768px.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Bilingual display contract (shared i18n) ───────────────────────
   Hide the inactive language everywhere — footer, bottom-nav, body.
   Mirrors styles/kulzer.css so pages that do NOT load kulzer.css and
   carry no inline rules still localise correctly (fixes footer showing
   "MandantenportalClient Portal"). `body.lang-en` is the single source
   of truth, toggled by each page's language switch. Loaded in <head>
   on every page, so this applies at all viewport widths. */
[data-lang-en] { display: none; }
body.lang-en [data-lang-de] { display: none; }
body.lang-en [data-lang-en] { display: inline; }
body.lang-en [data-lang-en-block] { display: block; }

/* ── Global Touch Optimisation ──────────────────────────────────── */
@media (max-width: 767px) {
  html {
    overflow-x: hidden;
    overscroll-behavior-y: contain;
  }
  body {
    -webkit-tap-highlight-color: transparent;
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }
  a, button, [role="button"], input, select, textarea, summary {
    touch-action: manipulation;
  }
  a:active, button:active, .practice-card:active, .cta-primary:active, .cta-secondary:active {
    transform: scale(0.97);
    transition: transform 80ms ease;
  }
}

/* ── Bottom Navigation Bar ──────────────────────────────────────── */
.kulzer-bottom-nav {
  display: none;
}

@media (max-width: 767px) {
  .kulzer-bottom-nav {
    display: flex;
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1200;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(14, 17, 17, 0.82);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-top: 1px solid rgba(184, 115, 51, 0.18);
    align-items: stretch;
    justify-content: space-around;
  }

  .kulzer-bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 44px;
    min-width: 0;
    padding: 6px 0 2px;
    text-decoration: none;
    color: rgba(245, 241, 232, 0.4);
    transition: color 180ms ease;
    position: relative;
    gap: 2px;
  }

  .kulzer-bottom-nav__item:hover,
  .kulzer-bottom-nav__item:focus-visible {
    color: rgba(245, 241, 232, 0.7);
  }

  .kulzer-bottom-nav__item[aria-current="page"],
  .kulzer-bottom-nav__item.is-active {
    color: var(--copper, #B87333);
  }

  .kulzer-bottom-nav__item[aria-current="page"]::before,
  .kulzer-bottom-nav__item.is-active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 2px;
    background: var(--copper, #B87333);
    border-radius: 0 0 2px 2px;
  }

  .kulzer-bottom-nav__icon {
    width: 18px;
    height: 18px;
    opacity: 0.85;
  }

  .kulzer-bottom-nav__label {
    font-family: var(--mono, 'IBM Plex Mono', monospace);
    font-size: 7.5px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
  }

  .kulzer-bottom-nav__item:focus-visible {
    outline: 2px solid var(--copper, #B87333);
    outline-offset: -2px;
  }
}

/* ── Page Transitions ───────────────────────────────────────────── */
@media (max-width: 767px) {
  @keyframes kulzer-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .kulzer-page-entering main,
  .kulzer-page-entering #main-content {
    animation: kulzer-fade-in 280ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  ::view-transition-old(root) {
    animation: 180ms ease-out both fade-out;
  }
  ::view-transition-new(root) {
    animation: 280ms cubic-bezier(0.16, 1, 0.3, 1) both fade-in;
  }
  @keyframes fade-out {
    to { opacity: 0; }
  }
  @keyframes fade-in {
    from { opacity: 0; transform: translateY(4px); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .kulzer-page-entering main,
  .kulzer-page-entering #main-content {
    animation: none !important;
  }
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }
}

/* ── Practice Cards — Mobile horizontal scroll ──────────────────── */
@media (max-width: 767px) {
  .practice-grid {
    display: flex !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 12px;
    padding: 0 20px 16px;
    margin: 0 -20px;
  }
  .practice-card {
    min-width: 85vw;
    max-width: 85vw;
    flex-shrink: 0;
    scroll-snap-align: start;
  }

  /* Scroll indicator dots */
  .practice-grid::after {
    content: '';
    min-width: 20px;
    flex-shrink: 0;
  }
}

/* ── Swipe Hint Indicators ──────────────────────────────────────── */
.kulzer-swipe-hint {
  display: none;
}

@media (max-width: 767px) {
  .kulzer-swipe-hint {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 10px 0 4px;
  }
  .kulzer-swipe-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(184, 115, 51, 0.25);
    transition: background 220ms ease, transform 220ms ease;
  }
  .kulzer-swipe-dot.is-active {
    background: rgba(184, 115, 51, 0.75);
    transform: scale(1.3);
  }
}

/* ── Mobile-optimised Section Spacing ───────────────────────────── */
@media (max-width: 767px) {
  .hero {
    padding: 100px 20px 60px !important;
    min-height: calc(100vh - 64px) !important;
    min-height: calc(100svh - 64px) !important;
  }
  .section-inner {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }
  .hero-ctas {
    flex-direction: column;
    gap: 12px;
  }
  .hero-ctas .cta-primary,
  .hero-ctas .cta-secondary {
    width: 100%;
    text-align: center;
    justify-content: center;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
  }
}

/* ── Scroll Progress Indicator ──────────────────────────────────── */
@media (max-width: 767px) {
  .kulzer-scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background: linear-gradient(90deg, rgba(184,115,51,0.6), rgba(184,115,51,0.9));
    z-index: 1300;
    transition: width 60ms linear;
    pointer-events: none;
  }
}

/* ── Hide bottom nav when mobile-nav overlay is open ────────────── */
.mobile-nav.open ~ .kulzer-bottom-nav,
body.mobile-nav-open .kulzer-bottom-nav {
  transform: translateY(100%);
  transition: transform 280ms ease;
}
