/* Unified storefront and purchase flow */
:root {
  --pos-ink: #172033;
  --pos-muted: #667085;
  --pos-line: #dce5ec;
  --pos-surface: #ffffff;
  --pos-soft: #f5f8fa;
  --pos-accent: #079ba5;
  --pos-accent-soft: #eefbfc;
  --pos-coral: #f47b61;
}

.home-category-catalog,
.product-category-page,
.category-catalog-page,
.product-purchase-page {
  color: var(--pos-ink);
  background: var(--pos-soft);
}

.home-category-catalog {
  padding: 38px 0 46px;
}

.home-category-catalog .home-catalog-heading {
  margin-bottom: 20px;
}

.home-category-catalog .home-catalog-heading h2,
.product-category-hero h1 {
  margin: 0;
  color: var(--pos-ink);
  font-size: clamp(25px, 3vw, 34px);
  line-height: 1.3;
  letter-spacing: 0;
}

.product-category-grid,
.home-category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  justify-content: stretch;
  padding-top: 0;
}

.product-category-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--pos-line);
  border-radius: 8px;
  background: var(--pos-surface);
  box-shadow: 0 10px 28px rgba(23, 32, 51, .06);
}

.product-category-card__link {
  height: 100%;
  display: flex;
  flex-direction: column;
  color: inherit;
  background: var(--pos-surface);
}

.product-category-card__link:hover,
.product-category-card__link:focus-visible {
  color: inherit;
  background: var(--pos-surface);
}

.product-category-card__link:focus-visible {
  outline: 3px solid rgba(7, 155, 165, .24);
  outline-offset: 3px;
}

.product-category-card__media {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  isolation: isolate;
  background: #f1f5f7;
}

.product-category-card__backdrop,
.product-category-card__foreground {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.product-category-card__backdrop {
  z-index: 0;
  overflow: hidden;
}

.product-category-card__backdrop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(16px) saturate(.9);
  opacity: .3;
  transform: scale(1.13);
}

.product-category-card__foreground {
  z-index: 1;
}

.product-category-card__foreground img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.product-category-card__count {
  position: absolute;
  z-index: 3;
  top: 10px;
  left: 10px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, .48);
  border-radius: 6px;
  padding: 5px 9px;
  color: #fff;
  background: rgba(23, 32, 51, .78);
  box-shadow: 0 6px 16px rgba(23, 32, 51, .16);
  backdrop-filter: blur(8px);
  font-size: 12px;
  line-height: 1;
  font-weight: 850;
}

.product-category-card__body {
  min-height: 60px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid #edf1f4;
  background: var(--pos-surface);
}

.product-category-card__body strong {
  min-width: 0;
  overflow: hidden;
  color: var(--pos-ink);
  font-size: 16px;
  line-height: 1.35;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-category-card__body svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
  color: var(--pos-accent);
}

.product-category-hero {
  padding: 28px 0;
}

.product-category-page > .product-category-grid {
  padding-top: 24px;
  padding-bottom: 56px;
}

/* Category workspace */
.category-catalog-summary {
  border-bottom: 1px solid var(--pos-line);
  background: var(--pos-surface);
}

.category-catalog-summary__inner {
  min-height: 96px;
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding-block: 14px;
}

.category-catalog-summary__image {
  width: 68px;
  height: 68px;
  border: 1px solid var(--pos-line);
  border-radius: 8px;
  object-fit: contain;
  background: var(--pos-soft);
}

.category-catalog-summary__identity {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.category-catalog-summary__identity h1 {
  margin: 0;
  color: var(--pos-ink);
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.25;
  letter-spacing: 0;
}

.category-catalog-summary__identity b {
  color: var(--pos-muted);
  font-size: 13px;
  font-weight: 750;
}

.category-catalog-summary__back {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--pos-line);
  border-radius: 7px;
  padding: 8px 12px;
  color: #475467;
  background: var(--pos-surface);
  font-size: 13px;
  font-weight: 800;
}

.category-catalog-summary__back:hover,
.category-catalog-summary__back:focus-visible {
  color: #475467;
  border-color: #b9c7d0;
  background: var(--pos-surface);
}

.category-catalog-summary__back svg,
.pos-catalog-toolbar-form svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.category-catalog-workspace {
  padding-top: 28px;
  padding-bottom: 60px;
}

.category-catalog-toolbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.category-catalog-toolbar h2 {
  margin: 0;
  color: var(--pos-ink);
  font-size: 25px;
  line-height: 1.3;
}

.category-catalog-toolbar > span {
  color: var(--pos-muted);
  font-size: 12px;
  font-weight: 750;
}

.pos-catalog-toolbar-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 220px 108px auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 22px;
  border: 1px solid var(--pos-line);
  border-radius: 8px;
  padding: 12px;
  background: var(--pos-surface);
}

.pos-catalog-search {
  height: 44px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid #cfd9e1;
  border-radius: 7px;
  padding: 0 12px;
  color: #98a2b3;
  background: var(--pos-surface);
}

.pos-catalog-search input {
  width: 100%;
  min-width: 0;
  height: 42px;
  border: 0;
  outline: 0;
  color: var(--pos-ink);
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
}

.pos-catalog-sort {
  display: grid;
  gap: 5px;
}

.pos-catalog-sort > span {
  color: var(--pos-muted);
  font-size: 11px;
  font-weight: 800;
}

.pos-catalog-sort select {
  width: 100%;
  height: 44px;
  border: 1px solid #cfd9e1;
  border-radius: 7px;
  padding-inline: 11px;
  color: var(--pos-ink);
  background: var(--pos-surface);
  font-family: inherit;
  font-size: 13px;
  font-weight: 750;
}

.pos-catalog-submit,
.pos-catalog-reset {
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 850;
}

.pos-catalog-submit {
  border: 1px solid var(--pos-accent);
  color: #fff;
  background: var(--pos-accent);
  cursor: pointer;
}

.pos-catalog-reset {
  width: 44px;
  border: 1px solid var(--pos-line);
  color: #667085;
  background: var(--pos-surface);
}

.pos-catalog-submit:hover,
.pos-catalog-submit:focus-visible {
  color: #fff;
  background: var(--pos-accent);
}

.pos-catalog-reset:hover,
.pos-catalog-reset:focus-visible {
  color: #667085;
  background: var(--pos-surface);
  border-color: #b9c7d0;
}

/* Product cards */
.catalog-page .product-grid,
.category-catalog-page .product-grid,
.am-home-reference .product-grid.home-products {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.am-product-card {
  box-shadow: 0 8px 24px rgba(23, 32, 51, .055) !important;
}

.am-product-card:hover,
.am-product-card:focus-within,
.am-product-card:hover .am-product-body,
.am-product-card:focus-within .am-product-body {
  color: inherit;
  background: var(--pos-surface) !important;
}

.am-product-body {
  gap: 9px;
  padding: 12px 13px 13px;
}

.pc-title {
  min-height: 42px;
  font-size: 15px;
}

.pc-description {
  height: auto;
  min-height: 0;
  max-height: 42px;
  border-inline-start-color: var(--pos-coral);
  background: rgba(244, 123, 97, .055);
}

.pc-price strong {
  font-size: 18px;
}

.pc-buy-button {
  min-width: 102px;
  min-height: 40px;
}

.pc-buy-button.is-loading {
  pointer-events: none;
  opacity: .74;
}

.pc-buy-button.is-loading svg {
  animation: pos-buy-spin .75s linear infinite;
}

@keyframes pos-buy-spin {
  to { transform: rotate(360deg) !important; }
}

/* Product page */
.product-purchase-page {
  padding: 34px 0 64px;
}

.product-purchase-page .wrap {
  max-width: 1060px;
}

.product-purchase-shell {
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.product-purchase-media,
.product-purchase-content {
  border: 1px solid var(--pos-line);
  border-radius: 8px;
  background: var(--pos-surface);
  box-shadow: 0 12px 30px rgba(23, 32, 51, .055);
}

.product-purchase-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px;
}

.product-purchase-title h1 {
  font-size: clamp(26px, 3.4vw, 38px);
  letter-spacing: 0;
}

.product-description-highlight {
  border-inline-start: 4px solid var(--pos-coral);
  border-radius: 0 7px 7px 0;
  padding: 13px 15px;
  background: rgba(244, 123, 97, .055);
}

.product-description-highlight h2 {
  margin: 0 0 5px;
  font-size: 12px;
}

.product-description-highlight p {
  margin: 0;
  color: #475467;
  font-size: 14px;
  line-height: 1.7;
}

.product-primary-action {
  margin-top: 20px;
  padding-top: 18px;
}

/* Same-page quick purchase */
.product-purchase-dialog {
  width: min(760px, calc(100% - 28px));
  border-radius: 10px;
}

.product-purchase-dialog__panel {
  border-radius: 10px;
}

.product-purchase-dialog__head {
  grid-template-columns: 54px minmax(0, 1fr) 40px;
  min-height: 72px;
  padding: 10px 14px;
}

.product-purchase-dialog__head img {
  width: 54px;
  height: 54px;
  border-radius: 7px;
}

.product-purchase-dialog__head h2 {
  font-size: 18px;
}

.product-purchase-dialog__body {
  padding: 16px;
}

.product-purchase-modal-form {
  gap: 14px;
}

.product-purchase-dialog .purchase-package-grid {
  max-height: 286px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.product-purchase-dialog .purchase-package-card__body {
  position: relative;
  min-height: 76px;
  justify-content: space-between;
  border: 1px solid var(--pos-line);
  border-radius: 7px;
  padding: 11px;
  background: var(--pos-surface);
}

.product-purchase-dialog .purchase-package-card input:checked + .purchase-package-card__body {
  border-color: var(--pos-accent);
  background: var(--pos-accent-soft);
  box-shadow: inset 0 0 0 1px var(--pos-accent);
}

.product-purchase-dialog .purchase-package-card input:checked + .purchase-package-card__body::after {
  content: "✓";
  position: absolute;
  top: 7px;
  left: 7px;
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--pos-accent);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.product-purchase-dialog .purchase-player-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  border-top: 1px solid #edf1f4;
  padding-top: 14px;
}

.purchase-modal-field input {
  border-radius: 7px;
}

.product-purchase-dialog .purchase-private-price {
  min-height: 40px;
  justify-content: flex-start;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.product-purchase-dialog .purchase-private-price button {
  min-height: 38px;
  border: 1px solid var(--pos-line);
  border-radius: 7px;
  background: var(--pos-surface);
}

.purchase-dialog-summary {
  position: sticky;
  bottom: -16px;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(120px, auto) minmax(220px, 1fr);
  align-items: center;
  gap: 14px;
  margin: 2px -16px -16px;
  border-top: 1px solid var(--pos-line);
  padding: 12px 16px;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(10px);
}

.purchase-dialog-summary > div {
  display: grid;
  gap: 2px;
}

.purchase-dialog-summary > div span {
  color: var(--pos-muted);
  font-size: 11px;
  font-weight: 750;
}

.purchase-dialog-summary > div strong {
  color: var(--pos-accent);
  font-size: 20px;
  line-height: 1.2;
  font-weight: 900;
}

.product-purchase-dialog .product-purchase-submit {
  width: 100%;
  min-height: 48px;
  margin: 0;
  border-radius: 7px;
  color: #fff !important;
  background: var(--pos-accent) !important;
  box-shadow: none !important;
}

.product-purchase-dialog .product-purchase-submit:hover,
.product-purchase-dialog .product-purchase-submit:focus-visible {
  color: #fff !important;
  background: var(--pos-accent) !important;
}

@media (max-width: 1100px) {
  .product-category-grid,
  .home-category-grid,
  .catalog-page .product-grid,
  .category-catalog-page .product-grid,
  .am-home-reference .product-grid.home-products {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .home-category-catalog {
    padding: 28px 0 34px;
  }

  .product-category-grid,
  .home-category-grid,
  .catalog-page .product-grid,
  .category-catalog-page .product-grid,
  .am-home-reference .product-grid.home-products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .product-category-card__count {
    top: 8px;
    left: 8px;
    min-height: 26px;
    padding: 4px 7px;
    font-size: 10px;
  }

  .product-category-card__body {
    min-height: 54px;
    padding: 10px 11px;
  }

  .product-category-card__body strong {
    font-size: 14px;
  }

  .category-catalog-summary__inner {
    grid-template-columns: 54px minmax(0, 1fr) 42px;
    gap: 10px;
    min-height: 80px;
  }

  .category-catalog-summary__image {
    width: 54px;
    height: 54px;
  }

  .category-catalog-summary__identity {
    display: grid;
    gap: 2px;
  }

  .category-catalog-summary__identity h1 {
    font-size: 21px;
  }

  .category-catalog-summary__back {
    width: 42px;
    min-height: 42px;
    justify-content: center;
    padding: 0;
  }

  .category-catalog-summary__back span {
    display: none;
  }

  .category-catalog-workspace {
    padding-top: 20px;
  }

  .category-catalog-toolbar h2 {
    font-size: 22px;
  }

  .pos-catalog-toolbar-form {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    padding: 10px;
  }

  .pos-catalog-search {
    grid-column: 1 / -1;
  }

  .pos-catalog-sort {
    min-width: 0;
  }

  .pos-catalog-sort > span {
    display: none;
  }

  .pos-catalog-submit {
    width: 44px;
  }

  .pos-catalog-submit span {
    display: none;
  }

  .product-purchase-page {
    padding: 18px 0 92px;
  }

  .product-purchase-shell {
    grid-template-columns: 1fr;
  }

  .product-purchase-media {
    width: min(78vw, 290px);
    justify-self: center;
  }

  .product-purchase-content {
    padding: 18px;
  }

  .product-purchase-title h1 {
    font-size: 25px;
  }

  .product-purchase-dialog {
    width: 100%;
    max-height: 94dvh;
    border-radius: 14px 14px 0 0;
  }

  .product-purchase-dialog__panel {
    max-height: 94dvh;
    border-radius: 14px 14px 0 0;
  }

  .product-purchase-dialog__body {
    padding: 12px;
  }

  .product-purchase-dialog .purchase-package-grid {
    max-height: 34dvh;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .product-purchase-dialog .purchase-package-card__body {
    min-height: 70px;
    padding: 9px;
  }

  .product-purchase-dialog .purchase-package-card strong {
    font-size: 13px;
  }

  .product-purchase-dialog .purchase-player-fields {
    grid-template-columns: 1fr;
  }

  .purchase-dialog-summary {
    bottom: -12px;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 9px;
    margin: 0 -12px -12px;
    padding: 10px 12px;
  }

  .purchase-dialog-summary > div strong {
    font-size: 17px;
  }
}

@media (max-width: 390px) {
  .product-category-grid,
  .home-category-grid,
  .catalog-page .product-grid,
  .category-catalog-page .product-grid,
  .am-home-reference .product-grid.home-products {
    gap: 9px;
  }

  .product-category-card__body {
    grid-template-columns: minmax(0, 1fr) 18px;
  }

  .product-category-card__body svg {
    width: 18px;
    height: 18px;
  }

  .product-purchase-dialog .purchase-package-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pc-buy-button.is-loading svg {
    animation: none;
  }
}
