:root {
  --bg-canvas: #fafafa;
  --bg-surface: #ffffff;
  --ink-primary: #141414;
  --ink-muted: #666666;
  --border-hairline: #e2e2e2;
  --border-strong: #141414;
}

/* Enforce strict square geometry across all elements */
*,
*::before,
*::after,
.btn,
.card,
.form-control,
.input-group-text,
.badge,
.modal-content,
.nav-link,
.page-link {
  border-radius: 0px !important;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-canvas);
  color: var(--ink-primary);
  -webkit-font-smoothing: antialiased;
}

/* Uppercase Headings */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
.font-editorial {
  font-family: 'Cormorant Garamond', Georgia, serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.text-none {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
  font-weight: 400 !important;
  text-transform: none !important;
  letter-spacing: normal;
}

/* Navbar */
.navbar {
  background-color: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-hairline);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 50% !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-mark img,
.brand-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Filter Buttons */
.category-btn-group .filter-btn {
  position: relative;
  box-shadow: none !important;
}

.filter-btn {
  border: 1px solid var(--border-hairline);
  background-color: var(--bg-surface);
  color: var(--ink-muted);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.45rem 0.9rem;
  transition: all 0.15s ease;
}

.filter-btn:hover {
  border-color: var(--border-strong);
  color: var(--ink-primary);
}

.filter-btn.active {
  background-color: var(--ink-primary);
  border-color: var(--ink-primary);
  color: #ffffff;
}

.dropdown-menu-gallery {
  border: 1px solid var(--border-strong);
  background-color: var(--bg-surface);
  min-width: 120px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.dropdown-menu-gallery .dropdown-item {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-primary);
  padding: 0.45rem 0.9rem;
}

.dropdown-menu-gallery .dropdown-item:hover,
.dropdown-menu-gallery .dropdown-item:focus {
  background-color: #f3f3f3;
  color: var(--ink-primary);
}

.dropdown-menu-gallery .dropdown-item.active {
  background-color: var(--ink-primary);
  color: #ffffff;
}

/*
 * Horizontal Justified Masonry Layout
 * - Preserves exact natural aspect ratio (--ratio)
 * - Enforces a strict 400px maximum image height across all rows
 * - Uses row-based justified layout computed by app.js with pure CSS fallback
 */
.horizontal-masonry {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: stretch;
}

#albumPhotosGrid.horizontal-masonry {
  gap: 0.5rem;
}

/* Uniform Home Page Album Grid (Every Cover Image Identical Size) */
.uniform-albums-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25rem;
  align-items: stretch;
}

@media (max-width: 1199.98px) {
  .uniform-albums-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .uniform-albums-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 767.98px) {
  .uniform-albums-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .uniform-albums-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.uniform-albums-grid .album-card-item {
  display: flex;
  width: 100%;
  min-width: 0;
}

/* Pure CSS baseline before JS row-justification runs (for any masonry album grids) */
.horizontal-masonry .album-card-item {
  flex: var(--ratio, 1.5) 1 calc(var(--ratio, 1.5) * 320px);
  max-width: calc(var(--ratio, 1.5) * 400px);
  min-width: 180px;
  display: flex;
}

/* JS-justified row mode: exact proportional widths & equal row height <= 400px */
.horizontal-masonry.masonry-justified .album-card-item {
  flex: 0 0 auto;
  max-width: none;
  min-width: 0;
}

/* Album Cards */
.album-card {
  border: 1px solid var(--border-hairline);
  background-color: var(--bg-surface);
  transition: border-color 0.2s ease;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.album-card:hover {
  border-color: var(--border-strong);
}

.album-cover-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  flex-shrink: 0;
  overflow: hidden;
  background-color: #efefef;
}

.uniform-albums-grid .album-cover-wrap {
  aspect-ratio: 3 / 2 !important;
  height: 0 !important;
  padding-bottom: 66.666667%;
}

.album-cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

.uniform-albums-grid .album-cover-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  object-position: center;
}

.album-card:hover .album-cover-wrap img {
  transform: scale(1.035);
}

.badge-count {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: rgba(20, 20, 20, 0.85);
  color: #ffffff;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.25rem 0.55rem;
}


/* Full-width single-column photos below 576px in individual album pages */
@media (max-width: 575.98px) {
  #albumPhotosGrid.horizontal-masonry,
  #albumPhotosGrid.horizontal-masonry.masonry-justified {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    gap: 0.75rem !important;
    align-items: stretch !important;
  }

  #albumPhotosGrid > .photo-tile {
    flex: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    max-height: none !important;
    aspect-ratio: var(--ratio, 1.5) !important;
  }

  #albumPhotosGrid > .photo-tile > img,
  #albumPhotosGrid > .photo-tile > video {
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    object-fit: cover !important;
  }
}



/* Use horizontal masonry grid on viewports >= 576px */
@media (min-width: 576px) {
  #albumPhotosGrid.horizontal-masonry {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    align-items: stretch !important;
  }
}

/* Album Detail Horizontal Justified Masonry (Preserves Proportions, Max Height 240px) */
.photo-tile {
  position: relative;
  flex: var(--ratio, 1.5) 1 calc(var(--ratio, 1.5) * 210px);
  max-width: calc(var(--ratio, 1.5) * 240px);
  min-width: 120px;
  aspect-ratio: var(--ratio, 1.5);
  max-height: 240px;
  overflow: hidden;
  border: 1px solid var(--border-hairline);
  background-color: #f0f0f0;
  cursor: pointer;
}

.horizontal-masonry.masonry-justified .photo-tile {
  flex: 0 0 auto;
  max-width: none;
  min-width: 0;
  max-height: 240px;
}

.photo-tile img {
  width: 100%;
  height: 100%;
  max-height: 240px;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.photo-tile:hover img {
  transform: scale(1.025);
}

.photo-tile-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 0.75rem 0.9rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), transparent);
  color: #ffffff;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.photo-tile:hover .photo-tile-overlay,
.photo-tile:focus .photo-tile-overlay {
  opacity: 1;
}

@media (max-width: 575.98px) {
  .horizontal-masonry:not(.masonry-justified) .album-card-item,
  .horizontal-masonry:not(.masonry-justified) .photo-tile {
    flex: 1 1 100%;
    max-width: 100%;
    min-width: 100%;
  }
}

/* Pagination */
.pagination-gallery {
  row-gap: 0.35rem;
}

.pagination-gallery .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-hairline);
  background-color: var(--bg-surface);
  color: var(--ink-primary);
  font-size: 0.875rem;
  line-height: 1;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.5rem 0.85rem;
  margin-left: -1px;
  box-shadow: none !important;
  transition: all 0.15s ease;
}

.pagination-gallery .page-link i.bi {
  font-size: 0.875rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

@media (max-width: 575.98px) {
  .pagination-gallery .page-link {
    font-size: 0.72rem;
    padding: 0.4rem 0.65rem;
    letter-spacing: 0.03em;
  }
}

.pagination-gallery .page-link:hover {
  border-color: var(--border-strong);
  background-color: #f3f3f3;
  color: var(--ink-primary);
  z-index: 2;
}

.pagination-gallery .page-item.active .page-link {
  background-color: var(--ink-primary);
  border-color: var(--ink-primary);
  color: #ffffff;
  z-index: 3;
}

.pagination-gallery .page-item.disabled .page-link {
  background-color: var(--bg-canvas);
  border-color: var(--border-hairline);
  color: #b0b0b0;
  pointer-events: none;
}

/* Tight-Bordered White Lightbox Modal */
.lightbox-modal .modal-content {
  background-color: #ffffff;
  border: none;
}

.lightbox-frame {
  border: none;
  padding: 0;
  background-color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
}

.lightbox-frame img {
  max-height: 90vh;
  max-width: 92vw;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
  transition: opacity 0.15s ease;
}

/* Full Size Zoom State */
.lightbox-stage-zoomed {
  overflow: auto !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  cursor: grab;
}

.lightbox-stage-zoomed:active {
  cursor: grabbing;
}

.lightbox-stage-zoomed .lightbox-frame {
  margin: auto;
  max-width: none;
  max-height: none;
}

.lightbox-stage-zoomed .lightbox-frame img {
  max-height: none !important;
  max-width: none !important;
  width: auto !important;
  height: auto !important;
  cursor: zoom-out;
}

.lightbox-nav-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border: 1px solid var(--border-strong);
  background-color: rgba(255, 255, 255, 0.94);
  color: var(--ink-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 1060;
  transition: all 0.15s ease;
}

.lightbox-nav-btn:hover {
  background-color: var(--ink-primary);
  color: #ffffff;
}

.lightbox-nav-btn.prev {
  left: 12px;
}

.lightbox-nav-btn.next {
  right: 12px;
}

/* Album Leaflet Map View */
.album-map-canvas {
  width: 100%;
  height: 540px;
  max-height: 72vh;
  background-color: #efefef;
  z-index: 1;
}

.album-map-popup {
  min-width: 190px;
  max-width: 240px;
}

.album-map-popup img {
  width: 100%;
  height: 135px;
  object-fit: cover;
  display: block;
  border: 1px solid var(--border-hairline);
  margin-bottom: 0.5rem;
  cursor: pointer;
}

.album-photo-pin {
  width: 34px;
  height: 34px;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  background-color: #141414;
  border-radius: 50% !important;
}

.album-photo-pin img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50% !important;
}

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background-color: rgba(20, 20, 20, 0.25) !important;
  border-radius: 50% !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background-color: #141414 !important;
  color: #ffffff !important;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 50% !important;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  border-radius: 0px !important;
}

.album-description-link {
  position: relative;
  z-index: 2;
  color: var(--ink-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  pointer-events: auto;
  transition: opacity 0.15s ease;
}

.album-description-link:hover {
  color: var(--ink-primary);
  opacity: 0.7;
}


/* Video Tiles & Lightbox Video Player */
.photo-tile.photo-tile-video {
  cursor: default;
}

.photo-tile video {
  width: 100%;
  height: 100%;
  max-height: 240px;
  object-fit: cover;
  display: block;
  background-color: #000000;
}

.video-lightbox-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background-color: rgba(20, 20, 20, 0.78);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  z-index: 4;
  transition: background-color 0.15s ease;
}

.video-lightbox-btn:hover {
  background-color: #141414;
  border-color: #ffffff;
}

.lightbox-frame video {
  max-height: 90vh;
  max-width: 92vw;
  width: auto;
  height: auto;
  display: block;
  background-color: #000000;
}
