/* ============================================================
   StreamTCG — collectible card styles (Drake-industrial plate)
   Shared by deck builder, collection view, and battle table.
   Namespaced under .tcg-card to avoid colliding with site CSS.
   ============================================================ */

.tcg-card {
  --accent: #6b7a89;
  --steel-0: #0a0c0f;
  --steel-1: #14181d;
  --steel-2: #1e242b;
  --steel-3: #2c343d;
  --edge-light: #4a5663;
  --ink: #e7eef7;
  --ink-dim: #9aa7b4;
  --hazard: #ff8a1e;
  --hazard-deep: #c8590a;

  --r-common: #6b7a89;
  --r-uncommon: #61f0a8;
  --r-rare: #2bd6ff;
  --r-mythic: #ffce3a;

  --stat-atk: #ff5a4d;
  --stat-hull: #5ad1a0;
  --stat-acc: #4ea0ff;
  --stat-eva: #c79bff;

  /* per-size-class body tints */
  --class1-a: #0c3b2e; --class1-b: #04140f;
  --class2-a: #0e3a5a; --class2-b: #04111c;
  --class3-a: #3a206b; --class3-b: #120a22;
  --class4-a: #6b1626; --class4-b: #1f0810;
  --class5-a: #7a3d08; --class5-b: #1f1006;

  width: 300px;
  height: 440px;
  position: relative;
  border: 1px solid var(--edge-light);
  clip-path: polygon(
    0 18px, 18px 0, calc(100% - 18px) 0, 100% 18px,
    100% calc(100% - 18px), calc(100% - 18px) 100%,
    18px 100%, 0 calc(100% - 18px)
  );
  box-shadow: 0 0 0 1px rgba(0,0,0,0.6), 0 18px 40px rgba(0,0,0,0.55), inset 0 0 60px rgba(0,0,0,0.4);
  padding: 12px;
  display: flex;
  flex-direction: column;
  font-family: 'Rajdhani', system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--steel-2), var(--steel-1) 55%, var(--steel-0));
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.tcg-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 0 0 1px var(--accent), 0 24px 50px rgba(0,0,0,0.6),
              0 0 30px color-mix(in srgb, var(--accent) 30%, transparent);
}
.tcg-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: repeating-linear-gradient(-45deg, var(--hazard) 0 8px, var(--steel-0) 8px 16px);
  opacity: 0.85;
  z-index: 2;
}

/* rarity accent */
.tcg-card.rarity-common  { --accent: var(--r-common); }
.tcg-card.rarity-uncommon{ --accent: var(--r-uncommon); }
.tcg-card.rarity-rare    { --accent: var(--r-rare); }
.tcg-card.rarity-mythic  { --accent: var(--r-mythic); }

/* size-class backgrounds + metal textures */
.tcg-card.class-1 {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.05) 0 2px, transparent 2px 11px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,0.05) 0 2px, transparent 2px 11px),
    repeating-linear-gradient(45deg, rgba(0,0,0,0.18) 0 1px, transparent 1px 11px),
    linear-gradient(160deg, var(--class1-a), var(--class1-b) 60%, var(--steel-0));
}
.tcg-card.class-2 {
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.04) 0 1px, rgba(0,0,0,0.05) 1px 2px, transparent 2px 4px),
    linear-gradient(160deg, var(--class2-a), var(--class2-b) 60%, var(--steel-0));
}
.tcg-card.class-3 {
  background:
    repeating-linear-gradient(63deg, rgba(0,0,0,0.28) 0 3px, transparent 3px 9px),
    repeating-linear-gradient(-63deg, rgba(255,255,255,0.05) 0 3px, transparent 3px 9px),
    linear-gradient(160deg, var(--class3-a), var(--class3-b) 60%, var(--steel-0));
}
.tcg-card.class-4 {
  background:
    radial-gradient(circle at 14px 14px, rgba(0,0,0,0.45) 1.5px, transparent 2.5px),
    radial-gradient(circle at 14px 14px, rgba(255,255,255,0.06) 0.5px, transparent 1.5px),
    linear-gradient(0deg, transparent calc(100% - 1px), rgba(0,0,0,0.3) 100%),
    linear-gradient(160deg, var(--class4-a), var(--class4-b) 60%, var(--steel-0));
  background-size: 40px 40px, 40px 40px, 100% 56px, 100% 100%;
}
.tcg-card.class-5 {
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,0.3) 0 2px, transparent 2px 16px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.06) 0 2px, transparent 2px 16px),
    repeating-linear-gradient(0deg, rgba(255,180,80,0.04) 0 8px, transparent 8px 16px),
    linear-gradient(160deg, var(--class5-a), var(--class5-b) 60%, var(--steel-0));
}

/* header */
.tcg-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 4px 4px 8px; gap: 8px; }
.tcg-name { font-family: 'Oswald', sans-serif; font-weight: 600; font-size: 22px; line-height: 1; letter-spacing: 0.5px; text-transform: uppercase; color: var(--ink); }
.tcg-mfr { font-family: 'Space Mono', monospace; font-size: 9px; letter-spacing: 1.5px; color: var(--ink-dim); text-transform: uppercase; margin-top: 3px; }
.tcg-class { flex-shrink: 0; text-align: right; }
.tcg-class-badge { font-family: 'Major Mono Display', monospace; font-size: 11px; letter-spacing: 1px; color: var(--accent); border: 1px solid var(--accent); padding: 3px 7px; display: inline-block; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tcg-size-label { font-family: 'Space Mono', monospace; font-size: 8px; letter-spacing: 1.5px; color: var(--ink-dim); text-transform: uppercase; margin-top: 4px; }

/* art window */
.tcg-art { position: relative; height: 180px; margin: 2px 0 8px; overflow: hidden; border: 1px solid var(--steel-3); background: #05070a; clip-path: polygon(0 0, 100% 0, 100% calc(100% - 14px), calc(100% - 24px) 100%, 0 100%); }
.tcg-art img { width: 100%; height: 100%; object-fit: cover; object-position: center; filter: contrast(1.05) saturate(1.05); }
.tcg-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 60%, rgba(5,7,10,0.85) 100%), repeating-linear-gradient(0deg, rgba(0,0,0,0.12) 0 2px, transparent 2px 4px); pointer-events: none; }
.tcg-art-tag { position: absolute; bottom: 8px; left: 8px; font-family: 'Space Mono', monospace; font-size: 8px; letter-spacing: 1.5px; color: var(--accent); text-transform: uppercase; text-shadow: 0 1px 3px #000; }
.tcg-art-fallback { width: 100%; height: 100%; display: grid; place-items: center; background: radial-gradient(circle at 50% 35%, #2a323c, #0a0e12 70%); font-family: 'Major Mono Display', monospace; font-size: 11px; letter-spacing: 2px; color: var(--ink-dim); text-align: center; }

/* stat grid */
.tcg-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 2px; margin-top: auto; }
.tcg-stat { display: flex; align-items: center; gap: 8px; background: linear-gradient(90deg, var(--steel-2), var(--steel-1)); border-left: 3px solid var(--sc, var(--edge-light)); padding: 7px 9px; }
.tcg-stat-ico { font-family: 'Major Mono Display', monospace; font-size: 13px; color: var(--sc, var(--ink-dim)); width: 16px; text-align: center; }
.tcg-stat-meta { display: flex; flex-direction: column; line-height: 1; }
.tcg-stat-label { font-family: 'Space Mono', monospace; font-size: 7px; letter-spacing: 1.5px; color: var(--ink-dim); text-transform: uppercase; }
.tcg-stat-val { font-family: 'Space Mono', monospace; font-weight: 700; font-size: 17px; color: var(--ink); margin-top: 2px; }
.tcg-stat.s-atk  { --sc: var(--stat-atk); }
.tcg-stat.s-hull { --sc: var(--stat-hull); }
.tcg-stat.s-acc  { --sc: var(--stat-acc); }
.tcg-stat.s-eva  { --sc: var(--stat-eva); }

/* substats: size + speed */
.tcg-substats { display: flex; gap: 6px; margin-top: 6px; }
.tcg-substat { flex: 1; display: flex; align-items: center; justify-content: space-between; padding: 5px 9px; background: var(--steel-0); border: 1px solid var(--steel-3); }
.tcg-substat .l { font-family: 'Space Mono', monospace; font-size: 8px; letter-spacing: 1.5px; color: var(--ink-dim); text-transform: uppercase; }
.tcg-substat .v { font-family: 'Space Mono', monospace; font-weight: 700; font-size: 14px; color: var(--hazard); }

/* footer */
.tcg-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--steel-3); }
.tcg-reg { font-family: 'Space Mono', monospace; font-size: 7px; letter-spacing: 1px; color: var(--ink-dim); text-transform: uppercase; }
.tcg-rarity-pip { font-family: 'Space Mono', monospace; font-size: 8px; letter-spacing: 1.5px; color: var(--accent); text-transform: uppercase; }

/* ===== LEADER VARIANT ===== */
.tcg-card.leader { background: linear-gradient(160deg, #241a14, #181210 55%, var(--steel-0)); }
.tcg-card.leader::before { background: repeating-linear-gradient(-45deg, var(--hazard) 0 8px, #2a1c10 8px 16px); }
.tcg-card.leader .tcg-art { height: 158px; }
.tcg-leader-portrait { width: 100%; height: 100%; display: grid; place-items: center; background: radial-gradient(circle at 50% 35%, #3a2a1c, #120c08 70%); }
.tcg-leader-portrait img { width: 100%; height: 100%; object-fit: cover; }
.tcg-leader-portrait .ph { font-family: 'Major Mono Display', monospace; font-size: 11px; letter-spacing: 2px; color: var(--hazard); text-align: center; opacity: 0.7; }
.tcg-ability { background: var(--steel-0); border: 1px solid var(--steel-3); border-left: 3px solid var(--hazard); padding: 7px 9px; margin-top: 6px; }
.tcg-ability-kind { font-family: 'Space Mono', monospace; font-size: 7px; letter-spacing: 1.5px; color: var(--hazard); text-transform: uppercase; }
.tcg-ability-name { font-family: 'Oswald', sans-serif; font-weight: 600; font-size: 13px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--ink); margin: 1px 0 2px; }
.tcg-ability-text { font-family: 'Rajdhani', sans-serif; font-weight: 500; font-size: 11px; line-height: 1.25; color: var(--ink-dim); }

/* compact variant for deck/table grids */
.tcg-card.compact { width: 180px; height: 264px; padding: 8px; }
.tcg-card.compact .tcg-name { font-size: 15px; }
.tcg-card.compact .tcg-art { height: 104px; }
.tcg-card.compact .tcg-stat-val { font-size: 13px; }
.tcg-card.compact .tcg-stat { padding: 4px 6px; gap: 5px; }
.tcg-card.compact .tcg-stat-ico { font-size: 10px; }

/* ===== Unified card grids (Collection / Catalog / pack reveal) ===== */
/* Wrapper that holds a TCGCard plus optional quantity / id badges. */
.tcg-card-wrap { position: relative; display: inline-block; line-height: 0; }

.tcg-qty-badge {
  position: absolute; top: 8px; right: 8px; z-index: 5;
  background: rgba(10,12,15,0.92); color: #fff;
  font-family: 'Space Mono', monospace; font-size: 12px; font-weight: 700;
  padding: 3px 8px; border-radius: 4px; border: 1px solid #4a5663; line-height: 1;
}
.tcg-id-badge {
  position: absolute; bottom: 8px; left: 8px; z-index: 5;
  background: rgba(10,12,15,0.85); color: #9aa7b4;
  font-family: 'Space Mono', monospace; font-size: 9px;
  padding: 2px 6px; border-radius: 3px; line-height: 1;
}

/* Retune the existing grids to tile the 180px compact cards */
.card-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
  justify-items: center;
}
.reveal {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
  justify-items: center;
}
/* pack-reveal pop-in for the new card wrappers */
.reveal .tcg-card-wrap { animation: pop-in 0.5s cubic-bezier(.2,.7,.2,1) backwards; }
.reveal .tcg-card-wrap:nth-child(1) { animation-delay: 0s; }
.reveal .tcg-card-wrap:nth-child(2) { animation-delay: 0.06s; }
.reveal .tcg-card-wrap:nth-child(3) { animation-delay: 0.12s; }
.reveal .tcg-card-wrap:nth-child(4) { animation-delay: 0.18s; }
.reveal .tcg-card-wrap:nth-child(5) { animation-delay: 0.24s; }
.reveal .tcg-card-wrap:nth-child(n+6) { animation-delay: 0.3s; }

/* ===== Card zoom lightbox (click a card to inspect) ===== */
.card-zoom-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
  background: rgba(5, 7, 11, 0.85);
  backdrop-filter: blur(4px);
  cursor: zoom-out;
  animation: card-zoom-fade 0.18s ease;
}
.card-zoom-holder {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  animation: card-zoom-pop 0.22s cubic-bezier(.2,.7,.2,1);
}
/* the full-size card, scaled up a touch on large screens */
.card-zoom-card { transform: scale(1.25); transform-origin: center; }
.card-zoom-caption {
  font-family: 'Space Mono', monospace; font-size: 13px; letter-spacing: 1px;
  color: #9aa7b4; margin-top: 30px;
}
@keyframes card-zoom-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes card-zoom-pop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* on smaller screens, don't over-scale */
@media (max-width: 700px) {
  .card-zoom-card { transform: scale(0.95); }
  .card-zoom-caption { margin-top: 10px; }
}
