.merch-section {
  position: relative;
  padding: 8rem 2rem;
  background-color: #000; /* keep existing flat black */
  color: #fff;
  overflow: hidden;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  isolation: isolate;
}

/* Subtle decorative blurred circles */
.merch-section::before,
.merch-section::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(12rem);
  opacity: 0.2;
  z-index: 0;
}

.merch-section::before {
  width: 26rem;
  height: 26rem;
  top: -10rem;
  left: -10rem;
  background: #7c3aed;
}

.merch-section::after {
  width: 28rem;
  height: 28rem;
  bottom: -12rem;
  right: -12rem;
  background: #ec4899;
}

/* Header */

.merch-header {
  position: relative;
  text-align: center;
  margin-bottom: 4rem;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.merch-header h2 {
  font-size: clamp(2.6rem, 5vw, 4rem);
  font-weight: 900;
  margin-bottom: 0.5rem;
  letter-spacing: -0.04em;
}

.merch-header p {
  font-size: 1.2rem;
  color: #d1d5db;
}

/* Cart button */
#merch-cart-button {
  position: absolute;
  right: 0;
  top: 0.25rem;
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  border: 1px solid #4b5563;
  background:
    radial-gradient(circle at top left, rgba(124,58,237,0.6), rgba(15,23,42,0.95));
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  box-shadow:
    0 10px 25px rgba(0,0,0,0.85),
    0 0 20px rgba(124,58,237,0.5);
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    border-color 0.25s ease,
    background 0.25s ease;
}

#merch-cart-button:hover {
  transform: translateY(-2px) scale(1.03);
  border-color: #a855f7;
  box-shadow:
    0 16px 35px rgba(0,0,0,0.95),
    0 0 28px rgba(168,85,247,0.7);
}

#merch-cart-count {
  padding: 0 0.45rem;
  border-radius: 999px;
  background: rgba(15,23,42,0.9);
  font-size: 0.8rem;
}

/* Mobile cart repositioning */
@media (max-width: 768px) {
  .merch-header {
    padding-bottom: 2.5rem;
  }

  #merch-cart-button {
    position: static;
    margin-top: 1rem;
  }
}

/* Category Filters */

.merch-categories {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 3rem;
  position: relative;
  z-index: 5;
}

.merch-categories button {
  padding: 0.55rem 1.6rem;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.5);
  background: rgba(15,23,42,0.96);
  color: #e5e7eb;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    transform 0.2s ease,
    box-shadow 0.3s ease,
    color 0.25s ease;
  backdrop-filter: blur(10px) saturate(160%);
}

.merch-categories button:hover {
  transform: translateY(-1px);
  border-color: #a855f7;
  box-shadow: 0 8px 18px rgba(0,0,0,0.7);
  color: #fff;
}

.merch-categories button.active {
  background: linear-gradient(120deg, #7c3aed, #ec4899);
  border-color: transparent;
  color: #f9fafb;
  box-shadow:
    0 10px 25px rgba(124,58,237,0.7),
    0 0 18px rgba(236,72,153,0.45);
}

/* Merch Grid */

.merch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.8rem;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 5;
}

/* Card */
.merch-item {
  background: radial-gradient(circle at top left, rgba(124,58,237,0.18), transparent 55%),
              radial-gradient(circle at bottom right, rgba(236,72,153,0.12), transparent 55%),
              #050507;
  border-radius: 1.25rem;
  overflow: hidden;
  transition:
    transform 0.3s ease,
    box-shadow 0.35s ease,
    border-color 0.3s ease,
    background 0.35s ease;
  cursor: pointer;
  border: 1px solid rgba(55,65,81,0.8);
  position: relative;
  box-shadow: 0 12px 30px rgba(0,0,0,0.85);
}

.merch-item::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 45px rgba(255,255,255,0.02);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.merch-item.hidden {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  pointer-events: none;
}

.merch-item:hover {
  transform: translateY(-6px) scale(1.03);
  border-color: rgba(124,58,237,0.9);
  box-shadow:
    0 16px 40px rgba(0,0,0,0.95),
    0 0 30px rgba(124,58,237,0.65);
}

.merch-item:hover::before {
  opacity: 1;
}

/* Image */
.merch-item img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  transition: transform 0.45s ease;
}

.merch-item:hover img {
  transform: scale(1.06);
}

/* Title */
.merch-item h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f9fafb;
  margin: 0.75rem 1rem 0.5rem 1rem;
  text-align: center;
}

/* Stock + price text */
.merch-stock {
  margin: 0 1rem 0.25rem 1rem;
  font-size: 0.9rem;
  color: #9ca3af;
  text-align: center;
}

.merch-price {
  margin: 0 1rem 1rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  color: #f97316;
  text-align: center;
}

/* Fade-up animation (synergy with global) */
.fade-up {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.8s ease-out;
}

.animate-fade-up {
  opacity: 1;
  transform: translateY(0);
}

/* Product Modal */

.merch-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.merch-modal.hidden {
  display: none;
}

.merch-modal-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(124,58,237,0.4), rgba(0,0,0,0.95));
  backdrop-filter: blur(10px);
}

.merch-modal-content {
  position: relative;
  z-index: 10;
  width: 95%;
  max-width: 900px;
  background: radial-gradient(circle at top left, #111827, #020617);
  border-radius: 1.6rem;
  border: 1px solid #4b5563;
  box-shadow: 0 30px 90px rgba(0,0,0,0.95);
  padding: 1.75rem;
}

/* Close button */
.merch-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid #4b5563;
  background: #020617;
  color: #e5e7eb;
  font-size: 1.2rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s ease,
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.merch-modal-close:hover {
  background: #111827;
  border-color: #a855f7;
  transform: scale(1.05);
  box-shadow: 0 0 18px rgba(168,85,247,0.6);
}

/* Modal layout */
.merch-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr);
  gap: 2rem;
  align-items: stretch;
}

.merch-modal-image-wrap {
  border-radius: 1.25rem;
  overflow: hidden;
  border: 1px solid #374151;
  background: radial-gradient(circle at top, #111827, #020617);
}

.merch-modal-image-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 420px;
  object-fit: cover;
}

/* Modal info */
.merch-modal-info {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#merch-modal-name {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.merch-modal-description {
  font-size: 0.95rem;
  color: #e5e7eb;
  line-height: 1.5;
}

.merch-modal-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: #f97316;
}

.merch-modal-stock {
  font-size: 0.9rem;
  color: #9ca3af;
}

/* Controls */
.merch-modal-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.merch-modal-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: #d1d5db;
}

.merch-modal-field label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #9ca3af;
}

#merch-modal-size,
#merch-modal-color,
#merch-modal-qty {
  background: #020617;
  color: #e5e7eb;
  border-radius: 0.75rem;
  border: 1px solid #4b5563;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

#merch-modal-size:focus,
#merch-modal-color:focus,
#merch-modal-qty:focus {
  border-color: #a855f7;
  box-shadow: 0 0 0 1px rgba(168,85,247,0.4);
  background: #020617;
}

#merch-modal-qty {
  appearance: textfield;
}
#merch-modal-qty::-webkit-outer-spin-button,
#merch-modal-qty::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Add to cart button */
.merch-add-btn {
  margin-top: 1.25rem;
  align-self: flex-start;
  padding: 0.75rem 1.75rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background-image: linear-gradient(90deg, #7c3aed, #ec4899);
  color: #f9fafb;
  box-shadow: 0 12px 30px rgba(236,72,153,0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.merch-add-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 18px 40px rgba(236,72,153,0.6);
  filter: brightness(1.05);
}

.merch-add-btn:active {
  transform: translateY(0px) scale(0.98);
  box-shadow: 0 10px 24px rgba(0,0,0,0.9);
}

/* Mobile modal layout */
@media (max-width: 768px) {
  .merch-modal-content {
    padding: 1.25rem;
    border-radius: 1.25rem;
  }

  .merch-modal-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .merch-modal-image-wrap img {
    max-height: 260px;
  }

  .merch-modal-controls {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Cart Overlay */

.merch-cart-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
}

.merch-cart-overlay.hidden {
  display: none;
}

.merch-cart-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,0.85);
  backdrop-filter: blur(10px);
}

.merch-cart-content {
  position: relative;
  z-index: 10;
  width: 95%;
  max-width: 600px;
  max-height: 80vh;
  background: #020617;
  border-radius: 1.25rem;
  border: 1px solid #4b5563;
  box-shadow: 0 24px 60px rgba(0,0,0,0.95);
  display: flex;
  flex-direction: column;
}

.merch-cart-header,
.merch-cart-footer {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #111827;
}

.merch-cart-footer {
  border-top: 1px solid #111827;
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.merch-cart-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

#merch-cart-close {
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 1.3rem;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
}

#merch-cart-close:hover {
  color: #e5e7eb;
  transform: scale(1.1);
}

.merch-cart-items {
  padding: 0.75rem 1.25rem 1rem 1.25rem;
  overflow-y: auto;
}

.merch-cart-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #111827;
  font-size: 0.9rem;
}

.merch-cart-row:last-child {
  border-bottom: none;
}

.merch-cart-row-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.merch-cart-row-main strong {
  font-weight: 600;
}

.merch-cart-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: #9ca3af;
}

.merch-cart-row-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: #e5e7eb;
}

.merch-cart-remove {
  border: none;
  background: transparent;
  color: #f97373;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  align-self: flex-end;
}

.merch-cart-remove:hover {
  color: #fecaca;
}

.merch-cart-empty {
  text-align: center;
  padding: 2rem 0;
  color: #9ca3af;
}

#merch-cart-total {
  font-weight: 700;
  color: #f97316;
}

.merch-checkout-btn {
  padding: 0.6rem 1.5rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #f9fafb;
  background-image: linear-gradient(90deg, #6366f1, #ec4899);
  box-shadow: 0 12px 30px rgba(79,70,229,0.6);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.merch-checkout-btn:hover {
  transform: translateY(-1px) scale(1.02);
  filter: brightness(1.05);
}

/* Order Overlay */

.merch-order-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
}

.merch-order-overlay.hidden {
  display: none;
}

.merch-order-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,0.9);
  backdrop-filter: blur(10px);
}

.merch-order-content {
  position: relative;
  z-index: 10;
  width: 95%;
  max-width: 650px;
  max-height: 85vh;
  background: #020617;
  border-radius: 1.25rem;
  border: 1px solid #4b5563;
  box-shadow: 0 26px 70px rgba(0,0,0,0.97);
  display: flex;
  flex-direction: column;
}

.merch-order-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #111827;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.merch-order-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

#merch-order-close {
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 1.3rem;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
}

#merch-order-close:hover {
  color: #e5e7eb;
  transform: scale(1.1);
}

.merch-order-summary {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid #111827;
  max-height: 200px;
  overflow-y: auto;
}

.merch-order-summary h4 {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.merch-order-list {
  list-style: disc;
  padding-left: 1.2rem;
  font-size: 0.9rem;
  color: #e5e7eb;
}

.merch-order-total {
  margin-top: 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #f97316;
}

.merch-order-form {
  padding: 1rem 1.25rem 0.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.merch-order-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
}

.merch-order-field label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #9ca3af;
}

.merch-order-field input,
.merch-order-field textarea {
  background: #020617;
  color: #e5e7eb;
  border-radius: 0.75rem;
  border: 1px solid #4b5563;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  outline: none;
  resize: vertical;
  min-height: 2.5rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.merch-order-field input:focus,
.merch-order-field textarea:focus {
  border-color: #a855f7;
  box-shadow: 0 0 0 1px rgba(168,85,247,0.4);
}

.merch-place-order-btn {
  margin-top: 0.75rem;
  align-self: flex-end;
  padding: 0.7rem 1.7rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #f9fafb;
  background-image: linear-gradient(90deg, #22c55e, #16a34a);
  box-shadow: 0 12px 28px rgba(34,197,94,0.5);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.merch-place-order-btn:hover {
  transform: translateY(-1px) scale(1.02);
  filter: brightness(1.05);
}

.merch-order-status {
  padding: 0.5rem 1.25rem 1rem 1.25rem;
  font-size: 0.85rem;
  color: #e5e7eb;
}
