/* ============================================================
   1. DESIGN TOKENS
   Every colour and size the page uses is named ONCE here, then
   referred to by name everywhere else. Change a value here and
   it updates across the whole site. That is the whole point.
   ============================================================ */
:root {
  /* Light theme — the default */
  --ground:      #F3F1F7;  /* the page background */
  --surface:     #FFFFFF;  /* cards sitting on the background */
  --surface-2:   #FAF9FC;
  --ink:         #1B1526;  /* main text — a plum-black, not pure black */
  --ink-soft:    #5A5370;  /* secondary text */
  --ink-faint:   #857EA0;  /* labels, small print */
  --line:        #DFDAEA;  /* borders */
  --brass:       #8A6A1F;  /* accent — the gold of a foil set symbol */
  --brass-bright:#B08B2E;
  --good:        #1C7551;  /* the savings figure */
  --good-bg:     #E4F2EA;
  --shadow: 0 1px 2px rgba(27,21,38,.06), 0 10px 28px rgba(27,21,38,.07);

  /* Magic's five colours — these stay the same in both themes,
     because they belong to the game, not to the page. */
  --mana-w: #EFE0BC;
  --mana-u: #6FAEDC;
  --mana-b: #4A4258;
  --mana-r: #DD836A;
  --mana-g: #79B079;

  /* Type scale and spacing */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Karla", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --radius: 10px;
  --container: 1120px;
}

/* Dark theme, part 1: the viewer's system is set to dark and they
   have NOT overridden it. Only the token values change. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground:      #131020;
    --surface:     #191529;
    --surface-2:   #201B36;
    --ink:         #EDE9F7;
    --ink-soft:    #A9A2C4;
    --ink-faint:   #7E7799;
    --line:        #322B4D;
    --brass:       #D9B457;
    --brass-bright:#EFCE7C;
    --good:        #4ECB92;
    --good-bg:     #16352A;
    --shadow: 0 1px 2px rgba(0,0,0,.45), 0 12px 32px rgba(0,0,0,.4);
  }
}

/* Dark theme, part 2: the viewer explicitly chose dark. Same values. */
:root[data-theme="dark"] {
  --ground:      #131020;
  --surface:     #191529;
  --surface-2:   #201B36;
  --ink:         #EDE9F7;
  --ink-soft:    #A9A2C4;
  --ink-faint:   #7E7799;
  --line:        #322B4D;
  --brass:       #D9B457;
  --brass-bright:#EFCE7C;
  --good:        #4ECB92;
  --good-bg:     #16352A;
  --shadow: 0 1px 2px rgba(0,0,0,.45), 0 12px 32px rgba(0,0,0,.4);
}

/* ============================================================
   2. BASE
   ============================================================ */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  text-wrap: balance;
  margin: 0;
}

p { margin: 0; }
a { color: inherit; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 24px;
}

/* A label above a heading — small, spaced-out capitals. */
.eyebrow {
  font-family: var(--font-mono);
  font-size: .75rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 14px;
}

/* Visible outline whenever someone tabs through with a keyboard. */
:focus-visible {
  outline: 2px solid var(--brass-bright);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ============================================================
   3. HEADER
   ============================================================ */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 68px;
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -.01em;
  text-decoration: none;
}
.wordmark span { color: var(--brass); }

.site-nav {
  display: flex;
  gap: 26px;
  font-size: .95rem;
}
.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
}
.site-nav a:hover { color: var(--ink); }

@media (max-width: 620px) {
  .site-nav { display: none; }
}

/* ============================================================
   4. HERO
   ============================================================ */
.hero { padding: 76px 0 64px; }

.hero .container {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 56px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(2.5rem, 5.4vw, 4rem);
  letter-spacing: -.02em;
}

.hero-lede {
  margin-top: 20px;
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 46ch;
}

.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--brass);
  border: 1px solid var(--brass);
  border-radius: 999px;
  padding: 5px 12px;
  margin-bottom: 22px;
}

/* ============================================================
   5. THE SIGNUP FORM
   ============================================================ */
.signup {
  display: flex;
  gap: 10px;
  margin-top: 30px;
  max-width: 440px;
  flex-wrap: wrap;
}
.signup input {
  flex: 1 1 220px;
  min-width: 0;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 15px;
}
.signup input::placeholder { color: var(--ink-faint); }

.signup button {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ground);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  padding: 13px 22px;
  cursor: pointer;
}
.signup button:hover { background: var(--brass); border-color: var(--brass); color: #fff; }

.form-note {
  margin-top: 12px;
  font-size: .85rem;
  color: var(--ink-faint);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Honeypot — hidden from people, left in the HTML for bots to find. */
.honeypot { display: none; }

/* ============================================================
   6. THE DECK CARD
   Laid out like a real Magic card: title bar, art window,
   type line, then the price box.
   ============================================================ */
.deck {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.deck-feature { border: 2px solid var(--brass); }

.deck-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 12px;
}
.deck-title h3 {
  font-size: 1.08rem;
  font-weight: 600;
}

/* The five mana pips */
.pips { display: flex; gap: 4px; flex-shrink: 0; }
.pip {
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.28);
}
.pip-w { background: var(--mana-w); }
.pip-u { background: var(--mana-u); }
.pip-b { background: var(--mana-b); }
.pip-r { background: var(--mana-r); }
.pip-g { background: var(--mana-g); }

/* Stand-in for deck photography — a gradient in the deck's colours.
   Real photos replace this later. */
.deck-art {
  height: 128px;
  border-block: 1px solid var(--line);
}
.art-atraxa { background: linear-gradient(115deg, var(--mana-w), var(--mana-u) 38%, var(--mana-b) 68%, var(--mana-g)); }
.art-krenko { background: linear-gradient(115deg, var(--mana-r), #9C4B33); }
.art-yuriko { background: linear-gradient(115deg, var(--mana-u), var(--mana-b)); }
.art-lathril { background: linear-gradient(115deg, var(--mana-b), var(--mana-g)); }

.deck-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px;
  font-size: .85rem;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
}
.deck-meta .condition { color: var(--ink-faint); }

/* The signature feature: asking price against card value. */
.price-box {
  padding: 15px 16px 17px;
  background: var(--surface-2);
  margin-top: auto;
}
.price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.price-ask {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.price-value {
  font-family: var(--font-mono);
  font-size: .85rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.price-value s { text-decoration-thickness: 1px; }

.savings {
  display: inline-block;
  margin-top: 9px;
  font-family: var(--font-mono);
  font-size: .78rem;
  font-weight: 500;
  color: var(--good);
  background: var(--good-bg);
  border-radius: 5px;
  padding: 4px 9px;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   7. SECTIONS
   ============================================================ */
.section { padding: 68px 0; border-top: 1px solid var(--line); }
.section h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); letter-spacing: -.015em; }
.section-lede {
  margin-top: 14px;
  color: var(--ink-soft);
  max-width: 60ch;
}

.points {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 34px;
  margin-top: 44px;
}
.point h3 { font-size: 1.15rem; margin-bottom: 9px; }
.point p { color: var(--ink-soft); font-size: .97rem; }

.deck-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-top: 40px;
}

.sample-note {
  margin-top: 22px;
  font-size: .85rem;
  color: var(--ink-faint);
}

/* Selling really is a sequence, so these are numbered. */
.steps {
  list-style: none;
  counter-reset: step;
  margin: 44px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 34px;
}
.steps li { counter-increment: step; }
.steps li::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--brass);
  margin-bottom: 10px;
}
.steps h3 { font-size: 1.1rem; margin-bottom: 8px; }
.steps p { color: var(--ink-soft); font-size: .97rem; }

/* ============================================================
   8. CLOSING CALL TO ACTION
   ============================================================ */
.cta {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 72px 0;
}
.cta h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); letter-spacing: -.015em; }
.cta .signup { margin-inline: 0; }

/* ============================================================
   9. FOOTER
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 34px 0;
  font-size: .87rem;
  color: var(--ink-faint);
}
.site-footer .container {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.site-footer a { color: var(--ink-faint); }

/* ============================================================
   10. NARROW SCREENS
   Most people will open this on a phone, so the multi-column
   grids collapse to one column.
   ============================================================ */
@media (max-width: 900px) {
  .hero .container { grid-template-columns: 1fr; gap: 40px; }
  .deck-grid { grid-template-columns: repeat(2, 1fr); }
  .points, .steps { grid-template-columns: 1fr; gap: 26px; }
}
@media (max-width: 560px) {
  .hero { padding: 52px 0 44px; }
  .section, .cta { padding: 52px 0; }
  .deck-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .deck { transition: transform .18s ease, box-shadow .18s ease; }
  .deck-grid .deck:hover { transform: translateY(-3px); }
}

/* ============================================================
   11. THE LISTING PAGE (deck.html)
   Added when the second page arrived. Both pages read this
   same file, so anything above is already shared.
   ============================================================ */

/* Makes a whole deck card clickable without changing how it looks. */
.deck-link { display: block; text-decoration: none; color: inherit; }

.crumbs {
  padding: 22px 0 0;
  font-size: .9rem;
  color: var(--ink-faint);
}
.crumbs a { color: var(--ink-soft); text-decoration: none; }
.crumbs a:hover { color: var(--brass); }

.listing { padding: 26px 0 68px; }
.listing .container {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 44px;
  align-items: start;
}

.listing-head { margin-bottom: 26px; }
.listing-head h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  letter-spacing: -.02em;
}
.listing-sub {
  margin-top: 10px;
  color: var(--ink-soft);
}

/* The buy panel sticks to the top of the screen as you scroll
   the decklist — the price stays in view while you read. */
.buy-panel { position: sticky; top: 20px; }

.buy-button {
  display: block;
  width: 100%;
  margin-top: 14px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink-faint);
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 13px 18px;
  text-align: center;
  cursor: not-allowed;
}

.panel-note {
  margin-top: 10px;
  font-size: .84rem;
  color: var(--ink-faint);
  text-align: center;
}

.seller {
  margin-top: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.seller h3 { font-size: 1rem; margin-bottom: 4px; }
.seller p { font-size: .88rem; color: var(--ink-soft); }

/* --- the decklist itself --- */
.decklist h2 {
  font-size: 1.5rem;
  letter-spacing: -.01em;
}
.list-group { margin-top: 30px; }
.list-group h3 {
  font-family: var(--font-mono);
  font-size: .76rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.list-group ul { list-style: none; margin: 0; padding: 0; }

.list-group li {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: .95rem;
}
.qty {
  font-family: var(--font-mono);
  font-size: .82rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.card-price {
  font-family: var(--font-mono);
  font-size: .85rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.card-price.notable { color: var(--brass); }

.list-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 26px;
  padding-top: 16px;
  border-top: 2px solid var(--ink);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.list-total .label { font-size: .9rem; color: var(--ink-soft); }
.list-total .sum { font-size: 1.25rem; }

@media (max-width: 900px) {
  .listing .container { grid-template-columns: 1fr; gap: 32px; }
  .buy-panel { position: static; }
}


/* ============================================================
   12. FILTERS (Phase 2)
   ============================================================ */

/* Art for the decks added in Phase 2. */
.art-burn    { background: linear-gradient(115deg, var(--mana-r), #8E3B22); }
.art-azorius { background: linear-gradient(115deg, var(--mana-w), var(--mana-u)); }
.art-mill    { background: linear-gradient(115deg, var(--mana-b), var(--mana-u) 85%); }
.art-rakdos  { background: linear-gradient(115deg, var(--mana-b), var(--mana-r)); }
.art-auras   { background: linear-gradient(115deg, var(--mana-w), var(--mana-g)); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 26px 40px;
  margin-top: 36px;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.filter-group { display: flex; flex-direction: column; gap: 10px; }

.filter-label {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.filter-controls { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  font-family: inherit;
  font-size: .9rem;
  color: var(--ink-soft);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
}
.chip:hover { border-color: var(--brass); color: var(--ink); }

/* The "on" state. JavaScript adds and removes this one class —
   it never touches colours or borders directly. */
.chip.is-on {
  color: var(--ground);
  background: var(--ink);
  border-color: var(--ink);
}

.chip-color { display: inline-flex; align-items: center; gap: 7px; }
.chip-color .pip { width: 13px; height: 13px; }

#max-price {
  font-family: inherit;
  font-size: .9rem;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
}

.result-count {
  margin-top: 22px;
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.deck-grid { margin-top: 16px; }

/* IMPORTANT: .deck-link sets display:block, which is more specific than
   the browser's built-in [hidden] rule — so hidden cards would still show
   without this line. This is the classic "why isn't it hiding?" bug. */
.deck-link[hidden] { display: none; }

.no-results {
  margin-top: 26px;
  color: var(--ink-soft);
}

.linkish {
  font: inherit;
  color: var(--brass);
  background: none;
  border: none;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
}

@media (max-width: 560px) {
  .filters { gap: 20px; padding: 16px; }
}

.result-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
}
.result-row .result-count { margin-top: 0; }

/* Titles wrap to two lines on some decks. Reserving the space keeps every
   card's art starting at the same height across a row. */
.deck-grid .deck-title h3 { min-height: 2.3em; }

/* ============================================================
   13. CONFIRMATION PAGE (thanks.html)
   Note how little there is here. A whole new page cost a dozen
   lines, because everything above is already shared.
   ============================================================ */
.confirm { padding: 76px 0 90px; }
.confirm .container { max-width: 620px; }

.confirm-mark {
  width: 52px;
  height: 52px;
  color: var(--good);
  margin-bottom: 26px;
}

.confirm h1 {
  font-size: clamp(2rem, 4.5vw, 2.9rem);
  letter-spacing: -.02em;
}

.confirm-lede {
  margin-top: 18px;
  font-size: 1.1rem;
  color: var(--ink-soft);
}

.confirm-next {
  margin-top: 40px;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.confirm-next h2 {
  font-family: var(--font-mono);
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.confirm-next ul {
  margin: 14px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 9px;
  color: var(--ink-soft);
  font-size: .97rem;
}

.confirm-actions { margin-top: 32px; }

.button-quiet {
  display: inline-block;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 20px;
}
.button-quiet:hover { border-color: var(--brass); color: var(--brass); }

/* Inline form error, created by app.js only when something fails. */
.form-error {
  margin-top: 12px;
  font-size: .9rem;
  color: #B3261E;
}
:root:not([data-theme="light"]) .form-error { color: #B3261E; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .form-error { color: #F2B8B5; }
}
:root[data-theme="dark"] .form-error { color: #F2B8B5; }

.signup button:disabled { opacity: .65; cursor: default; }
