:root {
  --bg: #FAF9F6;
  --surface: #FFFFFF;
  --ink: #1E1E1C;
  --ink-soft: #5B5953;
  --muted: #9A978F;
  --line: #E9E6DF;
  --error: #A1412F;
  --display: 'Cormorant Garamond', 'Times New Roman', serif;
  --ui: 'Inter', system-ui, -apple-system, sans-serif;
  --pad: clamp(16px, 4vw, 40px);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[hidden] { display: none !important; }

button, input, select { font: inherit; color: inherit; }

#site { min-height: 100vh; display: flex; flex-direction: column; }

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

.eyebrow {
  margin: 0 0 18px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
}
.title {
  margin: 0;
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(46px, 9vw, 84px);
  line-height: 1;
  letter-spacing: -0.01em;
}
.date {
  margin: 18px 0 0;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 46px;
  padding: 0 26px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn-dark { background: var(--ink); color: var(--bg); }
.btn-dark:hover { background: #3a3a37; }
.btn-line { border-color: var(--line); background: var(--surface); color: var(--ink); }
.btn-line:hover { border-color: var(--ink-soft); }

/* Eingabefelder: nur eine feine Linie */
.field-line {
  height: 46px;
  padding: 0 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  font-size: 16px; /* verhindert Auto-Zoom auf iOS */
  outline: none;
  transition: border-color 0.2s;
}
.field-line:focus { border-bottom-color: var(--ink); }
.field-line::placeholder { color: var(--muted); }

/* ---------- Sprachumschalter ---------- */

.lang {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: var(--pad);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 2px;
}
.lang button {
  border: 0;
  background: none;
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s;
}
.lang button[aria-pressed='true'] { color: var(--ink); }
.lang button:hover { color: var(--ink); }
.lang span { width: 1px; height: 12px; background: var(--line); }

/* ---------- Passwort-Seite ---------- */

.lock {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px var(--pad);
  text-align: center;
}
.lock-form {
  width: min(320px, 100%);
  margin-top: 56px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.lock-form p { margin: 0; color: var(--ink-soft); font-size: 14px; }
.lock-form input { text-align: center; }
.lock-form .btn { margin-top: 6px; }
.form-error { min-height: 1.5em; color: var(--error) !important; }

/* ---------- Kopfbereich ---------- */

.hero {
  text-align: center;
  padding: clamp(72px, 12vw, 120px) var(--pad) clamp(40px, 6vw, 64px);
}

/* ---------- Kategorien ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 249, 246, 0.9);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.tabs {
  display: flex;
  justify-content: center;
  gap: clamp(22px, 5vw, 44px);
  padding: 0 var(--pad);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  position: relative;
  flex: 0 0 auto;
  border: 0;
  background: none;
  padding: 17px 0 16px;
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected='true'] { color: var(--ink); }
.tabs button::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.5px;
  background: var(--ink);
  transform: scaleX(0);
  transition: transform 0.25s ease;
}
.tabs button[aria-selected='true']::after { transform: scaleX(1); }
.tabs .count {
  margin-left: 4px;
  font-size: 10px;
  color: var(--muted);
  vertical-align: super;
  line-height: 0;
}
@media (max-width: 380px) {
  .tabs { gap: 18px; }
  .tabs .count { display: none; }
}

/* ---------- Inhalt ---------- */

main {
  flex: 1;
  width: 100%;
  max-width: 1760px;
  margin: 0 auto;
  padding: clamp(4px, 2vw, 32px) clamp(4px, 2vw, 32px) 64px;
}

/* ---------- Upload ---------- */

.upload {
  max-width: 560px;
  margin: clamp(32px, 6vw, 56px) auto clamp(36px, 6vw, 64px);
  padding: 0 var(--pad);
  text-align: center;
}
.upload h2 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(30px, 5vw, 38px);
  line-height: 1.15;
}
.upload > p { margin: 0 auto; max-width: 440px; color: var(--ink-soft); }
.upload-form {
  display: flex;
  gap: 14px;
  margin-top: 28px;
}
.upload-form input { flex: 1; min-width: 0; }
@media (max-width: 520px) {
  .upload-form { flex-direction: column; }
  .upload-form input { text-align: center; }
}

.progress { margin-top: 28px; }
.progress-bar { height: 2px; background: var(--line); overflow: hidden; }
.progress-bar span { display: block; width: 0; height: 100%; background: var(--ink); transition: width 0.25s; }
.progress-status { margin-top: 14px; font-size: 14px; color: var(--ink-soft); }
.progress-status p { margin: 0; }
.progress.done .progress-status p { color: var(--ink); }
.errors { margin: 10px 0 0; padding: 0; list-style: none; color: var(--error); font-size: 13px; }

/* Modal: Nachfrage nach dem Namen während des Uploads */
.name-dialog {
  width: min(420px, calc(100vw - 32px));
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
}
.name-dialog[open] { animation: dialog-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.name-dialog::backdrop {
  background: rgba(20, 20, 18, 0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: fade-in 0.3s ease both;
}
@keyframes dialog-in { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
@keyframes fade-in { from { opacity: 0; } }
.name-dialog form { padding: 32px 28px 22px; text-align: center; }
.name-dialog-ask { display: flex; flex-direction: column; gap: 14px; }
.name-dialog h2 {
  margin: 0;
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: 30px;
  line-height: 1.15;
}
.name-dialog p { margin: 0; font-size: 14px; color: var(--ink-soft); }
.name-dialog .progress-bar { margin: 4px 0 2px; }
.name-dialog input { text-align: center; }
.link { border: 0; background: none; padding: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.link:hover { color: var(--ink); }
.name-dialog .name-dialog-thanks { display: none; padding: 18px 0 10px; font-family: var(--display); font-style: italic; font-size: 30px; color: var(--ink); }
.name-dialog.answered .name-dialog-ask { display: none; }
.name-dialog.answered .name-dialog-thanks { display: block; }

/* ---------- Gäste / Personen ---------- */

.people {
  max-width: 760px;
  margin: 0 auto clamp(28px, 5vw, 44px);
  padding: 0 var(--pad);
  text-align: center;
}
.people-label {
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
}
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.chip:hover { border-color: var(--ink-soft); }
.chip span { font-size: 11px; color: var(--muted); }

.person-bar {
  position: relative;
  margin: clamp(24px, 5vw, 44px) auto clamp(24px, 4vw, 40px);
  padding: 0 var(--pad);
  text-align: center;
}
.person-bar h2 {
  margin: 0;
  font-family: var(--display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(30px, 5vw, 40px);
  line-height: 1.15;
}
.person-bar p { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px 6px;
  border: 0;
  background: none;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
}
.back:hover { color: var(--ink); }
.back svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Galerie ---------- */

.gallery {
  --gap: 8px;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.row { display: flex; gap: var(--gap); max-width: 100%; }
.tile {
  position: relative;
  display: block;
  flex-basis: 0;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  border-radius: 2px;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}
.tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.tile img.loaded { opacity: 1; }
@media (hover: hover) {
  .tile:hover img { transform: scale(1.03); }
}

/* Name des Gastes auf der Kachel */
.tile-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 22px 10px 8px;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.42));
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}
.tile-name:hover { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 520px) { .tile-name { padding: 16px 6px 5px; font-size: 10.5px; } }

#sentinel { height: 1px; }

.empty {
  margin: 0;
  padding: 72px var(--pad);
  text-align: center;
  font-family: var(--display);
  font-style: italic;
  font-weight: 300;
  font-size: 24px;
  color: var(--muted);
}

/* ---------- Lightbox ---------- */

.pswp { --pswp-bg: #0c0c0b; --pswp-icon-color: #f2f0ea; }
.pswp__counter { font-family: var(--ui); font-size: 13px; letter-spacing: 0.06em; opacity: 0.75; }
.pswp__button--download-button .pswp__icn { top: 14px; left: 10px; width: 32px; height: 32px; }
.pswp__icn--download path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.pswp__icn--download .dl-shadow { stroke: var(--pswp-icon-stroke-color); stroke-width: 4.5px; }
.pswp__icn--download .dl-main { stroke: var(--pswp-icon-color); stroke-width: 2.2px; }

/* Bildunterschrift "Foto von …" */
.pswp__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(18px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.pswp--ui-visible .pswp__caption { opacity: 1; }
.pswp__caption[hidden] { display: none; }
.pswp__caption button {
  pointer-events: auto;
  padding: 9px 18px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #f2f0ea;
  font-family: var(--ui);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}
.pswp__caption button:hover { background: rgba(255, 255, 255, 0.2); }
.pswp__caption strong { font-weight: 500; }
