/* Guest registration form.
   No webfonts, no third-party assets — the page loads nothing off-origin,
   which keeps the CSP strict and leaks no referrer to a font CDN.
   Icons are CSS masks over data: SVGs (img-src allows data:), and nothing
   here relies on an inline style attribute, which the CSP blocks. */

:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --card: #ffffff;
  --ink: #0f1b33;
  --muted: #5b6477;
  --faint: #8a92a3;
  --line: rgba(15, 27, 51, 0.09);
  --field: #fbfcfe;
  --field-line: rgba(15, 27, 51, 0.16);
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eef3ff;
  --danger: #c62828;
  --warn: #9a5b00;
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(15, 27, 51, 0.04), 0 10px 30px rgba(15, 27, 51, 0.06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
/* Author display rules (grid/flex) would otherwise beat the hidden attribute. */
[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(37, 99, 235, 0.10), transparent 60%),
    radial-gradient(700px 380px at 100% -5%, rgba(16, 185, 129, 0.09), transparent 60%),
    var(--bg);
  background-repeat: no-repeat;
  min-height: 100vh;
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}

h1 { font-size: 1.55rem; line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.84rem; }

/* ---- Top bar ----------------------------------------------------------- */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 700; letter-spacing: 0.03em; font-size: 0.98rem; white-space: nowrap; }

/* Segmented language switch. On narrow phones only the active language
   shows its code; the flags alone are enough to find your own. */
.langs {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: #eceff5;
  border-radius: 999px;
}
.lang {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 650;
  cursor: pointer;
  transition: background-color 0.15s, box-shadow 0.15s, color 0.15s;
}
.lang img {
  display: block;
  width: 20px;
  height: 14px;
  border-radius: 3px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(15, 27, 51, 0.14);
}
.lang span { display: none; }
.lang[aria-pressed="true"] {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(15, 27, 51, 0.14);
}
.lang[aria-pressed="true"] span { display: inline; }
.lang:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
@media (min-width: 560px) {
  .lang span { display: inline; }
}
/* Smallest phones (320px): flags only, so the switch keeps its gutter. */
@media (max-width: 359px) {
  .top { gap: 8px; }
  .brand { font-size: 0.9rem; }
  .lang { padding: 0 7px; }
  .lang[aria-pressed="true"] span { display: none; }
}

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

.wrap {
  max-width: 620px;
  margin: 0 auto;
  padding: 18px 16px;
}
.stack { display: grid; gap: 14px; }
.wrap > .card + .card { margin-top: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card--center { text-align: center; padding: 38px 22px; display: grid; gap: 10px; justify-items: center; }

/* ---- Hero: whose stay this is ------------------------------------------ */

.eyebrow {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 4px;
}

.stay {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.stay__item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f4f6fa;
  font-weight: 600;
  font-size: 0.92rem;
  min-width: 0;
}
.stay__item--dates { grid-column: 1 / -1; }
.stay__item .icon { color: var(--primary); }
@media (min-width: 560px) {
  .stay { grid-template-columns: 2.2fr 1fr 1fr; }
  .stay__item--dates { grid-column: auto; }
}

.ref { margin-top: 10px; font-size: 0.84rem; color: var(--muted); }
.ref strong { color: var(--ink); font-weight: 600; }

.why {
  margin-top: 16px;
  padding: 13px 15px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: #22324f;
  font-size: 0.9rem;
  display: grid;
  gap: 6px;
}
.why__time { color: var(--muted); font-size: 0.85rem; }

/* ---- Guest cards ------------------------------------------------------- */

.guest { padding: 0; overflow: hidden; scroll-margin-top: 76px; }
label, .note { scroll-margin-top: 90px; }
.guest__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
}
.guest--open .guest__head { border-bottom: 1px solid var(--line); }
.guest__num {
  flex: 0 0 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary);
}
.guest__num--ok { background: var(--ok-soft); color: var(--ok); }
.guest__title {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 700;
  font-size: 1rem;
  overflow-wrap: anywhere;
}
.guest__sub { display: block; font-weight: 500; font-size: 0.82rem; color: var(--muted); }
.guest__state {
  flex: 0 0 auto;
  font-size: 0.76rem;
  font-weight: 650;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff4dc;
  color: var(--warn);
}
.guest__edit {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.84rem;
  background: #f0f2f7;
  color: var(--ink);
}
.guest__body { padding: 18px 20px 20px; display: grid; gap: 20px; }

fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 12px; min-width: 0; }
fieldset + fieldset { padding-top: 18px; border-top: 1px dashed var(--line); }
legend {
  float: left; /* lets the gap below apply; legends ignore grid otherwise */
  width: 100%;
  padding: 0;
  margin-bottom: 2px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
}

label { display: block; font-size: 0.86rem; font-weight: 550; color: #3a4459; }
.row { display: grid; gap: 12px; }
.row--pair { grid-template-columns: 1fr 1fr; }
@media (min-width: 520px) { .row--2 { grid-template-columns: 1fr 1fr; } }

input, select {
  display: block;
  width: 100%;
  font: inherit;
  /* 16px stops iOS zooming the viewport when a field is focused */
  font-size: 16px;
  font-weight: 400;
  margin-top: 6px;
  padding: 11px 13px;
  min-height: 48px; /* comfortable touch target */
  border: 1px solid var(--field-line);
  border-radius: 12px;
  background: var(--field);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
input::placeholder { color: #a3aab8; }
input:focus, select:focus {
  outline: none;
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}
input[aria-invalid="true"], select[aria-invalid="true"] {
  border-color: var(--danger);
  background: #fffafa;
}

.hint { display: block; margin-top: 5px; font-size: 0.78rem; font-weight: 400; color: var(--faint); }
.err { display: block; margin-top: 5px; font-size: 0.8rem; font-weight: 550; color: var(--danger); }
.warn { display: block; margin-top: 5px; font-size: 0.8rem; font-weight: 550; color: var(--warn); }

.minor-note {
  padding: 10px 13px;
  border-radius: 12px;
  background: #f4f6fa;
  color: var(--muted);
  font-size: 0.86rem;
}

/* "Same address as guest 1" sits above the address it would fill in. */
.copy-btn {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 13px;
  font-size: 0.84rem;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.remove-btn {
  justify-self: start;
  min-height: 0;
  padding: 4px 0;
  background: none;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 550;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.remove-btn:hover { color: var(--danger); }

/* Placeholder card for the next guest */
.add-guest {
  width: 100%;
  min-height: 60px;
  border: 1.5px dashed rgba(37, 99, 235, 0.35);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.6);
  color: var(--primary-dark);
  font-size: 0.95rem;
}
.add-guest:hover { background: #fff; border-color: var(--primary); }

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

button {
  font: inherit;
  font-weight: 650;
  border: 0;
  border-radius: 999px;
  padding: 13px 22px;
  min-height: 48px;
  cursor: pointer;
  transition: background-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
button:active { transform: translateY(1px); }
button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25); }
.primary:hover { background: var(--primary-dark); }
.primary:disabled { background: #9aa6bd; box-shadow: none; cursor: progress; }
.secondary { background: #eef1f6; color: var(--ink); }
.secondary:hover { background: #e3e8f0; }

/* ---- Finish ------------------------------------------------------------ */

.finish { display: grid; gap: 16px; }

.progress { display: grid; gap: 8px; }
.progress__text { font-weight: 650; font-size: 0.92rem; }
.progress__bar { display: block; height: 8px; border-radius: 999px; background: #edf0f5; overflow: hidden; }
.progress__fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  transition: width 0.35s ease;
}
/* Width is set through element.style (CSSOM), which the CSP allows —
   unlike a style attribute, which it blocks. */

.check {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}
.check input {
  width: 20px;
  height: 20px;
  min-height: 0;
  flex-shrink: 0;
  margin: 1px 0 0;
  padding: 0;
  accent-color: var(--primary);
}

/* Buttons wrap as whole buttons, never mid-label ("Fortschritt speichern"). */
.submit-row { display: flex; flex-wrap: wrap; gap: 10px; }
.submit-row button { flex: 1 1 auto; white-space: nowrap; }
.submit-row .primary { flex-grow: 2; }

.status { min-height: 1.3em; font-size: 0.86rem; color: var(--muted); text-align: center; }
.status--ok { color: var(--ok); }
.status:empty { min-height: 0; }

.note { padding: 12px 14px; border-radius: 12px; font-size: 0.87rem; display: grid; gap: 3px; }
.note--warn { background: #fff8e6; border: 1px solid #f5dc9c; color: #7a4b00; }
.note--ask { background: var(--primary-soft); border: 1px solid #c9d8fb; color: #22324f; gap: 6px; }
.note__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.note__actions button { min-height: 44px; padding: 10px 18px; font-size: 0.9rem; }

.privacy { padding: 0; }
.privacy summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 650;
  font-size: 0.93rem;
  list-style: none;
}
.privacy summary::-webkit-details-marker { display: none; }
.privacy summary::after {
  content: '';
  margin-left: auto;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--faint);
  border-bottom: 2px solid var(--faint);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.2s;
}
.privacy[open] summary::after { transform: rotate(225deg) translate(-2px, -2px); }
.privacy summary .icon { color: var(--muted); }
.privacy-body { padding: 0 20px 18px; display: grid; gap: 9px; font-size: 0.85rem; color: var(--muted); }
.privacy-body strong { color: var(--ink); }

/* ---- Loading / error / done -------------------------------------------- */

.mark {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}
.mark--ok { background: var(--ok-soft); color: var(--ok); }
.mark--muted { background: #eef1f6; color: var(--muted); }
.done__stay { font-weight: 600; color: var(--ink); }
.done button { margin-top: 10px; }

.spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid #e3e8f2;
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
  * { transition: none !important; }
}

/* ---- Icons (masks, so they take the text colour) ----------------------- */

.icon {
  display: inline-block;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: var(--i) no-repeat center / contain;
  mask: var(--i) no-repeat center / contain;
}
.icon--cal { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4.5' width='18' height='17' rx='2.5'/%3E%3Cpath d='M16 2.5v4M8 2.5v4M3 10h18'/%3E%3C/svg%3E"); }
.icon--moon { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.5 13.2A8.5 8.5 0 1 1 10.8 3.5a6.6 6.6 0 0 0 9.7 9.7z'/%3E%3C/svg%3E"); }
.icon--people { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M2.5 20.5v-1a5 5 0 0 1 5-5h3a5 5 0 0 1 5 5v1'/%3E%3Cpath d='M16 4.6a3.5 3.5 0 0 1 0 6.8M18.5 14.6a5 5 0 0 1 3 4.9v1'/%3E%3C/svg%3E"); }
.icon--lock { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='10.5' width='16' height='11' rx='2.5'/%3E%3Cpath d='M8 10.5V7a4 4 0 0 1 8 0v3.5'/%3E%3C/svg%3E"); }
.icon--home { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 10.5 12 3.5l8.5 7V20a1 1 0 0 1-1 1h-5v-6h-5v6h-5a1 1 0 0 1-1-1z'/%3E%3C/svg%3E"); }

/* Signed-in guests: fill in from / save to their account */
.from-account { display: grid; gap: 10px; background: #f3f8ff; border-color: #cfe0ff; }
.from-account p { margin: 0; }
.from-account .secondary { justify-self: start; }
.done__account { margin: 14px 0 0; font-size: 0.92rem; }
.check[hidden], .from-account[hidden], .done__account[hidden] { display: none; }
