/* ==========================================================================
   PEPTIDESTX DESIGN SYSTEM — CARDS
   Product Card · Collection Card · COA Card · Batch Verification Card ·
   Research Document Card
   ========================================================================== */

/* ---------------------------------------------------------------------
   PRODUCT CARD
   Purpose: primary catalog unit. Must surface molecular identity, purity,
   and batch/COA access at a glance — spec-forward, never lifestyle-styled.
   --------------------------------------------------------------------- */

.product-card {
  display: block;
  width: 288px;
  border: 1px solid var(--color-graphite-border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-white);
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
  position: relative;
}

.product-card:hover,
.product-card:focus-within {
  border-color: rgba(var(--color-royal-violet-rgb), 0.3);
  box-shadow: var(--shadow-card);
}

.product-card__image-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--color-cloud-grey);
  overflow: hidden;
}

/* ---------------------------------------------------------------------
   SHARED IMAGE PLACEHOLDER — shown whenever a real product image fails
   to load (Shop cards, Homepage Featured, Related Products, Recently
   Viewed, PDP gallery). Intentionally designed, never an empty box or
   broken-image icon. Inserted by window.PTXImageFallback (see header.js).
   --------------------------------------------------------------------- */
.ptx-image-placeholder {
  width: 100%;
  height: 100%;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--color-cloud-grey);
  color: var(--color-graphite-500);
  border-radius: inherit;
}

.ptx-image-placeholder svg {
  width: 32px;
  height: 32px;
}

.ptx-image-placeholder span {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.product-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-base) var(--ease-out);
}

.product-card:hover .product-card__image {
  transform: scale(1.02);
}

.product-card__body {
  padding: var(--space-5);
}

.product-card__link-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.product-card__link-overlay:focus-visible {
  outline: 2px solid var(--color-royal-violet);
  outline-offset: -2px;
}

.product-card__name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  line-height: 22px;
  color: var(--color-obsidian);
  margin-bottom: var(--space-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-card__spec {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--color-graphite-500);
  margin-bottom: var(--space-3);
  overflow-wrap: break-word;
  word-break: break-word;
}

.product-card__purity {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--color-verified-green-bg);
  color: var(--color-verified-green);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  margin-bottom: var(--space-3);
}

.product-card__batch {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 2; /* sits above the full-card link overlay so it's independently clickable */
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-graphite-500);
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
}

.product-card__batch svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.product-card__batch:hover {
  color: var(--color-royal-violet);
}

.product-card__divider {
  height: 1px;
  background: var(--color-graphite-border-light);
  margin: var(--space-4) 0;
}

.product-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.product-card__price {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 16px;
  color: var(--color-obsidian);
}

.product-card__coa-link {
  position: relative;
  z-index: 2;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  color: var(--color-royal-violet);
}

.product-card__coa-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Disabled/out-of-stock state */
.product-card.is-unavailable {
  opacity: 0.6;
}

.product-card.is-unavailable .product-card__link-overlay {
  pointer-events: none;
  cursor: default;
}

.product-card__stock-flag {
  position: absolute;
  top: var(--space-4);
  left: var(--space-4);
  z-index: 2;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--color-obsidian);
  color: var(--color-white);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

@media (max-width: 767px) {
  .product-card {
    width: 100%;
  }
}

/* ---------------------------------------------------------------------
   COLLECTION CARD
   Purpose: category-level entry point (e.g. "Metabolic Research Peptides").
   Simpler than a product card — no spec data, just category identity + count.
   --------------------------------------------------------------------- */

.collection-card {
  display: block;
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--color-obsidian);
}

.collection-card__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
  transition: transform 400ms var(--ease-out), opacity var(--dur-base) var(--ease-out);
}

.collection-card:hover .collection-card__image {
  transform: scale(1.04);
  opacity: 0.65;
}

.collection-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(11,13,15,0.85) 0%, rgba(11,13,15,0.2) 60%, transparent 100%);
}

.collection-card__content {
  position: absolute;
  left: var(--space-6);
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 1;
}

.collection-card__name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  color: var(--color-white);
  margin-bottom: var(--space-1);
}

.collection-card__count {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--color-graphite-300);
}

.collection-card:focus-visible {
  outline: 2px solid var(--color-royal-violet);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------
   COA CARD (Certificate of Analysis summary card)
   Purpose: represents a single batch's test record as a scannable,
   document-styled unit — used in COA Library grids/search results.
   --------------------------------------------------------------------- */

.coa-card {
  border: 1px solid var(--color-graphite-border-light);
  border-radius: var(--radius-md);
  background: var(--color-white);
  padding: var(--space-6);
  transition: border-color var(--dur-base) var(--ease-out);
}

.coa-card:hover {
  border-color: rgba(var(--color-royal-violet-rgb), 0.3);
}

.coa-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.coa-card__batch-number {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 18px;
  color: var(--color-obsidian);
}

.coa-card__compound-name {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--color-graphite-500);
  margin-top: 4px;
}

.coa-card__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--color-verified-green-bg);
  color: var(--color-verified-green);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  white-space: nowrap;
}

.coa-card__status svg {
  width: 12px;
  height: 12px;
}

.coa-card__data {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4) var(--space-6);
  margin-bottom: var(--space-5);
}

.coa-card__data-item dt {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--color-graphite-500);
  margin-bottom: 2px;
}

.coa-card__data-item dd {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--color-obsidian);
  margin: 0;
}

.coa-card__footer {
  display: flex;
  gap: var(--space-4);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-graphite-border-light);
}

@media (max-width: 480px) {
  .coa-card__data {
    grid-template-columns: 1fr;
  }
  .coa-card__footer {
    flex-direction: column;
  }
}

/* ---------------------------------------------------------------------
   BATCH VERIFICATION CARD
   Purpose: the result state of a batch-lookup search — confirms a batch
   is genuine and links through to its full COA. Distinct from the COA
   card in that it is a *verification receipt*, not a browsing unit.
   --------------------------------------------------------------------- */

.batch-verify-card {
  border: 1px solid var(--color-verified-green);
  border-radius: var(--radius-md);
  background: var(--color-white);
  padding: var(--space-6);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}

.batch-verify-card__icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--color-verified-green-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-verified-green);
}

.batch-verify-card__icon svg {
  width: 20px;
  height: 20px;
}

.batch-verify-card__title {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  color: var(--color-obsidian);
  margin-bottom: 4px;
}

.batch-verify-card__meta {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--color-graphite-500);
  margin-bottom: var(--space-3);
}

/* Not-found state — same shape, neutral (not alarming red) since an
   unrecognized batch number is most often a typo, not a security event. */
.batch-verify-card.is-not-found {
  border-color: var(--color-graphite-border-light-strong);
}

.batch-verify-card.is-not-found .batch-verify-card__icon {
  background: var(--color-cloud-grey);
  color: var(--color-graphite-500);
}

/* ---------------------------------------------------------------------
   RESEARCH DOCUMENT CARD
   Purpose: editorial card for Research Library / Blog entries.
   --------------------------------------------------------------------- */

.doc-card {
  display: block;
  border: 1px solid var(--color-graphite-border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-white);
  transition: border-color var(--dur-base) var(--ease-out);
}

.doc-card:hover,
.doc-card:focus-visible {
  border-color: rgba(var(--color-royal-violet-rgb), 0.3);
}

.doc-card__image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--color-cloud-grey);
  transition: transform var(--dur-base) var(--ease-out);
}

.doc-card:hover .doc-card__image {
  transform: scale(1.03);
}

.doc-card__body {
  padding: var(--space-6);
}

.doc-card__category {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-royal-violet);
  margin-bottom: var(--space-3);
}

.doc-card__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  line-height: 24px;
  color: var(--color-obsidian);
  margin-bottom: var(--space-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: text-decoration-color var(--dur-fast) var(--ease-out);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
}

.doc-card:hover .doc-card__title {
  text-decoration-color: var(--color-obsidian);
}

.doc-card__excerpt {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 22px;
  color: var(--color-graphite-500);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: var(--space-4);
}

@media (max-width: 767px) {
  .doc-card__image {
    height: 180px;
  }
}

/* ==========================================================================
   SHOPPING CART DRAWER
   Reuses the .modal-backdrop fade/focus-trap/Escape/backdrop-click system
   exactly — only the panel itself is a right-edge slide-in instead of a
   centered card, and background/backdrop is overridden accordingly.
   ========================================================================== */

.cart-drawer {
  justify-content: flex-end;
  padding: 0;
}

.cart-drawer__panel {
  width: 100%;
  max-width: 420px;
  height: 100%;
  background: var(--color-white);
  display: flex;
  flex-direction: column;
  transform: translateX(24px);
  opacity: 0;
  transition: transform var(--dur-mid) var(--ease-out), opacity var(--dur-mid) var(--ease-out);
}

.cart-drawer.is-open .cart-drawer__panel {
  transform: translateX(0);
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .cart-drawer__panel {
    transition: none;
  }
}

.cart-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6);
  border-bottom: 1px solid var(--color-graphite-border-light);
  flex-shrink: 0;
}

.cart-drawer__close.icon-btn {
  color: var(--color-obsidian) !important;
  background-color: var(--color-cloud-grey);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out);
}

.cart-drawer__close.icon-btn svg {
  width: 18px;
  height: 18px;
}

.cart-drawer__close:hover {
  background-color: var(--color-graphite-border-light);
  color: var(--color-royal-violet) !important;
}

.cart-drawer__close:focus-visible {
  outline: 2px solid var(--color-royal-violet);
  outline-offset: 2px;
}

.cart-drawer__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 20px;
  color: var(--color-obsidian);
}

.cart-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-6);
}

.cart-drawer__footer {
  padding: var(--space-6);
  border-top: 1px solid var(--color-graphite-border-light);
  flex-shrink: 0;
}

.cart-drawer__subtotal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  color: var(--color-obsidian);
  margin-bottom: var(--space-3);
}

.cart-drawer__note {
  font-family: var(--font-body);
  font-size: 12px;
  line-height: 18px;
  color: var(--color-graphite-500);
  margin-bottom: var(--space-4);
}

.cart-line {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: var(--space-3);
  align-items: start;
  padding-block: var(--space-4);
  border-bottom: 1px solid var(--color-graphite-border-light);
}

.cart-line:last-child {
  border-bottom: none;
}

.cart-line__image {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-cloud-grey);
}

.cart-line__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-line__name {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  color: var(--color-obsidian);
  margin-bottom: 2px;
}

.cart-line__size {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-graphite-500);
  margin-bottom: var(--space-2);
}

.cart-line__controls {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.cart-line__total {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  color: var(--color-obsidian);
  white-space: nowrap;
}

.qty-selector--sm {
  transform: scale(0.85);
  transform-origin: left center;
}
