/* ==========================================================================
   Weihnachtswichteln – Gestaltung für alle Seiten
   Mobile first: Grundwerte gelten fürs Handy, größere Bildschirme per @media.
   ========================================================================== */

/* ---------- Farben, Schriften, Maße ---------- */
:root {
  --green-900: #143628;
  --green-800: #1f4d3a;   /* Dunkelgrün – Hauptfarbe */
  --green-100: #e3ede6;
  --wine-800:  #6e1622;
  --wine-700:  #8a1c2b;   /* Weinrot – wichtige Aktionen */
  --wine-100:  #f6e4e6;
  --gold-500:  #c9a227;   /* Gold – nur Akzent (Icons, Linien) */
  --gold-700:  #7a5c0c;   /* dunkles Gold – lesbar auf hellem Grund */
  --gold-100:  #fbf1d9;
  --cream:     #fbf7f0;   /* warmes Weiß – Seitenhintergrund */
  --paper:     #ffffff;   /* Karten */
  --ink:       #1e2a23;   /* Text */
  --ink-muted: #55605a;   /* Nebentext (Kontrast > 6:1) */
  --line:      #e6ded0;   /* dezente Linien */
  --field:     #8a8374;   /* Rahmen von Eingabefeldern (Kontrast > 3:1) */

  --font-text: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: Georgia, Cambria, "Times New Roman", serif;

  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 1px 2px rgb(20 54 40 / 6%), 0 8px 24px rgb(20 54 40 / 8%);
  --tap:       48px;      /* Mindestgröße für Buttons und Felder */
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-text);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--cream);
}

h1, h2, h3 {
  margin: 0 0 0.5em;
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.2;
  color: var(--green-800);
}
h1 { font-size: clamp(1.75rem, 7vw, 2.4rem); }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--wine-700); text-underline-offset: 0.15em; }
a:hover { color: var(--wine-800); }

:focus-visible {
  outline: 3px solid var(--green-800);
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: 42rem;
  margin-inline: auto;
  padding-inline: 1rem;
}

main.container {
  flex: 1;
  padding-block: 1.5rem 3rem;
}
main.container > section + section,
main.container > section + .notice,
main.container > .notice + section { margin-top: 2rem; }

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

.muted { color: var(--ink-muted); }
.small { font-size: 0.9rem; }
[hidden] { display: none !important; }

/* ---------- Icons (schlichte Linien, inline SVG) ---------- */
.icon {
  width: 1.5em;
  height: 1.5em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

/* ---------- Kopfzeile und Fußzeile ---------- */
.site-header {
  background: var(--green-800);
  color: var(--cream);
  border-bottom: 3px solid var(--gold-500);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
}
.site-header :focus-visible { outline-color: var(--gold-500); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--cream);
  text-decoration: none;
}
.brand:hover { color: #fff; }
.brand .icon {
  width: 1.75rem;
  height: 1.75rem;
  color: var(--gold-500);
  transform-box: fill-box;
  transform-origin: center;
  animation: twinkle 4s ease-in-out infinite;
}

.site-footer {
  padding-block: 1.5rem 2rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--ink-muted);
}
.site-footer .icon { width: 1.1em; height: 1.1em; color: var(--gold-700); }

/* ---------- Einstieg (Hero) ---------- */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-700);
}
.eyebrow .icon { width: 1.2em; height: 1.2em; }

.lead {
  font-size: 1.125rem;
  color: var(--ink-muted);
}

/* Trennlinie mit Stern */
.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 2rem 0;
  color: var(--gold-500);
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-500), transparent);
}
.divider .icon { width: 1.25rem; height: 1.25rem; }

/* ---------- Karten ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}
.card > h2:first-child,
.card > h3:first-child { margin-top: 0; }

.card-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.card-title .icon { color: var(--wine-700); }

/* ---------- Eckdaten (Budget, Bescherung) ---------- */
.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.fact {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1rem;
}
.fact .icon {
  width: 1.75rem;
  height: 1.75rem;
  margin-bottom: 0.25rem;
  color: var(--gold-700);
}
.fact__label { font-size: 0.875rem; color: var(--ink-muted); }
.fact__value {
  font-family: var(--font-head);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--green-800);
}
.fact__sub { font-size: 0.875rem; font-weight: 600; color: var(--wine-700); }

@media (max-width: 22rem) {
  .facts { grid-template-columns: 1fr; }
}

/* ---------- Ablauf in Schritten ---------- */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
  counter-reset: step;
}
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 0.9rem;
  align-items: start;
  padding: 1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.steps strong { display: block; color: var(--green-800); }
.steps span { color: var(--ink-muted); }

.step-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--green-100);
  color: var(--green-800);
}
.step-icon::after {
  content: counter(step);
  position: absolute;
  top: -4px;
  right: -4px;
  display: grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--wine-700);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

/* ---------- Häufige Fragen (aufklappbar) ---------- */
.faq details {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.faq details + details { margin-top: 0.5rem; }
.faq summary {
  position: relative;
  display: flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0.75rem 3rem 0.75rem 1rem;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  position: absolute;
  right: 1.25rem;
  top: 50%;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--green-800);
  border-bottom: 2px solid var(--green-800);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.2s ease;
}
.faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq details p { margin: 0; padding: 0 1rem 1rem; color: var(--ink-muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--tap);
  padding: 0.7rem 1.25rem;
  border: 2px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.btn:active { transform: translateY(1px); }
.btn .icon { width: 1.25em; height: 1.25em; }

.btn-primary { background: var(--wine-700); color: #fff; }
.btn-primary:hover { background: var(--wine-800); color: #fff; }

.btn-secondary { background: var(--paper); color: var(--green-800); border-color: var(--green-800); }
.btn-secondary:hover { background: var(--green-100); color: var(--green-900); }

.btn-ghost { background: transparent; color: var(--green-800); }
.btn-ghost:hover { background: var(--green-100); color: var(--green-900); }

.btn-danger { background: var(--paper); color: var(--wine-700); border-color: var(--wine-700); }
.btn-danger:hover { background: var(--wine-100); color: var(--wine-800); }

.btn-block { width: 100%; }
.btn-icon { min-width: var(--tap); padding: 0.5rem; }

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.site-header .btn-ghost { color: var(--cream); }
.site-header .btn-ghost:hover { background: rgb(255 255 255 / 12%); color: #fff; }
.site-header .btn { flex: none; }

/* Schmale Handys: In der Kopfzeile nur das Symbol des Buttons zeigen (Text bleibt für Screenreader). */
@media (max-width: 30rem) {
  .brand { font-size: 1.15rem; }
  .site-header .btn { min-width: var(--tap); padding: 0.5rem; }
  .site-header .btn-label {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* ---------- Formulare ---------- */
.field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
}
.field label { font-weight: 600; }
.hint { font-size: 0.875rem; color: var(--ink-muted); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="date"],
input[type="tel"],
select,
textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 0.65rem 0.85rem;
  border: 2px solid var(--field);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: max(1rem, 16px); /* verhindert automatisches Zoomen auf dem iPhone */
}
textarea { min-height: 6rem; resize: vertical; }
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--green-800);
  outline-offset: 1px;
  border-color: var(--green-800);
}
input[aria-invalid="true"] { border-color: var(--wine-700); }

/* ---------- Hinweisboxen ---------- */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-left: 4px solid var(--green-800);
  border-radius: var(--radius-sm);
  background: var(--green-100);
  color: var(--green-900);
}
.notice .icon { margin-top: 0.05rem; }
.notice--warning { background: var(--gold-100); border-left-color: var(--gold-500); color: #4a3a08; }
.notice--error   { background: var(--wine-100); border-left-color: var(--wine-700); color: var(--wine-800); }

/* ---------- Fortschrittsanzeige ---------- */
.progress {
  height: 0.75rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--green-100);
}
.progress__bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green-800), var(--gold-500));
  transition: width 0.6s ease;
}

/* ---------- Toast-Meldungen ---------- */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 100;
  display: grid;
  gap: 0.5rem;
  width: min(92vw, 28rem);
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: var(--green-900);
  color: #fff;
  box-shadow: 0 10px 30px rgb(0 0 0 / 25%);
  pointer-events: auto;
  animation: toast-in 0.25s ease-out both;
}
.toast .icon { width: 1.3em; height: 1.3em; color: var(--gold-500); }
.toast--error { background: var(--wine-800); }
.toast--error .icon { color: #fff; }
.toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* ---------- Abschnitte untereinander ---------- */
.sections > * + * { margin-top: 1.5rem; }

/* ---------- Fehlermeldung in Formularen ---------- */
.form-error {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--wine-100);
  color: var(--wine-800);
  font-weight: 600;
}

/* ---------- Kleine Status-Etiketten ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--green-100);
  color: var(--green-900);
  font-family: var(--font-text);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.badge .icon { width: 1em; height: 1em; }
.badge--wait { background: var(--gold-100); color: #4a3a08; }
.badge--alert { background: var(--wine-100); color: var(--wine-800); }

/* ---------- Fortschritt mit Beschriftung ---------- */
.progress-block { margin: 0.25rem 0 1rem; }
.progress-label { margin: 0.4rem 0 0; font-size: 0.9rem; font-weight: 600; color: var(--green-800); }

/* ---------- Checkbox mit Beschriftung ---------- */
.check {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: var(--tap);
  margin-bottom: 0.5rem;
  cursor: pointer;
}
.check input {
  width: 1.35rem;
  height: 1.35rem;
  margin: 0;
  accent-color: var(--green-800);
}

.btn-block + .btn-block { margin-top: 0.5rem; }
.card-title .badge { margin-left: auto; font-size: 0.875rem; }

/* ---------- Eingabe + Button in einer Zeile ---------- */
.inline-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.inline-form input { flex: 1; min-width: 0; }
.inline-form .btn { flex: none; }

/* ---------- Personenliste (Admin) ---------- */
.people {
  margin: 0;
  padding: 0;
  list-style: none;
}
.person {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}
.person:first-child { border-top: none; }
.person__main { flex: 1; min-width: 0; }
.person__name { display: block; font-weight: 600; overflow-wrap: anywhere; }
.person__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.6rem;
  margin-top: 0.2rem;
  font-size: 0.875rem;
  color: var(--ink-muted);
}
.person__email {
  display: block;
  font-size: 0.875rem;
  color: var(--ink-muted);
  overflow-wrap: anywhere;
}
.person__actions { display: flex; flex: none; gap: 0.25rem; }
.person .inline-form { flex: 1; margin: 0; }
.btn-icon.is-danger { color: var(--wine-700); }
.btn-icon.is-danger:hover { background: var(--wine-100); color: var(--wine-800); }

/* ---------- Wunschliste ---------- */
.wishes {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}
.wish {
  padding: 0.9rem 0.9rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--cream);
}
.wish.is-moved { animation: highlight 0.7s ease-out; }
.wish--editing { padding: 0; border: none; background: none; }

.wish__body { display: flex; align-items: flex-start; gap: 0.75rem; }
.wish__number {
  display: grid;
  flex: none;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  margin-top: 0.05rem;
  border-radius: 50%;
  background: var(--green-800);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}
.wish__text { flex: 1; min-width: 0; }
.wish__title { margin: 0 0 0.2rem; font-weight: 700; overflow-wrap: anywhere; }
.wish__note { margin: 0 0 0.3rem; color: var(--ink-muted); white-space: pre-line; overflow-wrap: anywhere; }
.wish__link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.25rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.wish__link .icon { width: 1.1em; height: 1.1em; }

.wish__actions {
  display: flex;
  justify-content: space-between;
  margin-top: 0.35rem;
  padding-top: 0.25rem;
  border-top: 1px dashed var(--line);
}
.wish__actions > div { display: flex; gap: 0.25rem; }

.wish-form {
  padding: 1rem;
  margin-bottom: 1rem;
  border: 2px solid var(--green-800);
  border-radius: var(--radius-sm);
  background: var(--paper);
}
.wish-form .actions { margin-top: 0; }
.wish-form .actions .btn { flex: 1 1 8rem; }
.wish--editing .wish-form { margin-bottom: 0; }

.empty {
  padding: 1rem;
  margin-bottom: 1rem;
  border: 2px dashed var(--line);
  border-radius: var(--radius-sm);
  text-align: center;
  color: var(--ink-muted);
}

@keyframes highlight {
  from { background: var(--gold-100); }
  to   { background: var(--cream); }
}

/* ---------- Dialog ---------- */
.dialog {
  width: min(92vw, 26rem);
  padding: 1.5rem;
  border: none;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 20px 60px rgb(0 0 0 / 30%);
}
.dialog::backdrop { background: rgb(20 54 40 / 55%); }
.dialog[open] { animation: rise 0.2s ease-out both; }
.dialog h2 { font-size: 1.3rem; }
.dialog .actions { justify-content: flex-end; margin-top: 1.5rem; }

/* ---------- Dezente Animationen ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@keyframes twinkle {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50%      { transform: scale(1.12) rotate(10deg); }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.reveal { animation: rise 0.5s ease-out both; }
.reveal:nth-child(2) { animation-delay: 0.06s; }
.reveal:nth-child(3) { animation-delay: 0.12s; }
.reveal:nth-child(4) { animation-delay: 0.18s; }
.reveal:nth-child(5) { animation-delay: 0.24s; }

/* Wer in den Systemeinstellungen „Bewegung reduzieren“ aktiviert hat, bekommt keine Animationen. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Größere Bildschirme ---------- */
@media (min-width: 40rem) {
  body { font-size: 1.125rem; }
  .card { padding: 1.5rem; }
  main.container { padding-block: 2.5rem 4rem; }
}
