/* Wichtel-Organizer: Geschenkanhänger auf Packpapier, draußen schneit es.
   Tannengrün trägt, Rot ist das Band. Keine fremden Schriften; die Bilder des
   Hintergrunds erzeugt scripts/make_backdrop.py. */

:root {
  color-scheme: light dark;
  --bg: #f6efe0;
  --paper: #fffaf0;
  --field: #ffffff;
  --ink: #1d2b24;
  --muted: #55604f;
  --line: #dccfb3;
  --accent: #1f4d3a;
  --accent-ink: #fffaf0;
  --red: #a8241c;
  --red-ink: #ffffff;
  --gold: #9a5b00;
  --ok: #dcecd9;
  --warn: #fbe9c3;
  --err: #f8dcd8;
  --dot: rgba(29, 43, 36, 0.07);
  --shadow: 0 1px 0 rgba(29, 43, 36, 0.04), 0 10px 26px -14px rgba(29, 43, 36, 0.35);
  --sky: #cfe0e4;
  --flake: #ffffff;
  --flake-edge: rgba(96, 122, 134, 0.3);
  --night: 0;                /* 1 = Sterne und Mond sind zu sehen */
  --forest: url("backdrop/forest-light.svg");
  --lights: url("backdrop/lights-light.svg");
  --forest-h: 150px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Noto Serif", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}

/* Dunkel: wenn das Gerät dunkel ist und niemand „hell“ gewählt hat, oder von Hand über den Schalter.
   Beide Blöcke müssen gleich bleiben. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1d17;
    --paper: #162a22;
    --field: #0f201a;
    --ink: #f3ecdc;
    --muted: #b6c1b0;
    --line: #34503f;
    --accent: #ecdfc2;
    --accent-ink: #12241d;
    --red: #ff9085;
    --red-ink: #2b0b08;
    --gold: #ffd27a;
    --ok: #1e3d2c;
    --warn: #4a3a14;
    --err: #4d221e;
    --dot: rgba(243, 236, 220, 0.05);
    --shadow: 0 10px 26px -14px rgba(0, 0, 0, 0.7);
    --sky: #081620;
    --flake: rgba(243, 236, 220, 0.9);
    --flake-edge: transparent;
    --night: 1;
    --forest: url("backdrop/forest-dark.svg");
    --lights: url("backdrop/lights-dark.svg");
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1d17;
  --paper: #162a22;
  --field: #0f201a;
  --ink: #f3ecdc;
  --muted: #b6c1b0;
  --line: #34503f;
  --accent: #ecdfc2;
  --accent-ink: #12241d;
  --red: #ff9085;
  --red-ink: #2b0b08;
  --gold: #ffd27a;
  --ok: #1e3d2c;
  --warn: #4a3a14;
  --err: #4d221e;
  --dot: rgba(243, 236, 220, 0.05);
  --shadow: 0 10px 26px -14px rgba(0, 0, 0, 0.7);
  --sky: #081620;
  --flake: rgba(243, 236, 220, 0.9);
  --flake-edge: transparent;
  --night: 1;
  --forest: url("backdrop/forest-dark.svg");
  --lights: url("backdrop/lights-dark.svg");
}
:root[data-theme="light"] { color-scheme: light; }

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

[hidden] { display: none !important; }

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

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(circle at 2px 2px, var(--dot) 1.5px, transparent 2px);
  background-size: 22px 22px;
}

/* Zuckerstange: das Band ganz oben */
body::before {
  content: "";
  flex: none;
  height: 10px;
  background: repeating-linear-gradient(135deg, var(--red) 0 14px, var(--paper) 14px 28px);
}

.site-header, .page {
  width: 100%;
  max-width: 31rem;
  margin-inline: auto;
  padding-inline: 1rem;
}
.page { flex: 1; }

/* Die Lichterkette hängt unter der Zuckerstange und scrollt mit der Seite. */
.garland {
  flex: none;
  height: 44px;
  background: var(--lights) repeat-x center top / auto 44px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* --- Hintergrund: reiner Schmuck, trägt keine Information ------------------ */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.backdrop > * { position: absolute; }

.backdrop-sky {
  inset: 0;
  background: linear-gradient(var(--sky), transparent 82%);
}

/* Sterne: nur nachts, nach unten hin verblassend */
.backdrop-stars {
  inset: 0 0 auto;
  height: 75vh;
  opacity: var(--night);
  background-image:
    radial-gradient(circle at 40px 70px, #ffe9b0 0 1.2px, transparent 2px),
    radial-gradient(circle at 190px 30px, #f3ecdc 0 1px, transparent 1.8px),
    radial-gradient(circle at 300px 150px, #ffe9b0 0 1.4px, transparent 2.2px),
    radial-gradient(circle at 120px 210px, #f3ecdc 0 0.9px, transparent 1.6px),
    radial-gradient(circle at 250px 260px, #f3ecdc 0 1.1px, transparent 1.9px);
  background-size: 340px 300px;
  -webkit-mask-image: linear-gradient(#000 20%, transparent);
  mask-image: linear-gradient(#000 20%, transparent);
}

.backdrop-moon {
  display: none;
  top: 5.2rem;
  right: max(2rem, calc(50% - 31rem));
  width: 68px;
  height: 68px;
  border-radius: 50%;
  opacity: var(--night);
  box-shadow: inset -19px -9px 0 0 #f6e7bb;
  filter: drop-shadow(0 0 16px rgba(246, 231, 187, 0.35));
  transform: rotate(-18deg);
}

/* Schnee: zwei Ebenen, die nahe fällt schneller. Bewegt wird nur per transform. */
.backdrop-snow {
  inset: -420px 0 0;
  background-size: 300px 420px;
  animation: snowfall 34s linear infinite;
}
.backdrop-snow-far {
  opacity: 0.75;
  background-image:
    radial-gradient(circle at 30px 40px, var(--flake) 0 1.3px, var(--flake-edge) 1.9px, transparent 2.6px),
    radial-gradient(circle at 170px 110px, var(--flake) 0 1px, var(--flake-edge) 1.6px, transparent 2.3px),
    radial-gradient(circle at 250px 230px, var(--flake) 0 1.4px, var(--flake-edge) 2px, transparent 2.7px),
    radial-gradient(circle at 90px 300px, var(--flake) 0 1.1px, var(--flake-edge) 1.7px, transparent 2.4px),
    radial-gradient(circle at 210px 380px, var(--flake) 0 1.2px, var(--flake-edge) 1.8px, transparent 2.5px);
}
.backdrop-snow-near {
  background-size: 380px 420px;
  animation-duration: 19s;
  background-image:
    radial-gradient(circle at 60px 90px, var(--flake) 0 2.2px, var(--flake-edge) 3px, transparent 3.8px),
    radial-gradient(circle at 290px 30px, var(--flake) 0 1.9px, var(--flake-edge) 2.7px, transparent 3.5px),
    radial-gradient(circle at 180px 250px, var(--flake) 0 2.5px, var(--flake-edge) 3.3px, transparent 4.1px),
    radial-gradient(circle at 340px 340px, var(--flake) 0 2px, var(--flake-edge) 2.8px, transparent 3.6px);
}
@keyframes snowfall {
  to { transform: translateY(420px); }
}

/* --- Hell/Dunkel-Schalter: der Knopf liegt unter dem aktiven Zeichen -------- */

.theme-switch {
  position: relative;
  flex: none;
  width: 78px;
  height: 44px;
  padding: 0;
  color: var(--muted);
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.theme-switch::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 34px;
  height: 34px;
  background: var(--accent);
  border-radius: 50%;
  transition: transform 0.22s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.theme-switch[aria-checked="true"]::before { transform: translateX(34px); }
.theme-switch svg {
  position: absolute;
  top: 50%;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: color 0.2s ease;
}
.theme-sun { left: 10px; }
.theme-moon { right: 10px; }
.theme-switch[aria-checked="false"] .theme-sun,
.theme-switch[aria-checked="true"] .theme-moon { color: var(--accent-ink); }

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--accent);
  text-decoration: none;
}

.brand::before {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  margin-right: 0.55rem;
  background: var(--red);
  transform: rotate(45deg);
  border-radius: 2px;
}

.page { padding-bottom: 1rem; }

.page > * { animation: rise 0.3s ease-out both; }
.page > :nth-child(2) { animation-delay: 0.04s; }
.page > :nth-child(3) { animation-delay: 0.08s; }
.page > :nth-child(n + 4) { animation-delay: 0.12s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* --- Schrift ------------------------------------------------------------ */

h1, h2, h3 { font-family: var(--serif); line-height: 1.15; color: var(--accent); text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 8vw, 2.5rem); margin: 0.2rem 0 1rem; overflow-wrap: anywhere; }
h2 { font-size: 1.35rem; margin: 0 0 0.6rem; }
h3 { font-size: 1.12rem; margin: 0 0 0.3rem; }
p { margin: 0 0 0.8rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }

.eyebrow {
  margin: 0.6rem 0 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--red);
}

.lead { font-size: 1.2rem; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 0.95rem; margin: 0.35rem 0 0; }
.optional { font-family: var(--sans); font-size: 0.95rem; font-weight: 400; color: var(--muted); }

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

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

/* --- Karten ------------------------------------------------------------- */

.hero { padding: 1.2rem 0 0.6rem; }
.hero h1 { font-size: clamp(2.3rem, 11vw, 3.1rem); }
.hero .btn { margin-top: 0.4rem; }

.card {
  margin-block: 1rem;
  padding: 1.25rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.keep { border-left: 6px solid var(--gold); }
.confirm { border: 2px solid var(--red); background: var(--err); }
.danger > summary { color: var(--red); }

.notice {
  margin: 1rem 0;
  padding: 0.9rem 1rem;
  border-left: 6px solid var(--accent);
  border-radius: 12px;
  background: var(--ok);
}
.notice-error { border-color: var(--red); background: var(--err); }
.notice-warn { border-color: var(--gold); background: var(--warn); }

/* --- Schaltflächen ------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 0.6rem 1.1rem;
  font: inherit;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  color: var(--accent);
  background: transparent;
  border: 2px solid var(--accent);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(2px); }
.btn-primary { color: var(--accent-ink); background: var(--accent); }
.btn-danger { color: var(--red-ink); background: var(--red); border-color: var(--red); }
.btn-quiet {
  width: auto;
  min-height: 48px;
  padding-inline: 0.4rem;
  font-weight: 400;
  color: var(--muted);
  text-decoration: underline;
  border-color: transparent;
}

.actions { display: flex; flex-direction: column; gap: 0.6rem; margin-block: 0.8rem; }

/* --- Formulare ---------------------------------------------------------- */

.form > * + * { margin-top: 1rem; }
.field label, .check label { display: block; font-weight: 650; }
.field label { margin-bottom: 0.3rem; }

input[type="text"], input[type="date"], select, textarea {
  width: 100%;
  min-height: 52px;
  padding: 0.65rem 0.8rem;
  font: inherit;
  color: var(--ink);
  background: var(--field);
  border: 2px solid var(--line);
  border-radius: 10px;
}
textarea { resize: vertical; }
input[readonly] { color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--gold); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; align-items: end; }
.field-row .field-narrow { min-width: 6.5rem; }

.check { display: flex; gap: 0.8rem; align-items: flex-start; }
.check input { flex: none; width: 1.6rem; height: 1.6rem; margin: 0.15rem 0 0; accent-color: var(--accent); }
.check .hint { display: block; font-weight: 400; margin-top: 0.15rem; }

.subform { margin-top: 1.2rem; padding-top: 1.1rem; border-top: 2px dashed var(--line); }

.copy-row { display: flex; gap: 0.6rem; margin-block: 0.8rem; }
.copy-row input { flex: 1; min-width: 0; font-size: 0.95rem; }
.copy-row .btn { width: auto; }

/* --- Listen ------------------------------------------------------------- */

.facts { margin: 0; }
.facts > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px dashed var(--line);
}
.facts > div:last-child { border-bottom: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 650; text-align: right; }

.note {
  margin: 0.9rem 0 0;
  padding-left: 0.9rem;
  border-left: 4px solid var(--red);
  font-family: var(--serif);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; margin-block: 1rem; padding-left: 3.1rem; counter-increment: step; }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  font-family: var(--serif);
  font-weight: 700;
  color: var(--red-ink);
  background: var(--red);
  border-radius: 50%;
}

.people, .link-list { margin: 0; padding: 0; list-style: none; }
.people > li { padding: 0.8rem 0; border-top: 1px solid var(--line); }
.people > li:first-child { border-top: 0; }
.person-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.person-name { margin-right: 0.3rem; font-size: 1.15rem; font-weight: 700; overflow-wrap: anywhere; }
.exclusion, .link-list li { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; }
.link-list li { padding: 0.3rem 0; border-top: 1px solid var(--line); }
.link-list a { font-weight: 650; overflow-wrap: anywhere; }

.badge, .count {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.badge-ok { background: var(--ok); border-color: transparent; }
.badge-wait { background: var(--warn); border-color: transparent; }
.badge-muted { color: var(--muted); }
.count { vertical-align: middle; }

details > summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 48px;
  font-weight: 650;
  color: var(--accent);
  cursor: pointer;
  list-style: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "+"; width: 1ch; font-weight: 700; }
details[open] > summary::before { content: "\2013"; }
details.card > summary { font-family: var(--serif); font-size: 1.2rem; }
.people details > summary { font-weight: 400; font-size: 1rem; color: var(--muted); }

.qr { display: block; width: 232px; max-width: 100%; height: auto; margin: 0.6rem auto 0; padding: 6px; background: #fff; border-radius: 12px; }

/* --- Der Anhänger: hier steht, wen man beschenkt ------------------------- */

.reveal-card {
  position: relative;
  margin-top: 2.4rem;
  padding: 3.2rem 1.5rem 1.8rem;
  text-align: center;
  outline: 2px dashed var(--line);
  outline-offset: -9px;
}
.reveal-card::before {   /* das Loch */
  content: "";
  position: absolute;
  top: 1.25rem;
  left: 50%;
  width: 18px;
  height: 18px;
  background: var(--bg);
  border-radius: 50%;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.3);
  transform: translateX(-50%);
}
.reveal-card::after {    /* die Schnur */
  content: "";
  position: absolute;
  top: -1.7rem;
  left: 50%;
  width: 3px;
  height: 3.5rem;
  background: var(--red);
  border-radius: 2px;
  transform: translateX(-50%) rotate(5deg);
  transform-origin: bottom center;
}
.reveal-label {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.reveal-name {
  margin: 0.3rem 0 1.4rem;
  font-family: var(--serif);
  font-size: clamp(2.5rem, 13vw, 3.7rem);
  line-height: 1.05;
  color: var(--red);
  overflow-wrap: anywhere;
  animation: unwrap 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.15s both;
}
@keyframes unwrap {
  from { opacity: 0; transform: translateY(16px) scale(0.92); filter: blur(8px); }
  to { opacity: 1; transform: none; filter: none; }
}
.reveal-card .btn { margin-top: 0.4rem; }

.wishlist-text {
  padding: 0.8rem 1rem;
  text-align: left;
  white-space: pre-line;
  overflow-wrap: anywhere;
  background: var(--bg);
  border-radius: 10px;
}

/* --- Fuß ----------------------------------------------------------------- */

/* Der Wald steht am Ende der Seite, bei kurzen Seiten am unteren Fensterrand. Der Text bleibt darüber. */
.site-footer {
  margin-top: 1.5rem;
  padding: 1.5rem 1rem calc(var(--forest-h) + 0.6rem);
  font-size: 0.95rem;
  color: var(--muted);
  text-align: center;
  background: var(--forest) repeat-x center bottom / auto var(--forest-h);
}
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.2rem 1.2rem; }
.site-footer a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); }

.prose h1 { font-size: 1.8rem; }
.prose h2 { margin-top: 1.4rem; }
.prose ul { padding-left: 1.2rem; }

/* --- Breite Fenster: mehr Wald, und nachts steht der Mond neben dem Blatt --- */

@media (min-width: 48rem) {
  :root { --forest-h: 210px; }
  .garland { height: 56px; background-size: auto 56px; }
  .site-header { padding-top: 0.6rem; }
}
@media (min-width: 64rem) {
  .backdrop-moon { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (forced-colors: active) {
  .backdrop, .garland { display: none; }
  .site-footer { background: none; padding-bottom: 3rem; }
}

@media print {
  .backdrop, .garland, .theme-switch { display: none; }
  .site-footer { background: none; padding-bottom: 0; }
}
