*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

img { display: block; -webkit-user-drag: none; -webkit-touch-callout: none; }

/* ---------- Shell ---------- */

.ad {
  --line: rgba(201, 164, 92, 0.35);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --morph-ease: cubic-bezier(0.65, 0, 0.25, 1);
  position: relative;
  display: grid;
  width: var(--w);
  height: var(--h);
  padding: var(--pad);
  gap: var(--gap);
  overflow: hidden;
  background: radial-gradient(130% 70% at 50% 0%, var(--bg-glow) 0%, var(--bg) 65%);
  border: 1px solid var(--line);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.ad--stacked {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: var(--thumbs-size) minmax(0, 1fr) var(--bar-size);
  grid-template-areas: "thumbs" "stage" "bar";
}

.ad--split {
  grid-template-columns: minmax(0, 1fr) var(--thumbs-size);
  grid-template-rows: minmax(0, 1fr) var(--bar-size);
  grid-template-areas: "stage thumbs" "stage bar";
}

/* ---------- Loader ---------- */

.loader {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader span {
  width: 26px;
  height: 26px;
  border: 2px solid rgba(201, 164, 92, 0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.ad.is-ready .loader { opacity: 0; visibility: hidden; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Static thumbnails ---------- */

.thumbs {
  grid-area: thumbs;
  position: relative;
  display: flex;
  gap: var(--thumb-gap);
  min-width: 0;
  min-height: 0;
}

.ad--split .thumbs { flex-direction: column; }

.ad--stacked .thumbs::after {
  content: "";
  position: absolute;
  left: calc(var(--pad) * -1);
  right: calc(var(--pad) * -1);
  bottom: calc(var(--gap) / -2 - 0.5px);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.55;
}

.thumb {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #000;
  opacity: 0;
  transform: translateY(-10px);
  transition:
    opacity 0.6s ease calc(var(--i) * 120ms + 200ms),
    transform 0.7s var(--ease) calc(var(--i) * 120ms + 200ms),
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.ad--split .thumb { transform: translateX(10px); }

.ad.is-ready .thumb { opacity: 1; transform: none; }

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease), filter 0.4s ease;
}

.thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, 0.7));
  pointer-events: none;
}

.thumb__label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  z-index: 1;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 11px;
  font-style: italic;
  text-align: center;
  color: var(--gold-light);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  transition: transform 0.4s var(--ease), letter-spacing 0.4s var(--ease);
}

.thumb__label::after {
  content: "";
  display: block;
  width: 0;
  height: 1px;
  margin: 2px auto 0;
  background: var(--gold);
  transition: width 0.4s var(--ease);
}

.thumb:hover img,
.thumb:focus-visible img,
.thumb.is-active img { transform: scale(1.1); }

.thumb:hover .thumb__label,
.thumb.is-active .thumb__label { letter-spacing: 0.04em; }

.thumb:hover .thumb__label::after,
.thumb.is-active .thumb__label::after { width: 26px; }

.thumb.is-active {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 0 14px rgba(201, 164, 92, 0.5);
}

.ad.is-spotlight .thumb:not(.is-active) img { filter: grayscale(0.5) brightness(0.5); }

.thumb:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 1px; }

/* ---------- Stage / coverflow ---------- */

.stage {
  grid-area: stage;
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: radial-gradient(90% 70% at 50% 45%, rgba(201, 164, 92, 0.12), rgba(0, 0, 0, 0.55));
  cursor: grab;
  touch-action: pan-y;
  opacity: 0;
  transition: opacity 0.8s ease 0.1s;
}

.ad.is-ready .stage { opacity: 1; }

.stage.is-dragging { cursor: grabbing; }

.stage:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 1px; }

.cf {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: var(--dots-h);
  perspective: 800px;
  transition: opacity 0.5s ease, transform 0.6s var(--ease), filter 0.5s ease;
}

.ad.is-spotlight .cf { opacity: 0.25; transform: scale(0.9); filter: blur(2px); }

.cf-slide {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--sw);
  height: var(--sh);
  transform-style: preserve-3d;
  will-change: transform, opacity;
}

.cf-inner {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.65);
  transition: transform 0.35s ease-out, box-shadow 0.4s ease;
}

.cf-slide.is-center .cf-inner {
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  box-shadow: 0 0 0 1px rgba(201, 164, 92, 0.7), 0 14px 30px rgba(0, 0, 0, 0.7);
}

.cf-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.cf-shade {
  position: absolute;
  inset: 0;
  background: #000;
  pointer-events: none;
}

.cf-glare {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 0%), rgba(255, 240, 210, 0.35), transparent 55%);
  mix-blend-mode: overlay;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.stage.is-tilting .cf-slide.is-center .cf-glare { opacity: 1; }

/* Arrows + dots */

.arrow {
  position: absolute;
  top: calc((100% - var(--dots-h)) / 2);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--arrow);
  height: var(--arrow);
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(18, 10, 10, 0.7);
  color: var(--gold-light);
  transform: translateY(-50%);
  transition: opacity 0.3s ease, background 0.3s ease, transform 0.2s ease;
}

.arrow svg { width: 45%; height: 45%; }
.arrow--prev { left: 3px; }
.arrow--prev svg { transform: scaleX(-1); }
.arrow--next { right: 3px; }
.arrow:hover { background: var(--cta-bg); }
.arrow:active { transform: translateY(-50%) scale(0.9); }

.dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--dots-h);
  transition: opacity 0.3s ease;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.35);
  transition: width 0.4s var(--ease), background 0.4s ease;
}

.dot.is-active { width: 18px; background: var(--gold); }

.ad.is-spotlight .arrow,
.ad.is-spotlight .dots { opacity: 0; pointer-events: none; }

/* Swipe hint */

.hint {
  position: absolute;
  left: 50%;
  top: calc((100% - var(--dots-h)) / 2);
  z-index: 210;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(18, 10, 10, 0.78);
  color: var(--gold-light);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.9);
  transition: opacity 0.4s ease, transform 0.4s var(--ease);
}

.hint.is-visible { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.hint__track {
  position: relative;
  width: 26px;
  height: 10px;
}

.hint__track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--line);
}

.hint__track i {
  position: absolute;
  top: 50%;
  left: 0;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--gold-light);
  box-shadow: 0 0 6px var(--gold);
  animation: swipe 1.4s var(--ease) infinite;
}

@keyframes swipe {
  0% { transform: translateX(18px); opacity: 0; }
  20% { opacity: 1; }
  70% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(0); opacity: 0; }
}

/* ---------- Spotlight (thumbnail morphs into the stage) ---------- */

.spot {
  position: absolute;
  z-index: 300;
  overflow: hidden;
  border-radius: var(--radius);
  background: #000;
  box-shadow: 0 0 0 1px var(--gold), 0 16px 34px rgba(0, 0, 0, 0.75);
  visibility: hidden;
  cursor: zoom-in;
  touch-action: none;
  -webkit-touch-callout: none;
  transition:
    left var(--morph) var(--morph-ease),
    top var(--morph) var(--morph-ease),
    width var(--morph) var(--morph-ease),
    height var(--morph) var(--morph-ease);
}

.spot.is-visible { visibility: visible; }
.spot.no-anim { transition: none; }

.spot__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.25s ease-out;
}

.spot__img.is-out { opacity: 0; }

.spot__close {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(18, 10, 10, 0.75);
  color: var(--gold-light);
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.3s ease, background 0.3s ease;
}

.spot__close svg { width: 10px; height: 10px; }
.spot__close:hover { background: var(--cta-bg); }

.spot.is-settled .spot__close { opacity: 1; }

.spot__hint {
  position: absolute;
  left: 50%;
  top: 8px;
  z-index: 2;
  padding: 5px 10px;
  border-radius: 12px;
  background: rgba(18, 10, 10, 0.78);
  color: var(--gold-light);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -6px);
  transition: opacity 0.35s ease, transform 0.35s var(--ease);
}

.spot__hint.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Bottom bar / CTA ---------- */

.bar {
  grid-area: bar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 0 4px 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.2));
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.6s ease 0.7s, transform 0.7s var(--ease) 0.7s;
}

.ad--split .bar { padding: 0; border: 0; background: none; }

.ad.is-ready .bar { opacity: 1; transform: none; }

.tagline {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-light);
}

.cta {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: calc(100% - 8px);
  padding: 0 12px;
  overflow: hidden;
  border: 1px solid var(--gold);
  border-radius: 3px;
  background: var(--cta-bg);
  color: var(--cta-text);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.ad--split .cta { width: 100%; height: 100%; padding: 0 6px; font-size: 9.5px; letter-spacing: 0.06em; }

.cta:hover { box-shadow: 0 0 14px rgba(200, 16, 46, 0.6); }
.cta:active { transform: scale(0.97); }
.cta:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 1px; }

.cta svg { width: 11px; height: 11px; transition: transform 0.3s var(--ease); }
.cta:hover svg { transform: translateX(3px); }

.cta::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-20deg);
  animation: shimmer 3.4s ease-in-out 2.2s infinite;
}

@keyframes shimmer {
  0% { left: -60%; }
  35%, 100% { left: 130%; }
}

.ripple {
  position: absolute;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  pointer-events: none;
  animation: ripple 0.6s ease-out forwards;
}

@keyframes ripple { to { transform: scale(16); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .cta::after,
  .hint__track i { animation: none; }
}
