/* tcgbinder app.css — fonts and page chrome on top of theme.css. Tokens only; no raw colors. */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/fonts/inter-400-latin.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/fonts/inter-600-latin.woff2") format("woff2"); }
@font-face { font-family: "VT323"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/fonts/vt323-400-latin.woff2") format("woff2"); }
@font-face { font-family: "Anton"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/fonts/anton-400-latin.woff2") format("woff2"); }

/* ---------------------------------------------------------------- chrome */
.site { max-width: 1280px; margin-inline: auto; }
.masthead { display: grid; grid-template-columns: 1fr auto; gap: var(--space-3); align-items: center; }
.masthead h1 { margin: 0; font-size: 1.4em; }
.masthead h1 a { color: inherit; }
.masthead h1 .mascot { width: 28px; height: 28px; vertical-align: -6px; margin-inline-end: var(--space-2); color: var(--ink-2); }
.site-nav { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); align-items: center; grid-column: 1 / -1; }
.site-nav a { padding: var(--space-1) var(--space-2); border-radius: var(--radius); color: var(--ink-2); font-size: .92em; letter-spacing: .04em; text-transform: var(--display-transform); }
.site-nav a[aria-current="page"], .site-nav a:hover { color: var(--accent); background: var(--surface-2); text-decoration: none; }
.site-nav .spacer { flex: 1; }
.site-nav .who { color: var(--ink-muted); font-size: .85em; }
.site-nav form { display: inline; }
.site-nav .btn.link { min-height: 0; padding: var(--space-1) var(--space-2); background: transparent; color: var(--ink-2); border-color: transparent; font-size: .92em; }
.quick-search { display: flex; gap: var(--space-2); min-width: 0; }
.quick-search input { min-width: 12em; }
.site-nav { min-width: 0; max-width: 100%; box-sizing: border-box; }
/* phones: masthead stacks, the quick search fills the row (docs/08 §8) */
@media (max-width: 480px) {
  .masthead { grid-template-columns: 1fr; }
  .quick-search input { min-width: 0; flex: 1; }
  .site-nav { gap: var(--space-1) var(--space-2); }
  .site-nav a, .site-nav .btn.link { padding-inline: var(--space-1); font-size: .85em; }
}
main { min-height: 50vh; }
footer.attribution { color: var(--ink-muted); font-size: .8em; margin-block: var(--space-5) var(--space-3); line-height: 1.5; }
footer.attribution a { color: var(--ink-2); }
.flash { border: 1px solid var(--good); color: var(--good); padding: var(--space-2) var(--space-3); border-radius: var(--radius); margin-block-end: var(--space-3); }
.flash.bad { border-color: var(--bad); color: var(--bad); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-3); }
.check { display: flex; align-items: center; gap: var(--space-2); min-height: 44px; }
.check input { width: auto; min-height: 0; }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.inline-form { display: inline; }
pre.log { font-family: var(--font-mono); font-size: .8em; white-space: pre-wrap; background: var(--surface-2); padding: var(--space-3); border-radius: var(--radius); max-height: 24em; overflow: auto; color: var(--ink-2); }
details > summary { cursor: pointer; color: var(--accent); }
.pager { display: flex; gap: var(--space-2); align-items: center; justify-content: space-between; margin-block: var(--space-3); }
.card-page { display: grid; grid-template-columns: minmax(200px, 320px) 1fr; gap: var(--space-4); }
@media (max-width: 720px) { .card-page { grid-template-columns: 1fr; } }
.card-face { margin-block-end: var(--space-3); }
.card-face img { width: 100%; border: 1px solid var(--border); border-radius: 12px; display: block; }
.oracle-text { white-space: pre-wrap; }
.mana { font-family: var(--font-mono); color: var(--accent-2); }
.legalities { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.list-row { display: grid; grid-template-columns: 1fr auto auto; gap: var(--space-3); align-items: center; padding: var(--space-2) 0; border-bottom: 1px solid var(--border-inner, var(--border)); }
.list-row:last-child { border-bottom: 0; }
.chart-frame { min-height: 260px; }
.chart .uplot { font-family: var(--font-mono); }
.chart .u-legend { color: var(--ink-2); }
.chart table.table { display: none; }
.chart[data-view="table"] .uplot, .chart[data-view="table"] .chart-canvas { display: none; }
.chart[data-view="table"] table.table { display: table; }
.chart .chart-tools { display: flex; gap: var(--space-2); justify-content: flex-end; margin-block-start: var(--space-2); }
.chart .chart-tools .btn { min-height: 32px; padding-block: var(--space-1); font-size: .8em; }
.card-tile a { display: block; height: 100%; }
.card-tile .chip.set { position: absolute; top: var(--space-1); left: var(--space-1); }
.sg-bar { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-block-end: var(--space-4); }
.sg-bar .btn { min-height: 36px; padding-block: var(--space-1); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--space-2); }
.swatch { border: 1px solid var(--border-inner, var(--border)); border-radius: var(--radius); padding: var(--space-2); font-family: var(--font-mono); font-size: .8em; }
.swatch i { display: block; height: 28px; margin-block-end: var(--space-1); border-radius: var(--radius); background: var(--sw); }
.lexicon td:first-child { color: var(--ink-2); font-family: var(--font-mono); }
.sg-section { margin-block-end: var(--space-6); }
.tabbar a[aria-current="page"] { color: var(--accent); }

/* ---- deck editor (P5) */
.deck-editor { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(320px, 2fr) minmax(220px, .9fr); gap: var(--space-4); align-items: start; }
.deck-editor > #deck-body { display: contents; }
@media (max-width: 1100px) { .deck-editor { grid-template-columns: 1fr; } }
.deck-zone { margin-block-end: var(--space-3); }
.deck-zone h3 { margin: var(--space-2) 0; font-size: 1em; color: var(--accent-2); }
.deck-group { margin-block: var(--space-2); }
.deck-group > .label { margin-block-end: var(--space-1); }
.deck-line { display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-2); align-items: center; padding: var(--space-1) 0; border-bottom: 1px solid var(--border-inner, var(--border)); }
.deck-line .qty { display: inline-flex; align-items: center; gap: 2px; }
.deck-line .qty span { min-width: 1.6em; text-align: center; }
.deck-line .qty button, .search-hit .add button { min-height: 32px; min-width: 32px; padding: 0 var(--space-2); font-size: .85em; }
.deck-line .meta, .search-hit .meta { color: var(--ink-muted); font-size: .85em; }
.deck-line .tools { display: flex; flex-wrap: wrap; gap: var(--space-1); align-items: center; font-size: .85em; }
.deck-line .tools select { min-height: 32px; width: auto; }
.deck-line details { display: inline-block; }
.deck-line details summary { display: inline; color: var(--accent); cursor: pointer; }
.banner { border: 1px solid var(--border); border-left: 4px solid var(--good); padding: var(--space-2) var(--space-3); margin-block-end: var(--space-3); border-radius: var(--radius); background: var(--surface-2); }
.banner[data-status="bad"] { border-left-color: var(--bad); }
.banner[data-status="warn"] { border-left-color: var(--warn); }
.banner ul { margin: 0; padding-left: 1.2em; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 72px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.bars .bar i { display: block; background: var(--accent); }
.bars .bar i.b { background: var(--accent-2); }
.bars .bar span { font-family: var(--font-mono); font-size: .7em; text-align: center; color: var(--ink-muted); }
.pip-row { display: grid; grid-template-columns: 1.5em 1fr auto; gap: var(--space-2); align-items: center; font-family: var(--font-mono); font-size: .85em; }
.pip-row .track { height: 8px; background: var(--surface-2); border: 1px solid var(--border-inner, var(--border)); }
.pip-row .track i { display: block; height: 100%; background: var(--accent); }
.rail .tile { padding: var(--space-2); }
.rail .tile .big { font-size: 1.2em; }
.status-low { color: var(--warn); } .status-high { color: var(--bad); } .status-ok { color: var(--good); }
.search-hit { display: grid; grid-template-columns: 1fr auto; gap: var(--space-2); padding: var(--space-1) 0; border-bottom: 1px solid var(--border-inner, var(--border)); align-items: center; }
.search-hit .add { display: flex; gap: 2px; }
textarea { width: 100%; font-family: var(--font-mono); background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-2); }

/* ---- role chips (P6) */
.role-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.role-chip { display: inline-flex; align-items: center; gap: 2px; }
.role-chip button { min-height: 28px; padding: 0 var(--space-2); font-size: .8em; }

/* Quick add from the Cards tab (results grid and list) */
.table .row-add { grid-template-columns: 4.5em 7em auto; margin: 0; }
.table .row-add .owned { grid-column: 1 / -1; }
.table .row-add .btn { grid-column: 3; }

/* Set browser (/collection/browse) */
.browse-form { align-items: end; }
.browse-target { margin-block-end: var(--space-3); }
.browse-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.browse-tile { display: flex; flex-direction: column; aspect-ratio: auto; overflow: visible; padding-block-end: var(--space-1); }
.browse-tile > a { height: auto; aspect-ratio: 63 / 88; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; }
.browse-tile img, .browse-tile .placeholder { height: 100%; }
.browse-tile .chip.set, .browse-tile .chip.price { bottom: auto; top: var(--space-1); }
.browse-name, .browse-add { padding-inline: var(--space-1); }
.browse-name { font-size: .8em; line-height: 1.2; margin-block-start: var(--space-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.browse-add { display: grid; grid-template-columns: 1fr 1.6fr; gap: var(--space-1); align-items: center; margin-block-start: var(--space-1); }
.browse-add .owned { grid-column: 1 / -1; justify-self: start; }
.browse-add select { min-width: 0; width: 100%; font-size: .8em; padding: .15em .3em; }
.browse-add .btn { grid-column: 1 / -1; font-size: .85em; padding-block: .25em; min-height: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Camera scan (/collection/scan) */
.scan-live { margin-block-start: var(--space-3); }
.scan-frame { position: relative; max-width: 640px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #000; }
.scan-frame video { display: block; width: 100%; height: auto; }
.scan-guide { position: absolute; left: 4%; right: 4%; bottom: 6%; height: 14%; border: 2px dashed var(--accent); border-radius: var(--radius); display: grid; place-items: center; font-size: .75em; color: var(--accent); text-shadow: 0 0 4px #000; pointer-events: none; }
.scan-status[data-status="bad"] { color: var(--bad, var(--ink)); }
.scan-preview canvas { max-width: 100%; height: auto; border: 1px solid var(--border-inner, var(--border)); border-radius: var(--radius); margin-block-start: var(--space-2); }

/* phones: two tiles per row with room for the controls, the add bar wraps, tab bar fits six entries */
@media (max-width: 480px) {
  .browse-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
  .browse-add select, .browse-add .btn { font-size: .85em; min-height: 36px; }
  .browse-target .muted { flex-basis: 100%; }
  .tabbar a { padding-inline: var(--space-1); font-size: .7em; letter-spacing: .03em; }
  .scan-guide span { font-size: .9em; }
}
/* the search-language hint is one long line of keys: let it wrap on phones */
.search-help code { white-space: normal; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- card flips and the deal-in reveal */
.browse-tile .tile-img { display: block; }
.flip { perspective: 900px; }
.flip .flip-inner { display: block; position: relative; width: 100%; height: 100%; transition: transform .7s cubic-bezier(.2, .7, .2, 1); transform-style: preserve-3d; }
.flip .flip-front, .flip .flip-back { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flip .flip-back { position: absolute; inset: 0; transform: rotateY(180deg); }
.flip-toggle:checked ~ .flip .flip-inner, .flip-toggle:checked ~ .card-face-flip .flip-inner { transform: rotateY(180deg); }
.flip-btn { position: absolute; top: var(--space-1); right: var(--space-1); z-index: 2; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #000000b0; color: var(--ink); cursor: pointer; font-size: 1em; line-height: 1; border: 1px solid var(--border); transition: transform .3s; }
.flip-btn:hover { transform: rotate(180deg); }
.flip-toggle:checked ~ .flip-btn { color: var(--accent); transform: rotate(180deg); }
.browse-tile .chip.price { top: auto; bottom: auto; }
.browse-tile:has(.flip-btn) .chip.price { top: calc(var(--space-1) + 34px); }
.card-face-flip { aspect-ratio: 63 / 88; }
.card-face-flip img { width: 100%; height: 100%; object-fit: contain; }
.card-face-deal, .card-face-flip { animation: deal .6s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes deal { from { opacity: 0; transform: perspective(900px) rotateY(-90deg) translateY(8px); } to { opacity: 1; transform: none; } }
.browse-grid .card-tile { animation: deal .45s cubic-bezier(.2, .7, .2, 1) both; animation-delay: min(calc(var(--i, 0) * 28ms), 700ms); }
/* the inventory picture view */
.owned-tile .chip.qty { background: var(--accent); color: var(--surface); font-weight: 700; }
.owned-tile .tile-pick { position: absolute; left: var(--space-1); bottom: auto; top: calc(var(--space-1) + 48px); z-index: 2; background: #000000b0; border-radius: var(--radius); padding: 2px; display: grid; place-items: center; }
.owned-tile .tile-pick input { width: 18px; height: 18px; min-height: 0; margin: 0; }
.owned-tile .tile-meta { font-size: .75em; line-height: 1.3; padding-inline: var(--space-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* thumbnails in list views, and the ⊕ that adds one more copy of an inventory row */
.thumb-cell { width: 44px; padding-inline-end: 0; }
.thumb { display: block; width: 40px; height: 56px; object-fit: cover; border-radius: 2px; background: var(--surface-2); }
.thumb-cell a:hover .thumb { transform: scale(2.6); transform-origin: left center; position: relative; z-index: 3; box-shadow: var(--shadow); }
.tile-plus { position: absolute; left: var(--space-1); top: calc(var(--space-1) + 24px); z-index: 2; display: inline-flex; gap: 2px; align-items: center; }
.tile-plus .chip.qty { position: static; }
.plus { width: 26px; height: 26px; min-height: 0; padding: 0; border-radius: 50%; border: 1px solid var(--accent); background: var(--accent); color: var(--bg); font-size: 1.1em; line-height: 1; font-weight: 700; cursor: pointer; display: grid; place-items: center; }
.plus:hover, .plus:focus-visible { filter: brightness(1.15); }
.row-plus { display: inline-flex; gap: var(--space-1); align-items: center; margin: 0; }
.row-plus .plus { width: 22px; height: 22px; font-size: 1em; }
.owned-tile .tile-pick { top: calc(var(--space-1) + 56px); }

/* presence dot (who is connected) */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-muted); vertical-align: middle; }
.dot.on { background: var(--good); box-shadow: 0 0 6px var(--good); }
