@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap');

/* =========================================================
   GEMEINSAMES DESIGN SYSTEM
   ========================================================= */

:root {
  /* SCHRIFTEN */
  --font-primary: 'Inter', Arial, sans-serif;
  --font-mono: 'Space Mono', monospace;

  /* FARBEN */
  --color-cream: #FAF4E3;
  --color-sage: #9DAF99;
  --color-sage-light: #D8DFD6;
  --color-dark: #344238;
  --color-text-secondary: #586158;
  --color-accent: #C45C60;
  --color-accent-hover: #A9474B;

  /* HINTERGRÜNDE */
  --color-bg-base: var(--color-cream);
  --color-bg-panel: rgba(250, 244, 227, 0.96);
  --color-bg-toolbar: rgba(250, 244, 227, 0.96);
  --color-bg-toolbar-light: rgba(250, 244, 227, 0.85);
  --color-bg-hover: var(--color-sage-light);
  --color-bg-sources: var(--color-sage-light);

  /* TEXT */
  --color-text-main: var(--color-dark);
  --color-text-muted: var(--color-text-secondary);
  --color-text-dark: var(--color-dark);
  --color-meta: var(--color-accent);

  /* KARTE */
  --color-point: var(--color-sage);
  --color-point-active: var(--color-accent);

  /* RAHMEN */
  --border-light: rgba(52, 66, 56, 0.20);
  --border-strong: var(--color-sage);

  /* SCHRIFTGRÖSSEN */
  --font-size-title: 36px;
  --font-size-intro: 19px;
  --font-size-body: 17px;
  --font-size-small: 14px;
  --font-size-meta: 13px;
  --font-size-caption: 11px;

  /* STATUS-FARBEN */
  --color-badge-high: #3b6b49;
  --color-badge-high-bg: rgba(157, 175, 153, 0.35);
  --color-badge-med: #8a6a5d;
  --color-badge-med-bg: var(--color-sage-light);
  --color-badge-low: #a84b4b;
  --color-badge-low-bg: rgba(196, 92, 96, 0.18);

  /* SCHATTEN */
  --shadow-panel: 0 12px 30px rgba(0, 0, 0, 0.08);
  --shadow-title: 0 6px 20px rgba(0, 0, 0, 0.05);
}


/* =========================================================
   ALLGEMEINE STRUKTUR
   ========================================================= */

body {
  margin: 0;
  font-family: var(--font-primary);
  background: var(--color-bg-base);
  color: var(--color-text-main);
  overflow: hidden;
}

#app,
#map {
  position: relative;
  height: 100vh;
  width: 100%;
}


/* =========================================================
   UI-LAYER: TITEL & TOOLBAR
   ========================================================= */

#map-title {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);

  padding: 12px 24px;
  background: var(--color-bg-toolbar-light);
  backdrop-filter: blur(8px);
  color: var(--color-text-main);
  box-shadow: var(--shadow-title);

  font-family: var(--font-primary);
  font-size: 18px;
  font-weight: 700;

  border-radius: 14px;
  z-index: 1000;
  transition: background 0.2s ease;
}

#map-title:hover {
  background: var(--color-bg-hover);
}

#map-toolbar {
  position: absolute;
  top: 20px;
  left: 8px;

  display: flex;
  flex-direction: column;

  background: var(--color-bg-toolbar);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  z-index: 1000;
  transition: left 220ms ease;
}

#map-toolbar.detail {
  left: 300px;
}

.toolbar-button {
  width: 60px;
  height: 60px;
  border: none;

  background: transparent;
  color: var(--color-text-main);

  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  transition: all 0.2s ease;
}

.toolbar-button svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

.toolbar-button:hover,
.toolbar-button.active {
  color: var(--color-cream);
  background: var(--color-accent);
}


/* =========================================================
   SIDE PANEL
   ========================================================= */

#map-panel {
  position: absolute;
  top: 20px;
  left: 8px;

  width: 280px;
  height: calc(100vh - 40px);

  display: flex;
  flex-direction: column;

  background: var(--color-bg-panel);
  color: var(--color-text-main);

  border-radius: 18px;
  padding: 20px;
  box-sizing: border-box;

  box-shadow: var(--shadow-panel);
  z-index: 1000;

  opacity: 1;
  transform: translateX(0);
  transition: opacity 220ms ease, transform 220ms ease;
}

#map-panel.hidden {
  opacity: 0;
  transform: translateX(-16px);
  pointer-events: none;
}

#panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

#panel-title {
  margin: 0;

  font-family: var(--font-primary);
  font-size: var(--font-size-title);
  font-weight: 700;

  color: var(--color-text-main);
}

#panel-close {
  border: none;
  background: transparent;

  color: var(--color-text-main);

  font-size: 26px;
  line-height: 1;

  cursor: pointer;
}

.panel-view {
  min-height: 0;
  flex: 1;
}

.panel-view.hidden {
  display: none !important;
}

#panel-search-view,
#panel-filter-view {
  display: flex;
  flex-direction: column;
}

#panel-filter-view {
  overflow-y: auto;
}


/* =========================================================
   FORMULAR-ELEMENTE
   ========================================================= */

.panel-controls {
  margin-bottom: 16px;
}

#search-bar {
  width: 100%;
  box-sizing: border-box;

  padding: 12px 14px;
  margin-bottom: 12px;

  background-color: var(--color-cream);
  color: var(--color-text-main);

  border: 1px solid var(--border-light);
  border-radius: 10px;

  font-size: 16px;
  font-family: var(--font-primary);
}

#search-bar:focus {
  outline: none;

  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(196, 92, 96, 0.15);
}

.filter-section {
  display: flex;
  flex-direction: column;
  gap: 10px;

  padding: 16px 0 8px;

  border: none;
  border-top: 1px solid var(--border-light);
  
}

.filter-section:first-of-type {
  border-top: none;
  padding-top: 0;
}

.filter-section h3 {
  margin: 0 0 6px;

  font-family: var(--font-mono);
  font-size: var(--font-size-meta);
  font-weight: 700;

  letter-spacing: 0.08em;
  text-transform: uppercase;

  color: var(--color-meta);
}

.filter-option {
  display: flex;
  align-items: center;

  gap: 10px;
  padding: 8px 10px;

  border-radius: 10px;

  font-size: 15px;
  color: var(--color-text-main);

  cursor: pointer;
  transition: background 160ms ease;
}

.filter-option:hover {
  background: var(--color-bg-hover);
}

.filter-option input[type="checkbox"] {
  accent-color: var(--color-accent);

  width: 16px;
  height: 16px;

  cursor: pointer;
  flex-shrink: 0;
}

.filter-reset-button {
  width: 100%;

  padding: 10px 14px;
  margin-bottom: 14px;

  border: 1px solid var(--color-accent);
  border-radius: 10px;

  background: transparent;
  color: var(--color-accent);

  font-size: 14px;
  font-weight: 600;

  cursor: pointer;

  transition: all 160ms ease;
}

.filter-reset-button:hover {
  color: var(--color-cream);
  background: var(--color-accent);
  border-color: var(--color-accent);
}


/* =========================================================
   LISTEN
   ========================================================= */

#place-list {
  margin-top: 10px;

  flex: 1;
  min-height: 0;

  overflow-y: auto;
  overscroll-behavior: contain;

  padding-right: 4px;
}

.place-item {
  padding: 8px 0;
  border-bottom: 1px solid rgba(52, 66, 56, 0.2);
}

.place-year {
  display: block;
  margin: 0;

  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1;

  color: var(--color-accent);
}

.place-item strong {
  display: block;
  margin: 0;

  font-size: 1.05rem;
  line-height: 1;
  font-weight: 600;
}

.place-item-subtitle {
  display: block;

  font-size: 0.85rem;
  line-height: 1;
  font-weight: 400;

  color: var(--color-text-muted);
}

.place-item:hover {
  opacity: 0.8;
}

.popup-place {
  text-align: center;
}

/* =========================================================
   DETAIL-ANSICHT
   ========================================================= */

#default-button {
  position: absolute;
  top: 20px;
  left: 20px;

  display: none;

  padding: 10px 16px;

  border: none;
  border-radius: 10px;

  background: var(--color-bg-toolbar-light);
  color: var(--color-text-main);

  cursor: pointer;
  z-index: 1000;

  font-weight: 600;

  transition: background 0.2s ease;
}

#default-button:hover {
  background: var(--color-bg-hover);
}

#place-detail {
  box-sizing: border-box;

  margin: 0;
  padding: 0 24px;

  height: 0;

  overflow: hidden;

  opacity: 0;
  transform: translateY(24px);

  visibility: hidden;
  pointer-events: none;

  background: var(--color-cream);
  color: var(--color-text-main);

  transition:
    height 280ms ease,
    opacity 220ms ease,
    transform 280ms ease,
    padding 280ms ease,
    visibility 0s linear 280ms;
}

body.detail-view #place-detail {
  height: 67vh;

  padding: 24px;

  overflow-y: auto;

  opacity: 1;
  transform: translateY(0);

  visibility: visible;
  pointer-events: auto;

  transition:
    height 280ms ease,
    opacity 220ms ease,
    transform 280ms ease,
    padding 280ms ease,
    visibility 0s linear 0s;
}

body.detail-view #map-title,
body.detail-view #map-toolbar,
body.detail-view #map-panel {
  display: none;
}

body.detail-view #app,
body.detail-view #map {
  height: 33vh;
}


/* =========================================================
   DETAILANSICHT – MEDIEN
   ========================================================= */

.place-media {
  margin: 0;
  padding: 0;
}

.place-media-img {
  width: 100%;
  max-height: 350px;

  object-fit: cover;

  border-radius: 12px;
  border: 1px solid var(--border-light);

  box-shadow: 0 4px 12px rgba(0,0,0,0.05);

  cursor: zoom-in; 
  transition: transform 0.2s ease;
}

.place-media-img:hover {
  transform: scale(1.02);
}

.place-media-caption {
  margin-top: 10px;
  margin-bottom: 16px;

  font-family: var(--font-mono);
  font-size: var(--font-size-caption);
  font-weight: 400;

  color: var(--color-text-muted);

  line-height: 1.5;
  text-align: left;
}


/* =========================================================
   DETAILANSICHT – ARTIKEL
   ========================================================= */

.place-article {
  max-width: 1200px;
  margin: 0 auto;
}

.place-header {
  margin-bottom: 32px;
  padding-bottom: 20px;

  border-bottom: 1px solid var(--border-light);
}


/* Metadaten / Kategorie */

.place-eyebrow {
  margin: 0 0 8px;

  font-family: var(--font-mono);
  font-size: var(--font-size-meta);
  font-weight: 700;

  text-transform: uppercase;
  letter-spacing: 0.08em;

  color: var(--color-meta);
}


/* Ortsüberschrift */

.place-header-grid {
  display: grid;
  grid-template-columns: 2fr 1fr; 
  gap: 28px;
  align-items: start;
}

.place-title {
  margin: 0 0 12px;

  font-family: var(--font-primary);
  font-size: var(--font-size-title);
  font-weight: 700;

  line-height: 1.15;

  color: var(--color-text-main);
}

.place-subtitle {
  margin: 0 0 14px;

  font-family: var(--font-primary);
  font-size: 18px;
  font-weight: 500;

  line-height: 1.4;

  color: var(--color-text-muted);
}


/* Weitere Metadaten */

.place-meta {
  display: flex;
  flex-wrap: wrap;

  gap: 10px 18px;

  margin: 0 0 16px;

  font-family: var(--font-mono);
  font-size: var(--font-size-meta);

  color: var(--color-meta);
}

.place-meta span::before {
  content: "• ";
  opacity: 0.5;
}

.place-meta span:first-child::before {
  content: "";
}


/* Kurzbeschreibung */

.place-lead {
  margin: 0;

  font-family: var(--font-primary);
  font-size: var(--font-size-intro);
  font-weight: 500;

  line-height: 1.5;

  color: var(--color-text-main);

  text-align: justify;
  hyphens: auto;
}

.place-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;

  gap: 28px;

  align-items: start;
}

.place-section {
  margin-bottom: 28px;
}

.place-section h3,
.place-card h3 {
  margin: 0 0 12px;

  font-family: var(--font-mono);
  font-size: var(--font-size-meta);
  font-weight: 700;

  letter-spacing: 0.08em;
  text-transform: uppercase;

  color: var(--color-meta);
}


/* Haupttext */

.place-section p {
  margin: 0;

  font-family: var(--font-primary);
  font-size: var(--font-size-body);
  font-weight: 400;

  line-height: 1.65;

  color: var(--color-text-main);

  text-align: justify;
  hyphens: auto;
}


/* =========================================================
   DETAIL-CARDS / QUELLEN
   ========================================================= */

.place-card {
  background: var(--color-bg-sources);

  border: 1px solid var(--border-light);
  border-radius: 16px;

  padding: 18px;
  margin-bottom: 16px;

  backdrop-filter: blur(6px);
}

.place-facts div {
  padding: 10px 0;

  border-bottom: 1px solid var(--border-light);
}

.place-facts div:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.place-facts dt {
  margin-bottom: 4px;

  font-family: var(--font-mono);
  font-size: var(--font-size-meta);

  color: var(--color-meta);
}

.place-facts dd {
  margin: 0;

  font-size: var(--font-size-small);
  line-height: 1.5;

  color: var(--color-text-main);
}

.place-sources-list {
  margin: 0;
  padding-left: 18px;

  font-family: var(--font-primary);
  font-size: var(--font-size-small);

  color: var(--color-text-main);
}

.place-sources-list li {
  margin-bottom: 8px;
  line-height: 1.5;
}


/* =========================================================
   BADGES
   ========================================================= */

.place-badge {
  display: inline-block;

  padding: 4px 10px;

  border-radius: 999px;

  font-size: 0.8rem;
  font-weight: 600;

  background: var(--color-badge-med-bg);
  color: var(--color-badge-med);
}

.place-badge--high {
  background: var(--color-badge-high-bg);
  color: var(--color-badge-high);
}

.place-badge--medium {
  background: var(--color-badge-med-bg);
  color: var(--color-badge-med);
}

.place-badge--low {
  background: var(--color-badge-low-bg);
  color: var(--color-badge-low);
}


/* =========================================================
   LEAFLET – MARKER
   ========================================================= */

.map-marker {
  width: 16px;
  height: 16px;

  background-color: var(--color-point);

  border: 2px solid var(--color-cream);
  border-radius: 50%;

  box-sizing: border-box;

  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.4);

  cursor: pointer;
}

/* Aktiver / ausgewählter Ort */
.active-marker .map-marker {
  background-color: var(--color-point-active);
}


/* =========================================================
   LEAFLET CONTROLS
   ========================================================= */

.leaflet-control-zoom a {
  background: var(--color-bg-toolbar);

  color: var(--color-text-main);

  border: none;
}

.leaflet-control-zoom a:hover {
  background: var(--color-accent);

  color: var(--color-cream);
}


/* =========================================================
   LEAFLET POPUPS
   ========================================================= */

.place-popup .leaflet-popup-content-wrapper {
  background: var(--color-cream);

  color: var(--color-text-main);
}

.place-popup .leaflet-popup-tip {
  background: var(--color-cream);
}

.popup-place {
  display: flex;
  flex-direction: column;
}

.popup-place strong {
  font-family: var(--font-primary);
  font-size: var(--font-size-small);
  font-weight: 600;

  color: var(--color-text-main);
}

.popup-place span {
  margin-top: 4px;
}

.popup-place span:first-of-type {
  font-family: var(--font-primary);
  font-size: var(--font-size-small);
  font-weight: 400;

  line-height: 1.4;

  color: var(--color-text-muted);
}

.popup-place span:last-of-type {
  font-family: var(--font-mono);
  font-size: var(--font-size-meta);

  color: var(--color-meta);
}


/* =========================================================
   RESPONSIVE DESIGN
   ========================================================= */

@media (max-width: 900px) {
  .place-layout {
    grid-template-columns: 1fr;
  }

  .place-title {
    font-size: 1.8rem;
  }
}

@media (max-width: 700px) {

  #app,
  #map {
    height: 100dvh;
  }

  #map-title {
    top: 14px;

    max-width: 70vw;

    padding: 6px 12px;

    text-align: center;
    line-height: 1.2;

    font-size: 12px;
  }

  #map-toolbar {
    top: 20px;
    left: 8px;
  }

  .toolbar-button {
    width: 52px;
    height: 52px;
  }

  .toolbar-button svg {
    width: 21px;
    height: 21px;
  }

  #map-panel {
    top: 0px;
    left: 0px;
    right: 0px;

    width: auto;
    height: 100dvh;

    max-height: none;

    padding: 18px;
  }

  #panel-title {
    font-size: 28px;
  }

  #place-list {
    -webkit-overflow-scrolling: touch;
  }

  .filter-option {
    padding: 12px 10px;
    font-size: 20px;
  }

  .filter-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
  }

  .place-sources-list {
    font-size: 20px;
    padding: 12px 10px;
  }

  body.detail-view #app,
  body.detail-view #map {
    height: 38dvh;
  }

  body.detail-view #place-detail {
    height: 62dvh;
    padding: 18px;
  }

  .place-layout {
    gap: 18px;
  }

  .place-title {
    font-size: 1.7rem;
  }

  .place-lead {
    font-size: 1rem;
  }

  .place-card {
    padding: 8px;
  }

  .place-section {
    background: var(--color-bg-sources);

    border: 1px solid var(--border-light);
    border-radius: 16px;

    padding: 18px 18px 16px;
    margin-bottom: 8px;

    backdrop-filter: blur(6px);
  }
}


/* =========================================================
   LIGHTBOX (BILD-VERGRÖSSERUNG)
   ========================================================= */
.lightbox-overlay {
  position: fixed;
  top: 0; 
  left: 0; 
  width: 100vw; 
  height: 100vh;
  z-index: 9999; /* Muss über der Karte und UI liegen! */
  
  display: flex;
  justify-content: center;
  align-items: center;
  
  /* Dein dunkles Grün als schicker, halbtransparenter Hintergrund */
  background: rgba(52, 66, 56, 0.85); 
  backdrop-filter: blur(8px); 
  
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  cursor: zoom-out;
}

.lightbox-overlay.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 10px 50px rgba(0,0,0,0.4);
}

.place-main {
  min-width: 0;
}

.place-gallery {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 24px 0;
  overflow: hidden;
}

.place-gallery .swiper-wrapper {
  align-items: flex-start;
}

.place-gallery .swiper-slide {
  width: 100%;
  margin: 0;
  box-sizing: border-box;
}

.place-gallery-img {
  display: block;

  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 460px;

  object-fit: contain;
  background: var(--color-cream);
}

.place-gallery-caption {
  margin-top: 10px;

  font-family: var(--font-mono);
  font-size: var(--font-size-caption);

  color: var(--color-text-muted);
  line-height: 1.5;

  text-align: center;
}

.place-gallery .swiper-button-prev,
.place-gallery .swiper-button-next {
  color: var(--color-accent);
}

.place-gallery .swiper-pagination {
  position: relative;
  margin-top: 12px;
  bottom: auto;
}