/* ===========================================================================
   AnimeFFA — 5/5 · Store
   Category grid, package cards (grid + list display types), the package
   detail page and the basket / checkout screen.
   Requires ffa-tokens.css and ffa-components.css.
   =========================================================================== */

/* ----------------------------------------------------- Two-column shell */
.store-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.5rem, 3vw, 2.25rem);
}
@media (min-width: 1080px) {
  .store-layout.has-sidebar { grid-template-columns: minmax(0, 1fr) 300px; }
}

/* -------------------------------------------------------- Category grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
}

.category-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .22s var(--ease);
}
.category-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-red);
  box-shadow: var(--shadow-2), 0 0 0 1px rgba(211, 37, 63, .22);
}

.category-card .thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(70% 70% at 50% 40%, rgba(183, 25, 47, .28), transparent 70%),
    var(--bg-3);
}
.category-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s var(--ease);
}
.category-card:hover .thumb img { transform: scale(1.04); }
.category-card .thumb svg {
  width: 44px; height: 44px;
  stroke: var(--crimson); fill: none; stroke-width: 1.4;
  opacity: .8;
}

.category-card .body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .9rem 1rem;
  border-top: 1px solid var(--line);
}
.category-card .name {
  margin: 0;
  font-family: var(--font-display);
  font-size: .98rem;
  line-height: 1.2;
}
.category-card .go {
  flex-shrink: 0;
  width: 26px; height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-red);
  border-radius: var(--r-xs);
  color: var(--crimson-2);
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.category-card:hover .go { background: var(--crimson); color: #fff; }
.category-card .go svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2.2; }

/* --------------------------------------------------------- Package cards */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 1rem;
}
.product-list { display: grid; gap: .75rem; }

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .22s var(--ease);
}
.product-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-red);
  box-shadow: var(--shadow-2), 0 0 0 1px rgba(211, 37, 63, .2);
}

.product-media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-md) var(--r-md) 0 0;
  overflow: hidden;
  background:
    radial-gradient(75% 75% at 50% 35%, rgba(183, 25, 47, .22), transparent 72%),
    var(--bg-3);
}
.product-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 1rem;
  transition: transform .35s var(--ease);
}
.product-card:hover .product-media img { transform: scale(1.045); }

.media-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.media-fallback svg {
  width: 40px; height: 40px;
  stroke: var(--crimson); fill: none; stroke-width: 1.4;
  opacity: .75;
}

.sale-flag {
  position: absolute;
  top: .6rem; left: .6rem;
  z-index: 1;
  padding: .2rem .5rem;
  border-radius: var(--r-xs);
  background: var(--crimson);
  color: #fff;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.countdown {
  position: absolute;
  top: .6rem; right: .6rem;
  z-index: 1;
  padding: .2rem .5rem;
  border-radius: var(--r-xs);
  background: rgba(8, 6, 7, .82);
  border: 1px solid var(--line-red);
  color: #f0c3ca;
  font-size: .66rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.product-body {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  padding: .9rem 1rem 1rem;
  flex: 1;
}

.product-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: .95rem;
  line-height: 1.25;
}
.product-title a:hover { color: var(--crimson-2); }

.price-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .5rem;
  margin: auto 0 0;
  padding-top: .2rem;
}
.price { font-family: var(--font-display); font-size: 1.15rem; color: #fff; }
.price-was { font-size: .85rem; color: var(--text-faint); text-decoration: line-through; }
.price-note { font-size: .85rem; color: var(--text-dim); }

/* Always stacked: 'Add to Basket' does not fit two-up in a 232px card. */
.product-actions { display: grid; gap: .45rem; margin-top: .2rem; }

.in-basket {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .55rem;
  border: 1px dashed var(--line-red);
  border-radius: var(--r-sm);
  background: rgba(183, 25, 47, .08);
  color: #f0c3ca;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.in-basket svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2.4; }

.unavailable-note { margin: 0; font-size: .76rem; color: var(--text-faint); }

/* List display type (category.displayType == "list") */
.product-list .product-card { flex-direction: row; align-items: stretch; }
.product-list .product-media {
  flex: 0 0 150px;
  aspect-ratio: auto;
  border-radius: var(--r-md) 0 0 var(--r-md);
}
.product-list .product-body { padding: 1rem 1.15rem; }
.product-list .product-actions { grid-auto-flow: column; justify-content: start; }
.product-list .product-actions .btn { min-width: 170px; }

@media (max-width: 620px) {
  .product-list .product-card { flex-direction: column; }
  .product-list .product-media {
    flex: none;
    aspect-ratio: 16 / 9;
    border-radius: var(--r-md) var(--r-md) 0 0;
  }
  .product-list .product-actions { grid-auto-flow: row; }
  .product-list .product-actions .btn { min-width: 0; }
}

/* ------------------------------------------------------- Package detail */
.product-detail {
  display: grid;
  gap: clamp(1.25rem, 3vw, 2rem);
  align-items: start;
}
@media (min-width: 880px) {
  .product-detail { grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); }
}
/* Stacked layouts put price and buy button above a long description. */
@media (max-width: 879px) {
  .product-detail > .buy-box { order: -1; }
}

.gallery { display: grid; gap: .6rem; }
.gallery-main {
  position: relative;
  aspect-ratio: 16 / 10;
  max-height: 440px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background:
    radial-gradient(70% 70% at 50% 35%, rgba(183, 25, 47, .22), transparent 72%),
    var(--bg-3);
}
.gallery-main img { width: 100%; height: 100%; object-fit: contain; padding: 1.25rem; }
.gallery-main iframe { width: 100%; height: 100%; border: 0; }

.gallery-strip {
  display: flex;
  gap: .5rem;
  overflow-x: auto;
  padding-bottom: .25rem;
  scroll-snap-type: x mandatory;
}
.gallery-strip > * {
  flex: 0 0 96px;
  aspect-ratio: 1;
  padding: 0;
  scroll-snap-align: start;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-3);
  cursor: pointer;
  transition: border-color .18s var(--ease), opacity .18s var(--ease);
  opacity: .72;
}
.gallery-strip > *:hover { opacity: 1; border-color: var(--line-red); }
.gallery-strip > .is-current { opacity: 1; border-color: var(--crimson-2); }
.gallery-strip img { width: 100%; height: 100%; object-fit: cover; }
.gallery-strip .thumb-video {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%; height: 100%;
}
.gallery-strip .thumb-video svg { width: 22px; height: 22px; fill: #fff; opacity: .9; }

.buy-box { padding: 1.25rem; display: grid; gap: .9rem; }
.buy-box .price-row { margin-top: 0; }
.buy-box .price { font-size: 1.6rem; }

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.detail-meta li {
  padding: .25rem .55rem;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ---------------------------------------------------- Basket / checkout */
.basket-layout {
  display: grid;
  gap: clamp(1.25rem, 3vw, 2rem);
  align-items: start;
}
@media (min-width: 900px) {
  .basket-layout { grid-template-columns: minmax(0, 1fr) 340px; }
}

.basket-items { display: grid; gap: .6rem; }

.basket-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: .85rem;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.basket-item .thumb {
  width: 72px; height: 72px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--bg-3);
}
.basket-item .thumb img { width: 100%; height: 100%; object-fit: contain; padding: .4rem; }
.basket-item .thumb svg { width: 24px; height: 24px; stroke: var(--crimson); fill: none; stroke-width: 1.6; opacity: .7; }
.basket-item .title { margin: 0 0 .15rem; font-family: var(--font-display); font-size: .95rem; }
.basket-item .title a:hover { color: var(--crimson-2); }
.basket-item .options {
  list-style: none;
  margin: .2rem 0 0;
  padding: 0;
  font-size: .78rem;
  color: var(--text-faint);
}
.basket-item .line-price { font-family: var(--font-display); color: #fff; }

.basket-controls { display: flex; align-items: center; gap: .5rem; }

.summary {
  position: sticky;
  top: 92px;
  padding: 1.25rem;
  display: grid;
  gap: .85rem;
}
.summary .row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  font-size: .88rem;
  color: var(--text-dim);
}
.summary .row.total {
  padding-top: .75rem;
  border-top: 1px solid var(--line);
  font-size: 1rem;
  color: var(--text);
}
.summary .row.total .amount { font-family: var(--font-display); font-size: 1.5rem; color: #fff; }

.coupon-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.coupon-list li {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .6rem;
  border: 1px dashed var(--line-red);
  border-radius: var(--r-xs);
  font-size: .8rem;
  color: #f0c3ca;
}

@media (max-width: 620px) {
  .basket-item { grid-template-columns: 56px minmax(0, 1fr); gap: .75rem; }
  .basket-item .thumb { width: 56px; height: 56px; }
  .basket-controls { grid-column: 1 / -1; justify-content: space-between; }
}
