/* ============================================================
   HOLOCAUST MEMORY — RESEARCH PAGE STYLES
   Map view + Explore-by-Sites + detail panel
   ============================================================ */

/* ---- Hero -------------------------------------------------- */
.research-hero {
  text-align: center;
  padding: 56px 24px 48px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.research-hero-title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--heading);
  margin-bottom: 12px;
}
.research-hero-tagline {
  font-size: 1rem;
  font-style: italic;
  color: var(--text);
  margin-bottom: 16px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.research-hero-desc {
  font-size: 0.9375rem;
  color: var(--text);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.75;
}

/* ---- View Toggle ------------------------------------------- */
.view-toggle-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  padding: 24px 24px 0;
}
.view-toggle-btn {
  padding: 9px 24px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  line-height: 1;
}
.view-toggle-btn:first-child {
  border-radius: 6px 0 0 6px;
  border-right: none;
}
.view-toggle-btn:last-child {
  border-radius: 0 6px 6px 0;
}
.view-toggle-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.view-toggle-btn:hover:not(.active) {
  background: var(--light);
  color: var(--heading);
}

/* ---- Main research area ------------------------------------ */
.research-main {
  position: relative;
  padding: 32px 0 0;
}

/* ---- Map View --------------------------------------------- */
.map-view {
  display: block;
}
.map-view.hidden,
.topic-view.hidden {
  display: none;
}

.map-container-wrap {
  position: relative;
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 0 24px;
}

#research-map {
  width: 100%;
  height: 520px;
  border-radius: 8px;
  border: 1px solid var(--border);
  z-index: 1;
}

.map-reset-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* Custom pin-drop icon (replaces the previous circle markers) */
.site-pin-icon {
  display: block;
  background: none;
  border: none;
  pointer-events: auto;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}
.map-reset-btn:hover {
  background: var(--light);
  color: var(--heading);
}

/* Leaflet popup customisation */
.leaflet-popup-content-wrapper {
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  font-family: var(--font);
}
.leaflet-popup-content {
  margin: 12px 16px;
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.5;
}
.popup-name {
  font-weight: 700;
  color: var(--heading);
  font-size: 0.9rem;
  margin-bottom: 2px;
}
.popup-loc {
  font-size: 0.8rem;
  color: var(--placeholder-text);
  margin-bottom: 8px;
}
.popup-open-btn {
  display: inline-block;
  padding: 5px 12px;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}
.popup-open-btn:hover {
  background: var(--accent-hover);
  opacity: 1;
  color: #fff;
}

/* ---- Sites Explorer (by city/country) --------------------- */
.topic-view {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 0 24px 0;
}

.theme-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 0;
}

.theme-card {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
}
.theme-card:hover {
  box-shadow: 0 4px 18px rgba(0,0,0,0.09);
  transform: translateY(-2px);
}
.theme-card.expanded {
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.theme-card-header {
  padding: 20px 22px 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
}
.theme-card-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--heading);
  line-height: 1.3;
  margin-bottom: 4px;
}
.theme-card-count {
  font-size: 0.78rem;
  color: var(--placeholder-text);
  font-weight: 500;
}
.theme-card-chevron {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--placeholder-text);
  transition: transform 0.25s ease;
  margin-top: 2px;
}
.theme-card.expanded .theme-card-chevron {
  transform: rotate(180deg);
}

/* Expanding body */
.theme-card-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
  border-top: 0px solid var(--border);
}
.theme-card.expanded .theme-card-body {
  grid-template-rows: 1fr;
  border-top-width: 1px;
}
.theme-card-body-inner {
  overflow: hidden;
}

.theme-direct-sites {
  padding: 10px 22px 14px;
}

.site-link-list {
  list-style: none;
  padding: 0;
  margin: 0 0 0;
}
.site-link-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 0;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  font-size: 0.875rem;
  color: var(--heading);
  font-weight: 500;
  transition: color 0.15s;
  border-bottom: 1px solid var(--border);
}
.site-link-btn:last-child {
  border-bottom: none;
}
.site-link-btn::before {
  content: '→';
  color: var(--accent);
  font-size: 0.8rem;
  flex-shrink: 0;
}
.site-link-btn:hover {
  color: var(--accent);
}

/* ---- Detail Panel ----------------------------------------- */
.research-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 1100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.research-panel-overlay.active {
  opacity: 1;
  visibility: visible;
}

.research-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(1180px, 94vw);
  height: min(880px, 90vh);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
  z-index: 1200;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -50%) scale(0.96);
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.25s ease;
  display: flex;
  flex-direction: column;
}
.research-panel.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.panel-header {
  flex-shrink: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-header-text {
  flex: 1;
  min-width: 0;
}
.panel-site-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--heading);
  line-height: 1.3;
  margin-bottom: 2px;
}
.panel-site-loc {
  font-size: 0.8rem;
  color: var(--placeholder-text);
}
.panel-close-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}
.panel-close-btn:hover {
  background: var(--border);
  color: var(--heading);
}

.panel-body {
  padding: 24px 32px 32px;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  column-gap: 36px;
  align-items: stretch;
}

.panel-right {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-right: 6px;
}

.panel-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  flex-wrap: wrap;
}
.panel-date-badge {
  font-size: 0.78rem;
  color: var(--placeholder-text);
  font-weight: 500;
}

/* Photo area */
.panel-photos {
  width: 100%;
  min-width: 0;
  min-height: 0;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}
.panel-photo-placeholder {
  background: var(--placeholder-bg);
  border-radius: 6px;
  flex: 1;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--placeholder-text);
  font-size: 0.8rem;
  padding: 12px;
  line-height: 1.5;
}
.panel-photo-placeholder svg {
  display: block;
  margin: 0 auto 8px;
  width: 32px;
  height: 32px;
  opacity: 0.4;
}

/* Description */
.panel-desc {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.75;
  margin-bottom: 0;
}

/* Readings */
.panel-readings-heading {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--placeholder-text);
  margin-bottom: 10px;
}
.reading-card {
  display: block;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  margin-bottom: 8px;
  transition: border-color 0.15s, background 0.15s;
}
.reading-card:last-child {
  margin-bottom: 0;
}
.reading-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.reading-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--heading);
  margin-bottom: 2px;
  line-height: 1.4;
}
.reading-card-source {
  font-size: 0.775rem;
  color: var(--accent);
}

/* ---- Panel Carousel --------------------------------------- */
.panel-carousel {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  touch-action: pan-y;
  background: var(--placeholder-bg);
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.panel-carousel-track {
  display: flex;
  transition: transform 0.3s ease;
  flex: 1;
  min-height: 0;
}
.panel-carousel-slide {
  min-width: 100%;
  flex-shrink: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}
.panel-carousel-slide img {
  width: 100%;
  flex: 1;
  min-height: 0;
  object-fit: contain;
  display: block;
  cursor: pointer;
}
.panel-carousel-caption {
  flex-shrink: 0;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.78);
  color: #f5f1ea;
  font-size: 0.82rem;
  line-height: 1.35;
  text-align: center;
  font-style: italic;
  letter-spacing: 0.01em;
}

/* Per-photo "stop" block — swaps with the carousel slide on photo-walks */
.panel-stop-block {
  margin-top: 14px;
  padding: 14px 16px;
  border-left: 3px solid var(--accent);
  background: rgba(0, 0, 0, 0.025);
  border-radius: 0 4px 4px 0;
}
.panel-stop-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.panel-stop-desc {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--body);
}

/* Counter + Dots */
.panel-carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 0 4px;
}
.panel-carousel-counter {
  font-size: 0.75rem;
  color: var(--placeholder-text);
  font-weight: 500;
  min-width: 40px;
  text-align: center;
  padding: 4px 0 2px;
}
.panel-carousel-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 0 2px;
}
.panel-carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.panel-carousel-dot.active {
  background: var(--accent);
  transform: scale(1.2);
}

/* Arrow buttons */
.panel-carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  color: var(--heading);
  font-size: 1rem;
  transition: background 0.15s;
  opacity: 0.85;
}
.panel-carousel-arrow--prev { left: 8px; }
.panel-carousel-arrow--next { right: 8px; }
.panel-carousel-arrow:hover {
  background: #fff;
  opacity: 1;
}

/* ---- Photo Groups ----------------------------------------- */
.panel-photo-groups {
  margin-top: 24px;
}
.panel-body:has(.panel-photo-groups) {
  display: block;
  overflow-y: auto;
}
.panel-body:has(.panel-photo-groups) .panel-photos {
  display: none;
}
.panel-body:has(.panel-photo-groups) .panel-right {
  overflow: visible;
  display: block;
  padding-right: 0;
}
.panel-body:has(.panel-photo-groups) .panel-right > * + * {
  margin-top: 18px;
}
.panel-photo-group {
  margin-bottom: 24px;
}
.panel-photo-group:last-child {
  margin-bottom: 0;
}
.panel-photo-group-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--placeholder-text);
  margin-bottom: 10px;
}

/* ---- Research Lightbox ------------------------------------ */
.research-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.research-lightbox.active {
  opacity: 1;
  visibility: visible;
}
.research-lightbox-img {
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 4px;
}
.research-lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  transition: color 0.15s;
}
.research-lightbox-close:hover {
  color: #fff;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .panel-body {
    display: block;
    overflow-y: auto;
    padding: 20px 24px 28px;
  }
  .panel-photos {
    display: block;
    margin-bottom: 18px;
    height: clamp(280px, 55vh, 480px);
  }
  .panel-right {
    overflow: visible;
    display: block;
    padding-right: 0;
  }
  .panel-right > * + * {
    margin-top: 18px;
  }
}

@media (max-width: 900px) {
  .theme-cards-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  #research-map {
    height: 400px;
  }
}

@media (max-width: 640px) {
  .research-hero {
    padding: 40px 20px 36px;
  }
  #research-map {
    height: 320px;
  }
  /* Panel becomes near-fullscreen centered modal on mobile */
  .research-panel {
    width: 96vw;
    height: 92vh;
    border-radius: 10px;
  }
  .panel-body {
    padding: 18px 18px 24px;
  }
  .view-toggle-bar {
    padding: 20px 16px 0;
  }
  .topic-view {
    padding: 0 16px 0;
  }
  .map-container-wrap {
    padding: 0 16px;
  }
  .panel-carousel-arrow {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
    opacity: 0.95;
  }
  .panel-carousel-dot { width: 7px; height: 7px; }
  .panel-photo-group { margin-bottom: 20px; }
}

/* Audio player + transcript block (used by audio-only site entries) */
.panel-audio-block {
  margin: 24px 0 8px;
  padding: 18px;
  background: var(--light, #f6f5f3);
  border: 1px solid var(--border, #d8d4ce);
  border-radius: 6px;
}
.panel-audio-player {
  width: 100%;
  display: block;
}
.panel-transcript-heading {
  margin-top: 18px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--heading, #2a2825);
}
.panel-transcript {
  margin-top: 8px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text, #3a3835);
  white-space: normal;
}
