*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-family: Georgia, serif;
}

#map {
  position: fixed;
  inset: 0;
  z-index: 0;
}

/* Title card */
#title-card {
  position: fixed;
  top: 16px;
  left: 60px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.93);
  padding: 12px 16px;
  border-radius: 4px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
  max-width: 260px;
  pointer-events: none;
}

#title-card h1 {
  font-size: 1.25rem;
  color: #222;
  line-height: 1.2;
}

#title-card p {
  font-size: 0.75rem;
  color: #666;
  margin-top: 4px;
  font-family: sans-serif;
}

#year-filter,
#address-search {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 5px 7px;
  font-size: 0.75rem;
  font-family: sans-serif;
  border: 1px solid #ccc;
  border-radius: 3px;
  color: #333;
  background: #fff;
  pointer-events: auto;
}

#year-filter:focus,
#address-search:focus {
  outline: none;
  border-color: #888;
}

.dataset-link {
  margin-top: 6px;
  font-size: 0.7rem;
}

.dataset-link a {
  color: #888;
  text-decoration: none;
  pointer-events: auto;
}

.dataset-link a:hover {
  color: #444;
  text-decoration: underline;
}

/* About page */
#about {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 24px 64px;
  color: #2a2a2a;
  line-height: 1.6;
}

#about h1 {
  font-size: 1.9rem;
  color: #1a1a1a;
  margin-bottom: 6px;
}

#about h2 {
  font-size: 1.15rem;
  color: #1a1a1a;
  margin: 28px 0 8px;
}

#about p,
#about li {
  font-size: 0.95rem;
  margin-bottom: 10px;
}

#about .lead {
  font-size: 1.05rem;
  color: #555;
}

#about ul {
  padding-left: 20px;
}

#about a {
  color: #0055aa;
  text-decoration: none;
}

#about a:hover {
  text-decoration: underline;
}

#about .back-link {
  font-family: sans-serif;
  font-size: 0.85rem;
}

#about .fine-print {
  margin-top: 32px;
  font-size: 0.78rem;
  color: #999;
  font-family: sans-serif;
}

/* Zoom hint */
#zoom-hint {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 7px 16px;
  border-radius: 20px;
  font-family: sans-serif;
  font-size: 0.78rem;
  pointer-events: none;
  z-index: 999;
  display: none;
  white-space: nowrap;
}

/* Sidebar */
#sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 340px;
  height: 100%;
  background: #fff;
  z-index: 1000;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.2);
  overflow-y: auto;
  transition: transform 0.2s ease;
}

#sidebar.hidden {
  transform: translateX(100%);
}

#close-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #555;
  line-height: 1;
  padding: 4px 8px;
  z-index: 1;
}

#close-btn:hover {
  color: #000;
}

#sidebar-content {
  padding: 16px;
}

#loading {
  color: #888;
  font-family: sans-serif;
  font-size: 0.9rem;
  padding-top: 40px;
  text-align: center;
}

/* Photo in sidebar - tall, contained, dark bg for letterbox */
.photo-wrap {
  width: 100%;
  background: #111;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 14px;
  cursor: zoom-in;
}

.photo-wrap img {
  width: 100%;
  height: 260px;
  object-fit: contain;
  display: block;
}

.meta h2 {
  font-size: 1rem;
  color: #1a1a1a;
  margin-bottom: 6px;
  line-height: 1.4;
}

.meta .date {
  font-size: 0.85rem;
  color: #555;
  font-family: sans-serif;
  margin-bottom: 4px;
}

.meta .address {
  font-size: 0.85rem;
  color: #555;
  font-family: sans-serif;
  margin-bottom: 12px;
}

.description {
  font-size: 0.85rem;
  color: #333;
  line-height: 1.5;
  margin-bottom: 8px;
  font-family: sans-serif;
}

.notes {
  font-size: 0.8rem;
  color: #555;
  font-style: italic;
  line-height: 1.4;
  margin-bottom: 8px;
  font-family: sans-serif;
}

.attribution {
  font-size: 0.78rem;
  color: #777;
  font-family: sans-serif;
  margin-bottom: 6px;
}

.rights {
  font-size: 0.72rem;
  color: #999;
  font-family: sans-serif;
  margin-bottom: 10px;
  line-height: 1.4;
}

.source-link {
  display: inline-block;
  font-size: 0.8rem;
  font-family: sans-serif;
  color: #0055aa;
  text-decoration: none;
}

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

.error {
  color: #c00;
  font-family: sans-serif;
  font-size: 0.85rem;
  padding-top: 20px;
  text-align: center;
}

/* Multi-photo strip */
.photo-count {
  font-size: 0.72rem;
  color: #888;
  font-family: sans-serif;
  margin-bottom: 6px;
}

/* Sticky "now viewing" detail for multi-photo locations */
.active-detail {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  padding: 6px 0 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid #eee;
  max-height: 42vh;
  overflow-y: auto;
}

.active-detail h2 {
  font-size: 0.95rem;
  color: #1a1a1a;
  margin-bottom: 6px;
  line-height: 1.35;
}

.active-detail .description {
  max-height: 8.5em;
  overflow-y: auto;
}

/* Multi-photo lazy grid */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 5px;
}

.grid-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  cursor: pointer;
  border-radius: 2px;
  background: #eee;
  transition: opacity 0.1s;
}

.grid-thumb:hover {
  opacity: 0.82;
}

.grid-sentinel {
  height: 1px;
}

.thumb-strip {
  display: flex;
  overflow-x: auto;
  gap: 4px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid #eee;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.strip-thumb {
  width: 80px;
  height: 60px;
  object-fit: cover;
  flex-shrink: 0;
  cursor: pointer;
  border-radius: 2px;
  border: 3px solid transparent;
  opacity: 0.55;
  transition:
    opacity 0.1s,
    border-color 0.1s;
}

.strip-thumb:hover {
  opacity: 0.85;
}

.strip-thumb.active {
  opacity: 1;
  border-color: #c0392b;
}

/* Modal / lightbox */
#modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#modal.hidden {
  display: none;
}

#modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  cursor: zoom-out;
}

#modal-img-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 92vw;
  max-height: 92vh;
  pointer-events: none;
}

#modal-img {
  display: block;
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 2px;
  pointer-events: auto;
}

#modal-close {
  position: fixed;
  top: 12px;
  right: 14px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.45);
  border: none;
  color: #fff;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  padding: 3px 10px 5px;
  border-radius: 3px;
}

#modal-close:hover {
  background: rgba(0, 0, 0, 0.7);
}

.modal-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: rgba(0, 0, 0, 0.4);
  border: none;
  color: #fff;
  font-size: 3rem;
  line-height: 1;
  cursor: pointer;
  padding: 12px 14px;
  border-radius: 3px;
  user-select: none;
  transition: background 0.1s;
}

.modal-nav:hover {
  background: rgba(0, 0, 0, 0.65);
}

.modal-nav.hidden {
  visibility: hidden;
}

#modal-prev {
  left: 8px;
}
#modal-next {
  right: 8px;
}

#modal-caption {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  padding: 10px 16px;
  text-align: center;
  color: #eee;
  font-family: sans-serif;
  font-size: 0.82rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));
  pointer-events: none;
}

#modal.hidden #modal-caption {
  display: none;
}

/* Mobile */
@media (max-width: 600px) {
  #sidebar {
    width: 100%;
  }

  /* Compact card — sits in top-left corner without swamping the map */
  #title-card {
    top: 8px;
    left: 50px;
    right: 8px;
    max-width: none;
    padding: 8px 12px;
  }

  #title-card h1 {
    font-size: 1rem;
  }

  #title-card > p:first-of-type {
    display: none; /* hide subtitle to save space */
  }

  .photo-wrap img {
    height: 200px;
  }
}
