/* ============================================================
   SHELL — shared chrome elements present on all main pages
   (index, ueber-uns, beratung):
     · .brand-watermark — fixed centered logo backdrop
     · .mobile-tabbar — floating pill nav with the 3 actions
     · .mobile-tabbar-maps + chooser popover
   ============================================================ */

/* Brand watermark — fixed centered logo behind the page, made to
   look subtly carved into the surface. Multi-layer drop-shadow
   stack approximates an embossed/recessed look. Sections with
   opaque backgrounds cover it; transparent sections let it
   elegantly bleed through. */
.brand-watermark {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(20rem, 55vmin, 38rem);
  height: clamp(20rem, 55vmin, 38rem);
  pointer-events: none;
  user-select: none;
  z-index: 0;
}
.brand-watermark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  opacity: 0.085;
  filter:
    drop-shadow(0 -1px 0 rgba(0, 0, 0, 0.95))
    drop-shadow(0 1px 0 rgba(255, 255, 255, 0.06))
    drop-shadow(0 0 1px rgba(0, 0, 0, 0.9))
    drop-shadow(0 4px 12px rgba(0, 0, 0, 0.55));
}
@media (max-width: 640px) {
  .brand-watermark { width: 70vmin; height: 70vmin; }
  .brand-watermark img { opacity: 0.075; }
}

/* Mobile tabbar — floating pill nav with Anrufen / Instagram /
   Maps-chooser. Hidden on desktop, shown on tablets/phones.
   Compact-mode collapses to a single logo button after scroll.
   Tap logo to expand back, tap any action or scroll to collapse. */
.mobile-tabbar { display: none; }
.mobile-tabbar-toggle { display: none; }

@media (max-width: 820px), (hover: none) and (pointer: coarse) {
  .mobile-tabbar {
    position: fixed;
    right: 1rem;
    bottom: calc(1rem + env(safe-area-inset-bottom));
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.3rem;
    padding: 0.35rem;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    border-radius: 999px;
    transition:
      width 0.45s cubic-bezier(0.23, 1, 0.32, 1),
      padding 0.45s cubic-bezier(0.23, 1, 0.32, 1),
      gap 0.45s cubic-bezier(0.23, 1, 0.32, 1);
    /* Visible overflow so the maps chooser popover can extend
       above the pill. The collapsing width transition still hides
       items via their own opacity+width animations. */
    overflow: visible;
    max-width: calc(100vw - 2rem);
  }
  .mobile-tabbar > a {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: #111111;
    text-decoration: none;
    border-radius: 50%;
    transition: background 0.2s, transform 0.15s, opacity 0.3s, width 0.4s, margin 0.4s;
  }
  .mobile-tabbar > a:active {
    background: rgba(0, 0, 0, 0.08);
    transform: scale(0.92);
  }
  .mobile-tabbar > a svg,
  .mobile-tabbar-maps-trigger svg {
    width: 22px;
    height: 22px;
    fill: #111111;
  }
  .mobile-tabbar .mobile-tabbar-logo img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    display: block;
  }

  /* Toggle-Button (Logo-Tap) — sichtbar nur im Compact-Mode */
  .mobile-tabbar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 0;
    flex: 0 0 auto;
    opacity: 0;
    width: 0;
    margin: 0;
    order: -1;
    border-radius: 50%;
    overflow: hidden;
    transition: opacity 0.3s, width 0.4s, margin 0.4s, background 0.2s, transform 0.15s;
  }
  .mobile-tabbar-toggle img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    display: block;
  }
  .mobile-tabbar-toggle:active {
    background: rgba(0, 0, 0, 0.08);
    transform: scale(0.92);
  }

  /* Maps slot — wraps the chooser button + popover. Behaves like
     an anchor in the flex row; the popover opens above on tap. */
  .mobile-tabbar-maps {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    transition: opacity 0.3s, width 0.4s, margin 0.4s;
  }
  .mobile-tabbar-maps-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 50%;
    color: inherit;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
  }
  .mobile-tabbar-maps-trigger:active,
  .mobile-tabbar-maps-trigger[aria-expanded="true"] {
    background: rgba(0, 0, 0, 0.08);
    transform: scale(0.92);
  }
  .mobile-tabbar-maps-trigger svg { width: 22px; height: 22px; fill: #111111; }

  /* Popover menu above the trigger. Right-anchored because Maps is
     the rightmost item — centering on the button would push the
     menu off the viewport. Dark surface to contrast the light pill. */
  .mobile-tabbar-maps-menu {
    position: absolute;
    bottom: calc(100% + 0.7rem);
    right: 0;
    min-width: 9.5rem;
    padding: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    background: oklch(0.22 0.008 218);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
            backdrop-filter: blur(18px) saturate(140%);
    border: 1px solid oklch(0.81 0.13 220 / 0.6);
    border-radius: 12px;
    box-shadow:
      0 16px 36px -14px rgba(0, 0, 0, 0.85),
      0 0 0 1px oklch(0.81 0.13 220 / 0.15) inset;
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    transition:
      opacity 0.2s cubic-bezier(0.22, 1, 0.36, 1),
      transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 70;
  }
  .mobile-tabbar-maps-menu[hidden] { display: none; }
  .mobile-tabbar-maps-menu[data-open="true"] {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
  .mobile-tabbar-maps-menu a {
    /* Override the round 44px anchor styling inherited above */
    display: block;
    width: auto;
    height: auto;
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
    text-align: left;
    text-decoration: none;
    color: #f3f5f7;
    background: transparent;
    border-radius: 8px;
    transition: background 0.15s ease, color 0.15s ease;
  }
  .mobile-tabbar-maps-menu a svg { display: none; }
  .mobile-tabbar-maps-menu a:hover,
  .mobile-tabbar-maps-menu a:focus-visible {
    background: oklch(0.81 0.13 220 / 0.18);
    color: #fff;
    outline: none;
  }
  .mobile-tabbar-maps-menu a:active {
    background: oklch(0.81 0.13 220 / 0.28);
    transform: none;
  }

  /* Compact-Mode: nur Toggle-Button sichtbar */
  .mobile-tabbar.is-compact { gap: 0; }
  .mobile-tabbar.is-compact .mobile-tabbar-toggle {
    opacity: 1;
    width: 44px;
  }
  .mobile-tabbar.is-compact:not(.is-expanded) > a,
  .mobile-tabbar.is-compact:not(.is-expanded) > .mobile-tabbar-maps {
    opacity: 0;
    width: 0;
    margin: 0;
    pointer-events: none;
  }
  .mobile-tabbar.is-compact.is-expanded > a,
  .mobile-tabbar.is-compact.is-expanded > .mobile-tabbar-maps {
    opacity: 1;
    width: 44px;
  }
  .mobile-tabbar.is-compact.is-expanded { gap: 0.3rem; }
  /* Compact: Logo-Anchor versteckt (Toggle IST das Logo) */
  .mobile-tabbar.is-compact .mobile-tabbar-logo {
    opacity: 0 !important;
    width: 0 !important;
    margin: 0 !important;
    pointer-events: none;
  }

  /* Open/Closed status dot — top-right corner of the pill, mirrors
     the brand's opening hours. Green pulses when shop is currently
     open, red is static when closed. JS applies .is-open-now or
     .is-closed-now on mobile-tabbar. */
  .tabbar-status {
    position: absolute;
    top: 5px;
    right: 7px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #888;
    border: 1.5px solid #ffffff;
    z-index: 2;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.06);
    transition: background 0.3s, box-shadow 0.3s;
  }
  .mobile-tabbar.is-open-now .tabbar-status {
    background: #22c55e;
    box-shadow:
      0 0 0 1px rgba(0,0,0,0.06),
      0 0 8px rgba(34, 197, 94, 0.55);
    animation: shell-status-pulse 2.4s ease-in-out infinite;
  }
  .mobile-tabbar.is-closed-now .tabbar-status {
    background: #ef4444;
    box-shadow:
      0 0 0 1px rgba(0,0,0,0.06),
      0 0 8px rgba(239, 68, 68, 0.45);
  }
  @keyframes shell-status-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.18); }
  }
  @media (prefers-reduced-motion: reduce) {
    .mobile-tabbar.is-open-now .tabbar-status { animation: none; }
  }

  /* Body-Padding, damit nichts unter der Pille verschwindet */
  body { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
}
