:root {
  --bg: #f7f1ea;
  --bg-alt: #efe5d9;
  --surface: #fffaf4;
  --ink: #2b2420;
  --muted: #7a6b60;
  --accent: #b5643c;
  --accent-ink: #fff;
  --line: #e2d4c4;
  --radius: 14px;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
[hidden] { display: none !important; }

.eyebrow {
  margin: 0 0 .5rem;
  font-size: .75rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--accent);
}
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }

/* ---------- Top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top, 0px)) var(--gutter) 12px;
  color: #fff;
  transition: background .3s, color .3s, box-shadow .3s;
}
.topbar.solid {
  background: rgba(247, 241, 234, .92);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  color: var(--ink);
  box-shadow: 0 1px 0 var(--line);
}
.brand { font: 500 1.5rem/1 var(--serif); text-decoration: none; letter-spacing: .04em; }
.brand span, h1 span, .footer span { font-style: italic; color: var(--accent); }
.topbar:not(.solid) .brand span { color: #f3c3a4; }
.topbar nav { display: flex; gap: clamp(14px, 3vw, 28px); }
.topbar nav a { text-decoration: none; font-size: .9rem; font-weight: 500; opacity: .9; }
.topbar nav a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  height: 100vh; height: 100svh;
  min-height: 520px;
  overflow: hidden;
  color: #fff;
  display: flex; align-items: flex-end;
}
.hero picture, .hero img { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero img { object-fit: cover; object-position: 50% 35%; }
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(30, 20, 14, .72) 0%, rgba(30, 20, 14, .25) 45%, rgba(30, 20, 14, .15) 100%);
}
.hero-text {
  position: relative; z-index: 1;
  padding: 0 var(--gutter) calc(clamp(40px, 9vh, 96px) + var(--safe-b));
  max-width: 720px;
}
.hero .eyebrow { color: #f3d9c6; }
.hero h1 {
  margin: 0;
  font: 400 clamp(3.2rem, 11vw, 7rem)/.95 var(--serif);
  letter-spacing: -.01em;
}
.hero h1 span { color: #f3c3a4; }
.hero .lead { font-size: clamp(1rem, 2.6vw, 1.2rem); margin: 1rem 0 1.6rem; opacity: .92; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Breite Bildschirme: Text links, Hochformat-Foto rechts */
@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .hero { align-items: center; background: var(--bg); color: var(--ink); }
  .hero picture { left: auto; width: 55%; }
  .hero img { object-position: 50% 40%; }
  .hero::after { display: none; }
  .hero-text { width: 45%; max-width: none; padding: 0 clamp(32px, 5vw, 80px); }
  .hero h1 { font-size: clamp(3.4rem, 5.6vw, 6.5rem); white-space: nowrap; }
  .hero .eyebrow { color: var(--accent); }
  .hero h1 span { color: var(--accent); }
  .hero .btn-ghost { color: var(--ink); border-color: var(--ink); }
  .hero .btn-ghost:hover { background: rgba(0,0,0,.05); }
  .topbar:not(.solid) { color: var(--ink); }
  .topbar:not(.solid) .brand span { color: var(--accent); }
  .topbar:not(.solid) nav { color: #fff; }
}

/* ---------- Buttons ---------- */
.btn {
  appearance: none; border: 1px solid var(--accent); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 24px;
  border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font: 500 .95rem var(--sans); text-decoration: none;
  transition: transform .15s, background .2s, opacity .2s;
}
.btn:hover { background: #a1552f; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.7); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.12); }
.btn-wide { width: 100%; }

/* ---------- Sections ---------- */
.section { scroll-margin-top: 0; padding: clamp(56px, 10vw, 112px) var(--gutter); }
.section-alt { background: var(--bg-alt); }
.section-head { max-width: 640px; margin: 0 auto clamp(28px, 5vw, 48px); text-align: center; }
.section-head h2 { margin: 0 0 .5rem; font: 400 clamp(2.2rem, 7vw, 3.4rem)/1.05 var(--serif); }
.section-head p { margin: 0 0 .75rem; }
.link { color: var(--accent); font-weight: 500; font-size: .92rem; text-underline-offset: 4px; }

/* ---------- Masonry grid ---------- */
.grid {
  column-count: 2;
  column-gap: 8px;
  max-width: 1400px; margin: 0 auto;
}
@media (min-width: 720px)  { .grid { column-count: 3; column-gap: 12px; } }
@media (min-width: 1100px) { .grid { column-count: 4; column-gap: 14px; } }

.tile {
  display: block; width: 100%;
  margin: 0 0 8px; padding: 0; border: 0;
  break-inside: avoid;
  border-radius: 8px; overflow: hidden;
  background: var(--line);
  cursor: zoom-in;
  position: relative;
}
@media (min-width: 720px) { .tile { margin-bottom: 12px; } }
@media (min-width: 1100px) { .tile { margin-bottom: 14px; } }
.tile img {
  width: 100%; height: auto;
  opacity: 0; transition: opacity .5s, transform .6s;
}
.tile img.loaded { opacity: 1; }
@media (hover: hover) { .tile:hover img { transform: scale(1.03); } }
.tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tile .by {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 18px 10px 8px;
  font-size: .75rem; color: #fff; text-align: left;
  background: linear-gradient(to top, rgba(0,0,0,.55), transparent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- Upload ---------- */
.upload {
  max-width: 560px; margin: 0 auto clamp(40px, 7vw, 64px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(16px, 4vw, 28px);
  display: grid; gap: 16px;
}
.dropzone {
  position: relative;
  display: grid; justify-items: center; gap: 4px;
  padding: 28px 16px;
  border: 1.5px dashed #cdb39b; border-radius: 12px;
  text-align: center; cursor: pointer;
  transition: background .2s, border-color .2s;
}
.dropzone:hover, .dropzone.drag { background: #fbf1e7; border-color: var(--accent); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone svg { width: 36px; height: 36px; color: var(--accent); margin-bottom: 4px; }
.dropzone strong { font-weight: 600; }

.previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}
.preview { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--line); }
.preview img { width: 100%; height: 100%; object-fit: cover; }
.preview button {
  position: absolute; top: 4px; right: 4px;
  width: 26px; height: 26px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.6); color: #fff; font-size: 16px; line-height: 1; cursor: pointer;
}
.preview.done::after, .preview.err::after {
  content: "✓"; position: absolute; inset: 0;
  display: grid; place-items: center;
  background: rgba(46, 125, 80, .55); color: #fff; font-size: 26px;
}
.preview.err::after { content: "!"; background: rgba(170, 40, 40, .6); }
.preview.busy::after {
  content: ""; position: absolute; inset: 0;
  background: rgba(255,255,255,.55);
}

.fields { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; font-size: .9rem; font-weight: 500; }
.field em { font-weight: 400; font-style: normal; color: var(--muted); }
.field input {
  width: 100%; min-height: 48px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink);
  font: 400 16px var(--sans); /* 16px verhindert Auto-Zoom auf iOS */
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar { height: 100%; width: 0; background: var(--accent); transition: width .25s; }
.status { margin: 0; min-height: 1.4em; text-align: center; font-size: .92rem; }
.status.ok { color: #2e7d50; }
.status.err { color: #a83232; }

/* ---------- Footer ---------- */
.footer {
  padding: 40px var(--gutter) calc(40px + var(--safe-b));
  text-align: center;
  font: 400 1.6rem var(--serif);
  color: var(--muted);
}
.footer p { margin: 0; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: #0f0c0a;
  color: #fff;
  display: flex; flex-direction: column;
  touch-action: none;
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } }
.lb-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 8px 8px 16px;
  position: relative; z-index: 2;
}
.lb-caption { font-size: .85rem; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-tools { display: flex; gap: 4px; flex-shrink: 0; }
.lb-btn, .lb-nav {
  appearance: none; border: 0; background: transparent; color: #fff; cursor: pointer;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
}
.lb-btn:hover, .lb-nav:hover { background: rgba(255,255,255,.12); }
.lb-btn svg, .lb-nav svg { width: 24px; height: 24px; }
.lb-stage {
  flex: 1; min-height: 0;
  position: relative;
  margin: 0 0 calc(40px + var(--safe-b));
  overflow: hidden;
}
.lb-stage img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  user-select: none; -webkit-user-drag: none;
  transition: transform .25s ease, opacity .2s;
}
.lb-stage img.dragging { transition: none; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; background: rgba(0,0,0,.35);
}
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
@media (hover: none) and (max-width: 719px) { .lb-nav { display: none; } }
.lb-counter {
  position: absolute; left: 0; right: 0; bottom: calc(12px + var(--safe-b));
  text-align: center; font-size: .8rem; opacity: .7;
}
body.lb-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
