/* ── All slides ─────────────────────────────────────────────────────── */

.slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: translateX(100%);         /* off-screen right — default hidden state */
  transition: transform var(--transition-slide);
  will-change: transform;
  overflow: hidden;
  background: var(--neutral-900);
}

.slide.active {
  transform: translateX(0);            /* visible — JS also uses inline transforms during transitions */
}

/* ── Slide 1: Startseite ─────────────────────────────────────────────── */

.slide-start {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  background: var(--neutral-900);
}

.slide-start__content {
  text-align: center;
  z-index: 2;
}

.slide-start__title {
  font-size: clamp(48px, 6vw, 80px);
  font-weight: var(--font-weight-bold);
  color: white;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.slide-start__subtitle {
  font-size: clamp(16px, 1.8vw, 24px);
  font-weight: var(--font-weight-regular);
  color: var(--neutral-400);
}

.slide-start__logo {
  position: absolute;
  bottom: 32px;
  left: 32px;
  z-index: 2;
}

.slide-start__logo img {
  height: 48px;
  display: block;
}

.slide-start__hint {
  position: absolute;
  bottom: 40px;
  right: 40px;
  z-index: 2;
  color: var(--neutral-600);
  font-size: 13px;
}

/* ── Slide 1: Video background ───────────────────────────────────────── */

.slide-start__video-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* YouTube API replaces the #yt-bg-player div with an iframe of the same ID.
   We only style the iframe here. The #yt-bg-player rule is intentionally omitted
   — an ID rule would win over this class rule and break top/left centering.
   Cover technique: iframe is always larger than the screen so no black bars
   appear on non-16:9 displays. 56.25vw = 9/16 of viewport width;
   177.78vh = 16/9 of viewport height — whichever is larger wins. */
.slide-start__video-bg iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100vw;
  height: 56.25vw;
  min-width: 177.78vh;
  min-height: 100vh;
  border: none;
  pointer-events: none;
}

.slide-start__video-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(26, 20, 16, 0.80);
  pointer-events: none;
}

/* Typewriter cursor — blinking pipe appended to the title */
.slide-start__title::after {
  content: '|';
  font-weight: 300;
  animation: blink-cursor 0.8s step-end infinite;
}

@keyframes blink-cursor {
  50% { opacity: 0; }
}

/* ── Leaflet marker overrides ────────────────────────────────────────── */

/* Remove Leaflet's default white box shadow from div icons */
.mission-pin-icon,
.mission-point-icon {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
}

.mission-pin-icon img {
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.45));
}

.mission-point-icon svg {
  display: block;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
}

/* ── Fly-in animation — opacity + scale on the inner wrapper ────────── */
/* Outer .mission-*-icon keeps Leaflet's positioning transform untouched. */

.pin-inner,
.point-inner {
  transform-origin: center center;
  /* Transition is always declared; anim-hidden suppresses it with transition:none
     so the initial hidden state is set instantly. Removing anim-hidden restores
     the transition and immediately triggers the 0→1 animation. */
  transition: opacity 400ms ease, transform var(--transition-pin);
}

.pin-inner.anim-hidden,
.point-inner.anim-hidden {
  opacity: 0;
  transform: scale(0);
  transition: none; /* no animation while positioning */
}

/* End state — only needed as an explicit override if desired; removing
   anim-hidden already returns to the transition + opacity:1 / scale:1 defaults. */

/* ── Stats panel ─────────────────────────────────────────────────────── */

/* ── Stats hint bar — always visible at the bottom of the map on slide 2 ── */

.stats-hint-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 48px;
  padding: 20px 24px 18px;
  background: linear-gradient(to top, rgba(17, 17, 17, 0.75) 0%, transparent 100%);
  pointer-events: none;
}

.stats-hint-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: white;
  opacity: 0.65;
}

.stats-hint-icon svg {
  width: 30px;
  height: 30px;
  stroke: white;
}

.stats-hint-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
}

/* ── Stats panel — full overlay over .slide-main ── */

.stats-panel {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: var(--neutral-900);
  display: flex;
  flex-direction: column;
  padding: 28px 28px 24px;
  gap: 0;
  transform: translateY(100%);
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.stats-panel.visible {
  transform: translateY(0);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 20px;
  flex: 1;
  min-height: 0;
}

.stats-card {
  background: var(--neutral-800);
  border-radius: 10px;
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  min-height: 0;
}

.stats-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.stats-card-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--neutral-400);
  flex-shrink: 0;
}

.stats-card-content {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stats-card-content canvas {
  position: absolute;
  inset: 0;
}

/* Folie 2: Donut über die gesamte obere Hälfte, darunter die zwei Regionaldiagramme */
.stats-card--wide {
  grid-column: 1 / -1;
}

/* Im breiten Kopfbereich Donut und Legende als Paar zentrieren, damit die Legende
   nicht über die ganze Bildschirmbreite auseinanderläuft. */
.stats-card--wide .stats-card-content--donut {
  justify-content: center;
}

/* Nur ein Sicherheitsnetz: wo die Breite korrekt aus aspect-ratio folgt, ist
   min-width wirkungslos (267px > 220px). Fällt die Breite dagegen auf 0 zusammen
   (Safari), bleibt der Donut dank dieses Mindestmaßes sichtbar. Eine feste width
   würde aspect-ratio überstimmen und den Kasten unnötig rechteckig machen. */
.stats-card--wide .stats-donut-canvas-wrap {
  min-width: 220px;
}

.stats-card--wide .stats-donut-legend {
  flex: 0 1 340px;
}

.stats-card--wide .stats-donut-legend-label {
  font-size: 13px;
}

.stats-card--wide .stats-donut-legend-value {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

/* Donut card: square canvas on the left, HTML legend on the right */
.stats-card-content--donut {
  align-items: stretch;
  justify-content: flex-start;
  gap: 16px;
}

.stats-donut-canvas-wrap {
  position: relative;
  /* Definite Höhe, damit die Breite aus aspect-ratio ableitbar ist: Safari nimmt
     sonst die Content-Breite (das Canvas ist absolut positioniert, also 0) und
     lässt das Element auf Breite 0 zusammenfallen — der Donut fehlt dann ganz. */
  height: 100%;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
}

.stats-donut-legend {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.stats-donut-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.stats-donut-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.stats-donut-legend-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.9);
}

.stats-donut-legend-value {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
  white-space: nowrap;
}

/* ── Sidebar legend ──────────────────────────────────────────────────── */

.legend-toggle {
  display: flex;
  border-bottom: 1px solid var(--neutral-700);
  flex-shrink: 0;
}

.legend-toggle-btn {
  flex: 1;
  padding: 10px 8px;
  border: none;
  background: transparent;
  color: var(--neutral-400);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.legend-toggle-btn:hover {
  background: var(--neutral-700);
  color: var(--neutral-100);
}

.legend-toggle-btn.active {
  background: var(--neutral-700);
  color: white;
}

.legend-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 0;
  transition: background var(--transition-fast);
  user-select: none;
}

.legend-item:hover {
  background: var(--neutral-700);
}

.legend-item.active {
  background: var(--neutral-700);
}

.legend-item.active .legend-label {
  color: white;
}

.legend-icon {
  flex-shrink: 0;
  display: block;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--neutral-400);
  flex-shrink: 0;
}

.legend-label {
  flex: 1;
  font-size: 13px;
  color: var(--neutral-300);
  line-height: 1.3;
}

.legend-count {
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  color: var(--neutral-500);
  min-width: 20px;
  text-align: right;
}

.legend-flower {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--neutral-700);
  flex-shrink: 0;
  margin-top: auto;
}

.legend-flower-label {
  font-size: 11px;
  color: var(--neutral-500);
  text-align: center;
}

/* ── Tile modal ──────────────────────────────────────────────────────── */

.tile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(43, 36, 34, 0.72);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.tile-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.tile-card {
  width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--paper);
  border-radius: 8px;
  color: var(--neutral-900);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
  position: relative;
}

.tile-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(43, 36, 34, 0.55);
  color: white;
  font-size: 20px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.tile-close:hover {
  background: rgba(43, 36, 34, 0.85);
}

.tile-thumbnail {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: var(--neutral-200);
}

.tile-thumbnail--placeholder {
  background: var(--neutral-200);
}

.tile-body {
  padding: 18px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tile-mission-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.tile-mission-icon {
  flex-shrink: 0;
}

.tile-mission-label {
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  color: var(--neutral-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tile-name {
  font-size: 20px;
  font-weight: var(--font-weight-bold);
  color: var(--neutral-900);
  line-height: 1.2;
}

.tile-org {
  font-size: 13px;
  color: var(--neutral-600);
}

.tile-location {
  font-size: 13px;
  color: var(--neutral-600);
}

.tile-description {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tile-description p {
  font-size: 14px;
  line-height: 1.55;
  color: var(--neutral-800);
}

.tile-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.tile-kw {
  font-size: 11px;
  padding: 3px 8px;
  background: var(--neutral-100);
  color: var(--neutral-600);
  border-radius: 12px;
}

.tile-funding {
  font-size: 14px;
  font-weight: var(--font-weight-semibold);
  color: var(--neutral-700);
  margin-top: 4px;
}

.tile-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  color: var(--terracotta);
  text-decoration: none;
  align-self: flex-end;
}

.tile-link:hover {
  text-decoration: underline;
}

/* ── Tile video (Phase 3) ────────────────────────────────────────────── */

.tile-thumbnail-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--neutral-200);
  overflow: hidden;
}

/* The YouTube IFrame API replaces this element in place — the iframe it inserts
   keeps the id and class directly (it is not nested inside the original div). */
.tile-yt-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  border: none;
}

.tile-play-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  border: none;
  padding: 0;
  margin: 0;
  background: none;
  cursor: pointer;
}

.tile-play-overlay img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tile-play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  color: white;
  text-shadow: 0 2px 10px rgba(0,0,0,0.6);
  transition: transform var(--transition-fast);
}

.tile-play-overlay:hover .tile-play-icon {
  transform: scale(1.1);
}

/* ── Mission sidebar (Folien 3–7) ────────────────────────────────────── */

.mission-sidebar-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 16px 18px;
  border-bottom: 1px solid var(--neutral-700);
  flex-shrink: 0;
}

.mission-sidebar-icon {
  display: block;
}

.mission-sidebar-title {
  font-size: 16px;
  font-weight: var(--font-weight-semibold);
  color: white;
  text-align: center;
  line-height: 1.3;
}

.mission-sidebar-intro {
  font-size: 13px;
  line-height: 1.5;
  color: var(--neutral-200);
  padding: 14px 16px;
  border-bottom: 1px solid var(--neutral-700);
  flex-shrink: 0;
}

.mission-pin-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mission-pin-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.mission-pin-item:hover {
  background: var(--neutral-700);
}

.mission-pin-preview {
  position: relative;
  width: 56px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  background: var(--neutral-700);
}

.mission-pin-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mission-pin-preview--empty img {
  display: none;
}

.mission-pin-preview-playicon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: white;
  background: rgba(0,0,0,0.3);
}

.mission-pin-name {
  font-size: 13px;
  color: var(--neutral-200);
  line-height: 1.3;
}
