/* Cardbridge
   Palette borrows from a card's own anatomy: paper stock, ink, and the
   rarity colours printed on the set symbol — gold for the ones worth
   slowing down over, rust for the ones that don't belong here at all. */

:root {
    --paper:    #faf9f6;
    --surface:  #ffffff;
    --ink:      #14161f;
    --ink-soft: #565a6b;
    --ink-faint:#8a8e9c;
    --line:     #e3e1da;
    --line-firm:#c9c6bc;

    --amethyst: #5b4b8a;
    --amethyst-wash: #efecf7;
    --gold:     #a67c1f;
    --gold-wash:#faf1dc;
    --rust:     #8c3b2e;
    --rust-wash:#f8ebe8;
    --moss:     #3e6b4a;
    --moss-wash:#eaf2ec;

    --radius: 3px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: Archivo, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: Spectral, Georgia, "Times New Roman", serif;
    font-weight: 500;
    letter-spacing: -0.01em;
    margin: 0;
}
h1 { font-size: 30px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }

a { color: var(--amethyst); text-decoration-thickness: 1px; text-underline-offset: 2px; }

.wrap { max-width: 940px; margin: 0 auto; padding: 0 24px 80px; }

/* The masthead sets the tone: a rule, a wordmark, nothing else. */
header.top {
    border-bottom: 1px solid var(--line-firm);
    background: var(--surface);
    margin-bottom: 36px;
}
header.top .wrap {
    padding-top: 20px; padding-bottom: 20px;
    display: flex; align-items: baseline; gap: 16px;
}
.mark {
    font-family: Spectral, Georgia, serif;
    font-size: 20px; letter-spacing: 0.02em;
    text-decoration: none; color: var(--ink);
}
.mark em { font-style: italic; color: var(--amethyst); }
.top nav { margin-left: auto; display: flex; gap: 18px; align-items: baseline; }
.who { font-size: 13px; color: var(--ink-faint); }

/* Signature: the line printed along the bottom edge of a real card.
   The collector number leads because it is the thing that decides whether
   a listing is safe or a coin flip. */
.cardline {
    font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 11.5px;
    letter-spacing: 0.04em;
    color: var(--ink-faint);
    text-transform: uppercase;
}
.cardline b { color: var(--ink); font-weight: 500; }
.cardline .sep { opacity: 0.4; padding: 0 5px; }

/* Cards and panels */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 20px;
}

.stats { display: flex; gap: 1px; background: var(--line); border: 1px solid var(--line);
         border-radius: var(--radius); overflow: hidden; margin-bottom: 28px; }
.stat { flex: 1; background: var(--surface); padding: 16px 18px; }
.stat .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em;
           color: var(--ink-faint); }
.stat .v { font-family: Spectral, Georgia, serif; font-size: 26px; margin-top: 3px; }

.bar { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; background: var(--amethyst); }

/* Set rows. Left rule carries the risk grade — the same way a set symbol
   carries rarity. */
.setrow {
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 3px solid var(--line-firm);
    border-radius: 0;
    margin-bottom: 10px;
}
.setrow[data-risk="clean"]  { border-left-color: var(--moss); }
.setrow[data-risk="verify"] { border-left-color: var(--gold); }
.setrow[data-risk="manual"] { border-left-color: var(--rust); }
.setrow[data-done="1"] { opacity: 0.55; }
.setrow[data-done="1"] .setname { text-decoration: line-through; }

.setrow > summary {
    list-style: none; cursor: pointer; padding: 14px 18px;
    display: flex; align-items: center; gap: 14px;
}
.setrow > summary::-webkit-details-marker { display: none; }
.setrow > summary:hover { background: var(--paper); }
.setname { font-weight: 500; }
.setmeta { margin-left: auto; text-align: right; font-size: 13px; color: var(--ink-soft);
           white-space: nowrap; }

.tag {
    font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
    padding: 3px 8px; border-radius: 2px; white-space: nowrap;
}
.tag.clean  { background: var(--moss-wash);  color: var(--moss); }
.tag.verify { background: var(--gold-wash);  color: var(--gold); }
.tag.manual { background: var(--rust-wash);  color: var(--rust); }

.setbody { padding: 4px 18px 18px; border-top: 1px solid var(--line); }

.reason {
    font-size: 13px; color: var(--gold); background: var(--gold-wash);
    padding: 8px 11px; border-radius: 2px; margin: 12px 0;
}
.reason.manual { color: var(--rust); background: var(--rust-wash); }

/* Card table */
table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th {
    text-align: left; font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.07em; color: var(--ink-faint); font-weight: 500;
    padding: 6px 8px; border-bottom: 1px solid var(--line);
}
td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
td.num { text-align: right; white-space: nowrap; }
.stale { color: var(--gold); font-size: 12px; }

/* Controls */
input[type=text], input[type=password], input[type=number], input[type=file], textarea {
    font: inherit; font-size: 14px; color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-firm); border-radius: var(--radius);
    padding: 8px 10px; width: 100%;
}
input:focus, textarea:focus, button:focus-visible, summary:focus-visible {
    outline: 2px solid var(--amethyst); outline-offset: 1px;
}
input[type=number] { width: 92px; text-align: right; }
input.abbrev { width: 130px; text-transform: uppercase;
               font-family: "JetBrains Mono", monospace; }
label.field { display: block; margin-bottom: 14px; }
label.field span { display: block; font-size: 12px; text-transform: uppercase;
                   letter-spacing: 0.06em; color: var(--ink-soft); margin-bottom: 5px; }

button, .btn {
    font: inherit; font-size: 14px; cursor: pointer;
    background: var(--surface); color: var(--ink);
    border: 1px solid var(--line-firm); border-radius: var(--radius);
    padding: 8px 15px; text-decoration: none; display: inline-block;
}
button:hover, .btn:hover { background: var(--paper); border-color: var(--ink-soft); }
button.primary { background: var(--amethyst); border-color: var(--amethyst); color: #fff; }
button.primary:hover { background: #4b3d74; }
button.quiet { border-color: transparent; color: var(--ink-soft); padding-left: 0; }
button.danger:hover { color: var(--rust); border-color: var(--rust); }

.actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; }
.actions .spacer { margin-left: auto; }

.flash { padding: 11px 14px; border-radius: var(--radius); margin-bottom: 18px; font-size: 14px; }
.flash.error { background: var(--rust-wash); color: var(--rust); }
.flash.ok    { background: var(--moss-wash); color: var(--moss); }

.empty { text-align: center; padding: 48px 24px; color: var(--ink-soft); }
.empty h2 { margin-bottom: 8px; }

.note { font-size: 13px; color: var(--ink-soft); }
.hint { font-size: 12.5px; color: var(--ink-faint); margin-top: 5px; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 14px 0 0; }
.steps li { counter-increment: step; position: relative; padding-left: 32px;
            margin-bottom: 11px; font-size: 14px; }
.steps li::before {
    content: counter(step); position: absolute; left: 0; top: 0;
    font-family: "JetBrains Mono", monospace; font-size: 11px;
    color: var(--amethyst); background: var(--amethyst-wash);
    width: 21px; height: 21px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

.login { max-width: 340px; margin: 90px auto; }

@media (max-width: 640px) {
    .stats { flex-wrap: wrap; }
    .stat { min-width: 45%; }
    .setrow > summary { flex-wrap: wrap; }
    .setmeta { margin-left: 0; width: 100%; text-align: left; }
    table, thead, tbody, th, td, tr { display: block; }
    thead { display: none; }
    td { border: none; padding: 3px 0; }
    tr { border-bottom: 1px solid var(--line); padding: 10px 0; display: block; }
    td.num { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* Scryfall card thumbnails: small in the row, full art on hover. */
.thumb img {
  width: 42px; border-radius: 3px; display: block;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.thumb { position: relative; display: inline-block; }
.thumb::after {
  content: ""; position: absolute; left: 54px; top: -40px; z-index: 30;
  width: 244px; height: 340px; border-radius: 12px;
  background-image: var(--large, none); background-size: cover;
  opacity: 0; pointer-events: none; transition: opacity 0.12s ease;
  box-shadow: 0 6px 24px rgba(0,0,0,0.35);
}
.thumb:hover::after { opacity: 1; }

.liveprice { color: var(--moss); font-weight: 500; }

/* The done checkbox sits inside the clickable summary row. */
.donebox { display: inline-flex; align-items: center; margin-right: 2px; }
.donebox input { width: 17px; height: 17px; accent-color: var(--moss); cursor: pointer; }

/* Tab bar: Expansions / All cards. */
.tabs { display: flex; gap: 4px; margin-top: 16px; border-bottom: 1px solid var(--line); }
.tabs a {
  padding: 8px 16px; text-decoration: none; color: var(--ink-faint);
  font-size: 14px; letter-spacing: 0.02em;
  border: 1px solid transparent; border-bottom: none;
  border-radius: 6px 6px 0 0; position: relative; top: 1px;
}
.tabs a:hover { color: var(--ink); }
.tabs a.active {
  color: var(--ink); background: var(--surface);
  border-color: var(--line); font-weight: 500;
}

/* Stretch a row's primary link over the whole row: the entire card is the
   click target, not just the title text. */
.rowlink::after { content: ""; position: absolute; inset: 0; }
.setrow:has(.rowlink):hover { background: var(--paper); cursor: pointer; }

/* Foil printings: a holographic sheen over the art. The small thumb gets a
   static rainbow wash; the hover preview animates it, like tilting the card
   under a light. */
.thumb.foil::before {
  content: ""; position: absolute; inset: 0; z-index: 1; border-radius: 3px;
  background: linear-gradient(115deg,
    rgba(255, 60, 60, 0.28), rgba(255, 220, 60, 0.22), rgba(80, 255, 160, 0.26),
    rgba(60, 160, 255, 0.28), rgba(200, 80, 255, 0.26));
  mix-blend-mode: screen; pointer-events: none;
}
.thumb.foil::after {
  background-image: linear-gradient(115deg,
      rgba(255, 60, 60, 0.20), rgba(255, 220, 60, 0.16), rgba(80, 255, 160, 0.18),
      rgba(60, 160, 255, 0.20), rgba(200, 80, 255, 0.18), rgba(255, 60, 60, 0.20)),
    var(--large, none);
  background-size: 300% 300%, cover;
  background-position: 0% 0%, center;
  background-blend-mode: screen, normal;
}
.thumb.foil:hover::after {
  animation: foilsheen 3s linear infinite;
}
@keyframes foilsheen {
  0%   { background-position: 0% 0%, center; }
  100% { background-position: 300% 300%, center; }
}

/* Small icon-only buttons, e.g. the trash can on a run row. */
.iconbtn {
  padding: 7px 9px; line-height: 0; color: var(--ink-faint);
  border-color: transparent; background: transparent;
}
.iconbtn:hover { color: var(--rust); border-color: var(--line-firm); background: var(--surface); }

/* Phone-friendly: tighter chrome, stacking stats, sideways-scrolling tables,
   and a hover preview that stays on screen. */
@media (max-width: 700px) {
  .wrap { padding-left: 14px; padding-right: 14px; }
  h1 { font-size: 24px; }
  header.top .wrap { flex-wrap: wrap; row-gap: 6px; }
  .top nav { gap: 12px; flex-wrap: wrap; }

  .stats { flex-direction: column; }
  .stat { padding: 12px 14px; }
  .stat .v { font-size: 21px; }

  th, td { padding: 8px 6px; }
  /* Wide tables keep their real layout and scroll sideways inside their
     wrapper — display:block on a table collapses cells and eats the images. */
  .tablewrap table { min-width: 640px; }

  .actions { flex-wrap: wrap; }
  .setmeta { flex-basis: 100%; text-align: left; margin-left: 46px; }
  .setbody { padding: 4px 12px 14px; }

  /* The zoomed card docks to the viewport instead of floating off-screen. */
  .thumb::after {
    position: fixed; left: 50%; top: 8vh; transform: translateX(-50%);
    width: min(244px, 62vw); height: min(340px, 86vw);
  }
}

/* Horizontal scroll container for wide tables on narrow screens. */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
