/* ==========================================================================
   HEART 2026 — Merchandise catalog, cart drawer and checkout dialogs
   ========================================================================== */

/* ---------- Overlay shell ------------------------------------------------ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  background: rgba(8, 1, 5, 0.74);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s var(--ease), visibility 0.28s;
}
.overlay.is-open { opacity: 1; visibility: visible; }
.overlay[hidden] { display: none; }

/* ---------- Catalog panel (slides up, full height on mobile) ------------- */
.catalog {
  position: relative;
  width: 100%;
  max-width: 1180px;
  max-height: 92svh;
  margin: auto;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #250a18, var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transform: translateY(26px) scale(0.985);
  opacity: 0;
  transition: transform 0.34s var(--ease), opacity 0.34s var(--ease);
}
.overlay.is-open .catalog { transform: none; opacity: 1; }

.panel-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  flex-shrink: 0;
}
.panel-head h2 {
  font-family: var(--font-display);
  font-size: 1.68rem;
  font-weight: 600;
  margin: 0 0 3px;
}
.panel-head p { font-size: 0.86rem; color: var(--muted-2); margin: 0; }
.panel-head-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; flex-shrink: 0; }

.icon-btn {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
  flex-shrink: 0;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--line-strong); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 19px; height: 19px; }

/* ---------- Filters ------------------------------------------------------ */
.filters {
  display: flex;
  gap: 7px;
  padding: 15px 26px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.filters::-webkit-scrollbar { display: none; }
.filter {
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 0.83rem;
  color: var(--muted);
  white-space: nowrap;
  transition: all 0.2s;
}
.filter:hover { color: var(--ink); border-color: var(--line-strong); }
.filter.is-active {
  background: var(--grad-hot);
  border-color: transparent;
  color: #fff;
  font-weight: 500;
}

/* ---------- Product grid ------------------------------------------------- */
.catalog-body {
  padding: 22px 26px 28px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(226px, 1fr));
  gap: 16px;
}

.product {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.28s var(--ease), border-color 0.28s, box-shadow 0.28s;
  animation: cardIn 0.42s var(--ease) both;
}
.product:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 46, 106, 0.4);
  box-shadow: 0 16px 38px -22px rgba(255, 46, 106, 0.7);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.product-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: linear-gradient(140deg, rgba(201, 16, 47, 0.24), rgba(255, 61, 139, 0.14) 60%, rgba(246, 201, 100, 0.12));
  display: grid;
  place-items: center;
  overflow: hidden;
}
.product-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease); }
.product:hover .product-media img { transform: scale(1.05); }
.product-media .placeholder-mark { width: 44%; max-width: 92px; opacity: 0.5; }

.product-badge {
  position: absolute;
  top: 10px; left: 10px;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(8, 1, 5, 0.66);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 1px solid var(--line);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-2);
}
.product-stock {
  position: absolute;
  top: 10px; right: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(8, 1, 5, 0.66);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  font-size: 0.66rem;
  color: #ffb4c6;
  border: 1px solid rgba(255, 46, 106, 0.4);
}

.product-info { padding: 16px 17px 17px; display: flex; flex-direction: column; flex: 1; gap: 9px; }
.product-info h3 { font-size: 0.99rem; font-weight: 600; margin: 0; line-height: 1.35; }
.product-desc {
  font-size: 0.81rem;
  color: var(--muted-2);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-price {
  font-family: var(--font-display);
  font-size: 1.32rem;
  font-weight: 600;
  line-height: 1;
  background: var(--grad-gold);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.product-foot { margin-top: auto; display: grid; gap: 9px; }

.variant-select {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(8, 1, 5, 0.5);
  color: var(--ink);
  font-size: 0.84rem;
  font-family: inherit;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-opacity='.6' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 15px;
  padding-right: 32px;
}
.variant-select:focus { border-color: rgba(246, 201, 100, 0.55); outline: none; }
.variant-select option { background: var(--panel-solid); color: var(--ink); }

.sold-out-label {
  text-align: center;
  padding: 10px;
  border-radius: 999px;
  border: 1px dashed rgba(255, 255, 255, 0.24);
  font-size: 0.82rem;
  color: var(--muted-2);
}

.catalog-empty { text-align: center; padding: 70px 20px; color: var(--muted-2); }
.catalog-empty svg { width: 52px; height: 52px; margin: 0 auto 16px; opacity: 0.4; }

/* Skeleton loading state */
.skeleton { pointer-events: none; }
.skeleton .sk {
  background: linear-gradient(90deg, rgba(255,255,255,.045) 25%, rgba(255,255,255,.1) 37%, rgba(255,255,255,.045) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}
.skeleton .sk-media { aspect-ratio: 1 / 1; border-radius: 0; }
.skeleton .sk-line { height: 12px; margin-bottom: 9px; }
.skeleton .sk-line.short { width: 55%; }
@keyframes shimmer {
  from { background-position: 100% 50%; }
  to   { background-position: 0 50%; }
}

/* ---------- Cart drawer -------------------------------------------------- */
.drawer-overlay { justify-items: end; }
.cart {
  position: relative;
  width: 100%;
  max-width: 436px;
  height: 100svh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #260a18, var(--bg-2));
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 60px -30px rgba(0, 0, 0, 0.85);
  transform: translateX(100%);
  transition: transform 0.34s var(--ease);
}
.overlay.is-open .cart { transform: none; }

.cart-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 18px 22px;
}

.cart-line {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 13px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  animation: cardIn 0.3s var(--ease) both;
}
.cart-line:last-child { border-bottom: 0; }
.cart-thumb {
  width: 62px; height: 62px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(140deg, rgba(201, 16, 47, 0.3), rgba(246, 201, 100, 0.16));
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.cart-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-thumb svg { width: 26px; height: 26px; opacity: 0.6; }

.cart-line-main { min-width: 0; }
.cart-line-top { display: flex; align-items: flex-start; gap: 10px; }
.cart-line-name { font-size: 0.9rem; font-weight: 500; line-height: 1.35; margin: 0; }
.cart-line-variant { font-size: 0.75rem; color: var(--gold); margin: 2px 0 0; }
.cart-line-price { font-size: 0.8rem; color: var(--muted-2); margin: 3px 0 0; }
.cart-remove {
  margin-left: auto;
  width: 28px; height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-2);
  flex-shrink: 0;
  transition: color 0.2s, background 0.2s;
}
.cart-remove:hover { color: #ff7a9c; background: rgba(255, 46, 106, 0.14); }
.cart-remove svg { width: 15px; height: 15px; }

.cart-line-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(8, 1, 5, 0.42);
}
.stepper button {
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1;
  transition: background 0.18s;
}
.stepper button:hover:not([disabled]) { background: rgba(255, 255, 255, 0.11); }
.stepper button[disabled] { opacity: 0.32; cursor: not-allowed; }
.stepper output {
  min-width: 30px;
  text-align: center;
  font-size: 0.86rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.cart-line-total { font-size: 0.9rem; font-weight: 600; white-space: nowrap; }

.cart-empty { text-align: center; padding: 64px 22px; color: var(--muted-2); }
.cart-empty svg { width: 46px; height: 46px; margin: 0 auto 15px; opacity: 0.35; }
.cart-empty p { font-size: 0.9rem; }

.cart-foot {
  flex-shrink: 0;
  padding: 18px 22px 22px;
  border-top: 1px solid var(--line);
  background: rgba(8, 1, 5, 0.34);
}
.cart-summary { display: grid; gap: 7px; margin-bottom: 15px; }
.cart-row { display: flex; justify-content: space-between; font-size: 0.87rem; color: var(--muted); }
.cart-row.is-total {
  padding-top: 11px;
  border-top: 1px solid var(--line);
  font-size: 1.05rem;
  color: var(--ink);
  font-weight: 600;
}
.cart-row.is-total b {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  background: var(--grad-gold);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Pickup notice ------------------------------------------------ */
.pickup-notice {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(246, 201, 100, 0.32);
  background: rgba(246, 201, 100, 0.08);
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--muted);
}
.pickup-notice svg { width: 18px; height: 18px; color: var(--gold); flex-shrink: 0; margin-top: 2px; }
.pickup-notice b { color: var(--gold-2); font-weight: 600; }
.pickup-notice a { color: var(--gold-2); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Dialogs (checkout / confirmation) ---------------------------- */
.dialog-overlay { place-items: center; padding: 20px; overflow-y: auto; }
.dialog {
  position: relative;
  width: 100%;
  max-width: 500px;
  margin: auto;
  background: linear-gradient(180deg, #280b19, var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transform: translateY(20px) scale(0.975);
  opacity: 0;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.overlay.is-open .dialog { transform: none; opacity: 1; }

.dialog-head {
  padding: 24px 26px 0;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.dialog-head h2 {
  font-family: var(--font-display);
  font-size: 1.58rem;
  font-weight: 600;
  margin: 0 0 4px;
}
.dialog-head p { font-size: 0.86rem; color: var(--muted-2); margin: 0; }
.dialog-head .icon-btn { margin-left: auto; }

.dialog-body { padding: 20px 26px; display: grid; gap: 15px; }
.dialog-foot {
  padding: 4px 26px 26px;
  display: grid;
  gap: 10px;
}

/* ---------- Form fields -------------------------------------------------- */
.field { display: grid; gap: 6px; }
.field label { font-size: 0.8rem; font-weight: 500; color: var(--muted); }
.field label .req { color: var(--rose); }
.field input,
.field textarea {
  width: 100%;
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(8, 1, 5, 0.52);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.94rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field textarea { resize: vertical; min-height: 74px; }
.field input::placeholder, .field textarea::placeholder { color: rgba(255, 255, 255, 0.3); }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: rgba(255, 46, 106, 0.6);
  box-shadow: 0 0 0 3px rgba(255, 46, 106, 0.14);
}
.field input[aria-invalid='true'], .field textarea[aria-invalid='true'] {
  border-color: #ff5d7f;
  box-shadow: 0 0 0 3px rgba(255, 93, 127, 0.16);
}
.field .hint { font-size: 0.74rem; color: var(--muted-2); }
.field .error { font-size: 0.75rem; color: #ff9db1; min-height: 1em; }

.order-recap {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.035);
  padding: 14px 16px;
  display: grid;
  gap: 8px;
  max-height: 168px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.order-recap-line { display: flex; justify-content: space-between; gap: 12px; font-size: 0.85rem; }
.order-recap-line span { color: var(--muted); min-width: 0; }
.order-recap-line b { white-space: nowrap; font-weight: 500; }
.order-recap-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  font-weight: 600;
}
.order-recap-total b {
  font-family: var(--font-display);
  font-size: 1.38rem;
  background: var(--grad-gold);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.form-alert {
  display: none;
  gap: 10px;
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 93, 127, 0.44);
  background: rgba(255, 46, 106, 0.12);
  font-size: 0.85rem;
  color: #ffc4d1;
}
.form-alert.is-visible { display: flex; }
.form-alert svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 2px; }

/* ---------- Button spinner ---------------------------------------------- */
.btn.is-loading { pointer-events: none; opacity: 0.85; }
.btn .spinner {
  display: none;
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn.is-loading .spinner { display: block; }
.btn.is-loading .btn-label { opacity: 0.75; }
.btn-gold .spinner { border-color: rgba(58, 16, 6, 0.3); border-top-color: #3a1006; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toast -------------------------------------------------------- */
.toast-stack {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 120;
  display: grid;
  gap: 8px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 17px;
  border-radius: 999px;
  background: rgba(24, 6, 14, 0.95);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  font-size: 0.87rem;
  animation: toastIn 0.3s var(--ease);
}
.toast.is-out { animation: toastOut 0.25s var(--ease) forwards; }
.toast svg { width: 17px; height: 17px; flex-shrink: 0; }
.toast.is-ok svg { color: #6ee7a8; }
.toast.is-err { border-color: rgba(255, 93, 127, 0.5); }
.toast.is-err svg { color: #ff8fa8; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(10px) scale(0.97); }
}

/* ---------- Mobile ------------------------------------------------------- */
@media (max-width: 780px) {
  .catalog {
    max-width: none;
    max-height: none;
    height: 100svh;
    border-radius: 0;
    border: 0;
  }
  .panel-head { padding: 15px 16px 13px; align-items: center; }
  .panel-head h2 { font-size: 1.22rem; }
  /* The catalog strapline costs three lines on a phone — the pickup notice in
     the cart and at checkout says the same thing where it matters. */
  .catalog .panel-head p { display: none; }
  .catalog .panel-head [data-open-cart] span:not(.cart-count) { display: none; }
  .catalog .panel-head [data-open-cart] { padding: 9px 13px; }
  .filters { padding: 12px 18px; }
  .catalog-body { padding: 17px 18px 26px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .product-info { padding: 13px 13px 14px; gap: 7px; }
  .product-info h3 { font-size: 0.9rem; }
  .product-desc { display: none; }
  .product-price { font-size: 1.15rem; }
  .cart { max-width: none; }
  .dialog-overlay { padding: 0; }
  .dialog {
    max-width: none;
    min-height: 100svh;
    border-radius: 0;
    border: 0;
    display: flex;
    flex-direction: column;
  }
  .dialog-body { flex: 1; overflow-y: auto; }
}
