:root {
  color-scheme: dark;
  --bg-core: #06070a;
  --bg-surface: #0e1017;
  --bg-card: #12141f;
  --bg-card-hover: #161927;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(217, 70, 239, 0.35);
  --border-gold: rgba(245, 196, 91, 0.4);
  --gold: #f5c45b;
  --gold-glow: rgba(245, 196, 91, 0.3);
  --magenta: #d946ef;
  --magenta-glow: rgba(217, 70, 239, 0.3);
  --cyan: #38bdf8;
  --text-main: #f7f4ef;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --max-w: 1240px;
}

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

body.merch-page {
  min-height: 100vh;
  background: var(--bg-core);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(217, 70, 239, 0.15), transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(245, 196, 91, 0.08), transparent 70%),
    radial-gradient(circle at 10% 40%, rgba(56, 189, 248, 0.05), transparent 50%);
  color: var(--text-main);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- Top Office Header ---------------- */
.merch-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  min-height: 64px;
  padding: 0.75rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(6, 7, 10, 0.88);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.merch-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
}

.merch-brand__emblem {
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(245, 196, 91, 0.4));
}

.merch-brand__text {
  display: grid;
}

.merch-brand__kicker {
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  color: var(--gold);
  text-transform: uppercase;
}

.merch-brand__title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text-main);
}

.merch-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem clamp(0.6rem, 1.8vw, 1.4rem);
  flex-wrap: wrap;
}

.merch-nav a {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(247, 244, 239, 0.75);
  text-decoration: none;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  transition: color 180ms ease, background 180ms ease;
}

.merch-nav a:hover,
.merch-nav a:focus-visible {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.merch-nav a.active {
  color: var(--gold);
  background: rgba(245, 196, 91, 0.12);
  border: 1px solid rgba(245, 196, 91, 0.3);
}

/* ---------------- Hero Section ---------------- */
.merch-hero {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4.5rem) clamp(1rem, 4vw, 2rem) 1.5rem;
  text-align: center;
}

.merch-hero__kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: rgba(217, 70, 239, 0.12);
  border: 1px solid rgba(217, 70, 239, 0.35);
  color: var(--magenta);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.merch-hero__kicker-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--magenta);
  box-shadow: 0 0 8px var(--magenta);
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.2); }
}

.merch-hero__title {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.08;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #ffffff 30%, #f5c45b 80%, #d946ef 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.merch-hero__lead {
  max-width: 680px;
  margin: 0 auto 1.8rem;
  font-size: clamp(0.95rem, 1.8vw, 1.15rem);
  color: var(--text-muted);
  line-height: 1.6;
}

.merch-hero__badges {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem 1.25rem;
}

.merch-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(247, 244, 239, 0.8);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.merch-badge svg {
  width: 14px;
  height: 14px;
  fill: var(--gold);
}

/* ---------------- Filter Tabs ---------------- */
.merch-filter-bar {
  max-width: var(--max-w);
  margin: 1.5rem auto 2.5rem;
  padding: 0 clamp(1rem, 4vw, 2rem);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-btn {
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all 180ms ease;
}

.filter-btn:hover {
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
}

.filter-btn.active {
  background: linear-gradient(135deg, rgba(245, 196, 91, 0.16), rgba(217, 70, 239, 0.16));
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 14px rgba(245, 196, 91, 0.2);
}

/* ---------------- Products Grid ---------------- */
.merch-container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem) 5rem;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: clamp(1.25rem, 2.5vw, 2rem);
}

/* ---------------- Product Card ---------------- */
.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}

.product-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-highlight);
  box-shadow:
    0 16px 36px rgba(0, 0, 0, 0.65),
    0 0 24px rgba(217, 70, 239, 0.2);
}

.product-card__media {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #090a10;
  overflow: hidden;
}

.product-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms ease;
}

.product-card:hover .product-card__img {
  transform: scale(1.06);
}

.product-card__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 0.25rem 0.55rem;
  background: rgba(6, 7, 10, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  backdrop-filter: blur(8px);
}

.product-card__body {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  padding: 1.25rem;
  gap: 0.6rem;
}

.product-card__title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}

.product-card__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.5rem;
}

.product-card__price {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
}

.price-main {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: -0.01em;
}

.price-currency {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.product-card__variants {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--cyan);
}

.product-card__action {
  margin-top: 0.75rem;
}

.btn-buy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  color: #06070a;
  background: linear-gradient(135deg, #f5c45b 0%, #f59e0b 60%, #eab308 100%);
  box-shadow: 0 4px 14px rgba(245, 196, 91, 0.35);
  border: none;
  cursor: pointer;
  transition: all 180ms ease;
}

.btn-buy:hover,
.btn-buy:focus-visible {
  background: linear-gradient(135deg, #fde047 0%, #f5c45b 60%, #d946ef 100%);
  color: #000;
  box-shadow:
    0 6px 20px rgba(245, 196, 91, 0.5),
    0 0 16px rgba(217, 70, 239, 0.35);
  transform: translateY(-1px);
  outline: none;
}

.btn-buy svg {
  width: 14px;
  height: 14px;
  transition: transform 180ms ease;
}

.btn-buy:hover svg {
  transform: translate(2px, -2px);
}

/* ---------------- Loading & Error States ---------------- */
.merch-loading,
.merch-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  gap: 1rem;
  text-align: center;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(217, 70, 239, 0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ---------------- Footer ---------------- */
.merch-footer {
  border-top: 1px solid var(--border-subtle);
  background: #040507;
  padding: 3rem clamp(1rem, 4vw, 2.5rem);
  text-align: center;
}

.merch-footer__content {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.merch-footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem 1.75rem;
}

.merch-footer__links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  transition: color 160ms ease;
}

.merch-footer__links a:hover {
  color: var(--gold);
}

.merch-footer__copy {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* ---------------- Responsive Tweaks ---------------- */
@media (max-width: 640px) {
  .merch-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem 1rem;
  }
  .merch-nav {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
  }
}

/* ---------------- Next Chapter Gate ---------------- */
.chapter-gate {
  max-width: var(--max-w);
  margin: clamp(3rem, 6vh, 5rem) auto clamp(2rem, 4vh, 3rem);
  padding: clamp(2rem, 5vh, 3.5rem) 1.5rem;
  text-align: center;
  background: radial-gradient(circle at 50% 50%, rgba(35, 12, 55, 0.6), transparent 70%), rgba(14, 16, 23, 0.85);
  border: 1px solid rgba(217, 70, 239, 0.35);
  border-radius: 14px;
  box-shadow: 0 0 35px rgba(217, 70, 239, 0.12);
}

.chapter-gate__inner {
  max-width: 650px;
  margin: 0 auto;
}

.chapter-gate__eyebrow {
  display: block;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #d946ef;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.chapter-gate__title {
  font-size: clamp(1.6rem, 3.6vw, 2.4rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  margin: 0 0 0.8rem;
  color: #fff;
}

.chapter-gate__desc {
  font-size: 0.92rem;
  line-height: 1.55;
  color: rgba(245, 240, 255, 0.8);
  margin: 0 0 1.8rem;
}

.chapter-gate__link {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 2rem;
  border: 1px solid rgba(232, 121, 249, 0.72);
  border-radius: 8px;
  color: #fff;
  background: rgba(168, 85, 247, 0.18);
  box-shadow: 0 0 30px rgba(168, 85, 247, 0.25);
  font-size: 0.84rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-decoration: none;
  text-transform: uppercase;
  transition: all 180ms ease;
}

.chapter-gate__link:hover,
.chapter-gate__link:focus-visible {
  transform: translateY(-2px);
  background: rgba(217, 70, 239, 0.35);
  border-color: #f0abfc;
  box-shadow: 0 0 45px rgba(217, 70, 239, 0.45);
}
