/* ==========================================================================
   Vanessa & Alex – Design-Tokens & Basis-Komponenten (gemeinsam für index + admin)
   Mobile-first. Scrapbook-/Collage-Look in Pastellblau & Apricot.
   ========================================================================== */

:root {
  /* Farbpalette */
  --blue: #a1c7da;
  --blue-dark: #6a869c;
  --apricot: #f7c8ae;
  --peach: #f7aa8e;
  --cream: #fdf8f2;
  --cream-2: #fff5ea;
  --paper: #fffdf9;
  --ink: #2c3e4c;
  --ink-soft: #52677a;
  --ink-muted: #8a9aa8;
  --line: rgba(44, 62, 76, 0.12);
  --success: #5a9e7c;
  --danger: #d9705c;

  /* Tints */
  --blue-10: rgba(161, 199, 218, 0.18);
  --blue-25: rgba(161, 199, 218, 0.38);
  --peach-10: rgba(247, 170, 142, 0.18);
  --peach-25: rgba(247, 170, 142, 0.38);
  --apricot-25: rgba(247, 200, 174, 0.45);

  /* Typografie */
  --font-display: "Fraunces", "Playfair Display", Georgia, serif;
  --font-body: "Plus Jakarta Sans", "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-hand: "Caveat", "Reenie Beanie", "Segoe Script", cursive;

  --fs-xs: 0.8rem;
  --fs-sm: 0.9rem;
  --fs-md: 1rem;
  --fs-lg: 1.15rem;
  --fs-xl: clamp(1.4rem, 1.1rem + 1.6vw, 1.9rem);
  --fs-2xl: clamp(1.9rem, 1.3rem + 3vw, 3rem);
  --fs-hero: clamp(2.6rem, 1.6rem + 7vw, 5.6rem);

  /* Abstände / Radien / Schatten */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --radius-pill: 999px;
  --shadow-sm: 0 2px 8px rgba(44, 62, 76, 0.08);
  --shadow-md: 0 10px 30px rgba(44, 62, 76, 0.12);
  --shadow-lg: 0 24px 60px rgba(44, 62, 76, 0.16);
  --tap: 48px;
  --container: 1080px;
  --gutter: clamp(1rem, 4vw, 2rem);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  color-scheme: light;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 1rem;
}
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: 1.6;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-wrap: anywhere;
}
img,
svg,
video {
  max-width: 100%;
  height: auto;
  display: block;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
a {
  color: var(--blue-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.1;
  margin: 0 0 var(--space-3);
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1 {
  font-size: var(--fs-hero);
}
h2 {
  font-size: var(--fs-2xl);
}
h3 {
  font-size: var(--fs-xl);
}
p {
  margin: 0 0 var(--space-4);
}
ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}
:focus-visible {
  outline: 3px solid var(--blue-dark);
  outline-offset: 3px;
  border-radius: 6px;
}
::selection {
  background: var(--apricot);
  color: var(--ink);
}

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

/* ---------- Layout-Helfer ---------- */
.container {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
}
.stack > * + * {
  margin-top: var(--space-4);
}

/* ---------- Typografie-Helfer ---------- */
.hand {
  font-family: var(--font-hand);
  font-size: 1.45em;
  line-height: 1.15;
  color: var(--blue-dark);
}
.eyebrow {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue-dark);
  margin-bottom: var(--space-2);
}
.muted {
  color: var(--ink-soft);
}

/* ---------- Buttons (mind. 48px Touch-Target) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: var(--fs-md);
  line-height: 1.2;
  text-decoration: none;
  border: 2px solid transparent;
  transition:
    transform 0.25s var(--ease-bounce),
    box-shadow 0.25s ease,
    background-color 0.2s ease,
    color 0.2s ease;
  user-select: none;
}
.btn:active {
  transform: scale(0.97);
}
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.btn-primary {
  background: var(--peach);
  color: var(--ink);
  box-shadow: 0 8px 22px rgba(247, 170, 142, 0.45);
}
.btn-primary:hover {
  background: #f59b7b;
  transform: translateY(-2px);
}
.btn-secondary {
  background: var(--blue);
  color: var(--ink);
  box-shadow: 0 8px 22px rgba(161, 199, 218, 0.45);
}
.btn-secondary:hover {
  background: #8fbbd1;
  transform: translateY(-2px);
}
.btn-ghost {
  background: transparent;
  border-color: var(--blue-dark);
  color: var(--blue-dark);
}
.btn-ghost:hover {
  background: var(--blue-10);
}
.btn-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}
.btn-sm {
  min-height: 40px;
  padding: 0.5rem 1rem;
  font-size: var(--fs-sm);
}
.btn-block {
  width: 100%;
}
.btn .icon {
  width: 1.2em;
  height: 1.2em;
}

/* ---------- Formulare ---------- */
.field {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.field > label,
.field-label {
  font-weight: 700;
  font-size: var(--fs-sm);
  color: var(--ink);
}
.field .hint {
  font-size: var(--fs-xs);
  color: var(--ink-muted);
}
.input,
.textarea,
.select {
  width: 100%;
  min-height: var(--tap);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--line);
  background: var(--paper);
  font-size: 16px; /* verhindert Auto-Zoom auf iOS */
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--blue-dark);
  box-shadow: 0 0 0 4px var(--blue-25);
}
.textarea {
  min-height: 112px;
  resize: vertical;
}
.input-code {
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-weight: 700;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.35rem;
}

/* Auswahl-Chips (Radio/Checkbox als grosse Buttons) */
.choice-group {
  display: grid;
  gap: var(--space-3);
}
.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 56px;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--line);
  background: var(--paper);
  cursor: pointer;
  transition:
    border-color 0.2s,
    background-color 0.2s,
    transform 0.25s var(--ease-bounce),
    box-shadow 0.2s;
}
.choice input {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.choice .choice-emoji {
  font-size: 1.5rem;
  line-height: 1;
}
.choice .choice-title {
  font-weight: 700;
}
.choice .choice-sub {
  font-size: var(--fs-xs);
  color: var(--ink-muted);
}
.choice:hover {
  border-color: var(--blue);
}
.choice:has(input:checked) {
  border-color: var(--blue-dark);
  background: var(--blue-10);
  box-shadow: 0 0 0 4px var(--blue-25);
  transform: scale(1.01);
}
.choice:has(input:focus-visible) {
  outline: 3px solid var(--blue-dark);
  outline-offset: 2px;
}
.choice.choice-peach:has(input:checked) {
  border-color: var(--peach);
  background: var(--peach-10);
  box-shadow: 0 0 0 4px var(--peach-25);
}

/* ---------- Karten / Papier ---------- */
.card {
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: clamp(1.25rem, 4vw, 2rem);
}
.paper {
  position: relative;
  background: var(--paper);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
}

/* Washi-Tape Streifen */
.tape {
  position: absolute;
  width: 92px;
  height: 26px;
  background: var(--blue-25);
  opacity: 0.9;
  transform: rotate(-6deg);
  border-left: 2px dashed rgba(255, 255, 255, 0.6);
  border-right: 2px dashed rgba(255, 255, 255, 0.6);
  box-shadow: 0 1px 2px rgba(44, 62, 76, 0.1);
  pointer-events: none;
}
.tape-peach {
  background: var(--peach-25);
}
.tape-apricot {
  background: var(--apricot-25);
}

/* Polaroid-Cutout (Foto-Platzhalter, später durch echte .webp ersetzen) */
.cutout {
  position: relative;
  display: inline-block;
  background: #fff;
  padding: 10px 10px 42px;
  border-radius: 4px;
  box-shadow: var(--shadow-md);
  transform: rotate(var(--tilt, -3deg));
  will-change: transform;
}
.cutout img,
.cutout svg,
.cutout .cutout-img {
  width: 100%;
  aspect-ratio: var(--ratio, 4 / 5);
  object-fit: cover;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--apricot) 100%);
}
.cutout .caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  text-align: center;
  font-family: var(--font-hand);
  font-size: 1.35rem;
  color: var(--ink-soft);
  line-height: 1;
}

/* Sticker / Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.25em 0.75em;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--blue-10);
  color: var(--blue-dark);
}
.badge-peach {
  background: var(--peach-10);
  color: #b8614b;
}
.badge-success {
  background: rgba(90, 158, 124, 0.15);
  color: var(--success);
}
.badge-danger {
  background: rgba(217, 112, 92, 0.15);
  color: var(--danger);
}
.badge-muted {
  background: rgba(138, 154, 168, 0.15);
  color: var(--ink-soft);
}

/* Meldungen */
.alert {
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  border: 2px solid transparent;
}
.alert-error {
  background: rgba(217, 112, 92, 0.1);
  border-color: rgba(217, 112, 92, 0.35);
  color: #a94a37;
}
.alert-success {
  background: rgba(90, 158, 124, 0.12);
  border-color: rgba(90, 158, 124, 0.35);
  color: #2f6b50;
}
.alert-info {
  background: var(--blue-10);
  border-color: var(--blue-25);
  color: var(--blue-dark);
}

/* Spinner */
.spinner {
  width: 1.1em;
  height: 1.1em;
  border-radius: 50%;
  border: 2.5px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: #fff;
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.25s,
    transform 0.3s var(--ease-out);
  z-index: 1000;
  max-width: calc(100vw - 2rem);
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Bewegung reduzieren ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
