/**
 * Wavecon Blind Box - Tier 3-view Image Carousel
 *
 * Replaces old three.js scene. Each tier card now has a 3-image carousel
 * (front/side/top) that rotates every 4 seconds. User uploads:
 *   - /wp-content/uploads/tier-{20,50,100}-front.jpg
 *   - /wp-content/uploads/tier-{20,50,100}-side.jpg
 *   - /wp-content/uploads/tier-{20,50,100}-top.jpg
 *
 * Memory compliance:
 *   - img !important rules
 *   - prefers-reduced-motion handled
 *   - touch-action pan-y !important (iOS Safari)
 */

[data-blinds-tiers] {
  position: relative;
  padding: clamp(96px, 14vw, 192px) clamp(20px, 4vw, 64px);
  max-width: 1400px;
  margin: 0 auto;
}

.tiers-head {
  display: grid;
  gap: 16px;
  max-width: 800px;
  margin: 0 0 64px;
}
.tiers-head .eyebrow {
  font-family: var(--font-body);
  font-size: var(--fs-12);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--ls-eyebrow);
  color: var(--ink-lime);
}
.tiers-head h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-96);
  line-height: 0.96;
  letter-spacing: var(--ls-tight);
  color: var(--ink-fg);
  text-wrap: balance;
  margin: 0;
}
.tiers-head h2 .accent { color: var(--ink-lime); font-style: italic; }
.tiers-head p {
  font-family: var(--font-body);
  font-size: var(--fs-18);
  line-height: 1.5;
  color: var(--ink-mute);
  max-width: 60ch;
  margin: 0;
}

/* 12-col bento - 3 equal cards (one per tier) */
.tiers-bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(16px, 2vw, 28px);
  grid-auto-rows: minmax(540px, auto);
}

.tier {
  position: relative;
  display: flex !important;
  flex-direction: column;
  /* Force inline anchor to flex */
  justify-content: space-between;
  padding: clamp(24px, 3vw, 40px);
  background: var(--ink-surface);
  border: 1px solid var(--ink-line);
  border-radius: var(--r-2xl);
  overflow: hidden;
  isolation: isolate;
  text-decoration: none !important;
  color: inherit;
  min-height: 540px;
  transition: transform var(--dur-base) var(--ease-spring),
              border-color var(--dur-base) var(--ease-out-expo),
              box-shadow var(--dur-base) var(--ease-out-expo);
}
.tier::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(ellipse at 50% 0%, var(--tier-glow, var(--ink-lime-soft)) 0%, transparent 60%);
  opacity: 0.4;
  animation: tier-breathe var(--dur-pulse) var(--ease-in-out) infinite;
  pointer-events: none;
}
@keyframes tier-breathe {
  0%, 100% { opacity: 0.30; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(1.05); }
}
.tier:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: var(--tier-line, var(--ink-lime-line));
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.7),
              0 0 60px -10px var(--tier-glow, var(--ink-lime-soft));
}

/* 3-card bento sizing (replaces old T1..T5 spans) */
@media (min-width: 1024px) {
  .tier-20 { grid-column: span 4; }
  .tier-50 { grid-column: span 4; }
  .tier-100 { grid-column: span 4; }
}
@media (max-width: 1023px) {
  .tier-20, .tier-50, .tier-100 {
    grid-column: span 12;
  }
}

/* 3-view image carousel container (replaces old .tier-3d) */
.tier-carousel {
  position: relative;
  z-index: var(--z-content);
  width: 100%;
  flex-shrink: 0;

  aspect-ratio: 1;
  margin: 0 auto;
  max-width: 360px;
  border-radius: var(--r-lg);
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(135deg, var(--ink-surface) 0%, var(--ink-surface-2) 100%);
}
.tier-carousel .tier-img {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
  opacity: 1;
  transition: opacity 400ms var(--ease-out-expo);
}
.tier-carousel .tier-img[style*="display: none"],
.tier-carousel .tier-img[style*="display:none"] {
  opacity: 0;
}
/* Smooth crossfade between angles */
.tier-carousel .tier-img[style*="display:none"] + .tier-img,
.tier-carousel .tier-img[style*="display: none"] + .tier-img {
  opacity: 0;
}

/* Empty placeholder when no image uploaded yet */
.tier-carousel .tier-img-empty {
  position: absolute;
  inset: 0;
  display: none;  /* toggled by JS onerror */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(135deg, var(--ink-surface) 0%, var(--ink-surface-2) 100%);
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  letter-spacing: 0.05em;
  text-align: center;
  padding: 16px;
  z-index: 1;
}
.tier-carousel .tier-img-empty svg { opacity: 0.4; }

/* Dots (3 angles) */
.tier-carousel-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  z-index: var(--z-content);
  position: relative;
}
.tier-carousel-dots button {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: all 300ms var(--ease-out-expo);
}
.tier-carousel-dots button[data-active="1"] {
  background: #C9FF00;
  width: 24px;
  border-radius: 4px;
  box-shadow: 0 0 12px rgba(201, 255, 0, 0.4);
}
.tier-carousel-dots button:hover {
  background: var(--ink-fg);
}

/* Tier num badge */
.tier-num {
  position: absolute;
  top: clamp(20px, 2.5vw, 32px);
  right: clamp(20px, 2.5vw, 32px);
  font-family: var(--font-body);
  font-size: var(--fs-12);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--ls-eyebrow);
  color: var(--ink-mute);
  z-index: var(--z-content);
}

.tier-meta {
  position: relative;
  z-index: var(--z-content);
  display: grid;
  gap: 8px;
}
.tier-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-24);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink-fg);
  margin: 0;
}
.tier-desc {
  font-family: var(--font-body);
  font-size: var(--fs-14);
  line-height: 1.5;
  color: var(--ink-mute);
  margin: 0;
}
.tier-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 12px;
}
.tier-price {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-48);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--tier-color, var(--ink-lime));
}
.tier-currency {
  font-family: var(--font-body);
  font-size: var(--fs-14);
  font-weight: 500;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: var(--ls-eyebrow);
}
.tier-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-family: var(--font-body);
  font-size: var(--fs-14);
  font-weight: 500;
  color: var(--tier-color, var(--ink-lime));
  width: max-content;
}

/* per-tier color tokens */
.tier-20 { --tier-glow: var(--ink-lime-soft); --tier-line: var(--ink-lime-line); --tier-color: var(--ink-lime); }
.tier-50 { --tier-glow: var(--ink-violet-soft); --tier-line: var(--ink-violet-line); --tier-color: #D4A8FF; }
.tier-100 { --tier-glow: rgba(255,214,0,0.18); --tier-line: rgba(255,214,0,0.4); --tier-color: var(--ink-amber); }

/* Reduced motion: no auto-rotate (handled by JS) */
@media (prefers-reduced-motion: reduce) {
  .tier-carousel .tier-img {
    transition: none;
  }
}
