/* LowKei Photography Gallery — Public CSS
   CSS Variables (overridable per-gallery via inline style):
   --lksg-primary  : #1a1a2e  (backgrounds, controls)
   --lksg-accent   : #c9a84c  (gold highlights)
   --lksg-bg       : #0a0a0a  (page background)
   --lksg-text     : #f2ede6  (text on dark)
   --lksg-overlay  : rgba(10,10,10,0.75) (caption overlay)
   --lksg-radius   : 4px
*/

.lksg-gallery-wrap {
  --lksg-primary:  #1a1a2e;
  --lksg-accent:   #c9a84c;
  --lksg-bg:       #0a0a0a;
  --lksg-text:     #f2ede6;
  --lksg-muted:    rgba(242,237,230,.55);
  --lksg-overlay:  rgba(10,10,10,0.78);
  --lksg-radius:   4px;
  --lksg-trans:    800ms;

  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--lksg-text);
  position: relative;
  width: 100%;
}

/* ── Gallery Header ── */
.lksg-gallery-header { margin-bottom: 20px; }
.lksg-gallery-title { font-family: 'Cormorant Garamond', Georgia, serif; font-size: clamp(28px, 4vw, 48px); font-weight: 300; color: var(--lksg-text); letter-spacing: -.5px; margin: 0 0 8px; }
.lksg-gallery-desc  { font-size: 14px; color: var(--lksg-muted); line-height: 1.7; margin: 0 0 12px; }
.lksg-gallery-meta  { display: flex; align-items: center; gap: 16px; font-size: 12px; color: var(--lksg-muted); }
.lksg-img-counter   { letter-spacing: 1px; text-transform: uppercase; font-size: 11px; }
.lksg-zip-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(201,168,76,.1); border: 1px solid rgba(201,168,76,.3);
  color: var(--lksg-accent); padding: 5px 14px; border-radius: 20px;
  font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  text-decoration: none; transition: background .2s;
}
.lksg-zip-btn svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; }
.lksg-zip-btn:hover { background: rgba(201,168,76,.2); color: var(--lksg-accent); }

/* ════════════════════════════════════════════
   CAROUSEL
════════════════════════════════════════════ */
.lksg-carousel {
  position: relative;
  background: var(--lksg-bg);
  border-radius: var(--lksg-radius);
  overflow: hidden;
  user-select: none;
}

/* Stage: needs explicit height (not just min-height) so
   position:absolute children can compute height:100% correctly */
.lksg-carousel-stage {
  position: relative;
  width: 100%;
  height: 280px;      /* JS overrides this with setStageHeight() */
  min-height: 200px;
}

/* Every slide: absolute, full stage size, crossfade via opacity */
.lksg-slide {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--lksg-trans, 800ms) ease;
  z-index: 1;
}

.lksg-slide.active {
  opacity: 1;
  pointer-events: all;
  z-index: 2;
}

/* Slide inner: center image */
.lksg-slide-inner {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* The image drives the stage height via JS — set max-height */
.lksg-slide img {
  display: block;
  max-width: 100%;
  max-height: 75vh;
  width: auto;
  height: auto;
  object-fit: contain;
  background: var(--lksg-bg);
}

/* Caption */
.lksg-slide-caption {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--lksg-overlay);
  padding: 18px 56px 18px 24px;
  backdrop-filter: blur(8px);
  transform: translateY(100%);
  transition: transform .4s ease;
}
.lksg-slide.active:hover .lksg-slide-caption,
.lksg-carousel:hover .lksg-slide.active .lksg-slide-caption { transform: translateY(0); }
.lksg-slide-caption strong { display: block; font-size: 15px; color: var(--lksg-text); margin-bottom: 4px; font-weight: 500; }
.lksg-slide-caption span   { font-size: 13px; color: var(--lksg-muted); line-height: 1.5; }

/* Download button on slide */
.lksg-slide-dl {
  position: absolute; bottom: 16px; right: 16px;
  background: rgba(201,168,76,.15); border: 1px solid rgba(201,168,76,.4);
  color: var(--lksg-accent); border-radius: 50%; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; transition: background .2s; opacity: 0; transition: opacity .3s;
}
.lksg-slide.active:hover .lksg-slide-dl,
.lksg-carousel:hover .lksg-slide-dl { opacity: 1; }
.lksg-slide-dl svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; }
.lksg-slide-dl:hover { background: rgba(201,168,76,.3); }

/* Prev / Next */
.lksg-carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(26,26,46,.75); border: 1px solid rgba(201,168,76,.2);
  color: var(--lksg-accent); width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 10;
  opacity: 0; transition: opacity .3s, background .2s;
  backdrop-filter: blur(4px);
}
.lksg-carousel:hover .lksg-carousel-btn { opacity: 1; }
.lksg-carousel-btn:hover { background: rgba(201,168,76,.2); }
.lksg-btn-prev { left: 14px; }
.lksg-btn-next { right: 14px; }
.lksg-carousel-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

/* Progress bar */
.lksg-progress-bar { position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: rgba(255,255,255,.1); z-index: 5; }
.lksg-progress-fill { height: 100%; background: var(--lksg-accent); width: 0%; transition: width linear; transform-origin: left; }

/* Dots */
.lksg-dots { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; z-index: 10; }
.lksg-dot {
  width: 6px; height: 6px; border-radius: 50%; border: none;
  background: rgba(242,237,230,.3); cursor: pointer;
  transition: background .25s, transform .25s;
  padding: 0;
}
.lksg-dot.active { background: var(--lksg-accent); transform: scale(1.4); }

/* Counter */
.lksg-slide-counter {
  position: absolute; top: 14px; right: 16px; z-index: 10;
  font-size: 11px; letter-spacing: 1.5px; color: rgba(242,237,230,.6);
  background: rgba(10,10,10,.5); padding: 4px 10px; border-radius: 12px;
  backdrop-filter: blur(4px);
}

/* Pause/Play */
.lksg-pause-btn {
  position: absolute; top: 14px; left: 14px; z-index: 10;
  background: rgba(10,10,10,.5); border: 1px solid rgba(201,168,76,.2);
  color: rgba(242,237,230,.6); border-radius: 50%; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: color .2s, border-color .2s;
  opacity: 0; transition: opacity .3s;
  backdrop-filter: blur(4px);
}
.lksg-carousel:hover .lksg-pause-btn { opacity: 1; }
.lksg-pause-btn:hover { color: var(--lksg-accent); border-color: rgba(201,168,76,.5); }
.lksg-pause-btn svg { width: 12px; height: 12px; fill: currentColor; }

/* ── Thumbnail Strip ── */
.lksg-thumbstrip {
  margin-top: 6px;
  overflow: hidden;
  position: relative;
}
.lksg-thumbstrip::before,
.lksg-thumbstrip::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 40px; z-index: 2; pointer-events: none;
}
.lksg-thumbstrip::before { left: 0;  background: linear-gradient(to right, var(--lksg-bg), transparent); }
.lksg-thumbstrip::after  { right: 0; background: linear-gradient(to left,  var(--lksg-bg), transparent); }
.lksg-thumbstrip-inner { display: flex; gap: 4px; overflow-x: auto; padding: 0 4px; scrollbar-width: none; }
.lksg-thumbstrip-inner::-webkit-scrollbar { display: none; }
.lksg-thumb {
  flex-shrink: 0; width: 64px; height: 48px;
  background: #111 center/cover no-repeat; border: 2px solid transparent;
  border-radius: 3px; cursor: pointer; transition: border-color .2s, opacity .2s;
  opacity: .55; padding: 0;
}
.lksg-thumb.active, .lksg-thumb:hover { border-color: var(--lksg-accent); opacity: 1; }

/* ════════════════════════════════════════════
   GRID
════════════════════════════════════════════ */
.lksg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 3px;
}
.lksg-grid-item { position: relative; overflow: hidden; aspect-ratio: 4/3; }
.lksg-grid-thumb {
  width: 100%; height: 100%;
  background: #111 center/cover no-repeat;
  transition: transform .5s cubic-bezier(.25,.46,.45,.94);
}
.lksg-grid-item:hover .lksg-grid-thumb { transform: scale(1.04); }
.lksg-grid-overlay {
  position: absolute; inset: 0;
  background: var(--lksg-overlay);
  display: flex; align-items: center; justify-content: center; gap: 12px;
  opacity: 0; transition: opacity .3s;
}
.lksg-grid-item:hover .lksg-grid-overlay { opacity: 1; }
.lksg-grid-open, .lksg-grid-dl {
  background: rgba(201,168,76,.15); border: 1px solid rgba(201,168,76,.5);
  color: var(--lksg-accent); width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; text-decoration: none; transition: background .2s;
  font-size: 15px;
}
.lksg-grid-open:hover, .lksg-grid-dl:hover { background: rgba(201,168,76,.3); }
.lksg-grid-open svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.lksg-grid-cap {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--lksg-overlay); padding: 10px 12px;
  transform: translateY(100%); transition: transform .3s;
}
.lksg-grid-item:hover .lksg-grid-cap { transform: translateY(0); }
.lksg-grid-cap strong { display: block; font-size: 13px; color: var(--lksg-text); margin-bottom: 2px; }
.lksg-grid-cap span   { font-size: 11px; color: var(--lksg-muted); }

/* ════════════════════════════════════════════
   MASONRY
════════════════════════════════════════════ */
.lksg-masonry {
  columns: 3 280px;
  column-gap: 3px;
}
.lksg-masonry-item {
  break-inside: avoid;
  margin-bottom: 3px;
  position: relative;
  overflow: hidden;
}
.lksg-masonry-item img { width: 100%; display: block; transition: transform .5s ease; }
.lksg-masonry-item:hover img { transform: scale(1.03); }
.lksg-masonry-overlay {
  position: absolute; inset: 0;
  background: var(--lksg-overlay);
  display: flex; align-items: center; justify-content: center; gap: 12px;
  opacity: 0; transition: opacity .3s;
}
.lksg-masonry-item:hover .lksg-masonry-overlay { opacity: 1; }

/* ════════════════════════════════════════════
   LIGHTBOX
════════════════════════════════════════════ */
.lksg-lightbox {
  position: fixed; inset: 0; z-index: 99999;
  display: flex; align-items: center; justify-content: center;
}
.lksg-lightbox-backdrop {
  position: absolute; inset: 0;
  background: rgba(5,5,8,.96);
  backdrop-filter: blur(12px);
}
.lksg-lb-close {
  position: absolute; top: 20px; right: 24px; z-index: 10;
  background: none; border: none; color: rgba(242,237,230,.5);
  font-size: 32px; line-height: 1; cursor: pointer; transition: color .2s;
}
.lksg-lb-close:hover { color: var(--lksg-accent); }
.lksg-lb-prev, .lksg-lb-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(26,26,46,.6); border: 1px solid rgba(201,168,76,.2);
  color: var(--lksg-accent); width: 50px; height: 50px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 10; transition: background .2s;
  backdrop-filter: blur(4px);
}
.lksg-lb-prev { left: 20px; } .lksg-lb-next { right: 20px; }
.lksg-lb-prev svg, .lksg-lb-next svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.lksg-lb-prev:hover, .lksg-lb-next:hover { background: rgba(201,168,76,.2); }
.lksg-lb-stage {
  position: relative; z-index: 5;
  max-width: 90vw; max-height: 88vh;
  display: flex; flex-direction: column; align-items: center;
}
.lksg-lb-img {
  max-width: 90vw; max-height: 80vh;
  object-fit: contain; display: block;
  border-radius: var(--lksg-radius);
  box-shadow: 0 20px 80px rgba(0,0,0,.8);
  transition: opacity .3s;
}
.lksg-lb-caption {
  margin-top: 14px; text-align: center;
  font-size: 13px; color: rgba(242,237,230,.65); max-width: 600px;
  line-height: 1.6;
}
.lksg-lb-dl {
  margin-top: 10px; display: inline-flex; align-items: center; gap: 6px;
  color: var(--lksg-accent); text-decoration: none; font-size: 11px;
  letter-spacing: 1px; text-transform: uppercase; border-bottom: 1px solid rgba(201,168,76,.3);
  transition: border-color .2s;
}
.lksg-lb-dl:hover { border-color: var(--lksg-accent); }
.lksg-lb-spinner {
  width: 36px; height: 36px; border: 2px solid rgba(201,168,76,.2);
  border-top-color: var(--lksg-accent); border-radius: 50%;
  animation: lksg-spin .7s linear infinite;
  display: none; margin: 60px auto;
}
@keyframes lksg-spin { to { transform: rotate(360deg); } }
.lksg-lb-loading .lksg-lb-spinner { display: block; }
.lksg-lb-loading .lksg-lb-img { display: none; }
.lksg-lb-counter {
  position: absolute; bottom: -36px; left: 50%; transform: translateX(-50%);
  font-size: 11px; letter-spacing: 2px; color: rgba(242,237,230,.4);
}

/* ── Password gate ── */
.lksg-password-gate { display: flex; justify-content: center; padding: 60px 20px; }
.lksg-pw-card { background: #111; border: 1px solid rgba(201,168,76,.2); border-radius: 12px; padding: 48px 40px; text-align: center; max-width: 360px; width: 100%; }
.lksg-pw-icon { font-size: 40px; margin-bottom: 16px; }
.lksg-pw-card h2 { font-size: 24px; color: var(--lksg-text); margin-bottom: 8px; font-family: Georgia, serif; font-weight: 300; }
.lksg-pw-card p { font-size: 14px; color: rgba(242,237,230,.5); margin-bottom: 20px; }
.lksg-pw-error { color: #fca5a5; font-size: 13px; margin-bottom: 12px; }
.lksg-pw-input { width: 100%; padding: 12px 16px; background: rgba(255,255,255,.05); border: 1.5px solid rgba(201,168,76,.2); border-radius: 6px; color: var(--lksg-text); font-size: 15px; text-align: center; margin-bottom: 12px; outline: none; }
.lksg-pw-input:focus { border-color: rgba(201,168,76,.5); }
.lksg-pw-btn { width: 100%; padding: 13px; background: var(--lksg-accent); color: #1a1a2e; border: none; border-radius: 6px; font-size: 13px; font-weight: 700; letter-spacing: 1px; cursor: pointer; transition: background .2s; }
.lksg-pw-btn:hover { background: #e0c070; }

/* ── Gallery index ── */
.lksg-gallery-index .lksg-index-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 3px; }
.lksg-index-card { background: #111; overflow: hidden; }
.lksg-index-thumb { height: 200px; background: #0a0a0a center/cover no-repeat; position: relative; display: flex; align-items: center; justify-content: center; }
.lksg-no-thumb { font-size: 36px; opacity: .2; }
.lksg-index-lock { position: absolute; top: 12px; right: 12px; font-size: 16px; }
.lksg-index-overlay { position: absolute; inset: 0; background: rgba(10,10,10,.4); display: flex; align-items: flex-end; padding: 14px; opacity: 0; transition: opacity .3s; }
.lksg-index-card:hover .lksg-index-overlay { opacity: 1; }
.lksg-index-count { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--lksg-accent); }
.lksg-index-info { padding: 14px; }
.lksg-index-title { font-size: 16px; font-weight: 600; color: #f2ede6; margin-bottom: 4px; }
.lksg-index-desc  { font-size: 12px; color: rgba(242,237,230,.5); margin-bottom: 6px; }
.lksg-index-type  { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: rgba(201,168,76,.7); }

/* ── Empty / misc ── */
.lksg-gallery-wrap.lksg-empty { display: flex; align-items: center; justify-content: center; min-height: 200px; }
.lksg-empty { color: rgba(242,237,230,.4); font-size: 14px; }

/* ── Responsive ── */
@media (max-width: 680px) {
  .lksg-masonry { columns: 2 180px; }
  .lksg-grid { grid-template-columns: repeat(2, 1fr); }
  .lksg-lb-prev { left: 8px; } .lksg-lb-next { right: 8px; }
  .lksg-lb-prev, .lksg-lb-next { width: 38px; height: 38px; }
  .lksg-carousel-btn { width: 36px; height: 36px; }
  /* Make carousel buttons always visible on touch devices (no hover) */
  .lksg-carousel-btn { opacity: 0.7; }
  .lksg-pause-btn { opacity: 0.7; }
  /* Larger tap targets for thumbs on mobile */
  .lksg-thumb { width: 56px; height: 42px; }
}

/* ── Touch-action on filmstrip ──
   pan-x tells the browser horizontal scroll is expected here,
   so it doesn't delay/cancel taps on individual thumbs.
── */
.lksg-thumbstrip-inner {
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
}
