/* Reisecenter Fehmarn – Fotogalerie + Lightbox. Reines CSS, keine Bibliotheken.
   Farben kommen aus den Tokens (tokens.css); Fallbacks erlauben den Einsatz ohne tokens.css.
   Responsive per Container Query (.rg und .rg-lb sind die Container). */

.rg, .rg-lb, .rg-ov {
  --rg-ink: var(--ink, #0f2a3a);
  --rg-muted: var(--muted, #4d6573);
  --rg-brand: var(--brand, #1d6a86);
  --rg-brand-deep: var(--brand-deep, #0e3b52);
  --rg-on-brand: var(--on-brand, #ffffff);
  --rg-tint: var(--sea-tint, #dcebf0);
  --rg-accent: var(--accent, #e8a33d);
  --rg-accent-ink: var(--accent-ink, #2a1a00);
  --rg-sans: 'Plus Jakarta Sans', sans-serif;
  --rg-serif: 'Plus Jakarta Sans', sans-serif;
  font-family: var(--rg-sans);
  box-sizing: border-box;
}
.rg *, .rg *::before, .rg *::after, .rg-ov *, .rg-ov *::before, .rg-ov *::after, .rg-lb *, .rg-lb *::before, .rg-lb *::after { box-sizing: border-box; }

/* Lightbox-Farben: gleiche Variablen wie die Gaestebuch-Lightbox (footer-css-6.css).
   Zentral aenderbar: --rcf-lb-* einmal in der globalen CSS (:root) setzen, dann gilt es fuer beide.
   Ohne globale Definition greifen die Fallbacks (= aktuelle Gaestebuch-Werte). */
.rg-lb, .rg-ov {
  --lb-backdrop: var(--rcf-lb-backdrop, rgba(0, 0, 0, .9));
  --lb-btn: var(--rcf-lb-btn, rgba(0, 0, 0, .4));
  --lb-btn-hover: var(--rcf-lb-btn-hover, rgba(0, 0, 0, .7));
  --lb-text: var(--rcf-lb-text, #fff);
}

/* ---------- Abschnitt ---------- */
.rg { color: var(--rg-ink); padding: 48px 0 56px; }
.rg .rg-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 56px; margin: 0 0 24px; }
.rg .rg-eyebrow { margin: 0 0 8px; font: 700 12px/16px var(--rg-sans); letter-spacing: .14em; text-transform: uppercase; color: var(--rg-brand); }
.rg .rg-title { margin: 0; font: 400 clamp(26px, 3.4vw, 36px)/1.15 var(--rg-serif); letter-spacing: -.01em; color: var(--rg-ink); }
.rg .rg-text { margin: 0; max-width: 46ch; font: 400 16px/1.6 var(--rg-sans); color: var(--rg-muted); }

/* ---------- Karussell ---------- */
.rg .rg-carousel { position: relative; }
.rg .rg-track {
  display: flex; gap: 8px; margin: 0; padding: 0; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; border-radius: 8px;
}
.rg .rg-track::-webkit-scrollbar { display: none; }
/* Eine Karussell-Seite = Block A (7 Kacheln, 12 Spalten, 3 Zeilen) */
.rg .rg-page {
  flex: none; width: 100%; scroll-snap-align: start;
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: clamp(92px, 12vw, 172px); gap: 8px;
}
.rg .rg-tile {
  position: relative; display: block; min-width: 0; min-height: 0; margin: 0; padding: 0; border: 0;
  overflow: hidden; isolation: isolate; cursor: zoom-in; text-align: left;
  border-radius: 8px; background: var(--rg-tint); color: #fff;
  -webkit-tap-highlight-color: transparent;
}
.rg .rg-page .rg-tile:nth-child(1) { grid-column: 1 / 7;  grid-row: 1 / 3; }
.rg .rg-page .rg-tile:nth-child(2) { grid-column: 7 / 10; grid-row: 1; }
.rg .rg-page .rg-tile:nth-child(3) { grid-column: 10 / 13; grid-row: 1; }
.rg .rg-page .rg-tile:nth-child(4) { grid-column: 7 / 13; grid-row: 2; }
.rg .rg-page .rg-tile:nth-child(5) { grid-column: 1 / 5;  grid-row: 3; }
.rg .rg-page .rg-tile:nth-child(6) { grid-column: 5 / 9;  grid-row: 3; }
.rg .rg-page .rg-tile:nth-child(7) { grid-column: 9 / 13; grid-row: 3; }
/* letzte Seite mit weniger Fotos: untere Reihe füllt die Breite */
.rg .rg-page[data-n="6"] .rg-tile:nth-child(5) { grid-column: 1 / 7; }
.rg .rg-page[data-n="6"] .rg-tile:nth-child(6) { grid-column: 7 / 13; }
.rg .rg-page[data-n="5"] .rg-tile:nth-child(5) { grid-column: 1 / 13; }

.rg .rg-img {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  object-fit: cover; max-width: none;
  transition: transform .8s cubic-bezier(.2, .6, .2, 1);
}
.rg .rg-cap {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  padding: 44px 16px 14px;
  font: 600 14px/1.3 var(--rg-sans); letter-spacing: .01em; color: #fff;
  background: linear-gradient(to top, rgba(8, 28, 40, .72), rgba(8, 28, 40, 0));
  opacity: 0; transform: translateY(6px);
  transition: opacity .35s ease, transform .35s ease;
  pointer-events: none;
}
.rg .rg-tile:hover .rg-img, .rg .rg-tile:focus-visible .rg-img { transform: scale(1.045); }
.rg .rg-tile:hover .rg-cap, .rg .rg-tile:focus-visible .rg-cap { opacity: 1; transform: none; }
.rg .rg-tile:focus-visible { outline: 3px solid var(--rg-brand); outline-offset: -3px; }

.rg .rg-arrow {
  position: absolute; top: 50%; z-index: 2; width: 48px; height: 48px; margin: -24px 0 0; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, .94); color: var(--rg-ink);
  box-shadow: 0 6px 18px rgba(15, 42, 58, .22); cursor: pointer;
  transition: opacity .2s ease, background-color .2s ease, transform .2s ease;
}
.rg .rg-arrow:hover { background: #fff; transform: scale(1.06); }
.rg .rg-arrow:focus-visible { outline: 3px solid var(--rg-brand); outline-offset: 2px; }
.rg .rg-arrow[disabled] { opacity: 0; pointer-events: none; }
.rg .rg-arrow svg { width: 22px; height: 22px; }
.rg .rg-prev { left: 14px; }
.rg .rg-next { right: 14px; }

/* ---------- Fußzeile: Fortschritt + Button ---------- */
.rg .rg-foot { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 24px; }
.rg .rg-progress { position: relative; flex: 1; max-width: 280px; height: 3px; border-radius: 3px; background: var(--rg-tint); overflow: hidden; }
.rg .rg-bar { position: absolute; top: 0; bottom: 0; left: 0; width: 20%; border-radius: 3px; background: var(--rg-brand); transition: left .15s linear, width .15s linear; }
.rg .rg-all {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; margin: 0; padding: 0 26px;
  border: 0; border-radius: 8px; background: var(--rg-brand); color: var(--rg-on-brand);
  font: 600 15px/1 var(--rg-sans); letter-spacing: .01em; cursor: pointer;
  transition: background-color .2s ease;
}
.rg .rg-all:hover { background: var(--rg-brand-deep); color: var(--rg-on-brand); }
.rg .rg-all:focus-visible { outline: 3px solid var(--rg-brand); outline-offset: 3px; }
.rg .rg-all svg { width: 18px; height: 18px; flex: none; }

/* ---------- Mobil ---------- */
@media (max-width: 640px) {
  .rg .rg-head { display: block; margin-bottom: 20px; }
  .rg .rg-text { margin-top: 12px; font-size: 15px; }
  .rg .rg-page { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 26vw; }
  .rg .rg-page[data-n] .rg-tile:nth-child(n) { grid-column: auto; grid-row: auto; }
  .rg .rg-page[data-n] .rg-tile:nth-child(1) { grid-column: 1 / -1; grid-row: span 2; }
  .rg .rg-page[data-n] .rg-tile:nth-child(4) { grid-row: span 2; }
  .rg .rg-page[data-n] .rg-tile:nth-child(7) { grid-column: 1 / -1; grid-row: span 2; }
  .rg .rg-arrow { width: 40px; height: 40px; margin-top: -20px; }
  .rg .rg-prev { left: 10px; }
  .rg .rg-next { right: 10px; }
  .rg .rg-cap { padding: 32px 12px 10px; font-size: 13px; }
  .rg .rg-foot { flex-direction: column; align-items: stretch; gap: 16px; margin-top: 18px; }
  .rg .rg-progress { flex: none; max-width: none; }
  .rg .rg-all { width: 100%; justify-content: center; }
}

/* ---------- Overlay „Alle Fotos“ (halbtransparent) ---------- */
.rg-ov {
  position: fixed; inset: 0; z-index: 2000; display: flex; flex-direction: column;
  background: var(--lb-backdrop); color: var(--lb-text);
  opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility 0s linear .25s;
}
.rg-ov.is-open { opacity: 1; visibility: visible; transition-delay: 0s; }
.rg-ov--inline { position: absolute; }
.rg-ov .rg-ov-head { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; }
.rg-ov .rg-ov-title { font: 600 18px/1.3 var(--rg-sans); color: #fff; }
.rg-ov .rg-ov-close {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: 0; padding: 0;
  border: 0; border-radius: 50%; background: var(--lb-btn); color: var(--lb-text); cursor: pointer; transition: background-color .2s ease;
}
.rg-ov .rg-ov-close:hover { background: var(--lb-btn-hover); }
.rg-ov .rg-ov-close:focus-visible, .rg-ov .rg-ov-item:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.rg-ov .rg-ov-close svg { width: 22px; height: 22px; }
.rg-ov .rg-ov-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 24px 32px; }
.rg-ov .rg-ov-grid { column-count: 4; column-gap: 8px; }
.rg-ov .rg-ov-item {
  display: block; width: 100%; margin: 0 0 8px; padding: 0; border: 0; border-radius: 8px; overflow: hidden;
  break-inside: avoid; cursor: zoom-in; background: rgba(255, 255, 255, .08);
}
.rg-ov .rg-ov-item img { display: block; width: 100%; height: auto; max-width: none; transition: transform .6s cubic-bezier(.2, .6, .2, 1); }
.rg-ov .rg-ov-item:hover img { transform: scale(1.04); }
@media (max-width: 900px) { .rg-ov .rg-ov-grid { column-count: 3; } }
@media (max-width: 560px) {
  .rg-ov .rg-ov-grid { column-count: 2; }
  .rg-ov .rg-ov-head { padding: 12px 16px; }
  .rg-ov .rg-ov-body { padding: 0 16px 24px; }
}

/* ---------- Lightbox ---------- */
.rg-lb {
  position: fixed; inset: 0; z-index: 2100;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--lb-backdrop); color: var(--lb-text);
  opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility 0s linear .25s;
}
.rg-lb.is-open { opacity: 1; visibility: visible; transition-delay: 0s; }
.rg-lb--inline { position: absolute; }
.rg-lb .rg-lb-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; }
.rg-lb .rg-lb-count { color: var(--lb-text); font-family: var(--rg-sans); font-size: 15px; line-height: 1.4; background: var(--lb-btn); padding: 6px 14px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.rg-lb .rg-lb-btn {
  display: inline-flex; align-items: center; justify-content: center; margin: 0; padding: 0;
  border: 0; border-radius: 50%; background: var(--lb-btn); color: var(--lb-text); cursor: pointer;
  transition: background-color .2s ease;
}
.rg-lb .rg-lb-btn:hover { background: var(--lb-btn-hover); }
.rg-lb .rg-lb-btn:focus-visible, .rg-lb .rg-lb-cta:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.rg-lb .rg-lb-btn svg { width: 22px; height: 22px; }
.rg-lb .rg-lb-close { width: 44px; height: 44px; }
.rg-lb .rg-lb-main { position: relative; min-height: 0; padding: 0 84px; touch-action: pan-y; }
.rg-lb .rg-lb-img { display: block; width: 100%; height: 100%; max-width: none; object-fit: contain; animation: rg-lb-in .35s ease; }
@keyframes rg-lb-in { from { opacity: 0; } to { opacity: 1; } }
.rg-lb .rg-lb-nav { position: absolute; top: 50%; width: 52px; height: 52px; margin-top: -26px; }
.rg-lb .rg-lb-prev { left: 16px; }
.rg-lb .rg-lb-next { right: 16px; }
.rg-lb .rg-lb-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px 24px;
  padding: 16px 24px 20px; background: var(--lb-btn);
}
.rg-lb .rg-lb-name { display: block; font: 600 18px/1.3 var(--rg-sans); color: #fff; }
.rg-lb .rg-lb-sub { display: block; margin-top: 2px; font: 400 14px/1.4 var(--rg-sans); color: rgba(255, 255, 255, .74); }
.rg-lb a.rg-lb-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: none;
  min-height: 48px; padding: 0 26px; margin: 0; text-decoration: none; white-space: nowrap;
}
/* Farben/Form kommen von Bootstrap (.btn .btn-primary) */
.rg-lb a.rg-lb-cta:hover, .rg-lb a.rg-lb-cta:focus { text-decoration: none; }
.rg-lb a.rg-lb-cta svg { width: 18px; height: 18px; }

@media (max-width: 640px) {
  .rg-lb .rg-lb-top { padding: 10px 14px; }
  .rg-lb .rg-lb-main { padding: 0 8px; }
  .rg-lb .rg-lb-nav { width: 40px; height: 40px; margin-top: -20px; background: var(--lb-btn); }
  .rg-lb .rg-lb-prev { left: 14px; }
  .rg-lb .rg-lb-next { right: 14px; }
  .rg-lb .rg-lb-bar { flex-direction: column; align-items: stretch; padding: 14px 16px 18px; gap: 12px; }
  .rg-lb .rg-lb-name { font-size: 17px; }
  .rg-lb a.rg-lb-cta { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .rg .rg-img, .rg .rg-cap, .rg-lb, .rg-ov, .rg-lb .rg-lb-img { transition: none; animation: none; }
  .rg .rg-track { scroll-behavior: auto; }
}

/* ---------- Anpassungen fuer das Portal (Bootstrap 3, echte Links) ---------- */
.rg a.rg-tile, .rg a.rg-tile:hover, .rg a.rg-tile:focus { text-decoration: none; color: #fff; }
.rg .rg-tile picture { position: absolute; inset: 0; display: block; }
.rg .rg-head .rg-text p:last-child { margin-bottom: 0; }
.rg .rg-arrow svg, .rg .rg-all svg { pointer-events: none; }
.rg-ov .rg-ov-item picture, .rg-lb .rg-lb-pic { display: block; }
.rg-lb .rg-lb-pic { width: 100%; height: 100%; }
.rg-ov .rg-ov-item { background: rgba(255,255,255,.08); }

/* ---------- Admin-Leiste und Admin-Buttons ---------- */
.rg-admin { margin: 16px 0; padding: 12px 16px; border: 2px dashed #e8a33d; border-radius: 8px; background: #fff8ec; color: #2a1a00; font: 400 14px/1.5 'Plus Jakarta Sans', sans-serif; }
.rg-admin .rg-admin-btn { margin: 0 0 0 8px; padding: 4px 12px; border: 1px solid #2a1a00; border-radius: 6px; background: #fff; color: #2a1a00; cursor: pointer; font: 600 13px/1.4 'Plus Jakarta Sans', sans-serif; }
.rg-admin .rg-admin-btn:hover { background: #2a1a00; color: #fff; }
.rg-admin .rg-admin-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 16px; margin-top: 10px; }
.rg-admin .rg-admin-form label { display: flex; flex-direction: column; font-weight: 600; font-size: 12px; }
.rg-admin .rg-admin-form input, .rg-admin .rg-admin-form textarea, .rg-admin .rg-admin-form select { min-width: 200px; padding: 4px 8px; font: 400 14px/1.4 'Plus Jakarta Sans', sans-serif; }
.rg-admin .rg-admin-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-top: 12px; }
.rg-admin .rg-admin-list[hidden] { display: none; }
.rg-admin .rg-ex { padding: 6px; border: 1px solid #e0c590; border-radius: 6px; background: #fff; font-size: 12px; line-height: 1.35; }
.rg-admin .rg-ex img { display: block; width: 100%; height: 100px; object-fit: cover; margin-bottom: 4px; border-radius: 4px; }
.rg-admin .rg-ex button { margin: 4px 0 0; width: 100%; }
.rg-lb .rg-lb-admin { display: flex; flex-wrap: wrap; gap: 8px; }
.rg-lb .rg-lb-admin button { min-height: 40px; padding: 0 14px; border: 1px solid rgba(255,255,255,.5); border-radius: 8px; background: transparent; color: #fff; cursor: pointer; font: 600 13px/1 'Plus Jakarta Sans', sans-serif; }
.rg-lb .rg-lb-admin button:hover { background: rgba(255,255,255,.18); }
@media (max-width: 640px) { .rg-lb .rg-lb-admin { flex-direction: column; } }
