/* ═══════════════════════════════════════════
   SHILPKRITI — SHARED PRODUCT CARD (.sk-card)
   Markup: assets/js/product-card.js (ShilpCard.html).
   Loaded on the homepage and the product page, after the page CSS.
   Self-contained: own tokens, own reset, explicit fonts/colours/sizing, so
   the card looks identical with or without the homepage `.page-homepage *`
   reset and the global style.css `a{}` / `img{}` rules.
   Container width/layout is owned by each page (.p-grid, .products-carousel).
   ═══════════════════════════════════════════ */

.sk-card {
  --skc-brand: #ff6600;
  --skc-brand-dark: #e55a00;
  --skc-text: #111111;
  --skc-muted: #aaaaaa;
  --skc-green: #0d9f4f;
  --skc-dark: #111111;
  --skc-line: #f2efeb;
  --skc-line-hover: #e8e4de;
  --skc-bg: #ffffff;
  --skc-media-bg: #f7f5f2;
  --skc-radius: 10px;
  --skc-ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.sk-card, .sk-card *, .sk-card *::before, .sk-card *::after {
  box-sizing: border-box; margin: 0; padding: 0;
}

.sk-card {
  display: block;
  position: relative;
  min-width: 0;
  background: var(--skc-bg);
  border: 1px solid var(--skc-line);
  border-radius: var(--skc-radius);
  overflow: hidden;
  color: var(--skc-text);
  text-decoration: none;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  text-align: left;
  -webkit-font-smoothing: antialiased;
  transition: box-shadow 0.3s var(--skc-ease), transform 0.3s var(--skc-ease), border-color 0.3s var(--skc-ease);
}
.sk-card:hover { box-shadow: 0 8px 30px rgba(0,0,0,0.07); transform: translateY(-3px); border-color: var(--skc-line-hover); color: var(--skc-text); text-decoration: none; }
.sk-card:focus { outline: none; }
.sk-card:focus-visible { outline: 2px solid var(--skc-brand); outline-offset: 2px; border-radius: var(--skc-radius); }

/* Media (neutral placeholder background when there is no image) */
.sk-card-media {
  position: relative; display: block;
  aspect-ratio: 1 / 1; overflow: hidden;
  background: var(--skc-media-bg);
}
/* No-photo tile: gift icon centred; any loaded photo/video covers it. */
.sk-card-noimg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #cdbfb0; }
.sk-card-noimg svg { width: 44px; height: 44px; }
.sk-card-media img, .sk-card-media video { position: relative; z-index: 1; }
.sk-card-media img, .sk-card-media video {
  display: block; width: 100%; height: 100%; max-width: none;
  object-fit: cover;
  transition: transform 0.6s var(--skc-ease);
}
.sk-card:hover .sk-card-media img, .sk-card:hover .sk-card-media video { transform: scale(1.05); }
/* Photos are shown whole (never cropped) in a square frame; product shots are square.
   The off-white behind them matches the studio backgrounds of the photos.
   Videos still fill the frame. */
.sk-card-media img { object-fit: contain; background: var(--skc-media-bg); }

/* Badge (API-driven, one at most) */
.sk-card-badge {
  position: absolute; top: 0.5rem; left: 0.5rem; z-index: 2;
  font-size: 0.5625rem; font-weight: 700; line-height: 1.6;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem; border-radius: 3px;
  color: #fff; background: var(--skc-dark);
}
/* Fixed badge palette (admin "Badges & Occasions" picks a token; never user
   CSS). Every pair is WCAG AA for small text: c1 5.7, c2 18.9, c3 6.4,
   c4 9.6, c5 10.4, c6 12.3 :1. Keep in sync with Product_model::$badge_palette. */
.sk-card-badge--c1 { background: #b83d00; color: #fff; }
.sk-card-badge--c2 { background: #111111; color: #fff; }
.sk-card-badge--c3 { background: #0b6e3a; color: #fff; }
.sk-card-badge--c4 { background: #6b2c6b; color: #fff; }
.sk-card-badge--c5 { background: #1e3a8a; color: #fff; }
.sk-card-badge--c6 { background: #ffc94d; color: #111111; }

/* Low stock tag, top right (the offer badge sits top left). */
.sk-card-low {
  position: absolute; top: 0.5rem; right: 0.5rem; z-index: 2; max-width: calc(100% - 1rem);
  font-size: 0.5625rem; font-weight: 700; line-height: 1.6; letter-spacing: 0.03em;
  padding: 0.125rem 0.5rem; border-radius: 4px; background: #b45309; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}

/* Hover overlay CTA (desktop) */
.sk-card-hover {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 3;
  display: block; padding: 0.5rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.5));
  transform: translateY(100%);
  transition: transform 0.3s var(--skc-ease);
  pointer-events: none;
}
.sk-card:hover .sk-card-hover, .sk-card:focus-visible .sk-card-hover { transform: translateY(0); }
.sk-card-hover-btn {
  display: block; width: 100%; padding: 0.5rem;
  background: var(--skc-brand); color: #fff;
  border-radius: 6px;
  font-size: 0.6875rem; font-weight: 700; line-height: 1.6;
  text-transform: uppercase; letter-spacing: 0.04em; text-align: center;
}

/* Body */
.sk-card-body { display: block; padding: 0.75rem; }
.sk-card-cat {
  font-size: 0.625rem; font-weight: 600; line-height: 1.6;
  color: var(--skc-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 0.125rem;
}
.sk-card-name {
  font-size: 0.8125rem; font-weight: 600; line-height: 1.3;
  color: var(--skc-text);
  margin-bottom: 0.25rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
.sk-card-prices { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.375rem; }
.sk-card-now { font-size: 1rem; font-weight: 700; line-height: 1.6; color: var(--skc-text); }
.sk-card-was { font-size: 0.75rem; font-weight: 400; line-height: 1.6; color: var(--skc-muted); text-decoration: line-through; }
.sk-card-off { font-size: 0.625rem; font-weight: 700; line-height: 1.6; color: var(--skc-green); }
.sk-card-cta { display: none; }

/* Loading placeholder shimmer (.skel): every card row (homepage, product
   page, shop); the placeholder cards: shilp_card_skeletons() in includes/card_rows.php. */
.skel { background: linear-gradient(90deg, #f7f5f2 25%, #f0ece7 50%, #f7f5f2 75%); background-size: 200% 100%; animation: sk-shimmer 1.5s infinite; border-radius: 6px; }
@keyframes sk-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }
/* Skeleton placeholder card */
.sk-card--skel { pointer-events: none; }
.sk-card--skel:hover { transform: none; box-shadow: none; border-color: var(--skc-line); }
.sk-card-skel-media { display: block; aspect-ratio: 1 / 1; }
.sk-card-skel-line { display: block; height: 14px; width: 70%; margin: 0.75rem 0.75rem 0.4rem; }
.sk-card-skel-line--short { height: 16px; width: 35%; margin: 0 0.75rem 0.75rem; }

@media (max-width: 640px) {
  /* Narrow cards: with an offer badge (top left) too, the tag drops below it. */
  .sk-card-badge ~ .sk-card-low { top: 2rem; }
  .sk-card-body { padding: 0.5rem; }
  .sk-card-name { font-size: 0.6875rem; }
  .sk-card-now { font-size: 0.875rem; }
  .sk-card-cat { display: none; }
  .sk-card-hover { display: none; }
  .sk-card-cta {
    display: block; width: 100%; margin-top: 0.375rem;
    padding: 0.5rem; background: var(--skc-brand); color: #fff;
    border-radius: 6px;
    font-size: 0.6875rem; font-weight: 700; line-height: 1.6;
    text-align: center; text-transform: uppercase; letter-spacing: 0.04em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sk-card, .sk-card-media img, .sk-card-media video, .sk-card-hover { transition: none; }
  .sk-card:hover { transform: none; }
  .sk-card:hover .sk-card-media img, .sk-card:hover .sk-card-media video { transform: none; }
}

/* Sold out (admin switch, migration 032): a badge plus a black-and-white photo;
   the card keeps its place in the list and still opens the page. */
.sk-card-badge.sk-card-soldout { background: #c0392b; color: #fff; }
.sk-card--soldout .sk-card-media img,
.sk-card--soldout .sk-card-media video { filter: grayscale(1); }

/* ═══════════ BANNER CARD (.fb, ShilpCard.banner) ═══════════
   Phones: a big photo card with the name and price on it, in a swipe row
   (.fb-track) with the next card peeking in. Homepage and product page. */
.fb-track { display: none; }
a.fb, .fb--add {   /* .fb--add: the same card, not a link (cart, ShilpCard.banner opts.add) */
  position: relative; flex: 0 0 60vw; max-width: 260px; aspect-ratio: 1 / 1; border-radius: 14px; overflow: hidden;
  background: #eee; color: #fff; text-decoration: none; scroll-snap-align: start;
}
.fb img, .fb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fb--skel { position: relative; flex: 0 0 60vw; max-width: 260px; aspect-ratio: 1 / 1; border-radius: 14px; background: #efe9e2; scroll-snap-align: start; }
.fb-noimg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding-bottom: 18%; background: #f5efe8; color: #cdbfb0; }
.fb-noimg svg { width: 44px; height: 44px; }
.fb.is-sold img, .fb.is-sold video { filter: grayscale(1); }
.fb::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 62%, rgba(0,0,0,0.45) 78%, rgba(0,0,0,0.78) 100%); }
.fb-tag { position: absolute; left: 10px; top: 10px; z-index: 2; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; background: #b83d00; color: #fff; padding: 3px 7px; border-radius: 4px; }
.fb-tag--sold { background: #c0392b; }
.fb-txt { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 12px; }
.fb-name { font-size: 13.5px; font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-price { display: flex; align-items: baseline; gap: 6px; font-size: 12px; }
.fb-price b { font-size: 15px; }
.fb-price s { color: rgba(255,255,255,0.7); }
.fb-off { font-size: 11px; font-weight: 700; color: #7ee2a8; }
@media (max-width: 640px) {
  /* Edge to edge: --fb-px is the page's side gutter (16px by default). */
  .fb-track {
    display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; margin: 0 calc(-1 * var(--fb-px, 16px)); padding: 0 var(--fb-px, 16px); scroll-padding: 0 var(--fb-px, 16px);
  }
  .fb-track::-webkit-scrollbar { display: none; }
}

/* ═══════════ ROW ARROWS (.p-wrap > .p-arr, ShilpCard.arrows) ═══════════ */
.p-wrap { position: relative; }
button.p-arr {
  position: absolute; top: 38%; z-index: 4; width: 40px; height: 40px; padding: 0;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: #fff; color: #111; border: 1px solid #e8e4de; border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}
button.p-arr:hover { border-color: #ff6600; color: #ff6600; }
button.p-arr[hidden] { display: none; }
.p-arr--l { left: -14px; }
.p-arr--r { right: -14px; }
.p-arr svg { width: 18px; height: 18px; }
