/* ==============================
   GALLERY SYSTEM STYLES
============================== */

#gallery-container {
  max-width: 100%;
  margin: 0 auto;
  padding: 0.5rem 1rem 2rem;
}

.gallery-series {
  margin-bottom: 1.5rem;
}

.series-header {
  text-align: left;
  margin-bottom: 1rem;
  padding-left: 0.5rem;
}

.series-title {
  font-size: 1.2rem;
  font-weight: normal;
  margin: 0 0 0.2rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.series-subtitle {
  font-size: 0.95rem;
  color: #666;
  font-style: italic;
  margin: 0 0 0.4rem;
}

/* Description with expand/collapse */
.series-desc-wrap {
  max-width: 700px;
}

.series-desc {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #333;
  margin: 0 0 0.3rem;
  /* Desktop: show 2 lines then truncate */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.series-desc.expanded {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.desc-toggle {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.82rem;
  color: #666;
  cursor: pointer;
  text-decoration: underline;
  font-family: Georgia, serif;
  display: block;
  margin-bottom: 0.5rem;
}

.desc-toggle:hover { color: #000; }

/* Horizontal Scroll Row */
.series-scroll-row {
  display: flex;
  gap: 0.8rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.5rem 0 0.8rem;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}

.series-scroll-row::-webkit-scrollbar { height: 4px; }
.series-scroll-row::-webkit-scrollbar-track { background: transparent; }
.series-scroll-row::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.gallery-thumb-container {
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.gallery-thumb-container:hover { transform: translateY(-3px); }

.gallery-thumb {
  height: 280px;
  width: auto;
  display: block;
  object-fit: contain;
  transition: opacity 0.3s ease;
}

.gallery-thumb:hover { opacity: 0.9; }

.museum-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.85);
  color: white;
  padding: 0.4rem 0.5rem;
  font-size: 0.8rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  text-align: center;
}

.gallery-thumb-container:hover .museum-label { opacity: 1; }

/* ==============================
   LIGHTBOX
============================== */

.lightbox {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.95);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.lightbox.active { display: flex; }

.lightbox-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem 1rem;
}

/* Image fills available space above controls */
.lightbox-image-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  width: 100%;
  max-width: 900px;
  cursor: zoom-in;
  position: relative;
}

.lightbox-loader {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  pointer-events: none;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.lightbox-image-container.zoomed { cursor: grab; }
.lightbox-image-container.zoomed:active { cursor: grabbing; }

#lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
  transition: opacity 0.3s ease;
}

#lightbox-image.zoomed {
  max-width: none;
  max-height: none;
}

/* Close button */
.lightbox-close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  font-size: 2rem;
  line-height: 1;
  padding: 0.2rem 0.7rem;
  cursor: pointer;
  z-index: 10001;
  transition: background 0.2s;
}

.lightbox-close:hover { background: rgba(255,255,255,0.25); }

/* Caption */
.lightbox-caption {
  color: white;
  font-size: 0.9rem;
  text-align: center;
  padding: 0.5rem 1rem 0.25rem;
  max-width: 700px;
}

/* Controls row - ALL BUTTONS AT BOTTOM */
.lightbox-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem 0.75rem;
  flex-wrap: wrap;
  width: 100%;
  max-width: 700px;
}

.lightbox-controls button {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.5rem 1.2rem;
  transition: background 0.2s;
  white-space: nowrap;
}

.lightbox-controls button:hover { background: rgba(255,255,255,0.25); }

.lightbox-prev, .lightbox-next {
  font-size: 1.8rem !important;
  padding: 0.3rem 1rem !important;
  line-height: 1;
}

.lightbox-inquire {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.85rem !important;
}

.lightbox-inquire.unavailable {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
  text-decoration: line-through;
}

/* Zoom slider - desktop only */
.zoom-slider-wrap {
  display: none; /* shown via JS when zoomed on desktop */
  align-items: center;
  gap: 0.4rem;
}

.zoom-slider {
  width: 80px;
  accent-color: white;
  cursor: pointer;
}

.zoom-label {
  color: white;
  font-size: 0.75rem;
  min-width: 35px;
}

/* Series Transition Card */
.lightbox-series-card {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  text-align: center;
  padding: 2rem;
  min-height: 200px;
}

.lightbox-series-card h2 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 3px;
}

.lightbox-series-card p {
  font-size: 1.2rem;
  color: #ccc;
  font-style: italic;
}

.series-arrow { font-size: 3rem; margin-top: 0.5rem; }

/* ==============================
   LIST VIEW
============================== */

.list-view .series-scroll-row {
  display: block;
}

.list-view .gallery-thumb-container {
  margin: 1.5rem auto;
  max-width: 800px;
  text-align: center;
}

.list-view .gallery-thumb {
  height: auto;
  max-width: 100%;
  margin: 0 auto 0.75rem;
}

.list-view .museum-label {
  position: static;
  opacity: 1;
  background: transparent;
  color: #000;
  padding: 0.4rem 0;
  font-size: 0.95rem;
}

.list-view .museum-label::before {
  content: 'Andrew Newell Walther — ';
  font-weight: bold;
}

/* ==============================
   MOBILE
============================== */

@media (max-width: 768px) {

  #gallery-container {
    padding: 0.25rem 0.5rem 1.5rem;
  }

  .gallery-series {
    margin-bottom: 1rem;
  }

  .series-header {
    padding-left: 0.25rem;
    margin-bottom: 0.5rem;
  }

  .series-title { font-size: 1rem; }
  .series-subtitle { font-size: 0.85rem; }

  /* On mobile: hide description by default, show toggle */
  .series-desc {
    -webkit-line-clamp: 1;
    font-size: 0.82rem;
  }

  /* Landscape: also show only 1 line */
  @media (orientation: landscape) {
    .series-desc {
      -webkit-line-clamp: 1;
    }
  }

  .gallery-thumb { height: 200px; }

  /* Lightbox image takes most of screen */
  .lightbox-content {
    padding: 2.5rem 0.5rem 0.5rem;
  }

  .lightbox-caption {
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem 0.1rem;
  }

  /* Controls at bottom, more spacing to prevent accidental taps */
  .lightbox-controls {
    gap: 0.6rem;
    padding: 0.3rem 0.5rem 0.5rem;
    max-width: 100%;
  }

  .lightbox-controls button {
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem;
  }

  .lightbox-prev, .lightbox-next {
    font-size: 1.5rem !important;
    padding: 0.3rem 0.75rem !important;
  }

  .lightbox-inquire {
    font-size: 0.75rem !important;
    padding: 0.5rem 0.6rem !important;
  }

  /* No slider on mobile */
  .zoom-slider-wrap { display: none !important; }

  .lightbox-close {
    top: 0.4rem;
    right: 0.5rem;
    font-size: 1.6rem;
  }
}

/* Social icon styles (for gallery pages footer) */
.social-icon {
  width: 15px;
  height: 15px;
  object-fit: contain;
  vertical-align: middle;
}

/* Print */
@media print {
  .lightbox, #list-view-toggle { display: none !important; }
  .gallery-thumb { max-width: 100%; height: auto; }
  .museum-label { position: static; opacity: 1; background: white; color: black; }
}