/* =========================================================================
   Hochzeits-Upload – Styles (Mobile First)
   ========================================================================= */

:root {
  /* Werden von js/config.js überschrieben (theme.*) */
  --accent: #6f8a6e;
  --accent-dark: #55705a;
  --accent-soft: #e6ede4;
  --gold: #c9a96e;

  --ink: #1f2a22;
  --ink-soft: #5a665c;
  --ink-faint: #8a948c;
  --paper: rgba(255, 255, 253, 0.78);
  --paper-solid: #fffdf9;
  --line: rgba(31, 42, 34, 0.1);
  --danger: #b2554d;
  --danger-soft: #fbeceb;

  --radius-lg: 26px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-card: 0 22px 50px -22px rgba(70, 85, 70, 0.35), 0 2px 10px rgba(70, 85, 70, 0.08);

  --font-display: 'Cormorant Garamond', 'Times New Roman', serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--ink);
  background: #f3efe6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- Hintergrund ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  /* background-image wird aus js/config.js gesetzt (images.background) */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--bg-overlay, rgba(255,253,248,.15));
}

/* ---------- App-Rahmen (100dvh) ---------- */
.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(14px + var(--safe-top)) 16px calc(8px + var(--safe-bottom));
  gap: 14px;
}

/* ---------- Kopfbereich ---------- */
.hero {
  width: 100%;
  max-width: 520px;
  color: var(--ink);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  animation: rise .7s ease both;
}
.hero__photo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 30%;
  border: 3px solid #fff;
  box-shadow: 0 8px 22px rgba(70,85,70,.25);
  margin-bottom: 4px;
  background: #fff;
}
.hero__monogram {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: .04em;
  color: var(--accent-dark);
  border: 1.5px solid rgba(111,138,110,.6);
  background: rgba(255,255,255,.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  margin-bottom: 4px;
}
.hero__names {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(30px, 8vw, 42px);
  line-height: 1.05;
  letter-spacing: .01em;
}
.hero__names .amp {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
  padding: 0 .18em;
}
.hero__meta {
  margin: 0;
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.hero__meta .dot { margin: 0 .5em; opacity: .6; }
.hero__welcome {
  margin: 4px 0 0;
  font-size: 13.5px;
  line-height: 1.5;
  max-width: 34ch;
  color: var(--ink-soft);
}

/* ---------- Hauptbereich / Card ---------- */
.main {
  width: 100%;
  max-width: 520px;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

.card {
  width: 100%;
  background: var(--paper);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid rgba(255,255,255,.9);
  outline: 1px solid rgba(111,138,110,.14);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 22px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: rise .7s .12s ease both;
  position: relative;
  overflow: hidden;
}

.card__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 26px;
  line-height: 1.15;
  text-align: center;
}
.card__intro {
  margin: 4px 0 0;
  text-align: center;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
}

/* Sichtbarkeit je Zustand */
.card [data-show] { display: none; }
.card[data-state="empty"]           [data-show~="empty"],
.card[data-state="selected"]        [data-show~="selected"],
.card[data-state="uploading"]       [data-show~="uploading"],
.card[data-state="success"]         [data-show~="success"],
.card[data-state="partial-error"]   [data-show~="partial-error"] { display: flex; }
.card [data-show].u-block { display: none; }
.card[data-state="empty"]           [data-show~="empty"].u-block,
.card[data-state="selected"]        [data-show~="selected"].u-block,
.card[data-state="uploading"]       [data-show~="uploading"].u-block,
.card[data-state="success"]         [data-show~="success"].u-block,
.card[data-state="partial-error"]   [data-show~="partial-error"].u-block { display: block; }

.state-panel {
  flex-direction: column;
  gap: 14px;
  animation: fadeIn .35s ease both;
}

/* ---------- Dropzone ---------- */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 16px;
  border: 1.5px dashed rgba(111,138,110,.55);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(230,237,228,.55), rgba(255,255,255,.2));
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s;
  text-align: center;
  width: 100%;
  font: inherit;
  color: inherit;
}
.dropzone:hover, .dropzone.is-dragover {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(230,237,228,.9), rgba(255,255,255,.4));
}
.dropzone:active { transform: scale(.995); }
.dropzone__icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--accent);
  box-shadow: 0 6px 18px rgba(31,42,34,.12);
}
.dropzone__icon svg { width: 24px; height: 24px; }
.dropzone__label {
  font-weight: 600;
  font-size: 15.5px;
  color: var(--ink);
}
.dropzone__hint {
  font-size: 12.5px;
  color: var(--ink-faint);
  margin: 0;
}

.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;
}

/* ---------- Auswahl / Thumbnails ---------- */
.selection__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.selection__count {
  font-weight: 600;
  font-size: 15px;
}
.selection__size {
  font-size: 12.5px;
  color: var(--ink-faint);
}

.thumbs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px 8px;
  margin: -4px -2px -4px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(31,42,34,.25) transparent;
  list-style: none;
}
.thumbs::-webkit-scrollbar { height: 5px; }
.thumbs::-webkit-scrollbar-thumb { background: rgba(31,42,34,.22); border-radius: 99px; }

.thumb {
  position: relative;
  flex: 0 0 auto;
  width: 84px;
  height: 84px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #dfe5dc;
  scroll-snap-align: start;
  box-shadow: 0 2px 8px rgba(31,42,34,.12);
  animation: pop .3s ease both;
}
.thumb img, .thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb__fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: var(--accent-soft);
}
.thumb__badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 99px;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  backdrop-filter: blur(4px);
}
.thumb__badge svg { width: 10px; height: 10px; }
.thumb__remove {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(20,28,22,.72);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: background .15s, transform .15s;
}
.thumb__remove:hover { background: var(--danger); transform: scale(1.05); }
.thumb__status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(255,253,249,.72);
  color: var(--accent-dark);
  pointer-events: none;
}
.thumb__status[hidden] { display: none; }
.thumb__status svg { width: 26px; height: 26px; }
.thumb--error .thumb__status { color: var(--danger); background: rgba(251,236,235,.82); }

.thumb-add-wrap { flex: 0 0 auto; list-style: none; }
.thumb-add-wrap[hidden] { display: none; }
.thumb--add {
  padding: 0;
  border: 1.5px dashed rgba(111,138,110,.6);
  background: rgba(230,237,228,.5);
  color: var(--accent-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition: background .2s, border-color .2s;
}
.thumb--add:hover { background: var(--accent-soft); border-color: var(--accent); }
.thumb--add svg { width: 20px; height: 20px; }

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  border: 0;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  border-radius: 14px;
  padding: 14px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .2s, transform .15s, box-shadow .2s, opacity .2s;
  min-height: 48px;
  width: 100%;
  text-decoration: none;
}
.btn:active { transform: translateY(1px) scale(.995); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; flex: 0 0 auto; }

.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px -8px rgba(85,112,90,.6);
}
.btn--primary:hover:not(:disabled) { background: var(--accent-dark); }

.btn--ghost {
  background: rgba(255,255,255,.55);
  color: var(--accent-dark);
  border: 1px solid rgba(111,138,110,.45);
}
.btn--ghost:hover:not(:disabled) { background: #fff; border-color: var(--accent); }

.btn-row {
  display: flex;
  gap: 10px;
}
.btn-row .btn--ghost { flex: 0 0 auto; width: auto; padding-inline: 14px; }
.btn-row .btn--primary { flex: 1 1 auto; }

:where(button, a, input, [tabindex]):focus-visible {
  outline: 3px solid rgba(111,138,110,.55);
  outline-offset: 2px;
}

/* ---------- Upload-Fortschritt ---------- */
.progress-panel { text-align: center; align-items: center; }
.progress__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
}
.progress__ring {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}
.progress__bar {
  width: 100%;
  height: 10px;
  border-radius: 99px;
  background: rgba(31,42,34,.08);
  overflow: hidden;
  position: relative;
}
.progress__fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
  transition: width .25s ease;
  position: relative;
}
.progress__fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  animation: shimmer 1.6s linear infinite;
}
.progress__meta {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 13px;
  color: var(--ink-soft);
}
.progress__meta strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.progress__current {
  font-size: 12.5px;
  color: var(--ink-faint);
  margin: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.progress__hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 99px;
  background: rgba(201,169,110,.14);
  border: 1px solid rgba(201,169,110,.35);
}
.progress__hint svg { width: 14px; height: 14px; color: var(--gold); }

/* ---------- Erfolg ---------- */
.success-panel { text-align: center; align-items: center; padding: 10px 0 4px; }
.success__mark {
  width: 96px; height: 96px;
  position: relative;
  display: grid;
  place-items: center;
}
.success__mark svg { width: 96px; height: 96px; overflow: visible; }
.success__circle {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 290;
  stroke-dashoffset: 290;
  animation: draw 1s .1s cubic-bezier(.65,0,.35,1) forwards;
}
.success__fillcircle {
  fill: var(--accent-soft);
  transform-origin: center;
  transform: scale(0);
  animation: grow .6s .7s cubic-bezier(.2,.9,.3,1.2) forwards;
}
.success__check {
  fill: none;
  stroke: var(--accent-dark);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: draw .5s 1s ease forwards;
}
.success__leaf {
  fill: var(--accent);
  opacity: 0;
  transform-origin: center;
  animation: leaf 1.4s ease forwards;
}
.success__leaf:nth-child(1) { animation-delay: 1.2s; }
.success__leaf:nth-child(2) { animation-delay: 1.35s; }
.success__leaf:nth-child(3) { animation-delay: 1.5s; }
.success__leaf:nth-child(4) { animation-delay: 1.65s; }
.success__leaf:nth-child(5) { animation-delay: 1.8s; }
.success__leaf:nth-child(6) { animation-delay: 1.95s; }
.success__leaf--gold { fill: var(--gold); }

.success__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.1;
  animation: rise .6s 1.1s ease both;
}
.success__subtitle {
  margin: 0;
  font-size: 15px;
  color: var(--ink-soft);
  animation: rise .6s 1.25s ease both;
}
.success__text {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  max-width: 38ch;
  animation: rise .6s 1.4s ease both;
}
.success-panel .btn { animation: rise .6s 1.6s ease both; }

/* ---------- Fehler ---------- */
.error-panel { text-align: center; align-items: center; }
.error__icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--danger-soft);
  color: var(--danger);
}
.error__icon svg { width: 26px; height: 26px; }
.error__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
}
.error__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 40ch;
}

/* Inline-Hinweis (z. B. abgelehnte Dateien) */
.notice {
  display: none;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.45;
  background: var(--danger-soft);
  color: #7b3a34;
  border: 1px solid rgba(178,85,77,.25);
}
.notice.is-visible { display: flex; }
.notice svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; }
.notice button {
  margin-left: auto;
  background: none; border: 0; color: inherit;
  font-size: 16px; cursor: pointer; padding: 0 2px; line-height: 1;
}

/* ---------- Card-Fußzeile ---------- */
.card__foot {
  margin: 2px 0 0;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ink-faint);
}
.card__foot a {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- powered by ---------- */
.powered {
  flex: 0 0 auto;
  margin: 0;
  padding-top: 2px;
}
.powered__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 99px;
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(111,138,110,.18);
  transition: color .2s, background .2s, border-color .2s;
}
.powered__link:hover { color: var(--ink); background: rgba(255,255,255,.9); border-color: rgba(111,138,110,.4); }
.powered__logo {
  height: 12px;
  object-fit: cover;
  object-position: center 22%;   /* nur das X-Icon aus dem Logobild zeigen */
  display: block;
  /* Logo ist weiß/gold auf transparent – für hellen Hintergrund in Bronze abdunkeln */
  filter: brightness(.55) sepia(.6) saturate(1.6);
}
.powered__name {
  font-family: var(--font-body);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  color: var(--ink);
}

/* Demo-Banner */
.demo-banner {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: calc(40px + var(--safe-bottom));
  transform: translateX(-50%);
  background: rgba(31,42,34,.85);
  color: #fff;
  font-size: 11.5px;
  padding: 6px 12px;
  border-radius: 99px;
  backdrop-filter: blur(6px);
  pointer-events: none;
  white-space: nowrap;
}

/* ---------- Animationen ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes grow { to { transform: scale(1); } }
@keyframes leaf {
  0%   { opacity: 0; transform: translate(0,0) scale(.4) rotate(0deg); }
  30%  { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx, 0), var(--dy, -40px)) scale(1) rotate(var(--rot, 30deg)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .success__circle, .success__check { stroke-dashoffset: 0; }
  .success__fillcircle { transform: scale(1); }
  .success__leaf { display: none; }
  .progress__ring { border-top-color: var(--accent-soft); border-color: var(--accent); }
}

/* ---------- Responsive ---------- */
/* Sehr kleine Displays (iPhone SE etc.) – kompakter */
@media (max-height: 700px) {
  .app { gap: 10px; padding-top: calc(10px + var(--safe-top)); }
  .hero { gap: 3px; }
  .hero__photo, .hero__monogram { width: 56px; height: 56px; font-size: 20px; }
  .powered__logo { height: 22px; width: 22px; }
  .hero__names { font-size: 30px; }
  .hero__welcome { font-size: 12.5px; }
  .card { padding: 16px 16px 12px; gap: 11px; }
  .card__title { font-size: 22px; }
  .dropzone { padding: 16px 14px; gap: 6px; }
  .dropzone__icon { width: 44px; height: 44px; }
  .thumb { width: 72px; height: 72px; }
  .btn { min-height: 44px; padding: 11px 16px; }
}
@media (max-height: 600px) {
  .hero__welcome { display: none; }
}

/* Tablet / Desktop */
@media (min-width: 768px) {
  .app { padding: 32px 24px 16px; gap: 22px; justify-content: center; }
  .hero__photo, .hero__monogram { width: 96px; height: 96px; font-size: 28px; }
  .hero__names { font-size: 48px; }
  .hero__meta { font-size: 13px; }
  .hero__welcome { font-size: 15px; max-width: 42ch; }
  .main { flex: 0 1 auto; max-width: 560px; }
  .card { padding: 30px 28px 20px; gap: 18px; }
  .card__title { font-size: 30px; }
  .thumb { width: 96px; height: 96px; }
  .dropzone { padding: 32px 20px; }
}
@media (min-width: 1100px) {
  .app { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; gap: 72px; padding-bottom: 56px; }
  .hero { text-align: left; align-items: flex-start; max-width: 420px; }
  .hero__photo, .hero__monogram { width: 120px; height: 120px; }
  .hero__names { font-size: 60px; }
  .hero__welcome { font-size: 16px; }
  .main { max-width: 540px; }
  .powered { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; }
}
