/* Lightweight slideshow engine — shared by the in-page slider and the full-screen gallery.
   Vanilla CSS, no framework dependency. */

.ss-root {
  position: relative;
  width: 100%;
  background: #000;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* In-page variant keeps a 16:9 box in the document flow. */
.ss-root.ss-inline {
  aspect-ratio: 16 / 9;
}

/* Full-screen variant fills the viewport (used by gallery.html). */
.ss-root.ss-fill {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

.ss-viewport {
  position: absolute;
  inset: 0;
}

.ss-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  /* Soft cross-dissolve: the outgoing and incoming photos overlap and fade
     through each other. ease-in-out keeps the start/end gentle; ~1.5s reads as
     a long, cinematic dissolve rather than a quick cut. */
  transition: opacity 1.5s ease-in-out;
  pointer-events: none;
}

.ss-slide.is-active {
  opacity: 1;
  pointer-events: auto;
}

.ss-slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain; /* never crop real-estate photos */
  display: block;
}

/* Ken Burns: slow zoom on the active slide (in-page autoplay slider).
   The per-slide transform-origin (set in JS) varies the pan direction.
   Duration is set from JS via --kb-duration so the zoom spans the dwell. */
.ss-root.ss-kenburns .ss-slide img { will-change: transform; }
.ss-root.ss-kenburns .ss-slide.is-active img {
  /* linear = constant slow drift (no deceleration/"settle"), so the motion never
     visibly stops — the incoming photo is already drifting as it dissolves in. */
  animation: ss-kenburns var(--kb-duration, 6500ms) linear both;
}
@keyframes ss-kenburns {
  from { transform: scale(1.001); }
  to   { transform: scale(1.12); }
}

/* Respect users who prefer reduced motion: skip the zoom. */
@media (prefers-reduced-motion: reduce) {
  .ss-root.ss-kenburns .ss-slide.is-active img { animation: none; }
}

/* Controls ---------------------------------------------------------------- */
/* Bottom-center cluster: prev arrow | counter | next arrow, all the same height. */
.ss-controls {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ss-btn {
  border: none;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  height: 30px;
  min-width: 38px;
  padding: 0 10px;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  transition: background 0.2s ease;
}
.ss-btn:hover { background: rgba(0, 0, 0, 0.85); }

.ss-counter {
  height: 30px;
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font: 14px/1 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  padding: 0 14px;
  border-radius: 999px;
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
}

.ss-corner {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 6;
  display: flex;
  gap: 8px;
}
.ss-corner button {
  border: none;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}
.ss-corner button:hover { background: rgba(0, 0, 0, 0.8); }

/* Simple loading shimmer until the first image paints. */
.ss-root.is-loading::after {
  content: "";
  position: absolute;
  width: 36px;
  height: 36px;
  top: 50%;
  left: 50%;
  margin: -18px 0 0 -18px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ss-spin 0.8s linear infinite;
  z-index: 2;
}
@keyframes ss-spin { to { transform: rotate(360deg); } }

@media (max-width: 576px) {
  .ss-controls { bottom: 10px; gap: 6px; }
  .ss-btn { height: 28px; min-width: 34px; font-size: 15px; }
  .ss-counter { height: 28px; font-size: 13px; padding: 0 11px; }
}
