/* ─── Reset & Base ─────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --gold: #c9a84c;
  --gold-light: #e8d5a3;
  --gold-dark: #8b6914;
  --dark: #0e0c0a;
  --dark-mid: #1a1712;
  --dark-card: #161310;
  --cream: #f5efe6;
  --cream-dim: #d4c5b0;
  --radius: 4px;
  --transition: 0.38s cubic-bezier(0.4, 0, 0.2, 1);
  --header-h: 72px;
  --strip-h: 82px;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  background-color: var(--dark);
  background-image:
    radial-gradient(
      ellipse 80% 50% at 50% -10%,
      rgba(201, 168, 76, 0.08) 0%,
      transparent 70%
    ),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect width='4' height='4' fill='%230e0c0a'/%3E%3Crect width='1' height='1' fill='%23ffffff08'/%3E%3C/svg%3E");
  font-family: "Cormorant Garamond", Georgia, serif;
  color: var(--cream);
  user-select: none;
}

/* ─── Viewer Shell ──────────────────────────────────── */
.viewer {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  height: 100vh; /* fallback */
}

/* ─── Header ────────────────────────────────────────── */
.viewer__header {
  height: var(--header-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  border-bottom: 1px solid rgba(201, 168, 76, 0.12);
  background: rgba(14, 12, 10, 0.85);
  backdrop-filter: blur(8px);
  position: relative;
  z-index: 10;
}

.viewer__brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand__line {
  width: 40px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.brand__title {
  font-family: "Cinzel", serif;
  font-size: clamp(1rem, 3vw, 1.4rem);
  font-weight: 400;
  letter-spacing: 0.3em;
  color: var(--gold-light);
  text-shadow: 0 0 40px rgba(201, 168, 76, 0.3);
  white-space: nowrap;
}

.viewer__counter {
  font-family: "Cinzel", serif;
  font-size: 0.7rem;
  letter-spacing: 0.35em;
  color: var(--gold-dark);
}

/* ─── Stage ─────────────────────────────────────────── */
.viewer__stage {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 0;
}

.viewer__img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow:
    0 0 0 1px rgba(201, 168, 76, 0.15),
    0 24px 80px rgba(0, 0, 0, 0.85);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
  display: block;
  padding: 1rem;
}

.viewer__img.fading {
  opacity: 0;
  transform: scale(0.97);
}

/* ─── Tap Zones ─────────────────────────────────────── */
.tap-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 35%;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 5;
  -webkit-tap-highlight-color: transparent;
}
.tap-zone--prev {
  left: 0;
}
.tap-zone--next {
  right: 0;
}

.tap-zone:disabled {
  cursor: not-allowed;
}

/* ─── Arrows ────────────────────────────────────────── */
.arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.6rem;
  color: var(--gold);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  z-index: 6;
  text-shadow: 0 0 20px rgba(201, 168, 76, 0.5);
}
.arrow--prev {
  left: 1.2rem;
}
.arrow--next {
  right: 1.2rem;
}

/* show arrows on hover (desktop) */
.viewer__stage:hover .arrow--prev:not(.hidden),
.viewer__stage:hover .arrow--next:not(.hidden) {
  opacity: 0.7;
}

/* ─── Thumbnail Strip ───────────────────────────────── */
.viewer__strip {
  height: var(--strip-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 1.2rem;
  overflow-x: auto;
  overflow-y: hidden;
  border-top: 1px solid rgba(201, 168, 76, 0.12);
  background: rgba(14, 12, 10, 0.9);
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dark) transparent;
}

.viewer__strip::-webkit-scrollbar {
  height: 3px;
}
.viewer__strip::-webkit-scrollbar-track {
  background: transparent;
}
.viewer__strip::-webkit-scrollbar-thumb {
  background: var(--gold-dark);
  border-radius: 2px;
}

/* Thumb */
.strip__thumb {
  flex-shrink: 0;
  width: 44px;
  height: 58px;
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid rgba(201, 168, 76, 0.15);
  transition:
    border-color var(--transition),
    transform var(--transition),
    box-shadow var(--transition);
  position: relative;
  background: var(--dark-card);
}

.strip__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: brightness(0.7);
  transition: filter var(--transition);
}

.strip__thumb:hover img {
  filter: brightness(0.9);
}

.strip__thumb.active {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(201, 168, 76, 0.35);
  transform: translateY(-3px) scale(1.06);
}

.strip__thumb.active img {
  filter: brightness(1);
}

.strip__thumb .thumb-num {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-family: "Cinzel", serif;
  font-size: 0.48rem;
  letter-spacing: 0.15em;
  color: var(--gold-light);
  line-height: 1;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

/* ─── Mobile ────────────────────────────────────────── */
@media (max-width: 600px) {
  :root {
    --header-h: 56px;
    --strip-h: 68px;
  }

  .viewer__header {
    padding: 0 1rem;
  }

  .viewer__img {
    padding: 0.5rem;
  }

  .brand__line {
    display: none;
  }

  .strip__thumb {
    width: 36px;
    height: 48px;
  }
}

/* touch: always show arrow hints briefly */
@media (hover: none) {
  .arrow {
    opacity: 0.45;
  }
  .arrow.hidden {
    opacity: 0 !important;
  }
}
