/* ==========================================================================
   Basis: Reset, Typografie und die App-Hülle (Seitenbereich + Menüleiste)
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  /* Kein blauer Tap-Blitz auf Android/iOS – wir haben eigene Zustände */
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-m);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* Verhindert das "Gummiband"-Nachziehen der ganzen Seite auf dem Handy */
  overscroll-behavior-y: none;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Das hidden-Attribut soll IMMER verstecken – auch bei Elementen, denen
   wir per CSS ein display (grid, flex, block …) geben. */
[hidden] {
  display: none !important;
}

/* Nur für Screenreader sichtbar */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --- App-Hülle ----------------------------------------------------------- */

/* Hier rendert der Router den jeweils aktiven Bereich hinein. */
.view {
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
}

/* Jede Seite blendet beim Wechsel sanft ein. */
.page {
  animation: page-in var(--dur-m) var(--ease-out) both;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* Normale (scrollende) Inhaltsseiten bekommen Innenabstand + Maximalbreite.
   Vollbild-Seiten wie die Karte setzen stattdessen eigene Regeln. */
.page--content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: calc(var(--safe-top) + var(--space-5)) var(--space-4) var(--space-6);
}

.page-header {
  margin-bottom: var(--space-5);
}

.page-header h1 {
  font-size: var(--text-xxl);
}

.page-header p {
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* --- Untere Menüleiste ------------------------------------------------- */

.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 1000; /* über der Karte (Leaflet nutzt bis ~800) */
  display: flex;
  justify-content: space-around;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-top: 1px solid var(--border);
}

.tabbar__item {
  flex: 1;
  max-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--dur-fast);
}

/* Die "Pille" hinter dem Icon des aktiven Tabs (wie bei nativen Apps) */
.tabbar__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 30px;
  border-radius: var(--radius-pill);
  transition: background var(--dur-m) var(--ease-out), transform var(--dur-m) var(--ease-spring);
}

.tabbar__item[aria-current='page'] {
  color: var(--accent-strong);
}

.tabbar__item[aria-current='page'] .tabbar__icon {
  background: var(--accent-soft);
  transform: scale(1.04);
}

.tabbar__item:active .tabbar__icon {
  transform: scale(0.92);
}

/* --- Platzhalter-Seite ("Kommt bald") ------------------------------------ */

.placeholder {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  text-align: center;
  padding: var(--space-7) var(--space-4);
}

.placeholder__icon {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  margin-bottom: var(--space-2);
}

.placeholder h1 {
  font-size: var(--text-xl);
}

.placeholder p {
  color: var(--text-muted);
  max-width: 32ch;
}
