* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #323232; color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* Slides */
#viewport { position: fixed; inset: 0; overflow: hidden; touch-action: pan-y pinch-zoom; }
#track { position: absolute; inset: 0; will-change: transform; }
#track.animate { transition: transform .35s cubic-bezier(.2,.7,.3,1); }
.slide { position: absolute; top: 0; height: 100%; width: 100%; display: flex; align-items: center; justify-content: center; }
.page {
  position: relative; flex: none; overflow: hidden;
  background-size: 100% 100%; background-repeat: no-repeat;
  box-shadow: 0 4px 24px rgba(0,0,0,.35);
  transform-origin: center; user-select: none;
}
.item { position: absolute; background-repeat: no-repeat; background-size: 100% 100%; }
.item.round { border-radius: 50%; }
.item.link { cursor: pointer; }
.item.link:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.item svg { display: block; }

/* Navigation */
.nav {
  position: fixed; top: 50%; z-index: 5; width: 44px; height: 44px; margin-top: -22px;
  border: 0; border-radius: 50%; background: rgba(0,0,0,.45); color: #fff;
  display: grid; place-items: center; cursor: pointer; transition: opacity .2s;
}
.nav:hover { background: rgba(0,0,0,.7); }
.nav[disabled] { opacity: 0; pointer-events: none; }
.nav[hidden] { display: none; }
#prev { left: 16px; } #next { right: 16px; }
#counter {
  position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 5;
  padding: 4px 12px; border-radius: 999px; background: rgba(0,0,0,.45);
  font-size: 13px; font-variant-numeric: tabular-nums; pointer-events: none;
}
@media (hover: none) { #prev, #next { display: none; } }

/* Image popup */
#popup {
  position: fixed; inset: 0; z-index: 10; background: rgba(0,0,0,.88);
  display: none; align-items: center; justify-content: center; touch-action: pan-y pinch-zoom;
}
#popup.open { display: flex; }
#popup img { max-width: calc(100% - 32px); max-height: calc(100% - 96px); object-fit: contain; user-select: none; }
#popup .close { position: fixed; top: 12px; right: 12px; margin: 0; }
#popup .nav { position: fixed; }
#popup-count { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); font-size: 13px; opacity: .8; }

@media (prefers-reduced-motion: reduce) { #track.animate { transition: none; } }
