/* The shared deck view (templates/deck_view.html): the public site's player, tournament,
   archetype and deck-search pages, and the operator panel's deck page and triage.
   The site links this file right after site.css. The panel compiles it in
   (crates/web/src/operator.rs) and serves it before its own panel.css, so one copy of these
   rules draws the list in both places. It reads the colour tokens both stylesheets define. */
:root {
  /* One deck tool's box and the gap between two of them. A caller that lays the tools in a row
     over its own content reserves the gutter from these two numbers, so the reservation cannot
     drift from the buttons it is reserving for. */
  --deck-tool-size: 1.7rem;
  --deck-tool-gap: .4rem;
}

/* The deck view is a collage: the maindeck takes one full-measure column and the rail beside it
   stacks the sideboard over the card, so the two boards start on the same line and read as one
   75-card list. The rail's width is --deck-rail rather than a figure inside the track list, so a
   caller that wants a different split says one number instead of restating the whole grid. */
.deck-body { --deck-rail: 15.2rem; position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(9rem, var(--deck-rail)); gap: 0 1.6rem; padding: .4rem .35rem 1rem 3.5rem; }
.deck-tools { position: absolute; top: .55rem; left: .35rem; display: flex; flex-direction: column; gap: var(--deck-tool-gap); }
.deck-tool { position: relative; display: grid; place-items: center; width: var(--deck-tool-size); height: var(--deck-tool-size); padding: 0; color: var(--muted); background: var(--panel-strong); border: 1px solid var(--line); border-radius: .35rem; cursor: pointer; }
.deck-tool:hover, .deck-tool:focus-visible { color: var(--blue); border-color: var(--blue); }
.copy-tool.copied { color: var(--gold); border-color: var(--gold); }
.copy-tool.copied::after { content: "Copied"; position: absolute; top: 50%; left: calc(100% + .45rem); padding: .1rem .45rem; color: #18150d; font-size: .72rem; font-weight: 700; white-space: nowrap; background: var(--gold); border-radius: .35rem; transform: translateY(-50%); }
/* A copy that reached neither clipboard path says so on the button, in the valence pair's bad
   side, instead of flashing "Copied" over stale clipboard content. */
.copy-tool.copy-failed { color: var(--blue); border-color: var(--blue); }
.copy-tool.copy-failed::after { content: "Copy failed"; position: absolute; top: 50%; left: calc(100% + .45rem); padding: .1rem .45rem; color: #18150d; font-size: .72rem; font-weight: 700; white-space: nowrap; background: var(--blue); border-radius: .35rem; transform: translateY(-50%); }
.deck-cols { grid-column: 1; columns: 2 11rem; column-gap: 1.6rem; }
.deck-aside { grid-column: 2; min-width: 0; }
/* Nothing in the rail follows the scroll: ticket 07 dropped the sticky card because in a viewer
   about one screen tall it only bought a scrollbar inside a scrollbar. That premise is the box
   the caller gives the component. A caller narrow enough to run the maindeck in one column makes
   the list much taller than the rail, and there the card scrolls away from a low row.
   The card is capped by --deck-rail, not by a second copy of the number, so a caller that re-cuts
   the rail gets a card that follows it. Without scripting this is the only card on the page. */
.deck-preview { margin-top: 1.1rem; }
.deck-preview img, .deck-preview-empty { display: block; width: min(var(--deck-rail), 100%); margin-inline: auto; aspect-ratio: 5 / 7; height: auto; background: var(--panel-strong); border-radius: 4.75% / 3.4%; box-shadow: 0 14px 40px rgb(0 0 0 / 45%); }
.deck-preview-empty { box-shadow: none; }
.deck-preview-caption { display: grid; width: min(var(--deck-rail), 100%); height: 11.5rem; align-content: center; margin: .6rem auto 0; overflow: hidden; padding: .6rem .65rem; color: var(--muted); font-size: .76rem; line-height: 1.4; background: var(--panel); border: 1px solid var(--line); border-radius: .5rem; }
/* Ticket 53: one copy-ladder family. The deck viewer's caption rail and the inclusion boards'
   floating card preview draw the same rungs from the same data, so these rules are unscoped and
   both callers read them. A rung's length is a <progress> value, not a declaration, so no
   per-request number reaches the browser as CSS here. The two fills are the boards' own
   encoding: grey for a settled copy, violet for one still argued over. */
.deck-preview-ladder { display: grid; gap: .18rem; }
.deck-preview-rung { display: grid; grid-template-columns: 1.8rem minmax(0, 1fr) 2.6rem; gap: .35rem; align-items: center; }
.deck-preview-rung-label, .deck-preview-rung-percent { color: var(--quiet); font-size: .68rem; font-variant-numeric: tabular-nums; }
.deck-preview-rung-percent { color: var(--text); text-align: right; }
.deck-preview-rung-track { display: block; width: 100%; height: .55rem; appearance: none; border: 0; background: rgb(255 255 255 / 8%); border-radius: .1rem; }
.deck-preview-rung-track::-webkit-progress-bar { background: rgb(255 255 255 / 8%); border-radius: .1rem; }
.deck-preview-rung-track::-webkit-progress-value { background: #c9d1e4; border-radius: .1rem; }
.deck-preview-rung-track::-moz-progress-bar { background: #c9d1e4; border-radius: .1rem; }
.deck-preview-rung-track.is-argued::-webkit-progress-value { background: #9a78dd; }
.deck-preview-rung-track.is-argued::-moz-progress-bar { background: #9a78dd; }
.deck-preview-summary, .deck-preview-list { margin: 0; }
.deck-preview-list { color: var(--quiet); }
.deck-sec { break-inside: avoid; margin: 0 0 .8rem; }
.deck-sec.spill { break-inside: auto; }
.deck-sec.spill h5 { break-after: avoid; }
.deck-body h4, .deck-body h5 { margin: 0 0 .3rem; font-size: .85rem; }
.deck-body h4.board-head { margin: 0 0 .55rem; padding-bottom: .25rem; border-bottom: 1px solid var(--line); break-after: avoid; }
.deck-body h5 { color: var(--muted); font-weight: 700; }
.deck-body ul { margin: 0; padding: 0; list-style: none; font-size: .88rem; }
.deck-body li { display: grid; grid-template-columns: 1.4rem minmax(0, 1fr) auto; gap: .35rem; align-items: baseline; padding-block: .06rem; }
.deck-body .quantity { color: var(--muted); font-variant-numeric: tabular-nums; }
.card-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: default; user-select: text; }
.card-name:hover, .card-name:focus-visible { text-decoration: underline dotted; outline: none; }
.mana-cost { display: inline-flex; justify-self: end; gap: .1rem; white-space: nowrap; }
.mana-cost-symbol { width: 1rem; height: 1rem; }

@media screen and (max-width: 640px) {
  .deck-body { display: block; padding-left: .35rem; }
  .deck-tools { position: static; flex-direction: row; margin: 0 0 .55rem; }
  /* The tools sit side by side here, so the "Copied" flash drops under the button it belongs
     to. To the right it would cover the next tool. */
  .copy-tool.copied::after, .copy-tool.copy-failed::after { top: calc(100% + .3rem); left: 50%; transform: translateX(-50%); }
  .deck-cols { columns: 1; }
  /* The collage stacks at this width: the rail drops under the maindeck and keeps the sideboard,
     while the card goes with the rule below. Under a tall one-column list it would sit far from
     the row a reader tapped, so `deck-view.js` opens the floating card preview there instead. */
  .deck-aside { margin-top: 1.1rem; }
  .deck-preview { display: none !important; }
}
