/* Hallmark · route: custom (bespoke) on the locked landing-v5 system · page: card /{username}/{set}/{number}
 * idea: "the card lies on a measuring plate with crop marks at its printed size; its prices hang off a rail as tags,
 *        the history is a sheet behind range dividers, your copy is a ticket stub, the facts a catalogue label"
 * paper: oklch(94% 0.012 85) · accent: oklch(70% 0.16 155) (price up only) · display: Anybody wdth 62 · body: Hanken Grotesk · numerals: Martian Mono
 * Hallmark · pre-emit critique: P5 H5 E4 S5 R4 V5
 */

:root {
  --rarity-silver:    oklch(88% 0.008 250);
  --rarity-silver-hi: oklch(96% 0.006 250);
  --foil-1: oklch(84% 0.07 200);
  --foil-2: oklch(86% 0.07 300);
  --foil-3: oklch(88% 0.07 20);
  --foil-4: oklch(90% 0.07 95);
  --color-chip-ink: oklch(22% 0.006 85);
  --color-plate-line: oklch(18% 0.006 85 / 0.07);
  --color-mark: oklch(18% 0.006 85 / 0.55);
  --text-name: clamp(3rem, 1.2rem + 5.4vw, 7.4rem);
  --radius-card: 4.762% / 3.409%;
  --cal: 1;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) { --rarity-silver: oklch(78% 0.01 250); --rarity-silver-hi: oklch(88% 0.008 250);
    --color-plate-line: oklch(95% 0.012 85 / 0.06); --color-mark: oklch(95% 0.012 85 / 0.5); }
}
:root[data-theme='dark'] { --rarity-silver: oklch(78% 0.01 250); --rarity-silver-hi: oklch(88% 0.008 250);
  --color-plate-line: oklch(95% 0.012 85 / 0.06); --color-mark: oklch(95% 0.012 85 / 0.5); }

/* ---------- base (same as landing / collection) ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { color-scheme: light; -webkit-text-size-adjust: 100%; background-color: var(--color-paper); }
body {
  margin: 0;
  background-color: var(--color-paper);
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .32  0 0 0 0 .28  0 0 0 0 .2  0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    radial-gradient(120% 1400px at 20% 0%, var(--color-stock), transparent 60%);
  background-repeat: repeat, no-repeat;
  color: var(--color-ink);
  font: 400 var(--text-md)/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: inherit; }
img { display: block; }
h1, h2, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; border-radius: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: var(--space-md); top: -100px; z-index: 50; background: var(--color-ink); color: var(--color-stock); padding: var(--space-xs) var(--space-md); border-radius: var(--radius-pill); text-decoration: none; }
.skip:focus-visible { top: var(--space-sm); }
.mono { font-family: var(--font-mono); font-variation-settings: "wdth" 87.5; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* ---------- top bar (same as collection) ---------- */
.bar { position: sticky; top: 0; z-index: 30; min-height: var(--bar-h); display: flex; align-items: center; gap: var(--space-xl); padding: 0 var(--gutter); background: var(--color-paper); border-bottom: 1px solid var(--color-rule); }
.mark { font: 800 1.3rem/1 var(--font-display); font-variation-settings: "wdth" 70; letter-spacing: -.01em; text-decoration: none; white-space: nowrap; }
.bar-nav { display: flex; gap: var(--space-lg); margin-right: auto; }
.bar-nav a, .bar-link { font-weight: 600; font-size: var(--text-sm); text-decoration: none; white-space: nowrap; padding: 17px 2px 15px; border-bottom: 2px solid transparent; transition: border-color var(--dur-base) var(--ease-out); }
.bar-nav a { color: var(--color-muted); }
.bar-nav a:hover, .bar-link:hover { border-bottom-color: var(--color-rule-2); color: var(--color-ink); }
.bar-nav a[aria-current="page"] { color: var(--color-ink); border-bottom-color: var(--color-accent); }
.bar-end { display: flex; align-items: center; gap: var(--space-sm); }
.theme-toggle { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--color-rule-2); border-radius: var(--radius-pill); background: transparent; color: var(--color-ink); cursor: pointer; transition: border-color var(--dur-base) var(--ease-out); }
.theme-toggle:hover { border-color: var(--color-ink); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .i-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme='light']) .theme-toggle .i-moon { display: none; }
}
:root[data-theme='dark'] .theme-toggle .i-sun { display: block; }
:root[data-theme='dark'] .theme-toggle .i-moon { display: none; }

/* ---------- breadcrumb ---------- */
.crumbs { padding: clamp(18px, 3vw, 32px) var(--gutter) 0; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 0; font-size: var(--text-sm); color: var(--color-muted); }
.crumbs li { white-space: nowrap; }
.crumbs li + li::before { content: "/"; margin: 0 .6em; color: var(--color-rule-2); }
.crumbs a { color: var(--color-ink-2); text-decoration: none; font-weight: 600; }
.crumbs a:hover { text-decoration: underline; text-underline-offset: 3px; }
.crumbs [aria-current] .mono { font-size: .92em; color: var(--color-ink); }

/* ---------- the lot: plate left, facts of value right ---------- */
.lot {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start;
  gap: clamp(28px, 4vw, 72px); padding: clamp(16px, 2.4vw, 28px) var(--gutter) clamp(40px, 6vw, 80px);
}
.plate-col { position: sticky; top: calc(var(--bar-h) + 16px); min-width: 0; }

/* the plate: a measuring sheet with a 10 mm grid that follows the calibration */
.plate {
  position: relative; height: 560px; overflow: hidden; border-radius: 3px;
  background-color: var(--color-binder-page);
  background-image:
    linear-gradient(var(--color-plate-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-plate-line) 1px, transparent 1px);
  background-size: calc(10mm * var(--cal)) calc(10mm * var(--cal));
  background-position: var(--grid-x, 0) var(--grid-y, 0);
  box-shadow: var(--shadow-sheet);
  touch-action: pan-y;
}
/* .pos is the card at its printed size (63 mm wide); JS scales and places it. Three layers, one transform each:
   .pos = size and place, .drop = the entrance, .tilt = the pointer. */
.pos { position: absolute; left: 0; top: 0; width: calc(63mm * var(--cal)); aspect-ratio: 63 / 88; transform-origin: 0 0; will-change: transform; }
.pos.anim { transition: transform var(--dur-slow) var(--ease-settle); }
.drop { width: 100%; height: 100%; }
.js:not(.still) .drop { animation: settle 900ms var(--ease-settle) both; animation-delay: 120ms; }
@keyframes settle {
  0% { opacity: 0; transform: translateY(-9%) rotate(-3.5deg) scale(1.04); }
  55% { opacity: 1; }
  100% { opacity: 1; transform: none; }
}
.tilt {
  position: relative; width: 100%; height: 100%; border-radius: var(--radius-card);
  transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 420ms var(--ease-out);
}
.tilt.live { transition: transform 90ms linear; }
.tilt::before, .tilt::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-card); pointer-events: none; }
.tilt::before { box-shadow: var(--shadow-rest); }
.tilt::after { box-shadow: var(--shadow-lift); opacity: 0; transition: opacity var(--dur-base) var(--ease-out); }
.tilt.live::after { opacity: 1; }
.tilt img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-card); background: var(--color-paper-3); }
.ring { position: absolute; inset: -1.2%; z-index: 0; border-radius: 5.6% / 4%;
  background: conic-gradient(from 210deg, var(--foil-1), var(--foil-2), var(--foil-3), var(--foil-4), var(--foil-1), var(--foil-2), var(--foil-3), var(--foil-4), var(--foil-1)); }
/* a band of light that follows the pointer across the card (transform only) */
.glare { position: absolute; inset: 0; z-index: 2; overflow: hidden; border-radius: var(--radius-card); pointer-events: none; opacity: 0; transition: opacity var(--dur-base) var(--ease-out); }
.glare::before { content: ""; position: absolute; inset: -50%; background: linear-gradient(115deg, transparent 38%, var(--color-glint-hi) 47%, var(--color-highlight) 50%, var(--color-glint-hi) 53%, transparent 62%);
  transform: translate(var(--gx, 0%), var(--gy, 0%)); }
.tilt.live .glare { opacity: 1; }
.noimg-face { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; align-content: center; gap: 6px; padding: 14%; text-align: center; border-radius: var(--radius-card);
  background: repeating-linear-gradient(135deg, var(--color-paper-2) 0 6px, var(--color-paper-3) 6px 7px); }
.noimg-face b { font: 760 1.6rem/1.05 var(--font-display); font-variation-settings: "wdth" 70; }
.noimg-face span { font-size: var(--text-xs); color: var(--color-muted); }

/* crop marks and the printed size, drawn around wherever the card sits */
.marks { position: absolute; left: 0; top: 0; pointer-events: none; transition: opacity var(--dur-base) var(--ease-out); }
.marks.moving { opacity: 0; }
.tick { position: absolute; width: 14px; height: 14px; border: 0 solid var(--color-mark); }
.tick.tl { left: -20px; top: -20px; border-right-width: 1px; border-bottom-width: 1px; }
.tick.tr { right: -20px; top: -20px; border-left-width: 1px; border-bottom-width: 1px; }
.tick.bl { left: -20px; bottom: -20px; border-right-width: 1px; border-top-width: 1px; }
.tick.br { right: -20px; bottom: -20px; border-left-width: 1px; border-top-width: 1px; }
.dim { position: absolute; font-size: 10px; line-height: 1; color: var(--color-muted); white-space: nowrap; background: var(--color-binder-page); padding: 0 6px; }
.dim-h { left: 50%; top: -24px; transform: translateX(-50%); }
.dim-v { top: 50%; right: -24px; transform: translate(50%, -50%) rotate(90deg); }
.dim-h::before, .dim-v::before { content: ""; position: absolute; z-index: -1; top: 50%; height: 1px; background: var(--color-mark); }
.marks .rule-h, .marks .rule-v { position: absolute; background: var(--color-mark); }

.loupe { position: absolute; left: 0; top: 0; z-index: 5; width: 176px; height: 176px; border-radius: 50%; pointer-events: none; opacity: 0; background-repeat: no-repeat; background-color: var(--color-paper-3);
  box-shadow: 0 0 0 1px var(--color-ink), 0 0 0 5px var(--color-stock), 0 0 0 6px var(--color-rule-2), 0 18px 34px -10px var(--shadow-contact); transition: opacity var(--dur-fast) linear; }
.loupe.show { opacity: 1; }
.plate.loupe-on { cursor: none; touch-action: none; }

.plate-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); margin-top: var(--space-md); }
.seg { display: inline-flex; align-items: center; gap: 2px; height: 40px; padding: 3px; border: 1px solid var(--color-rule-2); border-radius: var(--radius-pill); background: var(--color-paper); }
.seg button { height: 32px; padding: 0 14px; border: 0; border-radius: var(--radius-pill); background: transparent; font-size: var(--text-sm); font-weight: 600; cursor: pointer; color: var(--color-ink-2); white-space: nowrap; transition: background-color var(--dur-fast) var(--ease-out); }
.seg button:hover { background: var(--color-paper-2); }
.seg button[aria-pressed="true"] { background: var(--color-ink); color: var(--color-stock); }
.tool { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 13px; border: 1px solid var(--color-rule-2); border-radius: var(--radius-pill); background: transparent; font-size: var(--text-sm); font-weight: 600; cursor: pointer; white-space: nowrap; transition: border-color var(--dur-base) var(--ease-out); }
.tool svg { width: 16px; height: 16px; }
.tool:hover { border-color: var(--color-ink); }
.tool[aria-pressed="true"] { background: var(--color-ink); color: var(--color-stock); border-color: var(--color-ink); }
.tool:disabled { opacity: .45; cursor: not-allowed; }
.plate-note { margin-top: var(--space-sm); max-width: 54ch; font-size: var(--text-xs); line-height: 1.5; color: var(--color-muted); min-height: 3em; }
.plate-note b { color: var(--color-ink-2); font-weight: 600; }
.plate-note .mono { font-size: .95em; color: var(--color-ink-2); white-space: nowrap; }
.calib { margin-top: var(--space-xs); padding: var(--space-md); border-radius: 3px; background: var(--color-stock); box-shadow: var(--shadow-rest); font-size: var(--text-sm); }
.calib label { display: block; color: var(--color-ink-2); max-width: 48ch; }
.cal-row { display: flex; align-items: center; gap: var(--space-sm); margin-top: var(--space-xs); }
.cal-row input { flex: 1 1 auto; min-width: 0; height: 32px; accent-color: var(--color-ink); }
.cal-row .mono { font-size: var(--text-xs); min-width: 5ch; text-align: right; }
.inline { padding: 4px 0; border: 0; background: none; cursor: pointer; font-size: var(--text-sm); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* ---------- name, badges, set line ---------- */
.info { min-width: 0; padding-top: 4px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--space-md); }
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 10px; border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: 600; white-space: nowrap; box-shadow: inset 0 0 0 1px var(--color-rule-2); color: var(--color-ink-2); }
.badge.own { background: var(--color-ink); color: var(--color-stock); box-shadow: none; }
.badge.own svg { width: 12px; height: 12px; }
.badge.out { box-shadow: none; background-image: none; outline: 1px dashed var(--color-rule-2); outline-offset: -1px; color: var(--color-muted); }
.badge.slab { font-family: var(--font-mono); font-variation-settings: "wdth" 87.5; letter-spacing: -.02em; box-shadow: inset 0 0 0 1.5px var(--color-ink); color: var(--color-ink); }
.badge.silver { color: var(--color-chip-ink); box-shadow: none; background: linear-gradient(180deg, var(--rarity-silver-hi), var(--rarity-silver)); }
.badge.chase { color: var(--color-chip-ink); box-shadow: none; background: linear-gradient(120deg, var(--foil-1), var(--foil-2) 40%, var(--foil-3) 70%, var(--foil-4)); }
.name {
  min-width: 0; overflow-wrap: anywhere;
  font: 820 var(--text-name)/.84 var(--font-display); font-variation-settings: "wdth" 62; letter-spacing: -.02em; text-wrap: balance;
}
.js:not(.still) .name { animation: rise 700ms var(--ease-settle) both; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.setline { margin-top: var(--space-md); font-size: var(--text-lg); color: var(--color-ink-2); }
.setline a { font-weight: 600; color: var(--color-ink); text-underline-offset: 4px; text-decoration-thickness: 1px; text-decoration-color: var(--color-rule-2); }
.setline a:hover { text-decoration-color: var(--color-ink); }
.setline .sep { color: var(--color-muted); margin: 0 .4em; }
.setline .mono { font-size: .86em; color: var(--color-ink); }
.share-row { margin-top: var(--space-md); }
.copy {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px 0 13px;
  border: 1px solid var(--color-rule-2); border-radius: var(--radius-pill); background: var(--color-stock);
  font-weight: 600; font-size: var(--text-sm); cursor: pointer; white-space: nowrap;
  box-shadow: 0 1px 0 var(--color-highlight) inset, 0 1px 2px var(--shadow-ambient);
  transition: border-color var(--dur-base) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.copy:hover { border-color: var(--color-ink); }
.copy:active { transform: translateY(1px); }
.copy svg { width: 16px; height: 16px; flex: none; }
.copy .i-ok { display: none; }
.copy.done .i-link { display: none; }
.copy.done .i-ok { display: block; }

/* ---------- variant pills: little tickets ---------- */
.variants { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13.5rem), 1fr)); gap: 8px; margin-top: clamp(24px, 3vw, 36px); }
.vpill {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 2px 10px; text-align: left;
  padding: 10px 14px 11px; border: 0; border-radius: 4px; cursor: pointer; background: var(--color-paper);
  box-shadow: inset 0 0 0 1px var(--color-rule-2); transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.vpill:hover { box-shadow: inset 0 0 0 1px var(--color-ink); }
.vpill:active { transform: translateY(1px); }
.vpill .vl { font-weight: 600; font-size: var(--text-sm); line-height: 1.25; min-width: 0; }
.vpill .vp { font: 600 var(--text-sm)/1.2 var(--font-mono); font-variation-settings: "wdth" 87.5; letter-spacing: -.02em; white-space: nowrap; }
.vpill .vo { grid-column: 1 / -1; font: 500 var(--text-2xs)/1.2 var(--font-mono); font-variation-settings: "wdth" 87.5; color: var(--color-muted); }
.vpill[aria-pressed="true"] { background: var(--color-ink); color: var(--color-stock); box-shadow: none; }
.vpill[aria-pressed="true"] .vo { color: var(--color-paper-3); }

/* ---------- market value: tags hanging off a rail ---------- */
.market { margin-top: clamp(32px, 4vw, 52px); }
.sec-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px var(--space-md); padding-bottom: 10px; border-bottom: 2px solid var(--color-ink); }
.sec-t { font: 760 clamp(1.3rem, 1rem + 1vw, 1.75rem)/1.05 var(--font-display); font-variation-settings: "wdth" 72; letter-spacing: -.005em; min-width: 0; }
.sec-t .v { font: 600 var(--text-sm)/1 var(--font-body); color: var(--color-muted); letter-spacing: 0; }
.sec-r { font-size: var(--text-sm); color: var(--color-muted); }
.sec-r .mono { font-size: .9em; color: var(--color-ink-2); }
.rail { position: relative; display: flex; flex-wrap: wrap; gap: 0 clamp(16px, 2.4vw, 36px); padding: 0 clamp(4px, 1.5vw, 20px); }
/* the string each tag hangs from comes down from the section rule */
.htag { position: relative; flex: 0 1 15.5rem; min-width: 0; padding-top: 30px; transform-origin: 50% 0; }
.htag::before { content: ""; position: absolute; left: 50%; top: 0; width: 1.2px; height: 40px; margin-left: -.6px; background: var(--color-string); }
.js:not(.still) .htag { animation: swing 1500ms var(--ease-out) both; animation-delay: calc(400ms + var(--i, 0) * 140ms); }
@keyframes swing {
  0% { opacity: 0; transform: rotate(-11deg) translateY(-6px); }
  18% { opacity: 1; }
  40% { transform: rotate(5deg); }
  62% { transform: rotate(-2.2deg); }
  80% { transform: rotate(.8deg); }
  100% { opacity: 1; transform: none; }
}
@media (hover: hover) { .htag-in { transition: transform 600ms var(--ease-settle); transform-origin: 50% -30px; } .htag:hover .htag-in { transform: rotate(-2deg); } }
.htag-in { position: relative; filter: drop-shadow(0 1px 1px var(--shadow-contact)) drop-shadow(0 10px 14px var(--shadow-ambient)); }
.htag-face {
  --cut: 16px;
  position: relative; display: block; padding: 32px 18px 18px; background: var(--color-stock);
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%, 0 var(--cut));
}
/* the headline read wears an ink edge: an ink face under a stock face inset by 1.5 px */
.htag.lead .htag-in::before { content: ""; position: absolute; inset: -1.5px; background: var(--color-ink);
  clip-path: polygon(16.5px 0, calc(100% - 16.5px) 0, 100% 16.5px, 100% 100%, 0 100%, 0 16.5px); }
.htag-hole { position: absolute; left: 50%; top: 11px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--color-paper-3);
  box-shadow: inset 0 1px 1px var(--shadow-contact), 0 0 0 3px var(--color-paper-2); }
.src { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; font-size: var(--text-xs); color: var(--color-muted); }
.src b { font-weight: 600; color: var(--color-ink); letter-spacing: .01em; }
.amt { display: block; margin-top: 8px; font: 600 clamp(1.65rem, 1.1rem + 1.5vw, 2.35rem)/1 var(--font-mono); font-variation-settings: "wdth" 87.5; letter-spacing: -.05em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.htag:not(.lead) .amt { font-size: clamp(1.35rem, 1rem + 1vw, 1.8rem); }
.tsub { display: block; margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--color-rule-2); font: 400 var(--text-2xs)/1.55 var(--font-mono); font-variation-settings: "wdth" 87.5; letter-spacing: -.02em; color: var(--color-flat); }
.tsub .up { color: var(--color-accent-deep); font-weight: 600; }
.tsub .up::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--color-accent); vertical-align: 1px; }
.tsub span { display: block; }
.mv-empty { padding: var(--space-lg) 0 0; color: var(--color-muted); font-size: var(--text-sm); }

/* ---------- price history: a sheet behind range dividers ---------- */
.history { margin-top: clamp(36px, 4vw, 56px); }
.tabs { display: flex; align-items: flex-end; padding: 0 2px; }
.tab {
  position: relative; flex: none; margin-right: -6px; padding: 9px 18px 9px 16px; border: 0; cursor: pointer;
  background: var(--color-paper-2); color: var(--color-ink-2); border-radius: var(--radius-tab);
  box-shadow: inset 0 1px 0 var(--color-highlight), 0 0 0 1px var(--color-rule);
  font: 600 var(--text-xs)/1.2 var(--font-mono); font-variation-settings: "wdth" 87.5; transform: translateY(4px);
  transition: transform var(--dur-base) var(--ease-out);
}
.tab:hover { transform: translateY(1px); }
.tab[aria-selected="true"] { z-index: 4; background: var(--color-stock); color: var(--color-ink); transform: translateY(1px);
  box-shadow: inset 0 1px 0 var(--color-highlight), 0 -1px 0 var(--color-rule), -1px 0 0 var(--color-rule), 1px 0 0 var(--color-rule); }
.tab:focus-visible { outline-offset: -3px; }
.sheet { position: relative; z-index: 1; background: var(--color-stock); border-radius: 0 3px 3px 3px; box-shadow: var(--shadow-sheet); }
.chart-sheet { padding: var(--space-lg) clamp(16px, 2vw, 28px) var(--space-md); }
.ch-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-md); }
.ch-head .k { font-size: var(--text-sm); font-weight: 600; color: var(--color-muted); }
.ch-head .v { margin-top: 4px; font: 600 1.35rem/1.2 var(--font-mono); font-variation-settings: "wdth" 87.5; letter-spacing: -.04em; }
.ch-head .v small { display: inline-block; margin-left: 8px; font-size: var(--text-2xs); font-weight: 400; letter-spacing: -.02em; color: var(--color-flat); }
.ch-head .v small.up { color: var(--color-accent-deep); font-weight: 600; }
.ch-read { font-size: var(--text-xs); color: var(--color-ink-2); text-align: right; min-height: 1.4em; padding-top: 4px; white-space: nowrap; }
.chart { position: relative; margin-top: var(--space-sm); height: 210px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart:focus-visible { outline-offset: 6px; }
.chart .line { fill: none; stroke: var(--color-ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart .area { fill: var(--color-ink); opacity: .05; }
.chart .gap { stroke: var(--color-muted); stroke-width: 1.5; stroke-dasharray: 2 5; stroke-linecap: round; fill: none; vector-effect: non-scaling-stroke; }
.chart .grid { stroke: var(--color-rule); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .ylab, .chart .xlab { font: 400 10px/1 var(--font-mono); font-variation-settings: "wdth" 87.5; fill: var(--color-muted); }
.chart .end { fill: var(--color-ink); }
.chart .end.up { fill: var(--color-accent); }
.chart .cross { stroke: var(--color-ink); stroke-width: 1; opacity: .5; vector-effect: non-scaling-stroke; }
.chart .dot { fill: var(--color-stock); stroke: var(--color-ink); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart .hover { opacity: 0; transition: opacity var(--dur-fast) linear; }
.chart.reading .hover { opacity: 1; }
/* the draw-in: a stock-coloured cover slides off to the right (transform only) */
.chart .cover { fill: var(--color-stock); transform-box: fill-box; transform-origin: 100% 50%; }
.js:not(.still) .chart .cover { animation: uncover 1100ms var(--ease-settle) both; animation-delay: 650ms; }
@keyframes uncover { to { transform: scaleX(0); } }
.still .chart .cover, .chart.redraw .cover { display: none; }
.since { margin-top: var(--space-xs); font-size: var(--text-xs); color: var(--color-muted); }
.no-hist { display: grid; place-items: center; height: 100%; color: var(--color-muted); font-size: var(--text-sm); }

/* ---------- lower band: your copy + the card's label ---------- */
.lower { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: clamp(32px, 5vw, 80px); padding: 0 var(--gutter) clamp(48px, 6vw, 88px); }
.copies .note { padding-top: var(--space-md); color: var(--color-ink-2); font-size: var(--text-md); max-width: 46ch; }
.copies .note a { font-weight: 600; text-underline-offset: 3px; }
.copies .note.muted { color: var(--color-muted); font-size: var(--text-sm); }
/* a copy is a ticket stub: quantity on the stub, a perforation, the rest on the ticket */
.stub-list { list-style: none; margin: 0; padding: var(--space-lg) 0 0; display: grid; gap: var(--space-sm); }
.stub {
  position: relative; display: grid; grid-template-columns: 5.2rem minmax(0, 1fr); min-height: 96px;
  filter: drop-shadow(0 1px 1px var(--shadow-contact)) drop-shadow(0 8px 12px var(--shadow-ambient));
}
.stub > * { background: var(--color-stock); }
.stub-q {
  display: grid; place-items: center; border-radius: 4px 0 0 4px;
  font: 600 1.6rem/1 var(--font-mono); font-variation-settings: "wdth" 87.5; letter-spacing: -.05em;
  -webkit-mask: radial-gradient(circle 7px at 100% 0, transparent 6.5px, #000 7px) top / 100% 51% no-repeat, radial-gradient(circle 7px at 100% 100%, transparent 6.5px, #000 7px) bottom / 100% 51% no-repeat;
          mask: radial-gradient(circle 7px at 100% 0, transparent 6.5px, #000 7px) top / 100% 51% no-repeat, radial-gradient(circle 7px at 100% 100%, transparent 6.5px, #000 7px) bottom / 100% 51% no-repeat;
}
.stub-b {
  position: relative; padding: 16px 20px 16px 22px; border-radius: 0 4px 4px 0;
  -webkit-mask: radial-gradient(circle 7px at 0 0, transparent 6.5px, #000 7px) top / 100% 51% no-repeat, radial-gradient(circle 7px at 0 100%, transparent 6.5px, #000 7px) bottom / 100% 51% no-repeat;
          mask: radial-gradient(circle 7px at 0 0, transparent 6.5px, #000 7px) top / 100% 51% no-repeat, radial-gradient(circle 7px at 0 100%, transparent 6.5px, #000 7px) bottom / 100% 51% no-repeat;
}
.stub-b::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; border-left: 1.5px dashed var(--color-rule-2); }
.stub .desc { font-weight: 600; font-size: var(--text-md); }
.stub .desc .mono { margin-left: 6px; font-size: var(--text-2xs); font-weight: 400; color: var(--color-muted); }
.stub .meta { margin-top: 4px; font-size: var(--text-sm); color: var(--color-muted); }
.stub .meta .mono { font-size: .9em; color: var(--color-ink-2); }
.stub .notes { margin-top: 8px; font-size: var(--text-sm); color: var(--color-ink-2); }

/* the card's facts as a catalogue label: dotted leaders between name and value */
.kv { margin: 0; padding-top: var(--space-md); display: grid; gap: 0; }
.kv > div { display: flex; align-items: baseline; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--color-rule); }
.kv dt { font-size: var(--text-sm); color: var(--color-muted); white-space: nowrap; }
.kv dt::after { content: ""; }
.kv .lead-dots { flex: 1 1 auto; min-width: 16px; height: 1px; align-self: center; margin-top: 4px; background-image: radial-gradient(circle, var(--color-rule-2) 1px, transparent 1.2px); background-size: 6px 3px; background-repeat: repeat-x; background-position: 0 50%; }
.kv dd { margin: 0; font-size: var(--text-sm); font-weight: 600; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.kv dd.mono { font-weight: 600; font-size: var(--text-xs); }

/* ---------- more from the set: a divider tab over a strip ---------- */
.related { padding: 0 var(--gutter) clamp(56px, 7vw, 96px); }
.rel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-md); }
.rel-tab {
  position: relative; z-index: 2; margin-bottom: -1px; padding: 12px 22px 11px 18px; border-radius: var(--radius-tab); background: var(--color-stock);
  box-shadow: inset 0 1px 0 var(--color-highlight), 0 -1px 0 var(--color-rule), -1px 0 0 var(--color-rule), 1px 0 0 var(--color-rule);
  font: 760 clamp(1.1rem, .9rem + .8vw, 1.5rem)/1.1 var(--font-display); font-variation-settings: "wdth" 72; min-width: 0; overflow-wrap: anywhere;
}
.setlink { padding-bottom: 10px; font-size: var(--text-sm); font-weight: 600; text-underline-offset: 3px; text-decoration-thickness: 1px; white-space: nowrap; }
.setlink:hover { text-decoration-thickness: 2px; }
.rel-sheet { padding: clamp(24px, 3vw, 36px) clamp(16px, 2.8vw, 40px) clamp(28px, 3vw, 40px); border-radius: 0 3px 3px 3px; }
.strip { list-style: none; margin: 0; padding: 4px 0 0; display: grid; grid-auto-flow: column; grid-auto-columns: clamp(132px, 12vw, 190px); gap: clamp(14px, 2vw, 30px);
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: thin; }
.strip > li { scroll-snap-align: start; min-width: 0; padding-bottom: 6px; }
.rcard { position: relative; display: block; text-decoration: none; color: inherit; transition: transform var(--dur-base) var(--ease-out); }
.rcard .frame { position: relative; display: block; aspect-ratio: 245 / 342; }
.rcard .frame::before, .rcard .frame::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-card); pointer-events: none; }
.rcard .frame::before { box-shadow: var(--shadow-rest); }
.rcard .frame::after { box-shadow: var(--shadow-lift); opacity: 0; transition: opacity var(--dur-base) var(--ease-out); }
.rcard .pic { position: relative; z-index: 1; display: block; width: 100%; height: 100%; overflow: hidden; border-radius: var(--radius-card); background: var(--color-paper-3); }
.rcard .pic img { width: 100%; height: 100%; object-fit: cover; }
.rcard .rring { position: absolute; inset: -2.5px; z-index: 0; border-radius: 5.6% / 4%; background: conic-gradient(from 210deg, var(--foil-1), var(--foil-2), var(--foil-3), var(--foil-4), var(--foil-1), var(--foil-2), var(--foil-3), var(--foil-4), var(--foil-1)); }
@media (hover: hover) { .rcard:hover { transform: translateY(-6px); } .rcard:hover .frame::after { opacity: 1; } }
.rcard:focus-visible { outline-offset: 6px; }
.ptag { position: relative; z-index: 2; display: inline-block; max-width: calc(100% - 8px); margin: -15px 0 0 8px; filter: drop-shadow(0 1px 1px var(--shadow-contact)) drop-shadow(0 4px 6px var(--shadow-ambient)); }
.ptag-face { display: block; background: var(--color-stock); padding: 5px 10px 6px 21px; clip-path: polygon(11px 0, 100% 0, 100% 100%, 11px 100%, 0 50%); }
.ptag-hole { position: absolute; left: 7px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--color-paper-3); box-shadow: inset 0 1px 1px var(--shadow-contact); }
.ptag .p { display: block; font: 600 var(--text-sm)/1.25 var(--font-mono); font-variation-settings: "wdth" 87.5; letter-spacing: -.02em; white-space: nowrap; }
.ptag .d { display: block; font: 400 10.5px/1.3 var(--font-mono); font-variation-settings: "wdth" 87.5; color: var(--color-flat); white-space: nowrap; }
.ptag .d.up { color: var(--color-accent-deep); }
.ptag .d.up::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--color-accent); vertical-align: 1px; }
.rcard .meta { display: block; padding: 8px 2px 0; }
.rcard .nm { display: block; font-weight: 600; font-size: var(--text-sm); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rcard .sub { display: block; margin-top: 2px; font-size: var(--text-2xs); color: var(--color-muted); }
.strip-one { grid-auto-columns: clamp(150px, 14vw, 200px); }

/* ---------- footer ---------- */
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-lg); border-top: 1px solid var(--color-rule); padding: var(--space-xl) var(--gutter) var(--space-2xl); font-size: var(--text-sm); color: var(--color-muted); }
.foot > div { max-width: 52ch; }
.foot-r { text-align: right; max-width: 40ch !important; }
.fbrand { display: block; font: 800 var(--text-md)/1.2 var(--font-display); font-variation-settings: "wdth" 70; color: var(--color-ink); margin-bottom: 4px; }
.legal { margin-top: var(--space-xs); }
.foot a { color: var(--color-ink-2); }

/* ---------- narrow ---------- */
@media (max-width: 959px) {
  .lot { grid-template-columns: minmax(0, 1fr); }
  .plate-col { position: static; }
  .lower { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 679px) {
  .bar { flex-wrap: wrap; gap: 0 var(--space-md); padding-top: 6px; }
  .mark { margin-right: auto; }
  .bar-nav { order: 3; flex-basis: 100%; gap: var(--space-lg); margin: 0; }
  .bar-nav a { padding: 8px 2px 10px; }
  .bar-link { padding: 10px 2px; }
  .lot { padding-left: 0; padding-right: 0; }
  .plate { border-radius: 0; }
  .plate-tools, .plate-note, .calib { margin-left: var(--gutter); margin-right: var(--gutter); }
  .info { padding: 0 var(--gutter); }
  .setline { font-size: var(--text-md); }
  .rail { padding: 0; }
  .htag { flex: 1 1 0; }
  .htag-face { padding: 30px 12px 14px; }
  .src { flex-direction: column; }
  .chart-sheet { border-radius: 0 3px 3px 3px; }
  .chart { height: 180px; }
  .related { padding-left: 0; padding-right: 0; }
  .rel-head { padding: 0 var(--gutter) 0 0; }
  .rel-tab { border-radius: 0 8px 0 0; padding-left: var(--gutter); }
  .rel-sheet { border-radius: 0; }
  .foot-r { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation: none !important; }
  .tilt { transform: none !important; }
  .chart .cover { display: none; }
}
.still .drop, .still .htag, .still .name { animation: none; opacity: 1; transform: none; }
