/* ---------- the slab view (src/scenes/slab.js, homeui.slabModal): the big slab on the table and Gemline's report ----------
   A dialog without its frame: the box is the 640x360 world frame (art px --a), its pieces sit at --x/--y/--w/--h
   (.sv-p), and a click between them falls through to the dimmed table, which closes it. The slab rises and settles
   while the report slides out from under its right edge; closing plays both back on a copy of the dialog
   (.modal-ghost, ui.closeModal). A dialog drawn again in place (.still) and Motion Off show it at once. Text grows with
   Text size up to 115%, and steps down where it runs long (--fit, areas.fitText). --sv-font scales all of its print: 1
   for both fonts, since Pipwick Bold's em matches Atkinson's (tested: the report fits at Text size 100 to 130% in
   both without a step down). */
#modal:has(> .modal-box.sv) { background: radial-gradient(ellipse 62% 78% at 50% 50%, rgba(10, 8, 5, 0.48), rgba(10, 8, 5, 0.8)); }
#modal:has(> .modal-box.sv:not(.still)) { animation: sv-dim 0.28s ease-out both; }
.modal-box.sv { --a: calc(var(--g) * 2); --ft: calc(min(var(--fs), 1.15) * var(--sv-font, 1)); position: relative; width: calc(var(--g) * 640); height: calc(var(--g) * 360);
  max-width: none; max-height: none; padding: 0; overflow: visible; background: none; border-radius: 0; box-shadow: none; animation: none;
  pointer-events: none; text-shadow: none; color: #2a2620; font-family: var(--font-ui); }
.sv .sv-p { position: absolute; left: calc(var(--a) * var(--x)); top: calc(var(--a) * var(--y)); width: calc(var(--a) * var(--w)); height: calc(var(--a) * var(--h));
  box-sizing: border-box; }
.sv > .sv-p { pointer-events: auto; }

/* the slab: the kit's slab_big, with the hard shadow every object on the table casts */
.sv .sv-slab { z-index: 2; filter: drop-shadow(calc(var(--a) * 2) calc(var(--a) * 3) 0 rgba(35, 32, 28, 0.38)); }
.sv .sv-slab > .sl-box { position: absolute; inset: 0; }
/* the report: its paper (art/areas/slab/report.png), and the DOM's print over it */
.sv .sv-slip { z-index: 1; filter: drop-shadow(calc(var(--a) * 2) calc(var(--a) * 3) 0 rgba(35, 32, 28, 0.38)); }
.sv .sv-paper { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; user-select: none; }
.sv .sv-cert { display: flex; align-items: center; justify-content: flex-end; white-space: nowrap; color: #1f5250;
  font: 700 calc(var(--g) * 5.6 * var(--ft)) / 1 var(--font-ui); letter-spacing: 0.08em; }
.sv .sv-body { display: flex; flex-direction: column; gap: calc(var(--g) * 4 * var(--fit, 1)); overflow: hidden; line-height: 1.22;
  font-size: calc(var(--g) * 6.8 * var(--ft) * var(--fit, 1)); }
/* Pipwick's ink is 9 of its 10 font pixels tall, so its lines sit 11 font pixels apart: a whole number, and the longest
   report (a Black Label's) keeps its full size where the size rounds up to the next whole font pixel */
:root:not(.font-clear) .sv .sv-body { line-height: 1.1; }
.sv .sv-cap { display: block; font-size: 0.74em; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #2d6b65; }
.sv .sv-card { display: flex; flex-direction: column; }
.sv .sv-name { font-family: var(--font-px); font-size: 1.45em; line-height: 1.15; color: #23201c; }
.sv .sv-dim { color: #6b6455; }
/* the subgrades as a printed table: the grader's read, and the Loupe's read of the true condition */
.sv .sv-mid { display: flex; gap: calc(var(--g) * 6); align-items: stretch; }
.sv .sv-subs { flex: 1; min-width: 0; border-collapse: collapse; font-size: 1em; }
.sv .sv-subs th, .sv .sv-subs td { padding: calc(var(--g) * 0.6) calc(var(--g) * 2); border-bottom: var(--g) solid rgba(45, 107, 101, 0.32); text-align: center; white-space: nowrap; }
.sv .sv-subs th { text-align: left; font-weight: 400; }
.sv .sv-subs tr:first-child th { font-size: 0.74em; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; text-align: center; color: #2d6b65; border-bottom-color: #2d6b65; }
.sv .sv-subs td { font-family: var(--font-px); font-weight: 700; font-size: 1.12em; line-height: 1.1; }
.sv .sv-subs td.v10 { color: #a06a12; }
.sv .sv-subs td.v9 { color: #44596a; }
.sv .sv-subs td.low, .sv .sv-subs td.down { color: #a33a2a; }
.sv .sv-subs td.up { color: #2a7a3a; }
.sv .sv-subs td.unk { color: #9a9282; }
/* the grade, printed on a swatch of its label: the stock, the foil edge and the lettering of its tier, with the seal */
.sv .sv-grade { position: relative; flex: none; width: calc(var(--a) * 42); display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(var(--g) * 3) calc(var(--g) * 2); background: var(--sv-stock); color: var(--sv-ink); text-align: center;
  border: calc(var(--g) * 2) solid var(--sv-foil); box-shadow: 0 0 0 var(--g) #23201c, inset 0 0 0 var(--g) rgba(255, 255, 255, 0.3); }
.sv .sv-grade .sv-cap { color: inherit; opacity: 0.8; }
.sv .sv-g { font-family: var(--font-px); font-size: 3.4em; line-height: 1; }
.sv .sv-word { font-weight: 700; font-size: 0.88em; letter-spacing: 0.08em; }
.sv .sv-tier { font-size: 0.74em; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.85; }
.sv .sv-seal { position: absolute; right: calc(var(--a) * -4); top: calc(var(--a) * -4); width: calc(var(--a) * 9); height: calc(var(--a) * 9);
  background: var(--seal) 0 0 / 100% 100% no-repeat; image-rendering: pixelated; filter: drop-shadow(var(--g) var(--g) 0 rgba(35, 32, 28, 0.4)); }
.sv .sv-seal::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, #ff86cf, #ffd36e 20%, #8dffb4 40%, #7ad9ff 60%, #c491ff 80%, #ff86cf);
  background-size: 400% 100%; mix-blend-mode: color; -webkit-mask: var(--seal) 0 0 / 100% 100% no-repeat; mask: var(--seal) 0 0 / 100% 100% no-repeat; animation: sl-foil 3.2s linear infinite; }
body.fx-reduced .sv .sv-seal::after { animation-duration: 8s; }
body.fx-off .sv .sv-seal::after { animation: none; background-position: 35% 0; }
/* the price and how it is made; the slab's records and what the Loupe says */
.sv .sv-price { display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: calc(var(--g) * 4); }
.sv .sv-price b { font-family: var(--font-px); font-size: 1.45em; line-height: 1.1; }
.sv .sv-math { grid-column: 1 / -1; font-size: 0.86em; color: #4a443b; }
.sv .sv-notes { display: flex; flex-direction: column; gap: calc(var(--g) * 0.6); font-size: 0.9em; color: #3a352d; }
.sv .sv-notes .sv-loupe { color: #1f5250; }
.sv .sv-notes b.up { color: #2a7a3a; }

/* the owner's stub: the actions as rubber stamps, in the ink of each (ink.png makes the ink uneven) */
.sv .sv-stub { display: grid; grid-template-columns: repeat(6, 1fr); grid-template-rows: 1fr 1.25fr; gap: calc(var(--g) * 2) calc(var(--g) * 3); align-items: stretch; }
.sv .sv-stamp { --st: #3a352d; --rot: -1.2deg; grid-column: span 2; min-width: 0; margin: 0; padding: 0 calc(var(--g) * 2.5); display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: none; color: var(--st); border: calc(var(--g) * 1.5) solid var(--st); border-radius: calc(var(--g) * 2);
  outline: var(--g) solid var(--st); outline-offset: calc(var(--g) * -3.5); box-shadow: none; text-shadow: none; white-space: nowrap; overflow: hidden; cursor: pointer;
  font: 700 calc(var(--g) * 6 * var(--ft)) / 1.1 var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; rotate: var(--rot); opacity: 0.9;
  background: color-mix(in srgb, var(--st) 7%, transparent);
  -webkit-mask: url(../../art/areas/slab/ink.png) 0 0 / calc(var(--a) * 32) repeat; mask: url(../../art/areas/slab/ink.png) 0 0 / calc(var(--a) * 32) repeat;
  transition: opacity 0.12s, rotate 0.12s, translate 0.08s; }
.sv .sv-stamp:nth-child(2) { --rot: 0.9deg; }
.sv .sv-stamp:nth-child(3) { --rot: 0.6deg; }
.sv .sv-stamp:nth-child(4) { --rot: -0.8deg; }
.sv .sv-stamp:nth-child(5) { --rot: 1.4deg; }
.sv .sv-stamp:hover, .sv .sv-stamp:focus-visible { opacity: 1; rotate: 0deg; }
.sv .sv-stamp:active { translate: 0 var(--g); }
.sv .sv-stamp:disabled { opacity: 0.36; cursor: default; rotate: var(--rot); }
.sv .sv-stamp.poor { opacity: 0.42; }
.sv .sv-stamp b { font-weight: 700; }
.sv .sv-stamp i { font-style: normal; font-weight: 400; font-size: 0.92em; letter-spacing: 0.04em; text-transform: none; }
.sv .sv-stamp.teal { --st: #16605a; }
.sv .sv-stamp.wine { --st: #7a1f33; }
.sv .sv-stamp.red { --st: #a8291f; grid-row: 2; grid-column: span 3; }
.sv .sv-stamp.ink { --st: #2f2a24; }

/* the way in: the table dims, the slab rises off it and settles, the report slides out from under its right edge. The
   report starts hidden under the slab (its left end clipped where it would show past the slab's left edge), so it
   comes out of the slab rather than from beside it; the clip tracks the slide in each step of the keyframes. */
@keyframes sv-dim { from { opacity: 0; } to { opacity: 1; } }
@keyframes sv-rise {
  0% { transform: translateY(calc(var(--a) * 12)) scale(0.92); opacity: 0; filter: drop-shadow(var(--a) calc(var(--a) * 1.5) 0 rgba(35, 32, 28, 0.3)); }
  45% { transform: translateY(calc(var(--a) * -5)) scale(1.035); opacity: 1; filter: drop-shadow(calc(var(--a) * 7) calc(var(--a) * 11) 0 rgba(35, 32, 28, 0.24)); }
  78% { transform: translateY(calc(var(--a) * 0.5)) scale(0.997); filter: drop-shadow(calc(var(--a) * 2) calc(var(--a) * 3) 0 rgba(35, 32, 28, 0.38)); }
  100% { transform: none; opacity: 1; filter: drop-shadow(calc(var(--a) * 2) calc(var(--a) * 3) 0 rgba(35, 32, 28, 0.38)); }
}
@keyframes sv-slide {
  0% { transform: translateX(calc(var(--a) * -150)); clip-path: inset(0 0 0 calc(var(--a) * 60)); }
  40% { transform: translateX(calc(var(--a) * -90)); clip-path: inset(0 0 0 0); }
  86% { transform: translateX(calc(var(--a) * 2)); clip-path: inset(0 0 0 0); }
  100% { transform: none; clip-path: inset(0 0 0 0); }
}
.sv .sv-slab { animation: sv-rise 0.56s cubic-bezier(0.2, 0.8, 0.25, 1) both; }
.sv .sv-slip { animation: sv-slide 0.52s cubic-bezier(0.3, 0.7, 0.3, 1) 0.2s both; }
.sv.still .sv-slab, .sv.still .sv-slip, body.calm .sv .sv-slab, body.calm .sv .sv-slip, body.calm #modal:has(> .modal-box.sv) { animation: none; }
/* the way out, on the copy: the report slides back under the slab, then the slab lifts and sinks away while the table
   comes back (the dimming is its own layer, so the pieces fade only as their own keyframes say) */
.modal-ghost { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; pointer-events: none;
  --u: var(--pu); --fu: calc(var(--pu) * var(--fs)); }
.modal-ghost::before { content: ''; position: absolute; inset: 0; animation: sv-dim 0.46s ease-in 0.08s reverse both; }
.modal-ghost:has(> .modal-box.sv)::before { background: radial-gradient(ellipse 62% 78% at 50% 50%, rgba(10, 8, 5, 0.48), rgba(10, 8, 5, 0.8)); }
.modal-ghost .sv .sv-slip { animation: sv-slide 0.3s cubic-bezier(0.5, 0, 0.75, 0.4) reverse both; }
.modal-ghost .sv .sv-slab { animation: sv-rise 0.4s cubic-bezier(0.5, 0, 0.75, 0.4) 0.14s reverse both; }

/* ---------- a Black Label wherever else it shows ---------- */
/* the card view's slab chips (small squares in the line of text, each with its price; a Black Label's is black and
   gold), the Loupe's readout (it could come back a Black Label) */
.card-view .gchip { display: inline-grid; vertical-align: middle; margin-right: calc(var(--u) * 1); }
.gchip.lb-black { background: #1c1915; color: #f0cf72; border-color: #e9bf52; }
.readout b.rd-bl { padding: 0 calc(var(--u) * 1.5); border-radius: calc(var(--u) * 1.5); background: #1c1915; color: #f0cf72; box-shadow: inset 0 0 0 calc(var(--u) * 0.5) #e9bf52; }
/* fx.rankUp's ribbon in black satin with gold trim (art/areas/slab/ribbon_black_*.png, the rank-up ribbon's cut) */
/* fx.blackReveal: the room dims to a pool of light round the slab */
.fx-shade { position: absolute; inset: 0; display: block; pointer-events: none; opacity: 0;
  background: radial-gradient(circle var(--r) at var(--cx) var(--cy), transparent 0, transparent 55%, rgba(8, 6, 4, 0.55) 80%, rgba(8, 6, 4, 0.82) 100%); }
