/* ══ DEPENDS ON: assets/css/site.css (tokens) — USED BY: print.html only. Class names are wired to assets/js/app.js + assets/js/email.js — do not rename classes/IDs here without checking those two files ══ */
/* ══════════════════════════════════════════
   INFINITE PRINT — light Infinite Library theme
   Class names kept 1:1 with app.js / email.js
   ══════════════════════════════════════════ */
.container { max-width: 1280px; margin: 0 auto; padding: 0 28px 90px; position: relative; z-index: 1; }

.page-head { padding: 40px 0 28px; }
.page-head h1 { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.03em; font-size: clamp(2.1rem, 4vw, 2.8rem); margin: 6px 0 6px; }
.subtitle { color: var(--ink-soft); font-size: 0.98rem; }

.input-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 30px;
}
@media(max-width:680px){ .input-section { grid-template-columns:1fr; } }

.panel {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.panel-title {
  font-family: var(--font-body); font-weight: 600;
  font-size: 0.778rem;
  color: var(--ink-soft);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
textarea {
  width: 100%; height: 190px;
  background: var(--bg);
  border: 1.5px solid var(--line-soft);
  border-radius: 8px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.65;
  padding: 12px 14px;
  resize: vertical; outline: none;
  transition: border-color 0.2s;
}
textarea:focus { border-color: var(--blue); }
textarea::placeholder { color: var(--ink-dim); font-family: var(--font-mono); font-size: 12.5px; }

.drop-zone {
  border: 2px dashed var(--line-soft);
  border-radius: 8px;
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  background: var(--bg);
  transition: all 0.2s;
}
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--blue); background: var(--blue-dim); }
.drop-icon { font-size: 1.8rem; opacity: 0.5; margin-bottom: 8px; }
.drop-text { color: var(--ink-soft); font-size: 0.88rem; line-height: 1.6; }
.drop-text strong { color: var(--ink); }
.file-input { display: none; }

.btn-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; align-items: center; }

.format-badge {
  display: none;
  align-items: center; gap: 5px;
  padding: 4px 12px; border-radius: 20px;
  font-size: 0.778rem; letter-spacing: 0.04em;
  border: 1.5px solid; font-family: var(--font-body); font-weight: 600;
  margin-left: 2px;
}
.format-badge.detected { color: var(--green); border-color: var(--green); background: #eaf7ef; }
.format-badge.error { color: var(--red); border-color: var(--red); background: #fdecec; }

#results { display: none; }

.view-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 26px;
  gap: 12px;
  flex-wrap: wrap;
}
.deck-title { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.03em; font-size: 1.3rem; }

.view-toggle {
  display: flex;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 30px;
  overflow: hidden;
}
.view-btn {
  padding: 9px 18px;
  background: transparent; border: none;
  color: var(--ink-soft);
  font-family: var(--font-body); font-weight: 600; font-size: 0.778rem; letter-spacing: 0.04em;
  cursor: pointer; transition: all 0.18s;
  display: flex; align-items: center; gap: 5px;
}
.view-btn.active { background: var(--ink); color: var(--bg); }
.view-btn:not(.active):hover { background: var(--bg); color: var(--ink); }

.deck-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.stat { text-align: center; padding: 8px 16px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 8px; }
.stat-num { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.03em; font-size: 1.3rem; color: var(--blue); display: block; }
.stat-label { font-size: 0.702rem; color: var(--ink-dim); letter-spacing: 0.06em; text-transform: uppercase; font-family: var(--font-body); font-weight: 600; }

/* LIST VIEW */
.section-title {
  font-family: var(--font-body); font-weight: 600; font-size: 0.778rem; color: var(--ink-soft);
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 6px 0; border-bottom: 2px solid var(--line);
  margin-bottom: 6px; margin-top: 24px;
  display: flex; align-items: center; gap: 8px;
}
.section-count { background: var(--bg); border: 1px solid var(--line-soft); color: var(--ink-soft); border-radius: 10px; padding: 1px 9px; font-size: 0.68rem; }
.card-table { width: 100%; border-collapse: collapse; }
.card-table tr { border-bottom: 1px solid var(--line-soft); transition: background 0.12s; }
.card-table tr:hover { background: var(--bg); }
.card-table td { padding: 8px; font-size: 0.9rem; }
.td-qty { font-family: var(--font-mono); color: var(--blue); font-weight: 700; font-size: 0.85rem; width: 36px; text-align: right; padding-right: 12px; }
.td-name { color: var(--ink); }
.td-set { color: var(--ink-dim); font-size: 0.72rem; font-family: var(--font-mono); width: 80px; }
.commander-row td { color: var(--ink) !important; font-weight: 700; }
.commander-row { background: var(--lime-dim); }
.sideboard-section { margin-top: 34px; padding-top: 26px; border-top: 2px solid var(--line); }
.parse-errors { background: #fdecec; border: 1.5px solid var(--red); border-radius: 8px; padding: 14px 16px; margin-bottom: 20px; }
.parse-errors-title { color: var(--red); font-family: var(--font-body); font-weight: 600; font-size: 0.778rem; letter-spacing: 0.06em; margin-bottom: 6px; }
.error-line { font-family: var(--font-mono); font-size: 0.78rem; color: var(--red); opacity: 0.85; padding: 2px 0; }

/* CARD VIEW */
.loading-bar { background: var(--surface); border: 1.5px solid var(--line); border-radius: 8px; padding: 20px; text-align: center; margin-bottom: 22px; }
.loading-bar-text { color: var(--ink-soft); font-size: 0.95rem; margin-bottom: 10px; font-family: var(--font-body); font-weight: 600; }
.progress-track { background: var(--bg); border: 1px solid var(--line-soft); border-radius: 4px; height: 8px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--blue); border-radius: 4px; transition: width 0.3s; width: 0%; }

.card-section-title {
  font-family: var(--font-body); font-weight: 600; font-size: 0.778rem; color: var(--ink-soft);
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 6px 0; border-bottom: 2px solid var(--line);
  margin-bottom: 14px; margin-top: 30px;
  display: flex; align-items: center; gap: 8px;
}
/* ── CARD FILTERS ──
   Markup injected by app.js (renderFilterBar). Sticks under the header so the
   filters stay reachable while scrolling a 100-card commander deck. */
.card-filters {
  position: sticky; top: 64px; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  padding: 12px 14px; margin-bottom: 18px;
  background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(21, 21, 26, 0.06);
}
.card-filters:empty { display: none; }
.cf-search {
  display: flex; align-items: center; gap: 7px;
  flex: 1 1 210px; min-width: 170px;
  padding: 7px 12px;
  border: 1.5px solid var(--line-soft); border-radius: 30px; background: var(--bg);
}
.cf-search:focus-within { border-color: var(--blue); }
.cf-search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font-family: var(--font-body); font-size: 0.85rem; color: var(--ink);
}
.cf-group { display: flex; flex-wrap: wrap; gap: 5px; }
.cf-chip {
  padding: 6px 11px;
  border: 1.5px solid var(--line-soft); border-radius: 30px; background: transparent;
  font-family: var(--font-body); font-weight: 600; font-size: 0.713rem; letter-spacing: 0.03em;
  color: var(--ink-soft); cursor: pointer; transition: all 0.14s;
}
.cf-chip:hover { border-color: var(--ink); color: var(--ink); }
.cf-chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
/* Colour chips are round and tinted with the real Magic colour, so they read as
   mana symbols rather than yet another word. */
.cf-mana {
  width: 30px; height: 30px; padding: 0; border-radius: 50%;
  display: grid; place-items: center; font-size: 0.7rem; font-weight: 700; color: var(--ink);
}
.cf-W { background: #f5efd6; } .cf-U { background: #b3d7ea; }
.cf-B { background: #cbc2bf; } .cf-R { background: #edb59a; }
.cf-G { background: #b4d1ba; } .cf-C { background: #ded8d1; }
.cf-mana.on { box-shadow: 0 0 0 2.5px var(--ink); border-color: var(--ink); }
.cf-r-mythic.on { background: #b8541c; border-color: #b8541c; }
.cf-r-rare.on { background: #a08a3c; border-color: #a08a3c; }
.cf-reset {
  padding: 6px 11px; border: 0; background: transparent;
  color: var(--blue); font-family: var(--font-body); font-weight: 600; font-size: 0.713rem;
  text-decoration: underline; cursor: pointer;
}
.cf-count {
  margin-left: auto; color: var(--ink-dim);
  font-family: var(--font-body); font-weight: 600; font-size: 0.734rem; white-space: nowrap;
}
.cf-empty {
  padding: 54px 20px; text-align: center;
  border: 1.5px dashed var(--line-soft); border-radius: var(--radius);
  color: var(--ink-soft);
}
.cf-empty p { margin: 0 0 5px; font-size: 0.9rem; }
.cf-empty p:last-child { font-size: 0.8rem; color: var(--ink-dim); }

@media (max-width: 700px) {
  .card-filters { top: 0; padding: 10px; }
  .cf-count { margin-left: 0; width: 100%; }
}

.card-grid { display: flex; flex-wrap: wrap; gap: 10px; }
/* Change these two numbers together to make on-screen cards bigger or smaller without stretching them. */

.card-img-wrap {
  width: 166px; height: 231px;
  border-radius: 10px; overflow: hidden;
  background: var(--bg); border: 1.5px solid var(--line);
  position: relative; flex-shrink: 0;
  transition: transform 0.15s, box-shadow 0.15s;
}
.card-img-wrap:hover { transform: translateY(-4px); box-shadow: 6px 8px 0 #c6c6c7; z-index: 10; }
.card-img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-placeholder { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px; text-align: center; color: var(--ink-dim); }
.card-placeholder-icon { font-size: 2rem; opacity: 0.35; }
.card-placeholder-name { font-size: 0.78rem; color: var(--ink-soft); margin-top: 6px; line-height: 1.3; }
.card-error-badge { position: absolute; bottom: 4px; left: 4px; right: 4px; background: var(--red); color: white; font-size: 0.65rem; border-radius: 4px; padding: 2px 6px; text-align: center; }

/* ── ORDER BUTTON ── */
.btn-order { background: var(--lime); color: var(--ink); border: 1.5px solid var(--line); font-family: var(--font-body); font-size: 0.821rem; padding: 11px 22px; border-radius: 30px; text-transform: uppercase; letter-spacing: 0.05em; cursor: pointer; font-weight: 700; transition: all 0.15s; }
.btn-order:hover { transform: translateY(-2px); box-shadow: 4px 4px 0 var(--ink); }
.btn:disabled { opacity: 0.4 !important; cursor: not-allowed !important; transform: none !important; }

/* ── ZOOM LIGHTBOX ── */
#zoomOverlay { display:none; position:fixed; inset:0; z-index:2000; background:rgba(21,21,26,0.86); backdrop-filter:blur(6px); align-items:center; justify-content:center; cursor:zoom-out; }
#zoomOverlay.open { display:flex; }
#zoomOverlay img { max-width:88vw; max-height:88vh; border-radius:14px; box-shadow:0 20px 60px rgba(0,0,0,0.5); }

/* ── MODAL BASE ── */
.modal-overlay { display:none; position:fixed; inset:0; z-index:1500; background:rgba(21,21,26,0.5); backdrop-filter:blur(3px); align-items:center; justify-content:center; padding:20px; }
.modal-overlay.open { display:flex; }
.modal { background:var(--surface); border:1.5px solid var(--line); border-radius:16px; padding:28px 30px; width:100%; max-width:460px; position:relative; max-height:92vh; overflow-y:auto; }
.modal-close { position:absolute; top:14px; right:16px; background:none; border:none; color:var(--ink-dim); font-size:1.2rem; cursor:pointer; line-height:1; padding:4px 6px; }
.modal-close:hover { color:var(--ink); }
.modal-title { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.03em; font-size:1.3rem; margin-bottom:4px; }
.modal-subtitle { color:var(--ink-soft); font-size:0.85rem; margin-bottom:18px; line-height:1.5; }
.form-group { margin-bottom:13px; }
.form-label { display:block; font-family:var(--font-body); font-size: 0.702rem; letter-spacing:0.08em; color:var(--ink-soft); text-transform:uppercase; margin-bottom:6px; }
.form-input { width:100%; background:var(--bg); border:1.5px solid var(--line-soft); border-radius:8px; color:var(--ink); font-family:var(--font-body); font-size:0.93rem; padding:9px 12px; outline:none; transition:border-color 0.2s; }
.form-input:focus { border-color: var(--blue); }
.form-input.err { border-color:var(--red) !important; }
.form-note { font-size:0.76rem; color:var(--ink-dim); margin-top:4px; }
.deck-preview-box { background:var(--bg); border:1.5px solid var(--line-soft); border-radius:8px; padding:10px 12px; font-family:var(--font-mono); font-size:12px; color:var(--ink-soft); max-height:80px; overflow-y:auto; margin-bottom:14px; white-space:pre-wrap; line-height:1.5; }
.modal-actions { display:flex; gap:10px; justify-content:flex-end; margin-top:16px; }

/* ── FEEDBACK FLOATING BTN ── */
#feedbackBtn { position:fixed; bottom:24px; right:24px; z-index:1000; width:46px; height:46px; border-radius:50%; background:var(--ink); border:1.5px solid var(--line); color:var(--bg); font-size:1.1rem; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:all 0.2s; box-shadow: 0 6px 20px rgba(21,21,26,0.25); }
#feedbackBtn:hover { background: var(--blue); transform:translateY(-2px); }
#feedbackBtn .tip { position:absolute; right:56px; background:var(--ink); border:1px solid var(--line); border-radius:8px; padding:5px 11px; font-family:var(--font-body); font-size: 0.713rem; letter-spacing:0.04em; white-space:nowrap; color:var(--bg); opacity:0; pointer-events:none; transition:opacity 0.18s; }
#feedbackBtn:hover .tip { opacity:1; }

/* ── SUCCESS BANNER ── */
.success-banner { display:none; background: var(--lime-dim); border:1.5px solid var(--line); border-radius:12px; padding:28px; text-align:center; margin-top:30px; }
.success-banner.show { display:block; }
/* email.js adds `.show` after an order is sent. Remove `.show` to hide this banner again. */
.success-icon {
  width: 46px; height: 46px; margin: 0 auto 12px;
  display: grid; place-items: center;
  background: var(--ink); border: 2px solid var(--ink); border-radius: 50%;
}
.success-icon svg { width: 28px; height: 28px; fill: none; stroke: var(--lime); stroke-width: 2.8; stroke-linecap: square; stroke-linejoin: miter; }
.success-title { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.03em; color:var(--ink); font-size:1.2rem; margin-bottom:6px; }
.success-text { color:var(--ink-soft); font-size:0.9rem; line-height:1.6; }

/* PRINT */
/* Paper-only identifying strip. Hidden on screen; the @media print block below
   turns it on. */
.print-header { display: none; }

/* ══════════════════════════════════════════
   PRINT — 9 cards per A4 sheet at true size
   ══════════════════════════════════════════
   The maths, so future changes do not silently drop back to two columns:

     A4 width                        210 mm
     − @page margin 7 mm × 2         196 mm usable
     3 cards × 63 mm                 189 mm
     + 2 gaps × 2 mm                 193 mm   → fits, 3 mm to spare

     A4 height                       297 mm
     − @page margin 7 mm × 2         283 mm usable
     3 rows × 88 mm + 2 gaps         268 mm   → fits, 15 mm for the header

   Anything that adds horizontal padding inside the page breaks this. That is
   exactly what used to happen: .container kept its 28 px side padding when
   printing (~15 mm), leaving 179 mm, and the third card wrapped to the next row.
   ══════════════════════════════════════════ */
@media print {
  body { background: white !important; }
  #feedbackBtn, #zoomOverlay, .modal-overlay, .success-banner, .site-header, .site-footer { display: none !important; }
  .page-head, .input-section, .view-toolbar, .btn-row, #listView, .loading-bar, .format-badge { display: none !important; }
  .card-filters { display: none !important; }
  /* The "printing the full deck" toast is position:fixed, so it was landing on
     top of a card in the printed sheet. */
  .toast { display: none !important; }
  /* Buttons overlaid on each card. Hidden on screen until hover, but print has
     no hover — force them out so they can never end up on paper. */
  .art-btn { display: none !important; }

  /* Reclaim every millimetre of the sheet. */
  .container { max-width: none !important; margin: 0 !important; padding: 0 !important; }
  #results { display: block !important; margin: 0 !important; }
  #cardView { display: block !important; }

  /* Section headings are dropped on paper: each one costs part of a card row and
     the cards identify themselves. Printing is for proxies, not for reading an
     index. Delete this line to bring them back. */
  .card-section-title, .sideboard-section { margin: 0 !important; }
  .card-section-title { display: none !important; }
  /* No forced page break before the sideboard either — it used to waste most of
     a sheet just to separate a handful of cards. */
  .sideboard-print-break { page-break-before: auto !important; }

  .card-grid { display: flex !important; flex-wrap: wrap !important; gap: 2mm !important; align-content: flex-start !important; }
  .card-wrap-outer { flex: 0 0 auto !important; margin: 0 !important; }
  .card-img-wrap {
    width: 63mm !important; height: 88mm !important;
    flex-shrink: 0 !important; border-radius: 3.5mm !important;
    border: 0.3mm solid #bbb !important; break-inside: avoid; overflow: hidden !important;
  }
  .card-img-wrap img { width: 63mm !important; height: 88mm !important; object-fit: cover !important; display: block !important; }
  .card-img-wrap:hover { transform: none !important; box-shadow: none !important; }

  /* Thin identifying strip at the top of the first sheet. */
  .print-header {
    display: flex !important; align-items: baseline;
    gap: 10mm; margin: 0 0 3mm; padding-bottom: 1.5mm;
    border-bottom: 0.3mm solid #999;
    font-family: Arial, Helvetica, sans-serif; color: #000;
  }
  .print-header .ph-brand { font-weight: 900; font-size: 11pt; letter-spacing: 0.06em; }
  /* Takes the rest of the row so the deck line sits away from the brand instead
     of hugging it — there is nothing on the right any more to balance against. */
  .print-header .ph-deck { flex: 1; font-size: 8.5pt; color: #444; text-align: right; }

  @page { margin: 7mm; }
}

/* ── ART PICKER ── */
.card-wrap-outer { position: relative; display: inline-block; flex-shrink: 0; }
.art-btn {
  position: absolute; bottom: 6px; right: 6px; z-index: 20;
  background: var(--ink); border: 1px solid var(--line);
  color: #fff; font-size: 0.67rem; padding: 4px 8px; border-radius: 20px;
  cursor: pointer; font-family: var(--font-body); font-weight: 600; letter-spacing: 0.04em;
  transition: background 0.15s;
  display: none;
}
.card-wrap-outer:hover .art-btn { display: block; }
.art-btn:hover { background: var(--blue); }

/* Art picker modal */
#artPickerModal { display:none; position:fixed; inset:0; z-index:3000; background:rgba(21,21,26,0.86); backdrop-filter:blur(6px); align-items:center; justify-content:center; padding:20px; }
#artPickerModal.open { display:flex; }
.art-modal-box { background:var(--surface); border:1.5px solid var(--line); border-radius:16px; padding:22px; max-width:860px; width:100%; max-height:85vh; display:flex; flex-direction:column; }
.art-modal-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.art-modal-title { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.03em; font-size:1.2rem; }
.art-modal-close { background:none; border:none; color:var(--ink-dim); font-size:1.3rem; cursor:pointer; }
.art-modal-close:hover { color:var(--ink); }
.art-grid { display:flex; flex-wrap:wrap; gap:10px; overflow-y:auto; padding-bottom:4px; }
.art-option {
  width:130px; flex-shrink:0; cursor:pointer; border-radius:8px;
  overflow:hidden; border:2px solid transparent; transition:all 0.15s;
}
.art-option:hover { border-color: var(--blue); transform:translateY(-2px); }
.art-option.selected { border-color: var(--ink); box-shadow: 3px 3px 0 var(--blue); }
.art-option img { width:130px; height:181px; object-fit:cover; display:block; }
.art-option-label { font-size:0.62rem; color:var(--ink-soft); text-align:center; padding:4px 4px; background:var(--bg); font-family:var(--font-mono); letter-spacing:0.02em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.art-loading { color:var(--ink-dim); font-style:italic; font-size:0.88rem; padding:20px; }
