html, body, #map {
  margin: 0;
  height: 100%;
}

body {
  font-family: system-ui, sans-serif;
  background: #F5F5F3;
  color: #2B2B2B;
}

a {
  color: #2B2B2B;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* Harita üstü kontrol paneli: başlık + arama + filtre */
.control-panel {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  width: 280px;
  max-width: calc(100vw - 24px);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 8px 12px;
  gap: 8px;
}

.panel-header h1 {
  margin: 0;
  font-size: 16px;
  color: #2B2B2B;
}

.panel-header p {
  margin: 2px 0 0;
  font-size: 13px;
  color: #6B6B69;
}

.panel-toggle {
  display: none;
  background: none;
  border: 1px solid #D6D6D4;
  border-radius: 4px;
  color: #2B2B2B;
  font-size: 16px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  transition: transform 0.15s;
}

.panel-toggle.open {
  transform: rotate(180deg);
}

.panel-body {
  padding: 0 12px 12px;
}

.search-box {
  position: relative;
}

.search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 10px;
  border: 1px solid #D6D6D4;
  border-radius: 4px;
  font-size: 14px;
  color: #2B2B2B;
  background: #FFFFFF;
}

.search-input:focus {
  outline: 2px solid #2B2B2B;
  outline-offset: 1px;
}

.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: #FFFFFF;
  border: 1px solid #D6D6D4;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  max-height: 220px;
  overflow-y: auto;
  z-index: 2;
}

.search-results[hidden] {
  display: none;
}

.search-results li {
  margin: 0;
}

.search-results button {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  color: #2B2B2B;
}

.search-results li.active button,
.search-results button:hover {
  background: #ECEEEA;
}

.result-type {
  display: block;
  font-size: 12px;
  color: #6B6B69;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.chip {
  background: #FFFFFF;
  border: 1px solid #D6D6D4;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  color: #2B2B2B;
  cursor: pointer;
}

.chip.active {
  background: #2B2B2B;
  border-color: #2B2B2B;
  color: #FFFFFF;
}

@media (max-width: 640px) {
  .panel-toggle {
    display: inline-flex;
  }

  .panel-body {
    display: none;
  }

  .panel-body.expanded {
    display: block;
  }
}

/* Okul kartı: harita popup'ı ve mobil bottom sheet tarafından paylaşılır. */
.card-cover {
  display: block;
  width: 100%;
  height: 110px;
  object-fit: cover;
}

.card-body {
  padding: 10px 12px;
}

.card-body strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

.card-body p {
  margin: 0 0 6px;
  font-size: 13px;
  color: #6B6B69;
}

.maplibregl-popup-content {
  padding: 0;
  overflow: hidden;
  border-radius: 4px;
}

/* Mobil bottom sheet: popup kartının mobildeki karşılığı. */
.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: #FFFFFF;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.2);
  transform: translateY(100%);
  transition: transform 0.2s ease-out;
  max-height: 60vh;
  overflow-y: auto;
}

.bottom-sheet.open {
  transform: translateY(0);
}

.bottom-sheet-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(43, 43, 43, 0.08);
  border: none;
  border-radius: 4px;
  font-size: 20px;
  line-height: 1;
  padding: 4px 10px;
  cursor: pointer;
  color: #2B2B2B;
}

.site-footer {
  position: absolute;
  bottom: 8px;
  left: 8px;
  z-index: 1;
  margin: 0;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.85);
  padding: 4px 8px;
  border-radius: 4px;
}

/* Detay sayfası */
.school-page {
  max-width: 700px;
  margin: 0 auto;
  padding: 16px;
  line-height: 1.6;
}

/* Galeri: ilk fotoğraf büyük ana görsel, geri kalanı altında küçük resimler. */
.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.gallery figure {
  margin: 0;
}

.gallery figure[data-index="0"] {
  flex-basis: 100%;
}

.gallery figure:not([data-index="0"]) {
  flex: 0 0 120px;
}

.gallery picture {
  display: block;
}

.gallery img {
  max-width: 100%;
  width: 100%;
  display: block;
  border-radius: 4px;
  background: #E8E8E6;
}

.gallery figure[data-index="0"] img {
  max-height: 420px;
  object-fit: cover;
}

.gallery figure:not([data-index="0"]) img {
  height: 90px;
  object-fit: cover;
}

.gallery figcaption {
  margin-top: 4px;
  font-size: 12px;
  color: #6B6B69;
}

.no-photo-placeholder,
.no-history-placeholder {
  color: #6B6B69;
  font-style: italic;
}

/* Tarihçe — okunaklı satır genişliği (~65-70 karakter). */
.history {
  max-width: 70ch;
}

/* Mini harita */
.mini-map-section h2,
.sources h2 {
  font-size: 15px;
  margin-bottom: 8px;
}

.mini-map {
  width: 100%;
  max-width: 400px;
  height: 220px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #D6D6D4;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(43, 43, 43, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-figure {
  margin: 0;
  max-width: 90vw;
  max-height: 85vh;
  text-align: center;
}

.lightbox-image {
  max-width: 90vw;
  max-height: 75vh;
  display: block;
  margin: 0 auto;
}

.lightbox-caption {
  color: #F5F5F3;
  font-size: 13px;
  margin-top: 8px;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  border: none;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  padding: 8px 14px;
  border-radius: 4px;
}

.lightbox-close {
  top: 16px;
  right: 16px;
}

.lightbox-prev {
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-next {
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}
