/* Card Vault styles · Shannon Cain */

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url(/static/fonts/archivo-latin-wdth-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url(/static/fonts/archivo-latin-ext-wdth-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --binder: #262d52;
  --binder-deep: #1b2140;
  --binder-ink: #f3f5fa;
  --page: #eef1f6;
  --sheet: #e6eaf2;
  --pocket: #ffffff;
  --pocket-empty: #dde3ed;
  --ink: #182033;
  --ink-2: #4a5470;
  --ink-3: #78829c;
  --line: #d0d7e3;
  --have: #13917f;
  --have-soft: #d4f1ec;
  --warn: #a8650a;
  --warn-soft: #fbecd2;
  --bad: #b8323d;
  --bad-soft: #f8dcde;
  --focus: #3f6dff;
  --radius-pocket: 7px;
  --radius-panel: 14px;
  --tabs-h: 64px;
  --font: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #11152a;
    --sheet: #171c33;
    --pocket: #1e2440;
    --pocket-empty: #151a30;
    --ink: #e8ebf4;
    --ink-2: #b2b9cf;
    --ink-3: #7c859f;
    --line: #2b3253;
    --have: #3cc7b2;
    --have-soft: #123a37;
    --warn: #f0a83a;
    --warn-soft: #3a2a10;
    --bad: #ff7a83;
    --bad-soft: #3d1b20;
    --focus: #8ea9ff;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  font-stretch: 100%;
  min-height: 100dvh;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 24px);
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--pocket); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }

/* ---------- binder spine (top bar) */
.spine {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--binder);
  color: var(--binder-ink);
  box-shadow: inset 0 -1px 0 rgba(255,255,255,.06);
}
.spine-mark { display: flex; align-items: center; gap: 8px; text-decoration: none; flex: none; }
.spine-mark span { font-weight: 780; font-stretch: 118%; font-size: 17px; letter-spacing: -.01em; }
.spine-search { flex: 1; min-width: 0; }
.spine-search input {
  width: 100%; height: 40px; border-radius: 10px; border: 0; padding: 0 12px;
  background: rgba(255,255,255,.12); color: var(--binder-ink);
  font-size: 16px;
}
.spine-search input::placeholder { color: rgba(243,245,250,.62); }
@media (max-width: 420px) { .spine-mark span { display: none; } }

/* ---------- tabs: bottom bar on phones, rail on desktop */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--binder-deep);
  color: rgba(243,245,250,.66);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; font-size: 11.5px; font-weight: 560; min-height: 44px;
}
.tabs a svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.tabs a[aria-current="page"] { color: #fff; }
.tabs a[aria-current="page"] span { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.tabs .tab-scan svg { width: 46px; height: 46px; padding: 10px; margin-top: -22px; border-radius: 50%;
  background: var(--have); color: #fff; box-shadow: 0 0 0 5px var(--binder-deep); stroke-width: 2; }
.tabs .tab-wide { display: none; }

@media (min-width: 960px) {
  body { padding-bottom: 40px; padding-left: 216px; }
  .spine { padding-left: 24px; }
  .tabs {
    top: 0; right: auto; width: 216px; height: 100dvh; padding: 84px 12px 24px;
    grid-template-columns: 1fr; grid-auto-rows: 48px; align-content: start; gap: 2px;
  }
  .spine { position: sticky; }
  .tabs a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 12px; border-radius: 10px; font-size: 15px; }
  .tabs a:hover { background: rgba(255,255,255,.06); color: #fff; }
  .tabs a[aria-current="page"] { background: rgba(255,255,255,.1); }
  .tabs a[aria-current="page"] span { text-decoration: none; }
  .tabs .tab-scan svg { width: 24px; height: 24px; padding: 0; margin: 0; background: none; box-shadow: none; color: var(--have); }
  .tabs .tab-wide { display: flex; }
  .spine-mark { position: fixed; left: 24px; top: 20px; z-index: 31; }
}

/* ---------- page layout */
main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 0; outline: none; }
@media (min-width: 960px) { main { padding: 32px 32px 0; } }
.page-head { margin: 4px 0 18px; }
h1, h2, h3 { margin: 0; line-height: 1.12; letter-spacing: -.012em; }
h1 { font-size: clamp(28px, 7vw, 40px); font-weight: 800; font-stretch: 116%; }
h2 { font-size: 21px; font-weight: 760; font-stretch: 112%; }
h3 { font-size: 17px; font-weight: 700; font-stretch: 106%; }
.lede { color: var(--ink-2); margin: 6px 0 0; max-width: 62ch; }
.muted { color: var(--ink-3); }
.num { font-stretch: 72%; font-variant-numeric: tabular-nums; }
section + section { margin-top: 30px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head a { font-size: 14.5px; color: var(--ink-2); }

/* ---------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 11px; border: 1.5px solid var(--line);
  background: var(--pocket); font-weight: 650; font-size: 15.5px; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--binder); border-color: var(--binder); color: var(--binder-ink); }
@media (prefers-color-scheme: dark) { .btn.primary { background: #3a4580; border-color: #3a4580; } }
.btn.go { background: var(--have); border-color: var(--have); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 9px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px;
  border: 1.5px solid var(--line); background: var(--pocket); font-size: 16px;
}
textarea.input { min-height: 84px; resize: vertical; }
.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.form-grid .wide { grid-column: 1 / -1; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line);
  background: transparent; font-weight: 600; font-size: 14.5px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--page); border-color: var(--ink); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 16px; }
.toolbar .input { flex: 1 1 220px; }
.toolbar select.input { flex: 0 1 200px; }

.panel { background: var(--pocket); border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 18px; }
.panel + .panel { margin-top: 14px; }
.note { padding: 12px 14px; border-radius: 10px; background: var(--sheet); color: var(--ink-2); font-size: 14.5px; }
.note.warn { background: var(--warn-soft); color: var(--ink); }
.note.bad { background: var(--bad-soft); color: var(--ink); }
.note ul { margin: 4px 0 0; padding-left: 18px; }
.badge { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12.5px; font-weight: 650; background: var(--sheet); color: var(--ink-2); white-space: nowrap; }
.badge.have { background: var(--have-soft); color: var(--have); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }

/* ---------- binder pages: the card grid */
.binder {
  display: grid; gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 12px; border-radius: var(--radius-panel);
  background: var(--sheet);
}
@media (min-width: 640px) { .binder { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 14px; } }
@media (min-width: 900px) { .binder { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.pocket {
  position: relative; display: block; aspect-ratio: 63 / 88; border-radius: var(--radius-pocket);
  text-decoration: none; overflow: hidden; background: var(--pocket);
  box-shadow: 0 0 0 1px var(--line);
}
.pocket img { width: 100%; height: 100%; object-fit: cover; }
.pocket.have::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(168deg, rgba(255,255,255,.34) 0%, rgba(255,255,255,0) 26%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35);
}
.pocket.need { background: var(--pocket-empty); box-shadow: inset 0 2px 6px rgba(10,16,40,.14), 0 0 0 1px var(--line); }
.pocket.need img { opacity: .2; filter: grayscale(1) contrast(.8); }
.pocket .ghost {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 8px; gap: 2px;
}
.pocket .ghost b { font-size: clamp(20px, 5.4vw, 30px); font-weight: 820; font-stretch: 70%; line-height: 1; color: var(--ink-2); }
.pocket .ghost small { font-size: 11.5px; line-height: 1.2; color: var(--ink-2); font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pocket .qty {
  position: absolute; right: 6px; top: 6px; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px;
  background: var(--binder); color: #fff; font-size: 12.5px; font-weight: 700; display: grid; place-items: center;
  font-stretch: 80%; font-variant-numeric: tabular-nums;
}
.pocket-caption { margin-top: 6px; font-size: 12.5px; color: var(--ink-2); line-height: 1.3; }
.binder-group { margin-top: 22px; }
.binder-group h3 { margin: 0 0 10px; }

/* ---------- progress */
.progress { display: grid; gap: 6px; }
.progress-bar { height: 8px; border-radius: 999px; background: var(--pocket-empty); overflow: hidden; }
.progress-bar i { display: block; height: 100%; background: var(--have); border-radius: inherit; }
.progress-text { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--ink-2); }

/* ---------- lists */
.rows { display: grid; gap: 2px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-panel); overflow: hidden; }
.row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 12px 14px; background: var(--pocket); text-decoration: none; min-height: 60px;
}
.row:hover { background: var(--sheet); }
.row .thumb { width: 42px; aspect-ratio: 63/88; border-radius: 4px; object-fit: cover; background: var(--pocket-empty); }
.row .sym { width: 30px; height: 30px; object-fit: contain; }
.row .title { font-weight: 650; line-height: 1.25; }
.row .sub { font-size: 13.5px; color: var(--ink-3); line-height: 1.3; }
.row .end { text-align: right; font-size: 14px; color: var(--ink-2); }
.row .dex { font-stretch: 70%; font-weight: 780; font-size: 20px; color: var(--ink-3); width: 46px; font-variant-numeric: tabular-nums; }
.series-head { margin: 26px 0 8px; font-size: 15px; color: var(--ink-3); font-weight: 650; }

.star { width: 40px; height: 40px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; color: var(--ink-3); }
.star svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.star[aria-pressed="true"] { color: var(--warn); }
.star[aria-pressed="true"] svg { fill: currentColor; }

/* ---------- home */
.hero { padding: 6px 0 4px; }
.hero h1 { font-size: clamp(34px, 10vw, 64px); font-stretch: 122%; font-weight: 820; line-height: 1; }
.hero h1 .count { font-stretch: 68%; font-variant-numeric: tabular-nums; }
.hero p { font-size: 17px; color: var(--ink-2); margin: 10px 0 0; }
.scroller { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(118px, 1fr); gap: 10px; overflow-x: auto;
  padding-bottom: 6px; scroll-snap-type: x mandatory; }
.scroller > * { scroll-snap-align: start; }
@media (min-width: 900px) { .scroller { grid-auto-flow: row; grid-template-columns: repeat(6, 1fr); overflow: visible; } }
.chase { display: grid; gap: 10px; }
@media (min-width: 760px) { .chase { grid-template-columns: 1fr 1fr; } }
.chase-item { display: grid; grid-template-columns: 52px 1fr; gap: 14px; align-items: center; text-decoration: none; }
.chase-item img { width: 52px; height: 52px; object-fit: contain; }

/* ---------- slab label (estimates) */
.slab {
  display: grid; grid-template-columns: 1fr auto; align-items: stretch; gap: 0;
  border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; background: var(--pocket);
}
.slab .slab-text { padding: 10px 14px; display: grid; gap: 2px; align-content: center; }
.slab .slab-text b { font-size: 15.5px; line-height: 1.2; }
.slab .slab-text span { font-size: 13px; color: var(--ink-2); }
.slab .slab-grade {
  display: grid; place-items: center; padding: 6px 16px; min-width: 86px; background: var(--ink); color: var(--page);
  text-align: center;
}
.slab .slab-grade strong { font-size: 40px; line-height: 1; font-weight: 840; font-stretch: 70%; font-variant-numeric: tabular-nums; }
.slab .slab-grade small { font-size: 11.5px; font-weight: 650; opacity: .8; }
.slab.mini .slab-grade strong { font-size: 26px; }
.slab.mini .slab-grade { min-width: 58px; }
.slab.mini .slab-text { padding: 8px 10px; }
.slab.pending .slab-grade { background: var(--ink-3); }

/* ---------- card page */
.card-hero { display: grid; gap: 22px; }
@media (min-width: 760px) { .card-hero { grid-template-columns: minmax(240px, 340px) 1fr; align-items: start; } }
.card-art { border-radius: 14px; overflow: hidden; box-shadow: 0 1px 0 var(--line), 0 14px 32px -16px rgba(10,16,40,.5); aspect-ratio: 63/88; background: var(--pocket-empty); }
.card-art img { width: 100%; height: 100%; object-fit: cover; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 16px 0 0; font-size: 15px; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; }
.copy { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.copy img { width: 54px; border-radius: 5px; }

/* ---------- scan: capture steps */
.steps { display: grid; gap: 12px; counter-reset: step; }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.shot { display: grid; gap: 10px; align-content: start; padding: 14px; border-radius: var(--radius-panel); background: var(--pocket); border: 1.5px solid var(--line); }
.shot.done { border-color: var(--have); }
.shot-head { display: flex; gap: 10px; align-items: baseline; }
.shot-head::before {
  counter-increment: step; content: counter(step);
  font-stretch: 70%; font-weight: 820; font-size: 28px; line-height: 1; color: var(--ink-3);
}
.shot.optional .shot-head::before { content: "+"; }
.shot p { margin: 0; font-size: 14.5px; color: var(--ink-2); }
.shot-preview { aspect-ratio: 4/3; border-radius: 10px; background: var(--sheet); overflow: hidden; display: grid; place-items: center; color: var(--ink-3); font-size: 14px; }
.shot-preview img { width: 100%; height: 100%; object-fit: contain; }
.shot input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-bar { height: 6px; border-radius: 999px; background: var(--pocket-empty); overflow: hidden; margin-top: 10px; }
.upload-bar i { display: block; height: 100%; width: 0; background: var(--have); transition: width .2s; }

/* ---------- scan: report */
.report { display: grid; gap: 16px; }
@media (min-width: 980px) { .report { grid-template-columns: 1.1fr 1fr; align-items: start; } .report .span { grid-column: 1 / -1; } }
.cats { display: grid; gap: 10px; }
.cat { display: grid; grid-template-columns: 96px 1fr auto; gap: 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cat:last-child { border-bottom: 0; }
.cat b { font-weight: 680; }
.cat .score { font-stretch: 70%; font-weight: 820; font-size: 24px; font-variant-numeric: tabular-nums; }
.cat p { margin: 0; font-size: 14.5px; color: var(--ink-2); }
.cat.limit .score { color: var(--bad); }
.defects { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.defects li { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; font-size: 14.5px; }
.corner-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.corner-grid figure { margin: 0; }
.corner-grid img { border-radius: 6px; width: 100%; aspect-ratio: 1; object-fit: cover; }
.corner-grid figcaption { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

/* ---------- centering editor */
.center-edit { display: grid; gap: 12px; }
@media (min-width: 640px) { .center-edit { grid-template-columns: minmax(0, 1fr) 200px; } }
.ce-stage { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; border-radius: 10px; overflow: hidden; background: #000; }
.ce-stage img { width: 100%; pointer-events: none; }
.ce-line { position: absolute; background: var(--have); opacity: .9; }
.ce-line.v { top: 0; bottom: 0; width: 2px; margin-left: -1px; }
.ce-line.h { left: 0; right: 0; height: 2px; margin-top: -1px; }
.ce-line.sel { background: #ff4fa3; }
.ce-hit { position: absolute; }
.ce-hit.v { top: 0; bottom: 0; width: 36px; margin-left: -18px; cursor: ew-resize; }
.ce-hit.h { left: 0; right: 0; height: 36px; margin-top: -18px; cursor: ns-resize; }
.ce-side { display: grid; gap: 10px; align-content: start; }
.ce-loupe { width: 100%; aspect-ratio: 1; border-radius: 10px; background: #000; display: block; }
@media (max-width: 639px) {
  .ce-side { grid-template-columns: 132px 1fr; column-gap: 14px; align-items: start; }
  .ce-loupe { grid-row: span 3; }
  .ce-side > .nudge, .ce-side > .badge, .ce-side > .btn-row { grid-column: 1 / -1; }
  .ce-side > .badge { justify-self: start; }
}
.ce-read { font-size: 15px; display: grid; gap: 4px; }
.ce-read .num { font-size: 22px; font-weight: 780; }
.nudge { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- login */
.login { max-width: 380px; margin: 12vh auto 0; display: grid; gap: 16px; }

/* ---------- misc */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 16px); transform: translateX(-50%);
  background: var(--ink); color: var(--page); padding: 12px 18px; border-radius: 12px; font-size: 15px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; }
@media (min-width: 960px) { .toast { bottom: 24px; left: calc(50% + 108px); } }
.empty { padding: 28px 18px; text-align: center; border-radius: var(--radius-panel); border: 1.5px dashed var(--line); color: var(--ink-2); }
.empty .btn { margin-top: 12px; }
.loading { padding: 40px 0; text-align: center; color: var(--ink-3); }
.more { display: flex; justify-content: center; margin-top: 16px; }
details.panel summary { cursor: pointer; font-weight: 680; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
