/*
 * Buoscio Fine Art — portfolio-gallery.css
 * Christie's-style layout: thumbnail strip + main image + zoom viewer
 */

@import url('https://fonts.googleapis.com/css2?family=Bodoni+Moda:ital,opsz,wght@0,6..96,400;0,6..96,600;1,6..96,400&family=Josefin+Sans:wght@100;300;400&display=swap');

/* ── Tokens (same as portfolio-single.css) ── */
.pf-gallery-layout {
  --pf-bg:        #080808;
  --pf-surface:   #111111;
  --pf-border:    #222222;
  --pf-text:      #f0ede8;
  --pf-muted:     #666660;
  --pf-accent:    #c8a96e;
  --pf-plum:      #9b5c8a;
  --pf-font-disp: 'Bodoni Moda', Georgia, serif;
  --pf-font-ui:   'Josefin Sans', 'Helvetica Neue', sans-serif;
  --pf-ease:      cubic-bezier(0.25, 0.46, 0.45, 0.94);

  background: var(--pf-bg);
  color: var(--pf-text);
  font-family: var(--pf-font-ui);
  -webkit-font-smoothing: antialiased;
  padding-top: 70px;
}
.admin-bar .pf-gallery-layout { padding-top: 102px; }

.pf-gallery-layout *,
.pf-gallery-layout *::before,
.pf-gallery-layout *::after { box-sizing: border-box; }

/* ── Page header (shared with main template) ── */

/* ════════════════════════════════════════
   GALLERY STAGE
   ════════════════════════════════════════ */
.pf-gallery-stage {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  padding: 16px;
  min-height: 70vh;
}

/* ── Thumbnail strip (left column) ── */
.pf-thumb-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  max-height: 80vh;
  scrollbar-width: thin;
  scrollbar-color: var(--pf-border) transparent;
}
.pf-thumb-strip::-webkit-scrollbar { width: 4px; }
.pf-thumb-strip::-webkit-scrollbar-thumb { background: var(--pf-border); }

.pf-thumb {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--pf-surface);
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.25s ease;
  flex-shrink: 0;
}
.pf-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.25s ease;
}
.pf-thumb:hover { border-color: var(--pf-muted); }
.pf-thumb:hover img { opacity: 0.85; }
.pf-thumb.active { border-color: var(--pf-accent); }

/* ── Main image area (right column) ── */
.pf-gallery-main {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: var(--pf-surface);
  overflow: visible;  /* must be visible so absolute button isn't clipped */
  min-height: 50vh;
}

.pf-gallery-main-img-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
}

.pf-gallery-main-img {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
  transition: opacity 0.3s ease;
}

/* View Scale button — bottom left of image area */
.pf-view-scale-btn {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--pf-font-ui);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pf-muted);
  background: rgba(8,8,8,0.8);
  border: 1px solid var(--pf-border);
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  transition: all 0.25s ease;
}
.pf-view-scale-btn:hover { border-color: var(--pf-accent); color: var(--pf-accent); }

/* Image counter */
.pf-gallery-counter {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  font-family: var(--pf-font-ui);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--pf-muted);
}

/* ════════════════════════════════════════
   ARTWORK INFO
   ════════════════════════════════════════ */
.pf-gallery-info {
  border-top: 1px solid var(--pf-border);
  padding: 3.5rem clamp(1.5rem, 5vw, 4rem) 3rem;
}

/* Centred single column — everything stacks and centres */
.pf-gallery-info-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.75rem;
  max-width: 700px;
  margin: 0 auto;
}

/* Title */
.pf-gallery-title {
  font-family: var(--pf-font-disp);
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--pf-text);
  margin: 0;
  line-height: 1.15;
}

/* Fields — fixed-width block, centred as a unit */
.pf-gallery-fields {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.pf-gallery-dl {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin: 0;
  width: 360px;
  max-width: 100%;
}

.pf-gallery-dl-row {
  display: flex;
  align-items: baseline;
  gap: 0;
  width: 100%;
}

.pf-gallery-dl dt {
  font-family: var(--pf-font-ui);
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--pf-muted);
  font-weight: 400;
  width: 110px;
  min-width: 110px;
  flex-shrink: 0;
  text-align: right;
  padding-right: 1rem;
  line-height: 1.6;
}

.pf-gallery-dl dd {
  font-family: var(--pf-font-disp);
  font-size: 1rem;
  color: var(--pf-text);
  margin: 0;
  line-height: 1.6;
  text-align: left;
  flex: 1;
}

.pf-gallery-dl-notes dd {
  font-family: var(--pf-font-ui);
  font-size: 0.88rem;
  color: var(--pf-muted);
  line-height: 1.75;
}

/* Actions — centred below fields */
.pf-gallery-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.pf-gallery-price {
  font-family: var(--pf-font-disp);
  font-size: 2rem;
  font-weight: 400;
  color: var(--pf-text);
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0;
  text-align: center;
}

.pf-gallery-avail {
  font-family: var(--pf-font-ui);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.3rem 0.9rem;
  border: 1px solid;
  margin: 0;
  text-align: center;
}
.pf-gallery-avail.available   { color: #7ab87a; border-color: #3a5a3a; }
.pf-gallery-avail.unavailable { color: var(--pf-muted); border-color: var(--pf-border); }

.pf-gallery-enquire {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--pf-font-ui);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--pf-bg);
  background: var(--pf-accent);
  border: 1px solid var(--pf-accent);
  padding: 0.85rem 2.5rem;
  text-decoration: none;
  min-width: 220px;
  transition: all 0.3s ease;
}
.pf-gallery-enquire:hover { background: transparent; color: var(--pf-accent); }

.pf-gallery-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}
.pf-gallery-cat {
  font-family: var(--pf-font-ui);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pf-plum);
  border: 1px solid #3a1a3a;
  padding: 0.2rem 0.65rem;
  text-decoration: none;
  transition: all 0.25s ease;
}
.pf-gallery-cat:hover { border-color: var(--pf-plum); color: var(--pf-text); }

/* ════════════════════════════════════════
   ZOOM VIEWER OVERLAY
   ════════════════════════════════════════ */
.pf-zoom-viewer {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  flex-direction: column;
  background: #000;
  pointer-events: none;
  overflow: hidden;
  -webkit-overflow-scrolling: auto;
}
.pf-zoom-viewer.open {
  display: -webkit-flex;
  display: flex;
  pointer-events: all;
}

.pf-zoom-topbar {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  position: relative;
  height: 52px;
  background: #111;
  border-bottom: 1px solid #2a2a2a;
  z-index: 2;
}

.pf-zoom-nav { display: flex; align-items: center; gap: 1.5rem; }

.pf-zoom-nav-btn {
  background: none; border: 1px solid #333; color: #aaa;
  font-size: 1.2rem; cursor: pointer; line-height: 1;
  min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
  -webkit-appearance: none; appearance: none;
}
.pf-zoom-nav-btn:hover:not(:disabled) { color: #fff; border-color: #c8a96e; }
.pf-zoom-nav-btn:disabled { opacity: 0.2; cursor: default; }

.pf-zoom-counter {
  font-family: 'Josefin Sans', sans-serif; font-size: 0.7rem;
  letter-spacing: 0.14em; color: #666; min-width: 60px; text-align: center;
}

.pf-zoom-close {
  position: absolute; right: 1rem; top: 50%; transform: translateY(-50%);
  background: none; border: 1px solid #555; color: #ccc;
  font-family: 'Josefin Sans', sans-serif; font-size: 0.65rem;
  letter-spacing: 0.18em; text-transform: uppercase;
  padding: 0.4rem 1rem; cursor: pointer;
  min-height: 44px; min-width: 44px; z-index: 3;
  -webkit-appearance: none; appearance: none;
}
.pf-zoom-close:hover { border-color: #c8a96e; color: #c8a96e; }

/* Canvas — key fix for iOS WebView */
.pf-zoom-canvas {
  -webkit-flex: 1 1 auto;
  flex: 1 1 auto;
  overflow: hidden;
  position: relative;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  z-index: 1;
  min-height: 0;        /* required for Safari flex children */
  touch-action: none;   /* prevent scroll interference */
}
.pf-zoom-canvas.grabbing { cursor: grabbing; }

.pf-zoom-img-wrap {
  position: relative;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  -webkit-transform-origin: center center;
  transform-origin: center center;
  -webkit-transform: translate(0,0) scale(1);
  transform: translate(0,0) scale(1);
}

.pf-zoom-img {
  display: block;
  /* Avoid calc/vh — use fixed percentages that work in all WebViews */
  max-width: 92vw;
  max-height: 72vh;
  width: auto;
  height: auto;
  object-fit: contain;
  -webkit-user-select: none; user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;  /* prevent iOS long-press menu */
  pointer-events: none;
}

.pf-zoom-controls {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  align-items: center;
  gap: 1rem;
  justify-content: center;
  height: 56px;
  background: #111;
  border-top: 1px solid #2a2a2a;
  padding-inline: 2rem;
  z-index: 2;
}

.pf-zoom-ctrl-btn {
  background: none; border: 1px solid #333; color: #aaa;
  font-size: 1.1rem; cursor: pointer; line-height: 1;
  min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; -webkit-appearance: none; appearance: none;
}
.pf-zoom-ctrl-btn:hover { color: #fff; border-color: #c8a96e; }

.pf-zoom-slider {
  flex: 1; max-width: 500px; height: 2px;
  -webkit-appearance: none; appearance: none;
  background: #333; outline: none; cursor: pointer;
}
.pf-zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px; height: 24px; border-radius: 50%;
  background: #c8a96e; cursor: pointer; border: none;
}
.pf-zoom-slider::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%;
  background: #c8a96e; cursor: pointer; border: none;
}
.pf-zoom-ctrl-btn:disabled,
.pf-zoom-slider:disabled { opacity: 0.2; cursor: default; pointer-events: none; }

/* ════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════ */
@media (max-width: 768px) {
  .pf-gallery-stage {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    padding: 8px;
    gap: 8px;
  }
  /* On mobile: thumbnail strip goes horizontal below main image */
  .pf-thumb-strip {
    order: 2;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: visible;
    max-height: none;
    padding-bottom: 4px;
  }
  .pf-thumb {
    width: 72px;
    flex-shrink: 0;
  }
  .pf-gallery-main { order: 1; min-height: 50vw; }
  .pf-gallery-info-inner {
    gap: 1.5rem;
  }
  .pf-gallery-actions { align-items: center; }
  .pf-gallery-cats    { justify-content: center; }
  .pf-gallery-dl { width: 100%; }
  .pf-gallery-dl-row { flex-direction: column; align-items: center; gap: 0.1rem; }
  .pf-gallery-dl dt { text-align: center; width: auto; padding-right: 0; }
  .pf-gallery-dl dd { text-align: center; }
}

@media (max-width: 480px) {
  .pf-gallery-dl-row { grid-template-columns: 90px 1fr; }
  .pf-zoom-slider { max-width: 200px; }
}

/* ── Video thumbnail in gallery strip ── */
.pf-thumb-video-icon {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.25rem;
  color: rgba(255,255,255,0.9);
  z-index: 2;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}
.pf-thumb { position: relative; }

/* Video in gallery main area */
.pf-gallery-main video {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  display: block;
  background: #000;
  cursor: default;
}

/* Disabled zoom controls when viewing video */
.pf-zoom-ctrl-btn:disabled,
.pf-zoom-slider:disabled {
  opacity: 0.2;
  cursor: default;
  pointer-events: none;
}
