/* ==========================================================================
   HxH Store · v1.6.21 polish layer
   Loaded last on purpose: refinements only, nothing here re-declares a layout
   that already works. Every rule is additive and mobile-first.
   ========================================================================== */

:root {
  --hxh-tap: 44px;
  --hxh-radius: 18px;
  --hxh-soft: 0 14px 34px -22px rgba(46, 16, 101, 0.45);
  --hxh-ring: 0 0 0 3px rgba(14,124,90, 0.28);
}

/* ---------------------------------------------------------------- Motion -- */
@media (prefers-reduced-motion: no-preference) {
  .product,
  .notif-card,
  .hxh-install-strip,
  .restock-notify-card {
    transition:
      transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
      box-shadow 0.24s cubic-bezier(0.22, 1, 0.36, 1),
      border-color 0.24s ease;
    will-change: transform;
  }
}

/* Cards should feel picked up by a finger, not shoved by a mouse. */
@media (hover: hover) and (pointer: fine) {
  .product:hover {
    transform: translateY(-3px);
    box-shadow: var(--hxh-soft);
  }
}

.product:active {
  transform: scale(0.994);
}

/* Touch targets: thumbs need 44px, not 28px. */
.btn.small,
.icon-btn,
.product-actions-wrap .btn,
.notify-restock-btn {
  min-height: var(--hxh-tap);
}

/* Creamy, app-like focus ring that never disappears for keyboard users. */
:is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--brand-accent, #0e7c5a);
  outline-offset: 2px;
  border-radius: 10px;
}

/* ------------------------------------------------------- Sold-out state -- */
.product.is-sold-out .product-media > .product-art {
  filter: saturate(0.55) brightness(0.94);
}

.product.is-sold-out .product-price strong {
  opacity: 0.75;
}

.availability-ring {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(14,124,90, 0.12);
  color: var(--brand-accent, #0a6e4f);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.notify-restock-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(14,124,90, 0.42);
  background: linear-gradient(135deg, rgba(14,124,90, 0.14), rgba(127,217,184, 0.2));
  color: var(--brand-accent, #08543d);
  font-weight: 700;
  cursor: pointer;
}

.notify-restock-btn:hover {
  border-color: var(--brand-accent, #0e7c5a);
  background: linear-gradient(135deg, rgba(14,124,90, 0.22), rgba(127,217,184, 0.28));
}

.notify-restock-btn .color-icon {
  width: 17px;
  height: 17px;
}

/* Restock modal */
.restock-notify-card {
  display: grid;
  gap: 12px;
  text-align: center;
  padding: 4px 2px 2px;
}

.restock-notify-art {
  width: 64px;
  height: 64px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: linear-gradient(150deg, rgba(14,124,90, 0.18), rgba(236, 72, 153, 0.14));
  color: var(--brand-accent, #0a6e4f);
  box-shadow: inset 0 0 0 1px rgba(14,124,90, 0.22);
}

.restock-notify-art .color-icon {
  width: 30px;
  height: 30px;
}

.restock-notify-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
}

.restock-signed-in {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin: 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(34, 197, 94, 0.1);
  color: #166534;
  font-size: 13px;
}

.restock-signed-in .color-icon {
  width: 16px;
  height: 16px;
}

/* ------------------------------------------- Get-the-app suggestion strip -- */
.hxh-install-strip {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(66px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 14px 14px 14px 13px;
  border-radius: 20px;
  border: 1px solid rgba(14,124,90, 0.28);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 18px 46px -20px rgba(46, 16, 101, 0.55);
  animation: hxhInstallIn 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

.hxh-install-strip.is-out {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

@keyframes hxhInstallIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hxh-install-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, #0e7c5a, #1cb98a 60%, #ec4899);
  box-shadow: 0 8px 20px -10px rgba(14,124,90, 0.8);
}

.hxh-install-icon svg {
  width: 22px;
  height: 22px;
}

.hxh-install-copy strong {
  display: block;
  font-size: 14px;
  color: #1f1235;
}

.hxh-install-copy p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: #574e70;
}

.hxh-install-points {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 3px;
  font-size: 11px;
  color: #6b6383;
}

.hxh-install-points li {
  position: relative;
  padding-left: 15px;
}

.hxh-install-points li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

.hxh-install-help {
  margin-top: 8px;
  font-size: 11.5px;
  color: #4c4463;
}

.hxh-install-help summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--brand-accent, #0a6e4f);
}

.hxh-install-help ol {
  margin: 6px 0 0;
  padding-left: 16px;
  display: grid;
  gap: 4px;
  line-height: 1.45;
}

.hxh-install-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.hxh-install-actions .btn {
  flex: 1 1 120px;
  justify-content: center;
}

.hxh-install-close {
  width: 30px;
  height: 30px;
  min-height: 30px;
  border-radius: 50%;
  color: #6b6383;
}

.hxh-install-close svg {
  width: 16px;
  height: 16px;
}

@media (min-width: 720px) {
  .hxh-install-strip {
    display: none;
  }
}

@media (prefers-color-scheme: dark) {
  .hxh-install-strip {
    background: rgba(23, 16, 42, 0.96);
    border-color: rgba(95,211,168, 0.32);
  }
  .hxh-install-copy strong {
    color: #f4f0ff;
  }
  .hxh-install-copy p,
  .hxh-install-help,
  .hxh-install-points {
    color: #c3b8e0;
  }
}

/* ------------------------------------------------------ Mobile ergonomics -- */
@media (max-width: 720px) {
  .content {
    padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  }

  .product-actions-wrap {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .modal {
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border-radius: 22px 22px 0 0;
  }

  /* Long e-mail addresses and product names must never widen the page. */
  .notif-card,
  .product-title,
  .restock-notify-card {
    overflow-wrap: anywhere;
  }

  input,
  select,
  textarea {
    font-size: 16px; /* stops iOS/Android zoom-on-focus jumping the layout */
  }
}

/* Smooth momentum scrolling everywhere it matters, without breaking modals. */
.notif-drawer-list,
.products-grid,
.content,
.history-delivery-content {
  -webkit-overflow-scrolling: touch;
}

/* A tiny, tasteful skeleton shimmer reuse for the catalog. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------------------------------------------- admin restock demand card -- */
/* Shown above the admin catalog table: how many customers are waiting on a
   sold-out listing, and which listing is the most wanted. */
.restock-demand-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--accent, #17a67a) 28%, transparent);
  background: color-mix(in srgb, var(--accent, #17a67a) 8%, var(--surface, #14121d));
  color: var(--text, #eceaf7);
  font-size: 0.9rem;
  line-height: 1.5;
}
.restock-demand-note .color-icon { flex: 0 0 auto; width: 22px; height: 22px; }
.restock-demand-note strong { color: var(--text-strong, #fff); }
@media (max-width: 560px) {
  .restock-demand-note { font-size: 0.84rem; padding: 10px 12px; }
}

/* ------------------------------------------- notification centre polish -- */
/* Cards that link somewhere behave like real buttons, and an unread card
   softly glows so "what's new" is obvious without shouting. */
.notif-card[role="button"] { cursor: pointer; }
.notif-card[role="button"]:focus-visible {
  outline: 2px solid var(--purple, #5fd3a8);
  outline-offset: 2px;
}
.notif-card.unread {
  background: linear-gradient(100deg, rgba(14,124,90, 0.14), transparent 62%), var(--panel2, #191527);
}
.notif-card.unread strong { color: var(--text-strong, #fff); }
.notif-read-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted, #a49dc4);
}
.notif-read-state .color-icon { width: 16px; height: 16px; }

/* --------------------------------------------- browser alert opt-in row -- */
.notif-alert-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed color-mix(in srgb, var(--purple, #5fd3a8) 40%, transparent);
  background: rgba(14,124,90, 0.07);
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--text, #eceaf7);
}
.notif-alert-row > span { flex: 1 1 auto; min-width: 0; }
.notif-alert-row .color-icon { flex: 0 0 auto; width: 20px; height: 20px; color: var(--purple, #5fd3a8); }
.notif-alert-row.is-on {
  border-style: solid;
  border-color: color-mix(in srgb, #34d399 45%, transparent);
  background: rgba(52, 211, 153, 0.08);
}
.notif-alert-row.is-on .color-icon { color: #34d399; }
@media (max-width: 520px) {
  .notif-alert-row { flex-wrap: wrap; font-size: 0.82rem; }
  .notif-alert-row .btn, .notif-alert-row .text-link { margin-left: auto; }
}

/* ---------------------------------------------------- footer release chip */
.footer-release {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--purple, #5fd3a8) 35%, transparent);
  background: rgba(14,124,90, 0.10);
  color: inherit;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.footer-release:hover { border-color: var(--purple, #5fd3a8); background: rgba(14,124,90, 0.18); }
.footer-release .color-icon { width: 14px; height: 14px; }
@media (max-width: 620px) {
  .footer-bottom { flex-wrap: wrap; gap: 8px; justify-content: center; text-align: center; }
  .footer-release { font-size: 0.7rem; }
}

/* ------------------------------------------------ global smoothness pass -- */
/* 1. Native-feeling scrolling, but only when the visitor allows motion. */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
/* 2. Remove the 300 ms tap delay and the grey tap flash on phones. */
a,
button,
[role="button"],
.toggle-pill,
.notif-card,
.pc-notify,
.fb-tile,
.avatar-choice {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
/* 3. Inner scrollers capture the gesture instead of dragging the page. */
.notif-drawer-list,
.modal-body,
.table-wrap,
.categories {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
/* 4. Cards paint once and animate transform only — no layout work mid-scroll. */
.product-card,
.panel,
.line-item {
  contain: layout paint style;
}
/* 5. Text stays crisp and images never reflow late. */
.product-card img,
.pc-art img,
.notif-icon-wrap svg {
  display: block;
}

/* ==========================================================================
   6. Product-card motion + a desktop pointer glow (v1.6.22)
   Everything below is additive, transform/opacity only, and switched off for
   reduced-motion or coarse pointers so phones keep their battery and calm.
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
  /* Cards ease in as they scroll into view — small travel, short delay. */
  .product {
    animation: hxh-card-in 0.42s cubic-bezier(0.22, 1, 0.36, 1) backwards;
    animation-delay: calc(var(--hx-stagger, 0) * 34ms);
  }
  /* Artwork breathes a little on hover instead of jumping. */
  .product .product-art img,
  .product .product-art svg,
  .product .product-art .brand-tile,
  .product .product-art .generic-product-mark {
    transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
    transform-origin: 50% 55%;
  }
  /* A thin sheen crosses the card once, then stays out of the way. */
  .product::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.14) 50%, transparent 62%);
    background-size: 260% 100%;
    background-position: 140% 0;
    opacity: 0;
    transition: background-position 0.7s ease, opacity 0.35s ease;
  }
  .product:hover::after,
  .product:focus-within::after {
    opacity: 1;
    background-position: -40% 0;
  }
  .product-title,
  .product .product-title-trigger {
    transition: color 0.2s ease;
  }
  .product:hover .product-title,
  .product:hover .product-title-trigger {
    color: var(--brand-accent, #5fd3a8);
  }
  .product:hover .product-actions-wrap .btn {
    transform: translateY(-1px);
  }
  @keyframes hxh-card-in {
    from { opacity: 0; transform: translateY(12px) scale(0.985); }
    to   { opacity: 1; transform: none; }
  }
}

/* The card needs a positioning context for the sheen layer. */
.product { position: relative; }
.product-media { overflow: hidden; }

@media (hover: hover) and (pointer: fine) {
  .product:hover .product-art img,
  .product:hover .product-art svg,
  .product:hover .product-art .brand-tile,
  .product:hover .product-art .generic-product-mark {
    transform: scale(1.055) rotate(-0.6deg);
  }
  /* A soft pointer halo: pure decoration, aria-hidden, no hit-testing. */
  .hxh-cursor-glow {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 260px;
    margin: -130px 0 0 -130px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 3;
    opacity: 0;
    background: radial-gradient(circle, rgba(14,124,90, 0.20), rgba(14,124,90, 0) 62%);
    transition: opacity 0.3s ease;
    will-change: transform;
  }
  .hxh-cursor-glow.is-on { opacity: 1; }
  /* A second, tighter dot keeps the pointer precise over busy artwork. */
  .hxh-cursor-dot {
    position: fixed;
    left: 0;
    top: 0;
    width: 8px;
    height: 8px;
    margin: -4px 0 0 -4px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 4;
    opacity: 0;
    background: rgba(196, 181, 253, 0.85);
    box-shadow: 0 0 0 3px rgba(14,124,90, 0.18);
    transition: opacity 0.25s ease, width 0.2s ease, height 0.2s ease, background 0.2s ease;
    will-change: transform;
  }
  .hxh-cursor-dot.is-on { opacity: 1; }
  .hxh-cursor-dot.is-hot {
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    background: rgba(95,211,168, 0.35);
  }
  /* Buttons and links get the classic pointer again — this is a highlight,
     not a replacement, so nothing feels unclickable. */
  .hxh-cursor-dot, .hxh-cursor-glow { cursor: inherit; }
}

@media (prefers-reduced-motion: reduce), (hover: none) {
  .hxh-cursor-glow, .hxh-cursor-dot { display: none !important; }
  .product::after { display: none; }
}

/* ------------------------------------------------- 7. Avatar picker (1.6.22) --
   Fifteen choices need a tidy grid: two roomy tiles on a phone, three on
   anything wider, and the illustrated set compressed so the modal stays short. */
.avatar-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 560px) {
  .avatar-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.avatar-grid-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin: 18px 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--hx-ink2, #8b8fa3);
}
.avatar-grid-label span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  opacity: 0.75;
}
.avatar-grid-art .avatar-choice {
  grid-template-columns: 44px minmax(0, 1fr);
  padding: 9px;
  gap: 9px;
}
.avatar-grid-art .avatar-choice img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: transparent;
}
.avatar-grid-art .avatar-choice small {
  display: none;
}
.avatar-grid-art .avatar-choice-check {
  display: none;
}
.avatar-grid-art .avatar-choice.is-active {
  outline: 2px solid var(--hx-primary, #0e7c5a);
  outline-offset: 1px;
}
.avatar-preview-strip {
  flex-wrap: wrap;
}

/* ------------------------------------------- 8. Admin patch chips (1.6.22) --
   Each published HXHP patch is one chip: "v1.0.12 → v1.0.13 · 640 KB". */
.patch-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}
.patch-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--hx-ink, #1f2430);
  background: rgba(55,221,163, 0.14);
  border: 1px solid rgba(55,221,163, 0.38);
  white-space: nowrap;
}
.patch-chip strong {
  font-weight: 800;
}
html[data-theme="black"] .patch-chip,
body[data-theme="black"] .patch-chip {
  color: #e7f6ff;
  background: rgba(55,221,163, 0.18);
  border-color: rgba(55,221,163, 0.45);
}
