/* ---------- pieces the scenes share (src/scenes/parts.js, areas.doorSwing) ---------- */
/* ---------- the graded slab (src/scenes/parts.js slabArt; art/areas/slab from tools/desk_art/slab_kit.py) ----------
   One slab everywhere, at three sizes: .sl-mini (22x32), .sl-std (32x48) and .sl-big (96x160). It fills its positioned
   parent; its parts sit in art pixels of the slab (--a), bottom to top: the clear case, the label of its tier
   (lb-black, lb-gold, lb-silver, lb-white) and what the label prints, the security seal, the card in the window, the
   glare. The rules are not scoped to a scene, so a slab works in a dialog too; every class carries the sl- prefix. */
.sl { --lt: min(var(--fs, 1), 1.15); position: absolute; inset: 0; display: block; padding: 0; margin: 0; border: 0; background: none; border-radius: 0;
  box-shadow: none; font: inherit; color: var(--ink); text-shadow: none; line-height: 1; white-space: nowrap; letter-spacing: 0; cursor: pointer; transition: translate 0.1s ease; }
span.sl { cursor: inherit; }
button.sl:hover, button.sl:focus-visible { translate: 0 calc(var(--a) * -1); outline: none; }
button.sl:focus-visible .sl-case { filter: brightness(1.15); }
.sl img { position: absolute; display: block; max-width: none; image-rendering: pixelated; -webkit-user-drag: none; user-select: none; pointer-events: none; }
.sl .sl-case, .sl .sl-glare { left: 0; top: 0; width: 100%; height: 100%; }
.sl .sl-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; }
.sl .sl-lbl { z-index: 1; }
.sl .sl-t, .sl .sl-c, .sl .sl-bar, .sl .sl-seal { z-index: 2; }
.sl .sl-win { z-index: 3; overflow: hidden; }
.sl .sl-win .cardpic { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 0; overflow: hidden; }
.sl .sl-win .cardpic .card-img { display: block; width: 100%; height: 100%; }
.sl .sl-glare { z-index: 4; }
/* A slab at any size: wrap it in .sl-box, sized from outside at the slab's own shape (22 / 32, 32 / 48 or 96 / 160);
   there an art pixel is the box's height over the slab's. */
.sl-box { position: relative; display: block; container-type: size; }
.sl-box > .sl.sl-mini { --a: calc(100cqh / 32); --g: calc(100cqh / 64); }
.sl-box > .sl.sl-std { --a: calc(100cqh / 48); --g: calc(100cqh / 96); }
.sl-box > .sl.sl-big { --a: calc(100cqh / 160); --g: calc(100cqh / 320); }
/* the lists and dialogs that are not scenes (homeui.slabHTML: the slab picker, the framed panels): a box in UI units */
.sl-box.sl-fit { flex: none; height: calc(var(--u) * 84); aspect-ratio: 32 / 48; filter: drop-shadow(calc(var(--u) * 2) calc(var(--u) * 3) 0 rgba(35, 32, 28, 0.38)); }
.sl-box.sl-fit.mini { height: calc(var(--u) * 48); aspect-ratio: 22 / 32; }
.pick-tile .sl-box.sl-fit.mini { height: calc(var(--u) * 41); }

/* what the label prints, in the tier's ink (GRADING.labelTiers colors); it grows a little with Text size (to 1.15) */
.sl .sl-t { display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--lb-ink); font-family: var(--font-ui); font-weight: 700; }
/* a print that runs wide steps down (.fit, areas.fitText: Pipwick's digits are wide, and its sizes come in whole font pixels) */
.sl .sl-t.fit { --lt: calc(min(var(--fs, 1), 1.15) * var(--fit, 1)); }
.sl .sl-g { font-family: var(--font-px); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.sl.sl-mini .sl-g { justify-content: flex-end; padding-right: calc(var(--a) * 0.6); font-size: calc(var(--a) * 4.4 * var(--lt)); }
.sl.sl-std .sl-g { font-size: calc(var(--a) * 6.2 * var(--lt)); }
/* slab: the four subgrades as cells tinted by value (10 gold, 9 silver, 8 and below plain) */
.sl .sl-c { display: block; background: rgba(58, 46, 30, 0.3); }
.sl .sl-c.v10 { background: #e2ae3a; box-shadow: inset 0 var(--g) 0 #fff0a6; }
.sl .sl-c.v9 { background: #aab7c1; box-shadow: inset 0 var(--g) 0 #f2f6f8; }
.sl.lb-black .sl-c.v0 { background: rgba(255, 244, 214, 0.22); }
/* slab_big: the card's lines, the grade and its word, the subgrade table, the barcode and the cert number */
.sl .sl-l { justify-content: flex-start; font-size: calc(var(--a) * 3 * var(--lt)); letter-spacing: 0.02em; }
.sl .sl-l2 { font-family: var(--font-px); font-size: calc(var(--a) * 4.1 * var(--lt)); letter-spacing: 0.04em; }
.sl .sl-l3 { font-weight: 400; }
.sl.sl-big .sl-g { font-size: calc(var(--a) * 13 * var(--lt)); padding-top: calc(var(--a) * 1); }
.sl .sl-w { font-size: calc(var(--a) * 2.7 * var(--lt)); letter-spacing: 0.03em; }
.sl .sl-s { flex-direction: column; gap: calc(var(--a) * 0.4); }
.sl .sl-s i { font-style: normal; font-weight: 400; font-size: calc(var(--a) * 2 * var(--lt)); opacity: 0.85; }
.sl .sl-s b { font-family: var(--font-px); font-size: calc(var(--a) * 3.4 * var(--lt)); }
.sl .sl-s.v10 b { color: #9a6410; }
.sl .sl-s.v9 b { color: #44596a; }
.sl.lb-black .sl-s.v10 b { color: #ffe89a; }
.sl.lb-black .sl-s.v9 b { color: #d3dce2; }
.sl .sl-bar { color: var(--lb-ink); margin: calc(var(--a) * 0.5) calc(var(--a) * 1); width: calc(var(--a) * (var(--w) - 2)); height: calc(var(--a) * (var(--h) - 1)); }
.sl .sl-cert { font-weight: 400; font-size: calc(var(--a) * 2.3 * min(var(--lt), 1.06)); letter-spacing: 0.04em; }   /* a long number: it grows less */
/* Pipwick's glyphs carry their own spacing, and at the label's small sizes a fraction of a font pixel only blurs them
   (and the cert number would not fit its slot) */
:root:not(.font-clear) .sl .sl-t { letter-spacing: 0; }
/* the security seal: the gem-shaped sprite with a foil sheen through its shape; the sheen drifts while Motion is on */
.sl .sl-seal { background: var(--seal) 0 0 / 100% 100% no-repeat; image-rendering: pixelated; }
.sl .sl-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; }
@keyframes sl-foil { to { background-position: 400% 0; } }
body.fx-reduced .sl .sl-seal::after { animation-duration: 8s; }
body.fx-off .sl .sl-seal::after { animation: none; background-position: 35% 0; }

/* doors seen from the front: the shut door squashes toward its hinge, then the open one grows out of it. Opened is the
   resting state (the shut door at nothing); a door hinged on the left (.dr-l) or the right (.dr-r) turns about that
   edge, and the open picture about the edge that touches the hinge. A scene whose art puts the hinge elsewhere sets
   its own transform-origin. */
#panel.area .dr-shut, #panel.area .dr-open { z-index: 4; pointer-events: none; }
#panel.area .dr-shut { transform: scaleX(0); }
#panel.area .dr-shut.dr-l { transform-origin: 0 50%; }
#panel.area .dr-shut.dr-r { transform-origin: 100% 50%; }
#panel.area .dr-open.dr-l { transform-origin: 100% 50%; }
#panel.area .dr-open.dr-r { transform-origin: 0 50%; }

/* A new slab seen from behind: plain label stock and the chosen card back inside the clear case. */
.sl.sl-back .sl-case { transform: scaleX(-1); }
.sl .sl-back-label { z-index: 2; background: #dfded5; box-shadow: inset 0 var(--g) 0 #efeee6, inset 0 calc(var(--g) * -1) 0 #b9bcb5; }
.sl .sl-back-card { z-index: 3; overflow: hidden; }
.sl .sl-back-card img { inset: 0; width: 100%; height: 100%; }
