:root {
  --bg: #f6f3ee;
  --text: #2b2724;
  --muted: #6f6862;
  --card: #ffffff;
  --accent: #3d5a80;
  --accent-text: #ffffff;
  --border: #e4ded6;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1a19;
    --text: #ece8e3;
    --muted: #a39b93;
    --card: #262422;
    --accent: #8fb0d9;
    --accent-text: #14181d;
    --border: #3a3633;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

a { color: var(--accent); }

.button {
  display: inline-block;
  padding: .8rem 1.6rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  text-decoration: none;
}
.button:hover, .button:focus-visible { filter: brightness(1.08); }
.button:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }

/* ---------- Landing Page ---------- */

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.mittig {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  padding: 2rem 1rem;
  overflow: hidden;
}

/* Bühne: Suchleiste mit den Polaroids drumherum */
.buehne {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: min(100%, 52rem);
}

.suche {
  position: relative;
  z-index: 5;
  display: flex;
  width: min(100%, 32rem);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  box-shadow: 0 4px 18px rgb(0 0 0 / .22), 0 1px 3px rgb(0 0 0 / .12);
}
.suche:focus-within { border-color: var(--accent); box-shadow: 0 6px 24px rgb(0 0 0 / .28), 0 1px 3px rgb(0 0 0 / .12); }

.suche input {
  flex: 1;
  min-width: 0;
  padding: .9rem 0 .9rem 1.4rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  outline: none;
}
.suche input::-webkit-search-cancel-button { cursor: pointer; }

.suche button {
  display: grid;
  place-items: center;
  width: 3.2rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.suche button:hover, .suche button:focus-visible { color: var(--accent); }
.suche button:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; border-radius: 999px; }
.suche button:last-child { border-radius: 0 999px 999px 0; }
.suche .mikro { width: 2.6rem; }
.suche .mikro[hidden] { display: none; }

/* Spracheingabe läuft: Mikrofon rot und pulsierend */
.suche.hoert { border-color: #d93025; }
.suche.hoert .mikro { color: #d93025; animation: hoert 1.2s ease-in-out infinite; }
@keyframes hoert { 50% { transform: scale(1.18); } }
/* Text erkannt, Suche wartet auf Bestätigung */
.suche.bereit .los { color: var(--accent); animation: hoert .5s ease-in-out 2; }
@media (prefers-reduced-motion: reduce) {
  .suche.hoert .mikro, .suche.bereit .los { animation: none; }
}

.landing .button { font-size: 1.05rem; padding: .9rem 1.8rem; }

/* Startseite nach dem Login: Kopfzeile oben, Suche mit Fotos mittig darunter */
.start { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.start .mittig { flex: 1; min-height: 0; padding-top: 1rem; }

/* Polaroids */
.familienbild {
  --foto: clamp(6.5rem, 26vw, 9rem);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 34rem;
  padding: 0 1rem;
}

.familienbild figure {
  width: var(--foto);
  margin: 0 -.6rem -.4rem;
  padding: .45rem .45rem 1.6rem;
  background: #fdfdfb;
  box-shadow: 0 1px 2px rgb(0 0 0 / .15), 0 8px 20px rgb(0 0 0 / .18);
  transform: rotate(var(--r, 0deg));
  transition: transform .2s ease, box-shadow .2s ease;
}
.familienbild figure:nth-child(odd)  { --r: -5deg; }
.familienbild figure:nth-child(even) { --r: 4deg; }
.familienbild figure:nth-child(3n)   { --r: -2deg; }

.familienbild figure:hover {
  z-index: 4;
  transform: rotate(0deg) scale(1.06);
  box-shadow: 0 2px 4px rgb(0 0 0 / .15), 0 14px 30px rgb(0 0 0 / .22);
}

.familienbild img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: 50% 25%;
}

/* Mit JavaScript: Polaroids rund um die Suchleiste gesteckt (Positionen setzt polaroids.js) */
.buehne.gesteckt { justify-content: center; }
.buehne.gesteckt .familienbild {
  --foto: clamp(6.5rem, min(14vw, 22vh), 12rem);
  position: absolute;
  inset: 0;
  display: block;
  max-width: none;
  padding: 0;
}
.buehne.gesteckt .familienbild figure {
  position: absolute;
  margin: 0;
}
@media (min-width: 48rem) {
  .buehne.gesteckt .familienbild figure { padding: .6rem .6rem 2.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .familienbild figure { transition: none; }
}

/* ---------- Seiten nach dem Login ---------- */

.kopf {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1.5rem;
  width: 100%;
  max-width: 60rem;
  margin: 0 auto;
  padding: 1rem;
}
.kopf .marke { color: var(--text); font-size: 1.3rem; font-weight: 700; text-decoration: none; }
.kopf .wer { margin-left: auto; color: var(--muted); font-size: .95rem; }

/* Reiter (Start, Apps, …) */
.reiter { display: flex; gap: .25rem; }
.reiter a {
  padding: .4rem .9rem;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}
.reiter a:hover, .reiter a:focus-visible { color: var(--text); background: var(--border); }
.reiter a[aria-current="page"] { color: var(--accent-text); background: var(--accent); }
@media (max-width: 30rem) {
  .reiter { order: 1; width: 100%; justify-content: center; }
}

.inhalt {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

/* Kacheln als App-Icons im Stil eines Homescreens */
.kacheln {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 2rem 1rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.kachel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .55rem;
  padding: .25rem;
  color: var(--text);
  text-align: center;
  text-decoration: none;
  border-radius: var(--radius);
}

.app-icon {
  display: grid;
  place-items: center;
  width: 5.5rem;
  aspect-ratio: 1;
  border-radius: 22.5%;
  background: var(--icon-bg, #fff);
  box-shadow:
    0 1px 2px rgb(0 0 0 / .12),
    0 6px 16px rgb(0 0 0 / .12),
    inset 0 0 0 1px rgb(0 0 0 / .06);
  overflow: hidden;
  transition: transform .15s ease;
}
@media (prefers-color-scheme: dark) {
  .app-icon { box-shadow: 0 6px 16px rgb(0 0 0 / .35), inset 0 0 0 1px rgb(255 255 255 / .12); }
}
.app-icon img { width: 66%; height: 66%; object-fit: contain; }

a.kachel:hover .app-icon,
a.kachel:focus-visible .app-icon { transform: scale(1.06); }
a.kachel:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
a.kachel:active .app-icon { transform: scale(.96); }

.kachel strong { font-size: 1rem; font-weight: 600; line-height: 1.2; }
.kachel span:not(.app-icon) { color: var(--muted); font-size: .8rem; line-height: 1.2; }
.kachel.geplant { opacity: .5; }

@media (prefers-reduced-motion: reduce) {
  .app-icon { transition: none; }
}

.hinweis {
  max-width: 32rem;
  margin: 15vh auto 0;
  padding: 0 1rem;
  text-align: center;
}
