/* ========================================
   BRUSH — Browse Posters feed (poster-reels.html)
   One poster per screen with vertical snap scrolling. Uses the site's
   tokens throughout; text that sits on top of poster art uses the same
   dark scrim + light text treatment as the homepage hero.
   ======================================== */

.reels-page {
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-primary);
}

/* ---- Top bar ---- */
.reels-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  pointer-events: none;
}

.reels-bar > * { pointer-events: auto; }

.reels-bar-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--bg-primary) 78%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 1.05rem;
  transition: border-color var(--transition-fast);
}

.reels-bar-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.reels-cart .cart-count { top: -2px; right: -2px; }

.reels-bar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 16px;
  border-radius: 50px;
  background: color-mix(in srgb, var(--bg-primary) 78%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  min-width: 0;
}

.reels-bar-title strong {
  font-family: var(--font-heading);
  font-size: var(--text-small);
  white-space: nowrap;
}

.reels-genre {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.reels-genre select {
  appearance: none;
  -webkit-appearance: none;
  max-width: 150px;
  padding: 7px 28px 7px 12px;
  border: 1px solid var(--border);
  border-radius: 50px;
  background: var(--bg-card);
  color: var(--text-primary);
  font: inherit;
  font-size: var(--text-micro);
  font-weight: 600;
  text-overflow: ellipsis;
  cursor: pointer;
}

.reels-genre i {
  position: absolute;
  right: 11px;
  font-size: 0.6rem;
  color: var(--text-muted);
  pointer-events: none;
}

/* ---- Feed ---- */
.reels { height: 100dvh; }

.reels-feed {
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  outline: none;
}

.reels-feed::-webkit-scrollbar { display: none; }

.reel {
  position: relative;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  justify-content: center;
}

/* Blurred copy of the poster fills the screen behind it. */
.reel-bg {
  position: absolute;
  inset: -40px;
  z-index: -1;
  background: var(--bg-secondary) center / cover no-repeat;
  filter: blur(36px) saturate(1.2);
  transform: scale(1.1);
  opacity: 0.85;
}

.reel-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(var(--bg-primary-rgb), 0.35);
}

.reel-stage {
  position: relative;
  width: 100%;
  max-width: 560px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(72px + env(safe-area-inset-top)) 18px 250px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.reel-poster {
  margin: 0;
  height: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reel-poster img {
  max-height: 100%;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: scale(0.97);
  transition: opacity 0.4s ease, transform 0.6s var(--ease-premium);
}

.reel-poster img[src] { opacity: 1; transform: none; }

/* Double-tap / add burst */
.reel-burst {
  position: absolute;
  top: 42%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin: -48px 0 0 -48px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 2.4rem;
  opacity: 0;
  transform: scale(0.3);
  pointer-events: none;
}

.reel-burst.play { animation: reel-burst 0.9s var(--ease-premium) forwards; }

@keyframes reel-burst {
  0% { opacity: 0; transform: scale(0.3); }
  25% { opacity: 1; transform: scale(1.1); }
  45% { transform: scale(0.95); }
  70% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.25) translateY(-30px); }
}

/* ---- Info + actions overlay (on the poster art: scrim + light text) ---- */
.reel-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 80px 0 calc(18px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.5) 55%, transparent 100%);
  pointer-events: none;
}

.reel-overlay > * { pointer-events: auto; }

.reel-info {
  flex: 1;
  max-width: 480px;
  padding: 0 12px 0 18px;
  color: var(--brand-cream);
  min-width: 0;
}

.reel-genre {
  display: inline-block;
  margin-bottom: 8px;
  padding: 4px 10px;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.reel-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: var(--tracking-tight);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.reel-price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 12px;
  font-variant-numeric: tabular-nums;
}

.reel-price-now { font-size: 1.25rem; }
.reel-price s { font-size: 0.85rem; color: var(--on-photo-secondary); }

.reel-off {
  font-size: 0.8rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--success) 45%, white);
}

.reel-sizes {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.reel-size {
  min-width: 52px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 50px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: var(--brand-cream);
  font-size: var(--text-small);
  font-weight: 700;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.reel-size:hover { border-color: var(--brand-cream); }

.reel-size.active {
  background: var(--brand-cream);
  border-color: var(--brand-cream);
  color: var(--brand-black);
}

.reel-add { width: 100%; justify-content: center; min-height: 46px; }
.reel-add.added { background: var(--success); }
.reel-add:disabled { opacity: 0.6; cursor: not-allowed; }

.reel-rail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 14px 4px 0;
}

.reel-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--brand-cream);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.reel-action i {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 1.1rem;
  transition: transform var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.reel-action:hover i { transform: scale(1.08); }
.reel-action:active i { transform: scale(0.92); }
.reel-action:disabled { opacity: 0.45; cursor: not-allowed; }
.reel-like.active i { background: var(--brand-cream); color: var(--accent); }

/* ---- Desktop prev/next ---- */
.reels-nav {
  position: fixed;
  right: 24px;
  top: 50%;
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transform: translateY(-50%);
}

.reels-nav button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--bg-primary) 78%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  color: var(--text-primary);
  transition: border-color var(--transition-fast);
}

.reels-nav button:hover { border-color: var(--accent); }

/* ---- First-visit hint ---- */
.reels-hint {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: var(--overlay);
  transition: opacity 0.4s ease;
}

.reels-hint[hidden] { display: none; }
.reels-hint.hide { opacity: 0; }

.reels-hint-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 28px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  text-align: center;
  font-size: var(--text-small);
  color: var(--text-secondary);
}

.reels-hint-card i {
  font-size: 1.8rem;
  color: var(--accent);
  margin-bottom: 6px;
  animation: reels-hint-swipe 1.4s ease-in-out infinite;
}

.reels-hint-card strong { color: var(--text-primary); }

@keyframes reels-hint-swipe {
  0%, 100% { transform: translateY(8px); }
  50% { transform: translateY(-8px); }
}

/* ---- Empty / loading ---- */
.reels-empty {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  color: var(--text-secondary);
}

.reels-loader {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: reels-spin 0.8s linear infinite;
}

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

/* ---- Phones ---- */
@media (max-width: 640px) {
  .reel-stage { padding: calc(66px + env(safe-area-inset-top)) 14px 236px; }
  .reel-title { font-size: 1.1rem; }
  .reel-price-now { font-size: 1.1rem; }
  .reel-rail { gap: 12px; padding-right: 10px; }
  .reel-action i { width: 42px; height: 42px; font-size: 1rem; }
  .reels-nav { display: none; }
  .reels-bar-title strong { display: none; }
  .reels-bar-title { padding: 5px; }
  .reels-genre select { max-width: 180px; }
}

/* Short landscape phones: shrink chrome so the poster keeps some room. */
@media (max-height: 560px) {
  .reel-stage { padding-bottom: 170px; }
  .reel-sizes { margin-bottom: 8px; }
  .reel-genre { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .reel-burst.play { animation-duration: 0.01s; }
  .reels-hint-card i { animation: none; }
  .reel-poster img { transition: opacity 0.2s; transform: none; }
}
