/* ═══ KARTE VIEWER — Tiki Reef Club ═══ */
/* Eingebettet in die Gastro-Section von baltic-wave.de */

.karte-viewer {
  --kv-page-radius: 8px;
  --kv-shadow: 0 24px 60px -20px rgba(28, 46, 62, 0.35), 0 8px 20px -8px rgba(28, 46, 62, 0.18);
  --kv-shadow-hover: 0 32px 70px -20px rgba(28, 46, 62, 0.45), 0 10px 24px -8px rgba(28, 46, 62, 0.22);
  --kv-coral: #C45A5A;
  --kv-orange: #E88A3A;
  --kv-rose: #D4707A;
  --kv-text: #2D3E50;
  --kv-text-light: #7A8A99;

  position: relative;
  max-width: 1080px;
  margin: 48px auto 0;
  padding: 0 16px;
  font-family: 'DM Sans', -apple-system, sans-serif;
  z-index: 2;
}

/* ── Stage: holds the page(s) ── */
.kv-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 2400px;
  min-height: 60vw;
  max-height: min(78vh, 920px);
}

.kv-spread {
  position: relative;
  display: flex;
  gap: 0;
  align-items: stretch;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  transition: transform 0.4s cubic-bezier(.2,.7,.25,1);
}

.kv-page {
  position: relative;
  flex: 0 1 auto;
  width: min(46%, 380px);
  aspect-ratio: 0.7038;
  background: #fff;
  border-radius: var(--kv-page-radius);
  box-shadow: var(--kv-shadow);
  overflow: hidden;
  cursor: zoom-in;
  transition: transform 0.4s cubic-bezier(.2,.7,.25,1), box-shadow 0.3s ease, opacity 0.4s ease;
  transform-origin: center center;
}

.kv-page img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.kv-page:hover {
  box-shadow: var(--kv-shadow-hover);
}

/* When showing a single page (cover, last page on odd count, or mobile) */
.kv-page--solo {
  width: min(58%, 460px);
}

/* Desktop spread mode: two pages side-by-side with center fold */
.kv-spread--double .kv-page--left {
  border-top-right-radius: 1px;
  border-bottom-right-radius: 1px;
  box-shadow: -16px 24px 50px -20px rgba(28, 46, 62, 0.35), -4px 8px 16px -8px rgba(28, 46, 62, 0.18), inset -8px 0 14px -8px rgba(0,0,0,0.18);
}
.kv-spread--double .kv-page--right {
  border-top-left-radius: 1px;
  border-bottom-left-radius: 1px;
  box-shadow: 16px 24px 50px -20px rgba(28, 46, 62, 0.35), 4px 8px 16px -8px rgba(28, 46, 62, 0.18), inset 8px 0 14px -8px rgba(0,0,0,0.18);
}

/* Subtle paper texture - slight inner highlight */
.kv-page::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, rgba(0,0,0,0) 40%, rgba(0,0,0,0) 60%, rgba(0,0,0,0.04) 100%);
  z-index: 1;
  border-radius: inherit;
}

/* Slide-in animation states */
.kv-spread.kv-anim-out-left { transform: translateX(-3%); opacity: 0.4; }
.kv-spread.kv-anim-out-right { transform: translateX(3%); opacity: 0.4; }
.kv-spread.kv-anim-in { transition: none; }

/* ── Arrows ── */
.kv-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(28, 46, 62, 0.08);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: all 0.25s ease;
  box-shadow: 0 6px 20px rgba(28, 46, 62, 0.15);
  color: var(--kv-coral);
}

.kv-arrow:hover {
  background: var(--kv-coral);
  color: #fff;
  transform: translateY(-50%) scale(1.06);
  box-shadow: 0 10px 24px rgba(196, 90, 90, 0.35);
}
.kv-arrow:active { transform: translateY(-50%) scale(0.96); }

.kv-arrow:disabled {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) scale(0.85);
}

.kv-arrow--prev { left: -8px; }
.kv-arrow--next { right: -8px; }

.kv-arrow svg { width: 20px; height: 20px; }

/* ── Controls bar (under viewer) ── */
.kv-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding: 0 8px;
  flex-wrap: wrap;
}

.kv-controls-left,
.kv-controls-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 auto;
  min-width: 0;
}
.kv-controls-right { justify-content: flex-end; }
.kv-controls-center {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  flex: 0 1 auto;
}

.kv-counter {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--kv-text-light);
  white-space: nowrap;
}

.kv-counter strong {
  color: var(--kv-coral);
  font-weight: 700;
}

/* Page dots — show position at a glance */
.kv-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  background: rgba(28, 46, 62, 0.18);
  padding: 0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.kv-dot:hover { background: var(--kv-rose); transform: scale(1.3); }
.kv-dot.is-active {
  background: var(--kv-coral);
  transform: scale(1.3);
}
/* Cover dot a touch larger */
.kv-dot:first-child { width: 10px; height: 10px; }

.kv-pdf-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--kv-coral);
  background: rgba(196, 90, 90, 0.08);
  border: 1px solid rgba(196, 90, 90, 0.22);
  text-decoration: none;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.kv-pdf-link:hover {
  background: var(--kv-coral);
  color: #fff;
  border-color: var(--kv-coral);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(196, 90, 90, 0.32);
}

.kv-pdf-link svg { width: 14px; height: 14px; }

/* Hint copy */
.kv-hint {
  margin-top: 18px;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--kv-text-light);
  font-weight: 500;
}

.kv-hint kbd {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(28, 46, 62, 0.12);
  background: #fff;
  font-size: 0.7rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--kv-text);
  margin: 0 2px;
}

/* ═══ MOBILE ═══ */
@media (max-width: 720px) {
  .karte-viewer { padding: 0 4px; margin-top: 32px; }
  .kv-stage { min-height: 105vw; }
  .kv-page { width: min(82%, 380px); }
  .kv-page--solo { width: min(82%, 380px); }
  .kv-arrow { width: 44px; height: 44px; }
  .kv-arrow--prev { left: 0; }
  .kv-arrow--next { right: 0; }
  .kv-controls { flex-direction: column; gap: 14px; }
  .kv-controls-left, .kv-controls-right {
    justify-content: center; width: 100%;
  }
  .kv-controls-center { order: -1; }
}

/* ═══ LIGHTBOX ═══ */
.kv-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(28, 46, 62, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.25s ease;
  padding: 24px;
  backdrop-filter: blur(6px);
}

.kv-lightbox.is-open {
  display: flex;
  opacity: 1;
}

.kv-lightbox__viewport {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

.kv-lightbox__img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center center;
  transition: transform 0.25s ease;
  cursor: zoom-in;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5);
  border-radius: 4px;
}

.kv-lightbox__img.is-zoomed {
  cursor: grab;
  transition: none;
}
.kv-lightbox__img.is-panning {
  cursor: grabbing;
}

.kv-lightbox__close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.2s ease;
}
.kv-lightbox__close:hover {
  background: var(--kv-coral);
  border-color: var(--kv-coral);
  transform: rotate(90deg);
}
.kv-lightbox__close svg { width: 18px; height: 18px; }

.kv-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.2s ease;
}
.kv-lightbox__nav:hover { background: var(--kv-coral); border-color: var(--kv-coral); }
.kv-lightbox__nav:disabled { opacity: 0.25; pointer-events: none; }
.kv-lightbox__nav--prev { left: 18px; }
.kv-lightbox__nav--next { right: 18px; }
.kv-lightbox__nav svg { width: 20px; height: 20px; }

.kv-lightbox__caption {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
  z-index: 10;
  background: rgba(0,0,0,0.35);
  padding: 8px 18px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Hide page-overflow during transitions */
.kv-stage { overflow: visible; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .kv-spread, .kv-page, .kv-arrow, .kv-lightbox, .kv-lightbox__img {
    transition: none !important;
  }
}

/* Tiki-Akzent (rechter Rand der Gastro-Section) */
.gastro-tiki-accent {
  position: absolute;
  right: -40px;
  bottom: -20px;
  width: clamp(180px, 22vw, 320px);
  pointer-events: none;
  opacity: 0.85;
  z-index: 1;
}
@media (max-width: 880px) {
  .gastro-tiki-accent { display: none; }
}

/* Deko-Hibiskus in der Gastro-Section: Img absolut positioniert, halbtransparent */
.hibiscus-deco {
  position: absolute;
  height: auto;
  opacity: 0.55;
  pointer-events: none;
  z-index: 1;
}

/* Override: Stage soll sich an Inhalt anpassen statt fixe min-height (sonst riesiger Whitespace beim Single-Page-Cover) */
.karte-viewer .kv-stage { min-height: 0; }

/* Controls vertikal stapeln: Dots → Seitenzahl → PDF-Download */
.karte-viewer .kv-controls {
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 64px;
}
.karte-viewer .kv-controls-center { order: 1; }
.karte-viewer .kv-controls-left   { order: 2; justify-content: center; }
.karte-viewer .kv-controls-right  { order: 3; justify-content: center; }
