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

:root {
  --bg: #fffcf7;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.grid-active {
  overflow-y: auto;
}

/* ── Site logo ── */
.site-logo {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  text-decoration: none;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #555;
  transition: color 0.25s;
}

.site-logo:hover {
  color: #111;
}

.logo-chno {
  font-weight: 700;
  color: #222;
  letter-spacing: 0.06em;
}

.logo-dot {
  color: #999;
}

.site-tagline {
  display: block;
  font-size: 10px;
  font-weight: 300;
  font-style: italic;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #aaa;
  margin-top: 2px;
  text-align: center;
}

/* ── View toggle buttons ── */
.view-toggle.about-toggle {
  right: 140px;
}

.view-toggle.stats-toggle {
  right: 100px;
}

.view-toggle.map-toggle {
  right: 60px;
}

.view-toggle.map-toggle.active {
  color: #fff;
  background: #333;
  border-color: #333;
}

.view-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  background: none;
  border: none;
  color: #888;
  padding: 8px;
  cursor: pointer;
  transition: color 0.25s, background 0.25s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-toggle:hover {
  color: #111;
}

/* ── Main layout ── */
.gallery {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding-top: 60px;
}

/* ── Grid view ── */
.grid-view {
  display: none;
}

.gallery.grid-mode {
  height: auto;
  min-height: 100vh;
  justify-content: flex-start;
  overflow-y: auto;
}

.gallery.grid-mode .image-wrapper,
.gallery.grid-mode .nav-controls,
.gallery.grid-mode .thumbnail-bar {
  display: none;
}

/* ── Grid filters ── */
.grid-filters {
  display: none;
  align-items: center;
}

.gallery.grid-mode .grid-filters {
  display: flex;
  flex-direction: row;
  gap: 10px;
  padding: 72px 24px 0;
  justify-content: center;
}

.filter-select {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 1px solid rgba(0, 0, 0, 0.15);
  color: #888;
  font-size: 11px;
  font-family: inherit;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 7px 28px 7px 14px;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  outline: none;
}

.filter-select:hover,
.filter-select:focus {
  color: #111;
  border-color: rgba(0, 0, 0, 0.4);
}

.filter-select.has-value {
  color: #111;
  border-color: #333;
}

.gallery.grid-mode .grid-view {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 8px;
  gap: 16px;
  padding: 16px 0 24px;
  width: 55%;
  margin: 0 auto;
}

.grid-item {
  cursor: pointer;
  overflow: hidden;
  position: relative;
  border-radius: 2px;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.grid-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.grid-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.grid-item:hover img {
  transform: scale(1.03);
}

.grid-item .grid-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 12px 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.5), transparent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.grid-item:hover .grid-label {
  opacity: 1;
}

/* ── Map view ── */
.map-view {
  display: none;
}

.gallery.map-mode {
  height: 100vh;
  overflow: hidden;
}

.gallery.map-mode .map-view {
  display: block;
  width: 100%;
  height: 100vh;
  position: absolute;
  inset: 0;
  z-index: 1;
}

.gallery.map-mode .image-wrapper,
.gallery.map-mode .nav-controls,
.gallery.map-mode .thumbnail-bar,
.gallery.map-mode .grid-view,
.gallery.map-mode .grid-filters {
  display: none;
}

/* Map marker thumbnails */
.map-marker-icon {
  background: none !important;
  border: none !important;
  overflow: visible !important;
  width: auto !important;
  height: auto !important;
}

.map-view .leaflet-marker-pane {
  z-index: 1000 !important;
}

.map-view .leaflet-popup-pane {
  z-index: 1001 !important;
}

.map-marker {
  position: relative;
  width: 48px;
  height: 48px;
  transition: width 0.3s ease, height 0.3s ease;
}

.map-marker img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Stack effect for clusters */
.map-marker.map-cluster {
  cursor: pointer;
}

.map-stack {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 255, 255, 0.8);
  background: rgba(200, 200, 200, 0.4);
  transform: rotate(6deg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  z-index: -1;
}

.map-marker img {
  position: relative;
  z-index: 1;
}

.map-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #333;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 9px;
  padding: 0 4px;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  z-index: 2;
}

/* Zoom-based marker sizing */
.zoom-far .map-marker {
  width: 36px;
  height: 36px;
  transform: translateY(18px);
}

.zoom-mid .map-marker {
  transform: translateY(12px);
}

.zoom-mid .map-marker {
  width: 56px;
  height: 56px;
}

.zoom-close .map-marker {
  width: 88px;
  height: 88px;
}

.zoom-close .map-count {
  font-size: 12px;
  min-width: 22px;
  height: 22px;
  line-height: 22px;
  top: -8px;
  right: -8px;
}

/* Hide spiderfy lines */
.leaflet-cluster-anim .leaflet-marker-icon,
.leaflet-cluster-anim .leaflet-marker-shadow {
  transition: transform 0.3s ease;
}

.map-view svg.leaflet-zoom-animated path {
  stroke: transparent !important;
}

/* Map popup styling */
.map-popup {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.map-popup-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #333;
  margin-bottom: 8px;
}

.map-popup-grid {
  display: grid;
  grid-template-columns: repeat(4, 80px);
  gap: 6px;
  max-height: 500px;
  overflow-y: auto;
}

.map-popup-grid img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
}

.map-popup-grid img:hover {
  transform: scale(1.05);
  opacity: 0.85;
}

/* ── Image wrapper: column layout, centered ── */
.image-wrapper {
  display: flex;
  flex-direction: column;
  max-width: 90vw;
  transition: width 0.25s ease;
}

/* ── Image container ── */
.image-container {
  position: relative;
  min-width: 0;
  width: fit-content;
}

.image-container img {
  display: block;
  max-width: 90vw;
  max-height: 65vh;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.20);
  opacity: 0;
  filter: blur(20px);
  transform: scale(1.03);
  transition: opacity 0.4s ease, filter 0.4s ease, transform 0.4s ease;
}

.image-container img.loaded {
  opacity: 1;
}

.image-container img.sharp {
  filter: blur(0);
  transform: scale(1);
}

.image-container img.fading {
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

/* ── Always-visible caption below image ── */
@keyframes captionIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.image-caption {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
  flex-shrink: 0;
}

.image-caption.animate-in { animation: captionIn 0.4s ease both; }


.caption-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.image-caption .info-title {
  font-size: clamp(13px, 1vw, 18px);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #111;
  line-height: 1.2;
}

.image-caption .info-location {
  font-size: clamp(10px, 0.75vw, 13px);
  color: #888;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.image-caption .buy-btn {
  margin-left: auto;
  flex-shrink: 0;
}

/* ── Info panel: camera/exposure/story, always visible ── */
.image-info {
  color: #333;
  margin-top: 6px;
}

.info-camera {
  font-size: clamp(10px, 0.7vw, 12px);
  color: #999;
  font-style: italic;
}

.info-exposure {
  font-size: clamp(10px, 0.7vw, 12px);
  color: #bbb;
  letter-spacing: 0.04em;
}

.info-camera,
.info-exposure,
.info-story {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(6px);
  transition: max-height 0.35s ease, opacity 0.3s ease, transform 0.3s ease;
}

.info-story {
  font-size: clamp(10px, 0.7vw, 13px);
  line-height: 1.5;
  color: #888;
  margin-top: 4px;
}

.image-wrapper:hover .info-camera,
.image-wrapper:hover .info-exposure,
.image-wrapper.is-zoomed .info-camera,
.image-wrapper.is-zoomed .info-exposure {
  max-height: 2em;
  opacity: 1;
  transform: translateY(0);
}

.image-wrapper:hover .info-story,
.image-wrapper.is-zoomed .info-story {
  max-height: 4em;
  opacity: 1;
  transform: translateY(0);
}

/* ── Buy button ── */
.buy-btn {
  display: inline-block;
  padding: 8px 22px;
  font-size: clamp(10px, 0.7vw, 13px);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  background: #333;
  border: none;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.2s ease;
}

.buy-btn:hover {
  background: #111;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.buy-price {
  font-weight: 400;
  opacity: 0.6;
  margin-left: 2px;
}

/* ── Nav controls ── */
.nav-controls {
  margin-top: 16px;
  display: flex;
  gap: 32px;
  flex-shrink: 0;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: #888;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 18px;
  cursor: pointer;
  transition: color 0.25s, transform 0.2s ease;
}

.nav-btn:hover {
  color: #111;
  transform: translateY(-1px);
}

.nav-btn svg {
  width: 16px;
  height: 16px;
}

/* ── Thumbnail bar ── */
.thumbnail-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 72px;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.95), transparent);
  opacity: 0;
  transform: translateY(100%);
  transition: opacity 0.35s ease, transform 0.35s ease;
  overflow: hidden;
  z-index: 100;
}

.thumbnail-bar.visible {
  opacity: 1;
  transform: translateY(0);
}

.thumbnail-track {
  display: flex;
  gap: 6px;
  padding: 12px 16px;
  height: 100%;
  align-items: center;
  overflow-x: auto;
  scroll-behavior: smooth;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.thumbnail-track::-webkit-scrollbar {
  display: none;
}

.thumbnail-track img {
  height: 48px;
  width: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border: 2px solid transparent;
  opacity: 0.5;
  cursor: pointer;
  transition: opacity 0.25s, border-color 0.25s, transform 0.25s;
  flex-shrink: 0;
}

.thumbnail-track img:hover {
  opacity: 0.85;
  transform: scale(1.08);
}

.thumbnail-track img.active {
  opacity: 1;
  border-color: #111;
}

/* ── Lightbox ── */
/* ── Zoom (image scales in place, no overlay) ── */
.lightbox {
  display: none;
}

.zoom-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: #fff;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.zoom-backdrop.active {
  opacity: 1;
}

.zoom-clone {
  position: fixed;
  z-index: 9999;
  cursor: zoom-out;
  transition: transform 0.4s cubic-bezier(0.2, 0, 0.2, 1),
              top 0.4s cubic-bezier(0.2, 0, 0.2, 1),
              left 0.4s cubic-bezier(0.2, 0, 0.2, 1),
              width 0.4s cubic-bezier(0.2, 0, 0.2, 1),
              height 0.4s cubic-bezier(0.2, 0, 0.2, 1);
}

.image-container img {
  cursor: zoom-in;
}

/* ── Print preview modal ── */
.print-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
}

.print-modal.open {
  display: flex;
}

.print-modal-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  max-width: 90vw;
  max-height: 90vh;
  position: relative;
}

.print-close {
  position: absolute;
  top: -40px;
  right: -8px;
  background: none;
  border: none;
  color: #aaa;
  font-size: 28px;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s;
}

.print-close:hover {
  color: #fff;
}

.print-preview {
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wall-scene {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80vw;
  height: 60vh;
  background: #f5f0eb;
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.6) 0%, transparent 70%),
    linear-gradient(180deg, #f5f0eb 70%, #e8e0d8 100%);
  border-radius: 4px;
  position: relative;
}

.wall-frame {
  background: #fff;
  padding: 20px;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.15),
    0 12px 40px rgba(0, 0, 0, 0.1),
    inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  max-height: 48vh;
  max-width: 65vw;
  overflow: hidden;
  transition: aspect-ratio 0.4s ease;
}

.wall-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.print-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.print-sizes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.print-size-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #aaa;
  font-size: 13px;
  font-family: inherit;
  letter-spacing: 0.06em;
  padding: 8px 18px;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}

.print-size-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
}

.print-size-btn.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  border-color: #fff;
}

.print-dimensions {
  font-size: 12px;
  color: #777;
  letter-spacing: 0.04em;
}

.print-order-btn {
  padding: 10px 32px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #111;
  background: #fff;
  border: none;
  cursor: pointer;
  transition: background 0.25s, transform 0.2s;
}

.print-order-btn:hover {
  background: #e8e8e8;
  transform: scale(1.03);
}

.print-order-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.print-size-price {
  display: block;
  font-size: 11px;
  opacity: 0.5;
  margin-top: 2px;
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .gallery.grid-mode .grid-filters {
    padding: 60px 8px 0;
    gap: 6px;
  }

  .filter-btn {
    font-size: 11px;
    padding: 5px 12px;
  }

  .gallery.grid-mode .grid-view {
    width: 100%;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 6px;
    gap: 8px;
    padding: 12px 8px 8px;
  }

  .site-logo {
    top: 14px;
    font-size: 18px;
  }

  .site-tagline {
    font-size: 8px;
  }

  .view-toggle.about-toggle {
    top: 12px;
    right: 120px;
  }

  .view-toggle.stats-toggle {
    top: 12px;
    right: 84px;
  }

  .view-toggle.map-toggle {
    top: 12px;
    right: 48px;
  }

  .view-toggle {
    top: 12px;
    right: 12px;
  }
  .image-wrapper {
    max-width: 96vw;
  }

  .image-container img {
    max-width: 96vw;
    max-height: 60vh;
  }

  .image-caption .info-title {
    font-size: 13px;
  }

  .image-caption .info-location {
    font-size: 10px;
  }

  .info-camera {
    font-size: 10px;
  }

  .info-story {
    font-size: 10px;
  }

  .buy-btn {
    font-size: 10px;
    padding: 6px 16px;
  }

  .nav-controls {
    margin-top: 12px;
    gap: 16px;
  }

  .nav-btn {
    font-size: 11px;
    padding: 6px 14px;
  }
}
