/* ══════════════════════════════════════
   CATALOG + GALLERY + MASONRY + LIGHTBOX
   ══════════════════════════════════════ */

/* ── CATALOG SPLIT LAYOUT ── */
.catalog-split {
  display: grid;
  grid-template-columns: 42% 58%;
  height: 100vh;
  height: 100dvh;
}



/* Film grain noise overlay */
.catalog-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.03;
  z-index: 100;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 128px;
}

/* ── LEFT PANEL ── */
.catalog-left {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 100px 48px 40px;
  position: relative;
  z-index: 2;
}

.catalog-left-header { margin-bottom: 8px; }

/* canonical .catalog-label lives in base.css */
.catalog-label { margin-bottom: 8px; }

.catalog-heading {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 300;
  font-style: italic;
  color: var(--text-strong);
  line-height: 1.15;
}

/* Album list */
.catalog-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  padding: 24px 0;
  overflow-y: auto;
}

.catalog-item {
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  text-decoration: none;
}

.catalog-item:hover {
  background: rgba(255,255,255,0.02);
}

.catalog-item.active {
  background: linear-gradient(to right, rgba(255,255,255,0.06), transparent);
}

/* Series label (Adventure Series / Portrait Series) */
.catalog-series-label {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--line-faint);
  font-weight: 300;
  padding: 20px 16px 6px;
}

.catalog-series-label + .catalog-item {
  /* no extra top margin for first item after label */
}

.catalog-series-label:not(:first-child) {
  margin-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 20px;
}

.catalog-item-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 17px;
  font-weight: 300;
  color: var(--text-secondary);
  transition: color 0.4s ease;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.catalog-item:hover .catalog-item-title,
.catalog-item.active .catalog-item-title {
  color: rgba(255,255,255,0.9);
}

.catalog-item-date {
  font-size: 10px;
  font-weight: 300;
  letter-spacing: 0.15em;
  color: var(--line-faint);
  transition: color 0.4s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.catalog-item:hover .catalog-item-date,
.catalog-item.active .catalog-item-date {
  color: var(--text-muted);
}

/* Inline map in left panel */
.catalog-map-inline {
  margin-top: auto;
  padding-top: 24px;
}
.catalog-map-label {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 300;
  font-style: italic;
  color: var(--text-mid);
  margin-bottom: 16px;
}

/* ── RIGHT PANEL ── */
.catalog-right {
  position: relative;
  overflow: hidden;
}

.catalog-covers {
  position: absolute;
  inset: 0;
  display: flex;
}

.catalog-cover-group {
  position: absolute;
  inset: 0;
  column-count: 2;
  column-gap: 4px;
  padding: 4px;
  opacity: 0;
  transition: opacity 0.7s ease;
  overflow: hidden;
  background: var(--bg);
}

/* Single column when there's only one photo */
.catalog-cover-group[data-count="1"] { column-count: 1; }


.catalog-cover-group.active {
  opacity: 1;
}

.catalog-cover-img {
  width: 100%;
  height: auto;
  display: block;
  margin-bottom: 4px;
  break-inside: avoid;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Gradient overlays */
.catalog-right-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    var(--bg) 0%,
    rgba(24,24,27,0.3) 20%,
    transparent 50%
  );
  z-index: 1;
  pointer-events: none;
}

.catalog-right-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(24,24,27,0.3) 100%);
  z-index: 1;
  pointer-events: none;
}

/* Corner index number */
.catalog-corner-index {
  position: absolute;
  top: 48px;
  right: 48px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 72px;
  font-weight: 300;
  color: rgba(255,255,255,0.04);
  z-index: 2;
  pointer-events: none;
  line-height: 1;
}

/* Info overlay — glass with gradient fade */
.catalog-right-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  pointer-events: none;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  padding: 60px 48px 48px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 40%);
  mask-image: linear-gradient(to bottom, transparent 0%, black 40%);
}

.catalog-cover-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 300;
  font-style: italic;
  color: var(--text-strong);
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin-bottom: 16px;
  text-shadow: 0 2px 30px rgba(0,0,0,0.5);
}

.catalog-cover-meta {
  display: flex;
  gap: 24px;
  align-items: center;
}

.catalog-cover-meta span {
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 300;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.catalog-cover-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
}

.catalog-cover-btn {
  display: inline-block;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  pointer-events: all;
  transition: color 0.3s ease;
  text-decoration: none;
}

.catalog-cover-btn:hover {
  color: rgba(255,255,255,0.9);
}

/* ── BACK TO CATALOG ── */
.gallery-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-mid);
  text-decoration: none;
  margin-bottom: 32px;
  transition: color 0.2s;
}
.gallery-back:hover { color: var(--text-strong); }
.gallery-back span { transition: transform 0.2s; }
.gallery-back:hover span { transform: translateX(-4px); }

/* ── GALLERY PAGE ── */
.gallery-header {
  /* --section-padding caps the content width — no max-width of its own,
     so the title column lines up with the grid below */
  padding: 160px var(--section-padding) 60px;
}

/* canonical .gallery-series / .gallery-page-title / .gallery-subtitle live in base.css */
.gallery-subtitle { margin-bottom: 12px; }

.gallery-count {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--line-faint);
  display: inline;
}

/* ── Color Sort Toggle (dark, right-angle) ── */
.color-sort-wrapper {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 10px;
}
.color-sort-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--line-faint);
  margin-right: 8px;
}
.color-sort-toggle {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  gap: 0;
}
.color-sort-opt {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  border-radius: 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--line-faint);
  cursor: pointer;
  padding: 8px 12px;
  transition: all 0.25s ease;
  white-space: nowrap;
}
.color-sort-opt .color-sort-check {
  display: none;
}
.color-sort-opt.active {
  background: none;
  color: var(--line-faint);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.color-sort-opt.active .color-sort-check {
  display: none;
}
.color-sort-opt:hover:not(.active) {
  color: var(--text-primary);
}
body.admin-editing .color-sort-wrapper {
  display: none;
}

/* ── Masonry grid — flex columns with JS round-robin distribution ── */
.masonry-grid {
  display: flex;
  gap: 28px;
  padding: 0 var(--section-padding) 120px;
}

.masonry-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Pottery grid — square tiles, use CSS Grid (uniform height is fine) */
#pottery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-flow: dense; /* let smaller tiles backfill around 2×2 features */
  gap: 10px;
}
#pottery-grid .masonry-column { display: contents; }
#pottery-grid .masonry-item img { aspect-ratio: 1/1; object-fit: cover; }
/* Featured pieces span a 2×2 block */
#pottery-grid .masonry-item[data-featured="true"] {
  grid-column: span 2;
  grid-row: span 2;
}

.masonry-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  min-height: 60px;
}

.masonry-item.revealed {
  opacity: 1;
  transform: translateY(0);
  min-height: 0;
}

/* Dominant-color placeholders (gallery.js grids only): the tile reveals as a
   colored box when it nears the viewport and the photo fades in over it */
.masonry-grid .masonry-item { min-height: 220px; }
.masonry-grid .masonry-item.loaded { min-height: 0; }
.masonry-grid .masonry-item img {
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.6s ease;
}
.masonry-grid .masonry-item.loaded img { opacity: 1; }

.masonry-item img {
  width: 100%;
  display: block;
  transition: transform 0.6s ease;
  background: rgba(128,128,128,0.1);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.masonry-item:hover img,
.masonry-item.touch-hover img { transform: scale(1.03); }

/* Deep-linked photo (#photo-{id} from the home page): brief glow marking
   the photo the visitor arrived at */
.masonry-item.deep-linked { animation: deep-link-pulse 2.6s ease-out both; }
@keyframes deep-link-pulse {
  0%, 50% { box-shadow: 0 0 0 2px var(--accent); }
  100% { box-shadow: 0 0 0 2px transparent; }
}

/* Heart / Like button */
.photo-heart {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 2;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  transition: opacity 0.3s ease;
  opacity: 0;
}
.masonry-item:hover .photo-heart,
.masonry-item.touch-hover .photo-heart { opacity: 1; }
.photo-heart.liked { opacity: 1; }
.photo-heart:hover { color: rgba(255, 255, 255, 1); }
.photo-heart.liked .heart-icon { color: var(--danger); }
.heart-icon { font-size: 14px; line-height: 1; transition: transform 0.3s ease, color 0.3s ease; }
.photo-heart:active .heart-icon { transform: scale(1.3); }

/* Masonry items with descriptions (pottery) — liquid glass hover overlay */
.masonry-item.has-description {
  position: relative;
  cursor: pointer;
  transform: translateZ(0);
}

.masonry-item-info {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  background: rgba(255,255,255,0.06);
  backdrop-filter: var(--glass-blur-light);
  -webkit-backdrop-filter: var(--glass-blur-light);
  border: var(--glass-border);
  opacity: 0;
  visibility: hidden;
  will-change: opacity;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.masonry-item.has-description:hover .masonry-item-info,
.masonry-item.has-description.touch-hover .masonry-item-info {
  opacity: 1;
  visibility: visible;
}

.masonry-item-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  font-weight: 300;
  color: rgba(255,255,255,0.95);
  margin-bottom: 4px;
}

.masonry-item-desc {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

/* In-stock marker — small logo stamp, only visible in the hover overlay */
.masonry-item-stock {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 24px;
  height: 24px;
  background: url('/logo.png') center / contain no-repeat;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.5s ease 0.1s, transform 0.5s ease 0.1s;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

.masonry-item.has-description:hover .masonry-item-stock,
.masonry-item.has-description.touch-hover .masonry-item-stock {
  opacity: 0.9;
  transform: translateY(0);
}

/* ── GALLERY EMPTY STATE ── */
.gallery-empty {
  text-align: center;
  padding: 80px 0;
  width: 100%;
}
.gallery-empty p {
  font-size: 14px;
  color: var(--text-mid);
  letter-spacing: 0.08em;
}

/* ── LIGHTBOX ── */
#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(18,18,18,0.97);
  z-index: var(--z-lightbox);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

#lightbox.open {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.25s ease;
}

@keyframes lightbox-zoom-in {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

#lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  animation: lightbox-zoom-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

#lightbox.zoomed img { cursor: grab; }

#lightbox.no-art .lightbox-art-bar,
#lightbox.no-art .lightbox-art-tools { display: none; }

@media (prefers-reduced-motion: reduce) {
  #lightbox, #lightbox img {
    transition: none;
    animation: none;
  }
}

.lightbox-close {
  position: absolute; top: 24px; right: 32px;
  color: var(--text-strong); font-size: 28px; cursor: pointer; background: none; border: none;
  min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
  outline: none;
  z-index: 10;
}

.lightbox-close:focus-visible {
  outline: 1px solid rgba(255,255,255,0.3);
  outline-offset: 4px;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 36px;
  cursor: pointer;
  padding: 20px;
  min-width: 44px; min-height: 44px;
  transition: color 0.2s;
  outline: none;
}

.lightbox-nav:focus-visible {
  outline: 1px solid rgba(255,255,255,0.3);
  outline-offset: 4px;
}

.lightbox-nav:hover { color: var(--text-strong); }
.lightbox-nav:disabled {
  color: rgba(255,255,255,0.2);
  cursor: default;
}
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.lightbox-caption {
  /* Static flow: the lightbox is a centered flex column (palette and counter
     are switched to static in generative-art.css). Holds only the
     View series/album link — photo titles are not displayed. */
  margin-top: 14px;
  display: flex;
  justify-content: center;
}

.lightbox-caption-link {
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: color 0.2s;
}

.lightbox-caption-link:hover { color: var(--text-strong); }

.lightbox-caption-link:focus-visible {
  outline: 1px solid rgba(255,255,255,0.3);
  outline-offset: 3px;
}

.lightbox-counter {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-primary);
  font-size: 10px;
  letter-spacing: 0.15em;
}

/* ── COLOR PALETTE ── */
.lightbox-palette {
  position: absolute;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  align-items: center;
}

.palette-swatch {
  width: 28px;
  height: 28px;
  border-radius: 0;
  border: 1px solid rgba(255,255,255,0.2);
  cursor: default;
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,0.3),
    inset 0 -1px 1px rgba(0,0,0,0.15),
    0 4px 16px rgba(0,0,0,0.3);
}

.palette-swatch:hover {
  transform: scale(1.15);
  opacity: 1;
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,0.4),
    inset 0 -1px 1px rgba(0,0,0,0.1),
    0 6px 24px rgba(0,0,0,0.4);
}

.palette-hex {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-primary);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.palette-swatch:hover .palette-hex {
  opacity: 1;
}

/* ── FOCUS-VISIBLE STYLES ── */
.catalog-item:focus-visible {
  outline: 1px solid rgba(255,255,255,0.3);
  outline-offset: -1px;
}
.photo-heart:focus-visible {
  outline: 1px solid rgba(255,255,255,0.3);
  outline-offset: 2px;
}
.color-sort-opt:focus-visible {
  outline: 1px solid rgba(255,255,255,0.3);
  outline-offset: 2px;
}

/* ── HOVER MOTION ── */
.lightbox-prev:hover { transform: translateY(-50%) translateX(-3px); }
.lightbox-next:hover { transform: translateY(-50%) translateX(3px); }

.photo-heart:hover .heart-icon { transform: scale(1.15); }
