/* ==========================================================================
   Nachtlager – Designsystem für das Lagerfeuer-RSVP
   Glut auf Kohle: warme Poster-Typografie, Feuerschein, Funkenflug.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Alfa+Slab+One&family=Karla:ital,wght@0,300..800;1,400&display=swap');

:root {
  /* Nacht */
  --night:      #100c09;
  --night-2:    #17110d;
  --bark:       #221a14;
  --bark-2:     #2e231a;
  --bark-3:     #3a2c20;

  /* Glut */
  --ember:      #ff6b1f;
  --ember-deep: #cf3f0b;
  --flame:      #ffa733;
  --spark:      #ffd487;

  /* Natur */
  --moss:       #8aa860;
  --dusk:       #7d9fb0;
  --clay:       #c96a55;

  /* Licht */
  --cream:      #f6ead8;
  --sand:       #e3cfae;
  --ash:        #a89579;

  --line:       rgba(246, 234, 216, 0.13);
  --line-soft:  rgba(246, 234, 216, 0.07);

  --font-display: 'Alfa Slab One', 'Georgia', serif;
  --font-body:    'Karla', 'Helvetica Neue', sans-serif;

  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 20px;
  --r-xl: 28px;

  --shadow-lift: 0 24px 60px -28px rgba(0, 0, 0, 0.9);
  --shadow-glow: 0 0 0 1px rgba(255, 107, 31, 0.25), 0 18px 50px -22px rgba(255, 107, 31, 0.55);

  --wrap: 1080px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- Grundlage ----------------------------------------------------------- */

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--night);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}

/* Nachtstimmung: Glutschein von unten + kaltes Mondlicht oben links. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(120% 70% at 50% 118%, rgba(255, 107, 31, 0.42) 0%, rgba(207, 63, 11, 0.16) 34%, transparent 68%),
    radial-gradient(70% 55% at 12% -8%, rgba(125, 159, 176, 0.14) 0%, transparent 60%),
    linear-gradient(178deg, var(--night) 0%, var(--night-2) 48%, #1c1109 100%);
  animation: breathe 9s ease-in-out infinite;
}

/* Feines Korn – nimmt den Verlaeufen das Digitale. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.35;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

@keyframes breathe {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.86; }
}

/* --- Typografie ---------------------------------------------------------- */

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.02; margin: 0; }

h1 {
  /* Alfa Slab One baut sehr breit – auf schmalen Displays klein starten. */
  font-size: clamp(2rem, 8.4vw, 5.6rem);
  letter-spacing: -0.015em;
  overflow-wrap: break-word;
  hyphens: auto;
  text-transform: uppercase;
  background: linear-gradient(174deg, var(--cream) 8%, var(--sand) 42%, var(--flame) 108%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 22px 60px rgba(255, 107, 31, 0.22);
}

h2 { font-size: clamp(1.5rem, 3.4vw, 2.15rem); }
h3 { font-size: 1.1rem; }

p { margin: 0 0 1rem; }
a { color: var(--flame); text-decoration-color: rgba(255, 167, 51, 0.4); text-underline-offset: 3px; }
a:hover { color: var(--spark); }

.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--ember);
}

.muted { color: var(--ash); }
.small { font-size: 0.86rem; }

/* --- Layout -------------------------------------------------------------- */

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }

.section { padding-block: clamp(2.5rem, 7vw, 4.5rem); }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.6rem;
}

.section-head::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line) 0%, transparent 100%);
}

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

.card {
  position: relative;
  background: linear-gradient(160deg, rgba(46, 35, 26, 0.92) 0%, rgba(26, 20, 15, 0.94) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lift);
  padding: clamp(1.4rem, 3.5vw, 2.2rem);
}

/* Glutkante am oberen Rand – das wiederkehrende Motiv. */
.card--ember::before {
  content: '';
  position: absolute;
  inset: -1px -1px auto -1px;
  height: 3px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: linear-gradient(90deg, transparent, var(--ember-deep) 18%, var(--flame) 50%, var(--ember-deep) 82%, transparent);
}

/* --- Buttons ------------------------------------------------------------- */

.btn {
  --btn-bg: linear-gradient(168deg, var(--flame), var(--ember) 55%, var(--ember-deep));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.85rem 1.6rem;
  border: 0;
  border-radius: 999px;
  background: var(--btn-bg);
  color: #1b0d05;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), filter 0.25s var(--ease);
  box-shadow: 0 12px 34px -16px rgba(255, 107, 31, 0.95);
}

.btn:hover  { transform: translateY(-2px); box-shadow: 0 20px 44px -16px rgba(255, 107, 31, 0.95); filter: saturate(1.1); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn--ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--sand);
  box-shadow: none;
}
.btn--ghost:hover { border-color: var(--flame); color: var(--flame); box-shadow: none; }

.btn--danger { background: transparent; border: 1px solid rgba(201, 106, 85, 0.45); color: var(--clay); box-shadow: none; }
.btn--danger:hover { background: rgba(201, 106, 85, 0.12); box-shadow: none; }

.btn--sm { padding: 0.5rem 1rem; font-size: 0.78rem; }

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

.field { display: block; margin-bottom: 1.15rem; }

.field > .label,
.label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ash);
}

.input, .textarea, .select {
  width: 100%;
  padding: 0.8rem 1rem;
  background: rgba(16, 12, 9, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.textarea { min-height: 92px; resize: vertical; line-height: 1.5; }

.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--ember);
  background: rgba(16, 12, 9, 0.95);
  box-shadow: 0 0 0 3px rgba(255, 107, 31, 0.18);
}

.input::placeholder, .textarea::placeholder { color: rgba(168, 149, 121, 0.55); }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a89579' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.4rem;
}

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1.1rem; }

.hint { margin-top: 0.4rem; font-size: 0.82rem; color: var(--ash); }

/* --- Chips / Badges ------------------------------------------------------ */

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.chip {
  padding: 0.42rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(16, 12, 9, 0.5);
  color: var(--sand);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.chip:hover { border-color: rgba(255, 167, 51, 0.5); color: var(--flame); }

.chip[aria-pressed='true'] {
  background: rgba(255, 107, 31, 0.16);
  border-color: var(--ember);
  color: var(--flame);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid currentColor;
}

.badge--yes   { color: var(--moss); }
.badge--maybe { color: var(--flame); }
.badge--no    { color: var(--ash); }

/* --- Meldungen ----------------------------------------------------------- */

.note {
  padding: 0.85rem 1.1rem;
  border-radius: var(--r-md);
  border-left: 3px solid var(--ember);
  background: rgba(255, 107, 31, 0.1);
  font-size: 0.92rem;
}

.note--error { border-color: var(--clay); background: rgba(201, 106, 85, 0.12); color: #f0c4ba; }
.note--ok    { border-color: var(--moss); background: rgba(138, 168, 96, 0.12); color: #dcefc2; }

/* --- Lagerfeuer ---------------------------------------------------------- */

.fire { position: relative; width: 130px; height: 150px; flex: none; }

.fire__glow {
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 240px;
  height: 190px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(255, 140, 40, 0.42), rgba(255, 107, 31, 0.14) 55%, transparent 78%);
  animation: glow 3.4s ease-in-out infinite;
}

.fire__flame {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform-origin: 50% 100%;
  border-radius: 50% 50% 28% 28% / 74% 74% 26% 26%;
  filter: blur(7px);
  will-change: transform, opacity;
}

.fire__flame--outer {
  width: 84px; height: 116px;
  margin-left: -42px;
  background: linear-gradient(to top, rgba(207, 63, 11, 0.95), rgba(255, 107, 31, 0.7) 45%, transparent 92%);
  animation: flicker-a 2.3s ease-in-out infinite;
}

.fire__flame--mid {
  width: 52px; height: 88px;
  margin-left: -26px;
  background: linear-gradient(to top, var(--ember) 5%, var(--flame) 55%, rgba(255, 212, 135, 0.2) 95%);
  filter: blur(4px);
  animation: flicker-b 1.7s ease-in-out infinite;
}

.fire__flame--core {
  width: 24px; height: 46px;
  margin-left: -12px;
  background: linear-gradient(to top, #fff3d0, var(--spark) 60%, rgba(255, 212, 135, 0) 100%);
  filter: blur(2px);
  animation: flicker-c 1.1s ease-in-out infinite;
}

.fire__logs { position: absolute; left: 50%; bottom: 8px; width: 118px; height: 34px; margin-left: -59px; }

.fire__log {
  position: absolute;
  top: 12px;
  left: 8px;
  width: 100px;
  height: 15px;
  border-radius: 8px;
  background: linear-gradient(160deg, var(--bark-3), #1a120c);
  box-shadow: inset 0 2px 0 rgba(255, 140, 40, 0.28);
}

.fire__log--a { transform: rotate(9deg); }
.fire__log--b { transform: rotate(-11deg) translateY(4px); }

@keyframes glow {
  0%, 100% { opacity: 0.85; transform: translateX(-50%) scale(1); }
  50%      { opacity: 1;    transform: translateX(-50%) scale(1.08); }
}

@keyframes flicker-a {
  0%, 100% { transform: scale(1, 1) skewX(0deg); opacity: 0.9; }
  33%      { transform: scale(1.06, 0.94) skewX(3deg); opacity: 1; }
  66%      { transform: scale(0.95, 1.08) skewX(-3deg); opacity: 0.82; }
}

@keyframes flicker-b {
  0%, 100% { transform: scale(1, 1) translateX(0); }
  40%      { transform: scale(0.92, 1.12) translateX(3px); }
  70%      { transform: scale(1.08, 0.92) translateX(-3px); }
}

@keyframes flicker-c {
  0%, 100% { transform: scaleY(1) translateY(0); opacity: 1; }
  50%      { transform: scaleY(1.22) translateY(-5px); opacity: 0.72; }
}

/* Funkenflug */
.sparks { position: fixed; inset: auto 0 0 0; height: 100vh; pointer-events: none; z-index: 0; overflow: hidden; }

.spark {
  position: absolute;
  bottom: -12px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--spark);
  box-shadow: 0 0 7px 1px rgba(255, 167, 51, 0.85);
  opacity: 0;
  animation: rise linear infinite;
}

@keyframes rise {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.6); }
  12%  { opacity: 0.95; }
  70%  { opacity: 0.55; }
  100% { opacity: 0; transform: translate(var(--drift, 40px), -78vh) scale(0.25); }
}

/* --- Baumsilhouette ------------------------------------------------------ */

.treeline {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  width: 100%;
  height: clamp(120px, 20vh, 230px);
  opacity: 0.55;
  pointer-events: none;
  fill: #0b0705;
}

/* --- Utilities ----------------------------------------------------------- */

.stack   { display: flex; flex-direction: column; gap: 1rem; }
.row     { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.spread  { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.hidden  { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

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

::selection { background: rgba(255, 107, 31, 0.32); color: var(--cream); }

/* Reveal beim Laden */
.reveal { opacity: 0; transform: translateY(22px); animation: reveal 0.9s var(--ease) forwards; }

@keyframes reveal {
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .sparks { display: none; }
}
