/* ═══════════════════════════════════════════════════════════
   item-card-v4.css — THE item-card renderer for Nine Lives Network

   Canonical visual for equippable ITEMS (weapons, headwear, outfits,
   shields, familiars) — the sibling of card-v4.css (spell cards).
   Same warm-night palette, same fonts, same rarity language; its own
   `.item-card` / `.ic-*` namespace so the two never collide.

   Link order on a page:
     variables-v2.css  →  components-v2.css  →  item-card-v4.css
   Pair with item-card-v4.js (buildItemCardV4 / initItemCards).

   All design tokens come from variables-v2.css — do NOT redefine them.
   ═══════════════════════════════════════════════════════════ */

/* ═══ CARD SHELL ═══ */
.item-card {
  --rc: #bbb;                 /* rarity colour  — set inline per card */
  --sc: var(--gold, #D4A64B); /* slot accent    — set inline per card */
  position: relative;
  width: 240px;
  height: 380px;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.25s ease, box-shadow 0.3s ease;
  background: linear-gradient(180deg, #14111c 0%, #0c0a14 55%, #0a0810 100%);
}
.item-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 25px 60px rgba(0,0,0,0.5), 0 0 32px var(--rc);
}

/* ═══ RARITY BORDER ═══ */
.ic-border {
  position: absolute;
  inset: -2px;
  border-radius: 14px;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.45s;
  background: conic-gradient(from 135deg, transparent, var(--rc) 8%, transparent 16%);
}
.item-card:hover .ic-border { opacity: 0.55; }
.item-card[data-rarity="legendary"] .ic-border { opacity: 0.22; }
.item-card[data-rarity="legendary"]:hover .ic-border { opacity: 0.85; }

/* ═══ FACE ═══ */
.ic-face {
  position: absolute;
  inset: 2px;
  border-radius: 10px;
  overflow: hidden;
  z-index: 1;
  background: linear-gradient(180deg, #14111c 0%, #0c0a14 55%, #0a0810 100%);
  border: 1.5px solid rgba(255,255,255,0.08);
}
.item-card[data-rarity="epic"] .ic-face,
.item-card[data-rarity="legendary"] .ic-face {
  border-color: color-mix(in srgb, var(--rc) 35%, transparent);
}

/* ═══ BODY (content column) ═══ */
.ic-body {
  position: relative;
  z-index: 4;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ═══ NAME BAR ═══ */
.ic-top {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: linear-gradient(180deg, rgba(0,0,0,0.62) 0%, rgba(0,0,0,0.25) 70%, transparent 100%);
}
.ic-name {
  flex: 1;
  min-width: 0;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.15;
  color: var(--text-bright, #F5F0E8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0,0,0,0.9), 0 0 8px rgba(0,0,0,0.6);
}

/* ═══ SLOT BADGE (top-right) ═══ */
.ic-slot-badge {
  position: absolute;
  top: 7px; right: 7px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-data);
  font-size: 7px;
  letter-spacing: 0.5px;
  padding: 4px 6px;
  border-radius: 4px;
  color: var(--sc);
  background: color-mix(in srgb, var(--sc) 16%, rgba(0,0,0,0.8));
  border: 1px solid color-mix(in srgb, var(--sc) 50%, transparent);
  text-shadow: 0 1px 2px rgba(0,0,0,0.95);
  pointer-events: none;
}
.ic-slot-badge .ic-slot-glyph { font-size: 9px; }

/* ═══ ART REGION ═══ */
.ic-art {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: -34px 0 0;          /* tuck behind the name bar's gradient */
  display: flex;
  align-items: center;
  justify-content: center;
}
/* rarity glow pooled behind the item render */
.ic-art::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 46%,
    color-mix(in srgb, var(--rc) 42%, transparent) 0%,
    color-mix(in srgb, var(--rc) 10%, transparent) 38%,
    transparent 66%);
  pointer-events: none;
}
.ic-art-img {
  position: relative;
  width: 78%;
  height: 78%;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.6));
  transition: opacity 0.15s;
}

/* ── Hover-spin — 16-frame turntable strip, CSS steps() only ──
   The strip (background-image) is set ONLY under :hover, so the ~0.5 MB
   image downloads lazily — idle cards never fetch it. Zero JS. */
.ic-art-spin {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  height: 78%;
  aspect-ratio: 1 / 1;
  background-repeat: no-repeat;
  background-position-x: 0;
  background-size: 1600% 100%;     /* 16 frames laid out horizontally */
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.6));
  opacity: 0;
  pointer-events: none;
}
.item-card.ic-has-spin:hover .ic-art-spin {
  background-image: var(--ic-strip);
  opacity: 1;
  animation: ic-spin 1.6s steps(16) infinite;
}
.item-card.ic-has-spin:hover .ic-art-img { opacity: 0; }
@keyframes ic-spin { to { background-position-x: 100%; } }
@media (prefers-reduced-motion: reduce) {
  .item-card.ic-has-spin:hover .ic-art-spin { animation: none; }
}
/* fallback when an item has no render */
.ic-art-fallback {
  position: relative;
  width: 64px; height: 64px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--rc) 18%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--rc) 45%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 26px;
  color: var(--rc);
}

/* ═══ INFO PANEL (bottom) ═══ */
.ic-panel {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px 12px;
  background: linear-gradient(to bottom,
    transparent 0%,
    rgba(10,8,18,0.72) 14%,
    rgba(10,8,18,0.96) 34%,
    rgba(10,8,18,0.99) 100%);
}

/* ═══ META ROW — slot + rarity ═══ */
.ic-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ic-slot {
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--sc);
  opacity: 0.85;
}
.ic-meta-spacer { flex: 1; }
.ic-rarity {
  font-family: var(--font-data);
  font-size: 8px;
  padding: 3px 8px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  line-height: 1;
  white-space: nowrap;
  color: var(--rc);
  background: color-mix(in srgb, var(--rc) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--rc) 30%, transparent);
}
.item-card[data-rarity="legendary"] .ic-rarity {
  box-shadow: 0 0 6px color-mix(in srgb, var(--rc) 25%, transparent);
}

/* ═══ STAT CHIPS ═══ */
.ic-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.ic-stat {
  display: flex;
  align-items: baseline;
  gap: 3px;
  font-family: var(--font-data);
  font-size: 8px;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  white-space: nowrap;
}
.ic-stat-val { font-size: 10px; font-weight: 700; }
.ic-stat-label { color: var(--text-faint, #6B5E50); }
.ic-stat--atk  .ic-stat-val { color: var(--stat-atk); }
.ic-stat--hp   .ic-stat-val { color: var(--stat-hp); }
.ic-stat--spd  .ic-stat-val { color: var(--stat-spd); }
.ic-stat--def  .ic-stat-val { color: var(--stat-def); }
.ic-stat--luck .ic-stat-val { color: var(--stat-luck); }
.ic-stat--util .ic-stat-val { color: var(--gold); }

/* ═══ SOCKET STRIP — the headline graphic ═══ */
.ic-sockets {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ic-sockets-label {
  font-family: var(--font-data);
  font-size: 6px;
  letter-spacing: 0.5px;
  color: var(--text-faint, #6B5E50);
  text-transform: uppercase;
}
.ic-socket-row { display: flex; gap: 5px; }
.ic-socket {
  width: 16px; height: 16px;
  border-radius: 4px;
  transform: rotate(45deg);          /* gem facet */
  display: flex;
  align-items: center;
  justify-content: center;
}
.ic-socket-glyph {
  transform: rotate(-45deg);
  font-size: 8px;
  line-height: 1;
}
/* empty socket — hollow */
.ic-socket--empty {
  background: rgba(0,0,0,0.45);
  border: 1.5px dashed rgba(255,255,255,0.22);
}
/* filled — weapon-augment */
.ic-socket--weapon {
  background: rgba(232,133,90,0.30);
  border: 1.5px solid #ffb454;
  box-shadow: 0 0 7px rgba(255,180,84,0.55);
  color: #ffd9b0;
}
/* filled — passive buff */
.ic-socket--equipment {
  background: rgba(106,200,216,0.28);
  border: 1.5px solid #6ac8d8;
  box-shadow: 0 0 7px rgba(106,200,216,0.5);
  color: #cdeef4;
}
.ic-no-sockets {
  font-family: var(--font-data);
  font-size: 6px;
  letter-spacing: 0.5px;
  color: var(--text-faint, #6B5E50);
  text-transform: uppercase;
}

/* ═══ PERK / DESCRIPTION ═══ */
.ic-perk {
  font-family: var(--font-body);
  font-size: 11px;
  font-style: italic;
  line-height: 1.3;
  color: color-mix(in srgb, var(--rc) 55%, var(--text-muted));
}

/* ═══ LEGENDARY ALWAYS-ON GLOW ═══ */
.item-card[data-rarity="legendary"] {
  box-shadow: 0 6px 20px rgba(0,0,0,0.3), 0 0 12px rgba(255,215,0,0.16);
}

/* ═══════════════════════════════════
   UNIFORM SCALE — one canonical item card, scaled as a unit
   (tasks/prd-card-uniform-scale.md)

   buildItemCardV4 now wraps every item card in the shared
   .sc-scaler > .sc-scale-inner wrapper (defined in card-v4.css) and
   the .item-card is always the canonical 240×380. The old
   item-card--mini / --tiny re-typesetting is gone — the card scales
   as a unit so text never reflows between sizes, matching spell cards.
   ═══════════════════════════════════ */

/* ═══ GRID HELPER ═══ */
.item-card-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-start;
}
