/* ============================================================================
   EZ42 — Catalogue product card
   ----------------------------------------------------------------------------
   One card for every product catalogue: pages, tracks, kits, unified store.
   Markup is produced by static/js/product-card.js.

   Anatomy deliberately matches the activity card (css/activity-card.css): a
   solid accent header carrying the product type, then a white body. The two
   surfaces read as one family.

   The card links through to the product page; buying happens there, so the
   footer carries a details button and the price rather than a buy control.

   Optional accent arrives as an inline CSS variable:
     --pc-accent   header background (defaults to brand purple)
   ============================================================================ */

.pc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 1.25rem;
}

.pc-card,
.pc-skeleton,
.pc-empty {
  --pc-surface: #ffffff;
  --pc-border: #e2e8f0;
  --pc-border-soft: #f1f5f9;
  --pc-canvas: #f8fafc;
  --pc-text: #1e293b;
  --pc-text-soft: #475569;
  --pc-text-muted: #64748b;
  --pc-text-light: #94a3b8;
  --pc-purple: #8b5cf6;
  --pc-purple-deep: #7c3aed;
  --pc-orange: #ff7f4d;
  --pc-orange-hover: #ea580c;
  --pc-green: #15803d;
  --pc-green-soft: #16a34a;
  --pc-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

.pc-card,
.pc-card *,
.pc-card *::before,
.pc-card *::after { box-sizing: border-box; }

/* ---------- Shell ---------- */

.pc-card {
  display: flex;
  flex-direction: column;
  background: var(--pc-surface);
  border: 1px solid var(--pc-border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: transform 250ms var(--pc-ease), box-shadow 250ms var(--pc-ease);
}

.pc-card.is-clickable { cursor: pointer; }

.pc-card.is-clickable:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14);
}

.pc-card:focus-visible {
  outline: 2px solid var(--pc-purple);
  outline-offset: 2px;
}

/* ---------- Header ---------- */

.pc-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.75rem 1.15rem;
  background: linear-gradient(135deg,
    var(--pc-accent, var(--pc-purple)) 0%,
    color-mix(in srgb, var(--pc-accent, var(--pc-purple)) 78%, black) 100%);
  color: #ffffff;
}

/* Owned products take the green header in every catalogue. */
.pc-card.is-owned .pc-head {
  background: linear-gradient(135deg, var(--pc-green-soft) 0%, var(--pc-green) 100%);
}

.pc-type {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #ffffff;
}

.pc-head-badges {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-inline-start: auto;
}

.pc-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  white-space: nowrap;
}

.pc-badge svg {
  width: 13px; height: 13px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2.2;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Body ---------- */

.pc-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.1rem 1.15rem 1.15rem;
}

.pc-grade {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  align-self: flex-start;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--pc-text-soft);
  background: var(--pc-border-soft);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
}

.pc-grade svg {
  width: 14px; height: 14px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

.pc-title {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.4;
  color: var(--pc-text);
  margin: 0;
}

.pc-desc {
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.65;
  color: var(--pc-text-soft);
  margin: 0;
}

/* ---------- Stats ---------- */

.pc-stats {
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
  padding: 0.7rem 0;
  border-top: 1px solid var(--pc-border-soft);
  border-bottom: 1px solid var(--pc-border-soft);
}

.pc-stat {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--pc-text-soft);
}

.pc-stat i {
  display: flex;
  color: var(--pc-accent, var(--pc-purple));
}

.pc-card.is-owned .pc-stat i { color: var(--pc-green); }

.pc-stat svg {
  width: 17px; height: 17px;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Progress (owned products) ---------- */

.pc-progress {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.pc-progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--pc-text-soft);
}

/* A number pair is an LTR run; left neutral in an RTL context the slash
   swaps the two numbers. */
.pc-progress-count {
  direction: ltr;
  font-weight: 800;
  color: var(--pc-text);
}

.pc-progress-rail {
  height: 8px;
  background: var(--pc-border-soft);
  border-radius: 999px;
  overflow: hidden;
}

.pc-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pc-purple) 0%, var(--pc-purple-deep) 100%);
  transition: width 400ms var(--pc-ease);
}

.pc-card.is-complete .pc-progress-fill {
  background: linear-gradient(90deg, var(--pc-green-soft) 0%, var(--pc-green) 100%);
}

/* Card used directly as a link */
a.pc-card { text-decoration: none; color: inherit; display: flex; }

/* ---------- Footer ---------- */

.pc-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.pc-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid var(--pc-orange);
  border-radius: 10px;
  padding: 0.55rem 1.3rem;
  background: var(--pc-orange);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 127, 77, 0.4);
  transition: background-color 150ms var(--pc-ease), transform 150ms var(--pc-ease);
}

.pc-cta:hover {
  background: var(--pc-orange-hover);
  border-color: var(--pc-orange-hover);
  transform: translateY(-1px);
}

.pc-cta svg {
  width: 14px; height: 14px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2.2;
  stroke-linecap: round; stroke-linejoin: round;
}

.pc-cta-owned {
  background: var(--pc-green);
  border-color: var(--pc-green);
  box-shadow: none;
}

.pc-cta-owned:hover {
  background: #166534;
  border-color: #166534;
}

.pc-cta-soon {
  background: var(--pc-surface);
  border-color: var(--pc-border);
  color: var(--pc-text-muted);
  box-shadow: none;
  cursor: default;
}

.pc-cta-soon:hover {
  background: var(--pc-surface);
  border-color: var(--pc-border);
  transform: none;
}

.pc-price {
  font-size: 1rem;
  font-weight: 800;
  color: var(--pc-text);
}

.pc-price-free { color: var(--pc-green); }

.pc-price-strike {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--pc-text-light);
  text-decoration: line-through;
  margin-inline-end: 0.3rem;
}

/* ---------- Highlighted (restricted browsing) ---------- */

.pc-card.is-highlighted {
  border-color: var(--pc-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18), 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* ---------- Empty / loading ---------- */

.pc-empty {
  grid-column: 1 / -1;
  background: var(--pc-surface);
  border: 1px solid var(--pc-border);
  border-radius: 16px;
  padding: 3rem 2rem;
  text-align: center;
  color: var(--pc-text-muted);
}

.pc-empty h3 {
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--pc-text);
  margin: 0 0 0.4rem;
}

.pc-empty p { margin: 0 0 1.25rem; }

.pc-empty-btn {
  border: 1px solid var(--pc-border);
  background: var(--pc-surface);
  border-radius: 10px;
  padding: 0.55rem 1.25rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--pc-text-soft);
  cursor: pointer;
}

.pc-empty-btn:hover { border-color: var(--pc-purple); }

.pc-skeleton {
  background: var(--pc-surface);
  border: 1px solid var(--pc-border);
  border-radius: 16px;
  min-height: 280px;
  position: relative;
  overflow: hidden;
}

.pc-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.12), transparent);
  animation: pc-shimmer 1.4s infinite;
}

@keyframes pc-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ---------- Responsive ---------- */

@media (max-width: 719px) {
  .pc-grid { grid-template-columns: 1fr; }
  .pc-cta { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .pc-card, .pc-cta { transition: none; }
  .pc-skeleton::after { animation: none; }
}