/* =========================================================
   MtG Card Frame — Lands of Lore: The Gathering
   ========================================================= */

:root {
  --card-scale: 1;
  --card-w: 250px;
  --card-h: 350px;
  --card-radius: 12px;
  --card-border: 3px;
  --frame-border: #a08040;

  /* Color frame gradients */
  --frame-W: linear-gradient(160deg, #f9f4e8 0%, #d4c99a 60%, #b8a86a 100%);
  --frame-U: linear-gradient(160deg, #c0d8f0 0%, #6699cc 60%, #3366aa 100%);
  --frame-B: linear-gradient(160deg, #3a3040 0%, #1a1020 60%, #0a0810 100%);
  --frame-R: linear-gradient(160deg, #f0c080 0%, #cc4422 60%, #882200 100%);
  --frame-G: linear-gradient(160deg, #a0d8a0 0%, #448844 60%, #224422 100%);
  --frame-multi: linear-gradient(160deg, #f0d060 0%, #cc8822 50%, #886600 100%);
  --frame-artifact: linear-gradient(160deg, #d8e0e8 0%, #a0b0c0 60%, #6080a0 100%);
  --frame-land: linear-gradient(160deg, #c8b880 0%, #a09060 60%, #706040 100%);
  --frame-C: linear-gradient(160deg, #d0d0d0 0%, #a0a0a0 60%, #707070 100%);

  /* Text color per frame */
  --text-W: #2a2010;
  --text-U: #0a1828;
  --text-B: #e0d0f0;
  --text-R: #1a0800;
  --text-G: #0a1808;
  --text-multi: #1a0800;
  --text-artifact: #0a1020;
  --text-land: #1a1008;
  --text-C: #101010;
}

/* ---- Card wrapper ---- */
.card-frame {
  display: inline-flex;
  flex-direction: column;
  width: calc(var(--card-w) * var(--card-scale));
  height: calc(var(--card-h) * var(--card-scale));
  border-radius: calc(var(--card-radius) * var(--card-scale));
  border: calc(var(--card-border) * var(--card-scale)) solid var(--frame-border);
  overflow: hidden;
  font-size: calc(10px * var(--card-scale));
  box-shadow: 0 4px 12px rgba(0,0,0,0.6);
  position: relative;
  flex-shrink: 0;
}

/* ---- Color frame variants ---- */
.card-frame.frame-W { background: var(--frame-W); color: var(--text-W); --frame-border: #c8b870; }
.card-frame.frame-U { background: var(--frame-U); color: var(--text-U); --frame-border: #5577aa; }
.card-frame.frame-B { background: var(--frame-B); color: var(--text-B); --frame-border: #6644aa; }
.card-frame.frame-R { background: var(--frame-R); color: var(--text-R); --frame-border: #cc4422; }
.card-frame.frame-G { background: var(--frame-G); color: var(--text-G); --frame-border: #336633; }
.card-frame.frame-multi { background: var(--frame-multi); color: var(--text-multi); --frame-border: #cc8800; }
.card-frame.frame-artifact { background: var(--frame-artifact); color: var(--text-artifact); --frame-border: #8899aa; }
.card-frame.frame-land { background: var(--frame-land); color: var(--text-land); --frame-border: #806040; }
.card-frame.frame-C { background: var(--frame-C); color: var(--text-C); --frame-border: #888888; }

/* ---- Name bar ---- */
.card-name-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(4px * var(--card-scale)) calc(6px * var(--card-scale));
  background: rgba(0,0,0,0.18);
  border-bottom: 1px solid rgba(0,0,0,0.2);
  gap: calc(4px * var(--card-scale));
  min-height: calc(22px * var(--card-scale));
}

.card-name {
  font-weight: bold;
  font-size: calc(10px * var(--card-scale));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.card-mana-cost {
  display: flex;
  gap: calc(2px * var(--card-scale));
  align-items: center;
  flex-shrink: 0;
}

.card-mana-cost .ms {
  font-size: calc(10px * var(--card-scale));
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.4));
}

/* ---- Art box ---- */
.card-art {
  width: 100%;
  flex: 1 1 auto;
  overflow: hidden;
  border-top: 1px solid rgba(255,255,255,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.card-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-art-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(4px * var(--card-scale));
  opacity: 0.5;
  font-size: calc(9px * var(--card-scale));
  text-align: center;
  padding: calc(8px * var(--card-scale));
  height: 100%;
  width: 100%;
}

.card-art-placeholder svg {
  width: calc(40px * var(--card-scale));
  height: calc(40px * var(--card-scale));
}

/* ---- Type line ---- */
.card-type-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(3px * var(--card-scale)) calc(6px * var(--card-scale));
  background: rgba(0,0,0,0.15);
  border-top: 1px solid rgba(0,0,0,0.2);
  border-bottom: 1px solid rgba(0,0,0,0.2);
  font-size: calc(9px * var(--card-scale));
  font-weight: 600;
  min-height: calc(18px * var(--card-scale));
}

.card-set-symbol {
  font-size: calc(11px * var(--card-scale));
  opacity: 0.8;
}

/* ---- Text box ---- */
.card-text-box {
  padding: calc(5px * var(--card-scale)) calc(6px * var(--card-scale));
  background: rgba(255,255,255,0.12);
  font-size: calc(8.5px * var(--card-scale));
  line-height: 1.35;
  flex: 0 0 auto;
  min-height: calc(80px * var(--card-scale));
  max-height: calc(110px * var(--card-scale));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: calc(3px * var(--card-scale));
}

.card-oracle-text p {
  margin: 0 0 calc(3px * var(--card-scale)) 0;
}

.card-flavor-text {
  font-style: italic;
  opacity: 0.75;
  border-top: 1px solid rgba(0,0,0,0.15);
  padding-top: calc(3px * var(--card-scale));
  margin-top: calc(2px * var(--card-scale));
  font-size: calc(8px * var(--card-scale));
}

/* ---- Bottom bar (P/T, loyalty, collector info) ---- */
.card-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(2px * var(--card-scale)) calc(6px * var(--card-scale));
  background: rgba(0,0,0,0.18);
  font-size: calc(8px * var(--card-scale));
  min-height: calc(18px * var(--card-scale));
}

.card-collector-info {
  opacity: 0.65;
  font-size: calc(7.5px * var(--card-scale));
}

.card-pt-box {
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(0,0,0,0.3);
  border-radius: calc(3px * var(--card-scale));
  padding: calc(1px * var(--card-scale)) calc(5px * var(--card-scale));
  font-weight: bold;
  font-size: calc(9.5px * var(--card-scale));
  min-width: calc(28px * var(--card-scale));
  text-align: center;
}

.card-loyalty-box {
  background: rgba(0,0,150,0.4);
  border: 1px solid rgba(0,0,200,0.5);
  border-radius: 50%;
  width: calc(20px * var(--card-scale));
  height: calc(20px * var(--card-scale));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: calc(10px * var(--card-scale));
}

/* ---- Prose (discussion posts) ------------------------------------------ */
/* Tailwind's preflight resets browser heading styles; these restore them     */
/* for any element inside .prose (used on rendered Markdown comment bodies).  */
.prose { line-height: 1.65; }

.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
  font-weight: 700;
  line-height: 1.25;
  margin-top: 1em;
  margin-bottom: 0.4em;
  color: #f5f5f4;
}
.prose h1 { font-size: 1.6em; }
.prose h2 { font-size: 1.3em; }
.prose h3 { font-size: 1.15em; }
.prose h4 { font-size: 1em; }

.prose p  { margin-top: 0.5em; margin-bottom: 0.5em; }
.prose p:first-child { margin-top: 0; }
.prose p:last-child  { margin-bottom: 0; }

.prose ul { list-style: disc;    padding-left: 1.5em; margin: 0.5em 0; }
.prose ol { list-style: decimal; padding-left: 1.5em; margin: 0.5em 0; }
.prose li { margin: 0.2em 0; }
.prose li > p { margin: 0; }

.prose code {
  font-family: 'Fira Code', 'Cascadia Code', ui-monospace, monospace;
  font-size: 0.875em;
  background: rgba(255,255,255,0.1);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
.prose pre {
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 0.75em 1em;
  border-radius: 6px;
  overflow-x: auto;
  margin: 0.75em 0;
}
.prose pre code { background: none; padding: 0; font-size: 0.9em; }

.prose blockquote {
  border-left: 3px solid #f59e0b;
  padding: 0.2em 0.8em;
  color: #a8a29e;
  margin: 0.6em 0;
  font-style: italic;
}
.prose a    { color: #f59e0b; text-decoration: underline; }
.prose strong { font-weight: 700; color: #f5f5f4; }
.prose hr   { border: none; border-top: 1px solid rgba(255,255,255,0.12); margin: 1em 0; }

/* ---- Rarity indicators ---- */
.rarity-common    { color: #888; }
.rarity-uncommon  { color: #aabbcc; }
.rarity-rare      { color: #cc9900; }
.rarity-mythic    { color: #cc4400; }

/* ---- Inline mana symbols in text ---- */
.card-text-box .ms {
  font-size: calc(9px * var(--card-scale));
  vertical-align: middle;
}

/* ---- Scale helpers ---- */
.card-frame.scale-sm  { --card-scale: 0.7; }
.card-frame.scale-md  { --card-scale: 1;   }
.card-frame.scale-lg  { --card-scale: 1.5; }
.card-frame.scale-xl  { --card-scale: 2;   }

/* ---- Print layout ---- */
@media print {
  body { background: white !important; color: black !important; }
  nav, .no-print { display: none !important; }
  .print-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 4mm;
  }
  .card-frame {
    page-break-inside: avoid;
    box-shadow: none;
    border-color: #555;
  }
}
