/* ==========================================================
   Beispielseite: Galerie & Neuigkeiten selbst pflegen
   Links der Verwaltungsbereich (dunkel, Braindance-Stil),
   rechts die Kunden-Website im hellen, eigenen Stil.
   ========================================================== */

.demo-page { padding-block: 140px 100px; }
/* „hidden“ muss auch gegen display:grid/flex gewinnen */
.demo-page [hidden] { display: none !important; }

/* ---------- Einleitung ---------- */
.demo-intro { max-width: 760px; margin-bottom: clamp(56px, 8vw, 96px); }
.demo-intro h1 { font-size: clamp(2.2rem, 1.3rem + 3.4vw, 3.8rem); margin-bottom: 20px; }
.demo-lead { font-size: clamp(1.1rem, 1rem + .5vw, 1.35rem); color: var(--text-dim); max-width: 640px; }
.demo-note {
  display: flex; gap: 14px; align-items: flex-start;
  margin-top: 28px; padding: 16px 20px;
  border: 1px solid rgba(34, 211, 238, .35);
  border-radius: var(--radius-sm);
  background: rgba(34, 211, 238, .06);
  color: var(--text-dim); font-size: .95rem;
}
.demo-note strong { color: var(--text); }
.demo-note svg { width: 22px; height: 22px; flex: none; margin-top: 1px; fill: none; stroke: var(--cyan); stroke-width: 2; stroke-linecap: round; }
.demo-jump { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.demo-jump .btn { min-height: 44px; }

/* ---------- Abschnitte ---------- */
.demo-section { scroll-margin-top: 90px; margin-bottom: clamp(72px, 10vw, 128px); }
.demo-section-head { max-width: 720px; margin-bottom: 32px; }
.demo-section-head h2 { font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3rem); margin-bottom: 12px; }
.demo-section-head p:not(.kicker) { color: var(--text-dim); }

.demo-split {
  display: grid;
  grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 36px);
  align-items: start;
}
@media (max-width: 900px) { .demo-split { grid-template-columns: 1fr; } }

/* ---------- Verwaltungsbereich ---------- */
.demo-admin {
  display: grid; gap: 16px;
  padding: clamp(20px, 3vw, 28px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-2);
}
@media (min-width: 901px) { .demo-admin { position: sticky; top: 96px; } }
.demo-admin h3 { font-size: 1.25rem; }
.demo-admin h4 { font-size: .95rem; margin-bottom: 10px; color: var(--text-dim); font-weight: 600; }
.demo-badge {
  display: inline-flex; align-items: center; gap: 8px; justify-self: start;
  padding: 5px 12px; border-radius: 999px;
  background: rgba(198, 255, 61, .1); color: var(--lime);
  font-family: var(--mono); font-size: .85rem; letter-spacing: .04em;
}
.demo-badge svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* Auswahlfläche für Bilder (ganze Fläche klickbar, auch Drag & Drop) */
.drop {
  position: relative;
  display: grid; justify-items: center; gap: 6px;
  padding: 26px 16px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .02);
  text-align: center; color: var(--text-dim);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop svg { width: 30px; height: 30px; fill: none; stroke: var(--cyan); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.drop strong { color: var(--text); }
.drop small { font-size: .8rem; color: var(--text-faint); }
.drop:hover, .drop.is-over { border-color: var(--cyan); background: rgba(34, 211, 238, .06); }
.drop:focus-within { outline: 2px solid var(--cyan); outline-offset: 3px; }
.drop-sm { grid-auto-flow: column; justify-content: center; align-items: center; padding: 14px 16px; }
.drop-sm svg { width: 22px; height: 22px; }

/* Entwürfe vor dem Veröffentlichen */
.drafts { display: grid; gap: 14px; }
.draft-list { display: grid; gap: 12px; }
.draft {
  display: grid; grid-template-columns: 72px 1fr; gap: 12px;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .02);
}
.draft img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.draft-fields { display: grid; gap: 8px; }
.draft input, .draft textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: rgba(7, 7, 12, .6); color: var(--text); font: inherit; font-size: 16px;
  resize: vertical;
}
.draft input:focus, .draft textarea:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139, 92, 246, .2); }
.draft .sr-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Bereits veröffentlicht (eigene Inhalte) */
.own-list { display: grid; gap: 8px; }
.own-list li {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px;
  padding: 6px 6px 6px 6px; border: 1px solid var(--border); border-radius: 10px;
  font-size: .9rem;
}
.own-list .own-thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--surface-2); }
.own-list span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px;
  border: 0; border-radius: 8px; background: transparent;
  color: var(--text-faint); cursor: pointer;
  transition: color .2s, background .2s;
}
.icon-btn:hover { color: #f87171; background: rgba(248, 113, 113, .1); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.demo-status { min-height: 1.4em; font-size: .9rem; color: var(--lime); }
.demo-status.error { color: #f87171; }

.news-form { display: grid; gap: 12px; }
.news-form input[type="date"] { color-scheme: dark; min-height: 58px; }
.field-hint { margin-top: -6px; padding-inline: 4px; font-size: .8rem; color: var(--text-faint); }
.news-form .field label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(100% - 36px); }
.news-preview { display: flex; align-items: center; gap: 12px; }
.news-preview img { width: 96px; height: 64px; object-fit: cover; border-radius: 8px; }

/* ---------- Kunden-Website (heller, eigener Stil wie im Hero-Mockup) ---------- */
.demo-site {
  --ink: #1e1b4b;
  --ink-dim: #4a4a63;
  --paper: #f5f5f8;
  --line: #dcdce6;
  --accent: #4f46e5;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8);
}
.ds-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px; background: #e6e6ee; border-bottom: 1px solid var(--line);
}
.ds-bar i { width: 10px; height: 10px; border-radius: 50%; background: #c9c9d4; }
.ds-bar span {
  margin-left: 10px; padding: 3px 12px; border-radius: 6px; background: #fff;
  font-family: var(--mono); font-size: .75rem; color: var(--ink-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ds-body { padding: clamp(20px, 4vw, 40px); }
.ds-kicker { font-family: var(--mono); font-size: .85rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.ds-h { font-family: var(--serif); font-size: clamp(1.7rem, 1.2rem + 1.8vw, 2.5rem); font-weight: 600; line-height: 1.1; letter-spacing: -.02em; margin-bottom: 24px; }
.ds-h em { font-style: italic; font-weight: 500; color: var(--accent); }

/* Galerie */
.ds-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(140px, 40%), 1fr)); gap: 16px; }
.ds-gallery figure { display: grid; gap: 8px; margin: 0; }
.ds-gallery button {
  display: block; padding: 0; border: 0; border-radius: 10px; overflow: hidden;
  aspect-ratio: 4 / 3; background: var(--line); cursor: zoom-in;
}
.ds-gallery button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.ds-gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease-out); }
.ds-gallery button:hover img { transform: scale(1.04); }
.ds-gallery figcaption strong { display: block; font-size: .95rem; }
.ds-gallery figcaption span { display: block; font-size: .85rem; color: var(--ink-dim); line-height: 1.45; }
.is-new { animation: pop-in .6s var(--ease-out); }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* Neuigkeiten */
.ds-news { display: grid; gap: 18px; }
.ds-post {
  display: grid; grid-template-columns: 200px 1fr; gap: 20px;
  padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff;
}
.ds-post.no-img { grid-template-columns: 1fr; }
.ds-post img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; }
.ds-post time { font-family: var(--mono); font-size: .75rem; color: var(--ink-dim); }
.ds-post h4 { font-family: var(--serif); font-size: 1.35rem; line-height: 1.2; margin: 4px 0 8px; }
.ds-post p { font-size: .95rem; color: var(--ink-dim); line-height: 1.6; margin-bottom: 8px; white-space: pre-line; }
.ds-post a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px;
  color: var(--accent); font-weight: 600; font-size: .95rem; text-underline-offset: 3px;
}
/* Spalte schmal → Bild über den Text (richtet sich nach der Breite der Ansicht, nicht des Fensters) */
.ds-news { container-type: inline-size; }
@container (max-width: 540px) { .ds-post { grid-template-columns: 1fr; } .ds-post img { aspect-ratio: 16 / 9; } }

/* ---------- Großansicht ---------- */
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: rgba(5, 5, 9, .94); color: var(--text);
}
.lightbox::backdrop { background: rgba(0, 0, 0, .6); }
.lightbox[open] { display: grid; place-items: center; }
.lightbox figure { display: grid; justify-items: center; gap: 14px; max-width: min(1100px, 92vw); margin: 0; padding: 64px 0 24px; }
.lightbox img { max-width: 100%; max-height: 72dvh; border-radius: 10px; object-fit: contain; }
.lightbox figcaption { display: grid; gap: 4px; text-align: center; max-width: 60ch; }
.lightbox figcaption span { color: var(--text-dim); font-size: .95rem; }
.lightbox figcaption small { color: var(--text-faint); font-family: var(--mono); font-size: .75rem; }
.lb-btn {
  position: fixed; display: grid; place-items: center;
  width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid var(--border-strong); background: rgba(13, 13, 22, .8); color: var(--text);
  cursor: pointer;
}
.lb-btn:hover { background: var(--surface-2); }
.lb-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
@media (max-width: 600px) { .lb-prev, .lb-next { top: auto; bottom: 16px; transform: none; } }

/* ---------- Abschluss ---------- */
.demo-cta { margin-top: 0; }
.demo-reset-wrap { margin-top: 10px; font-size: .85rem; color: var(--text-faint) !important; }
.link-btn {
  padding: 0; border: 0; background: none; font: inherit; color: var(--cyan);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
  padding-block: 11px; margin-block: -11px;   /* 44 px Tippfläche ohne Layoutänderung */
}
@media (max-width: 760px) { .demo-cta { flex-direction: column; align-items: stretch; padding: 28px 24px; gap: 20px; } }

@media (prefers-reduced-motion: reduce) {
  .is-new { animation: none; }
  .ds-gallery img { transition: none; }
}

/* Löschen: Symbol + Text, gut sichtbar und groß genug zum Antippen */
.own-hint { margin: -4px 0 10px; font-size: .85rem; color: var(--text-faint); }
.del-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: transparent; color: var(--text-dim);
  font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
  transition: color .2s, background .2s, border-color .2s;
}
.del-btn:hover, .del-btn:focus-visible { color: #fca5a5; border-color: rgba(248, 113, 113, .6); background: rgba(248, 113, 113, .1); }
.del-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.undo-btn { color: var(--lime); font-weight: 600; }
