/* The card face, drawn the way the app draws it (KartoDesign CardView), so a card on the page is the app's card at
   any size rather than a picture of one.

   `.kcard` is a size container; everything on the face is a fraction of its width (cqw), as the face is in the app:
   name heavy at 17/393 of the width with 0.6/17 tracking, programme medium at 12/393, both set in by 18/393; the
   band 56/393 tall; radius 4.5% of the width; the white code plate inset by the same margin, its padding, gap and
   digits proportions of the symbol's own width (16, 10, 6 and 12 of 325). Colours per card (--c, --on, --sheen,
   --key, --hair) come from tools/cards.py, which solves them with BrandInk's rules. */

.kcard { container-type: inline-size; position: relative; display: block; width: 100%; aspect-ratio: 1.586;
  text-align: left; -webkit-user-select: none; user-select: none; }
.kcard-face { position: absolute; inset: 0; overflow: hidden; border-radius: 4.5cqw; color: var(--on);
  background:
    radial-gradient(circle 90cqw at 18% -15%, rgb(255 255 255 / var(--sheen)) 2.5cqw, rgb(255 255 255 / 0) 90cqw),
    linear-gradient(to bottom, rgb(255 255 255 / 0.02), rgb(255 255 255 / 0) 50%, rgb(0 0 0 / 0.02)),
    var(--c); }
/* The light catching the top edge: a 1 pt line in the ink's colour, fading out by the middle of the card. */
.kcard-face::after { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--on) calc(var(--key) * 100%), transparent),
    color-mix(in srgb, var(--on) calc(var(--key) * 18%), transparent) 25%, transparent 50%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); }
/* A face too light to separate itself from a light ground prints its own edge. */
.kcard-face::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 0.5px color-mix(in srgb, var(--on) calc(var(--hair) * 100%), transparent); }

.kcard-band { position: absolute; inset: 0 0 auto; min-height: 14.249cqw; padding: 2.7794cqw 4.5802cqw 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter Variable", system-ui, sans-serif;
  line-height: 1.1777; white-space: nowrap; }
.kcard-name { display: block; overflow: hidden; text-overflow: clip; font-size: max(11px, 4.3257cqw); font-weight: 800;
  letter-spacing: 0.0353em; }
.kcard-program { display: block; font-size: max(11px, 3.0534cqw); font-weight: 500; letter-spacing: 0; }
.kcard-band:not(:has(.kcard-program)) { padding-top: 4.5774cqw; }
@container (width < 240px) {
  .kcard-program { display: none; }
  .kcard-band { padding-top: 4.5774cqw; }
}

/* The code plate: pure white in both appearances, as on a plastic card, with a soft shadow on the fill. Its width is
   the face's less two margins (90.84 cqw); the symbol is that over 1 + 2 x 16/325. */
.kcard-plate { position: absolute; left: 4.5802cqw; right: 4.5802cqw; bottom: 4.5802cqw; display: grid;
  justify-items: center; row-gap: 1.5267cqw; padding: 2.5445cqw 4.0712cqw; border-radius: 3.4cqw; background: #fff;
  box-shadow: 0 3.4cqw 7.9cqw rgb(0 0 0 / var(--plate-shadow, 0.14)); }
.kcard-plate img { display: block; width: 82.697cqw; max-width: none; height: auto; }
.kcard-digits { color: rgb(0 0 0 / 0.8); font: 500 3.0534cqw/1.18 ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums; letter-spacing: 0; white-space: nowrap; }
/* A matrix code is a third of the face wide and centred; its digits would be too small to read, so it has none. */
.kcard-plate.is-matrix { left: 50%; right: auto; translate: -50% 0; row-gap: 0.6277cqw; padding: 1.0462cqw 1.6738cqw; }
.kcard-plate.is-matrix img { width: 34cqw; }
.kcard-plate.is-matrix .kcard-digits { display: none; }
/* Below the width where they would read (9 pt), the digits go. */
@container (width < 295px) { .kcard-digits { display: none; } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .kcard { --plate-shadow: 0.28; } }
:root[data-theme="dark"] .kcard { --plate-shadow: 0.28; }

/* A pass of light across the face (CardSheen): a band as wide as the card and 1.3 diagonals long, its glow a narrow core
   (60%) over a wide halo, travelling corner to corner along the diagonal in 1.4 s on (0.3, 0, 0.2, 1). It plays when its card gets .is-sheen. */
.kcard-sheen { position: absolute; left: 50%; top: 50%; width: 100cqw; height: 153.7cqw; margin: -76.85cqw 0 0 -50cqw;
  pointer-events: none; opacity: 0; transform: rotate(32.24deg) translateX(-109.1cqw);
  background: linear-gradient(to right, transparent, rgb(var(--sheen-ink, 255 255 255) / calc(var(--peak, 0.22) * 0.115)) 20%, rgb(var(--sheen-ink, 255 255 255) / calc(var(--peak, 0.22) * 0.284)) 34%, rgb(var(--sheen-ink, 255 255 255) / calc(var(--peak, 0.22) * 0.599)) 43%,
    rgb(var(--sheen-ink, 255 255 255) / var(--peak, 0.22)) 50%, rgb(var(--sheen-ink, 255 255 255) / calc(var(--peak, 0.22) * 0.599)) 57%, rgb(var(--sheen-ink, 255 255 255) / calc(var(--peak, 0.22) * 0.284)) 66%, rgb(var(--sheen-ink, 255 255 255) / calc(var(--peak, 0.22) * 0.115)) 80%, transparent); }
@media (prefers-reduced-motion: no-preference) {
  .kcard.is-sheen .kcard-sheen { animation: sheen 1.4s cubic-bezier(0.3, 0, 0.2, 1) both; }
}
@keyframes sheen {
  from { opacity: 1; transform: rotate(32.24deg) translateX(-109.1cqw); }
  to { opacity: 1; transform: rotate(32.24deg) translateX(109.1cqw); }
}

/* Each sample card's face colours, from tools/cards.py (BrandInk's rules applied to its brand colour). */
.kcard[data-card="marigold"] { --c: #E4572E; --on: #FFFFFF; --sheen: 0.1; --key: 0.2957; --hair: 0; --sheen-ink: 255 255 255; --peak: 0.55; }
.kcard[data-card="northwind"] { --c: #2B6B70; --on: #FFFFFF; --sheen: 0.1; --key: 0.3278; --hair: 0; --sheen-ink: 255 255 255; --peak: 0.55; }
.kcard[data-card="copper"] { --c: #5B3A29; --on: #FFFFFF; --sheen: 0.1; --key: 0.3563; --hair: 0; --sheen-ink: 255 255 255; --peak: 0.55; }
.kcard[data-card="atelier"] { --c: #1C1C1E; --on: #FFFFFF; --sheen: 0.1; --key: 0.3882; --hair: 0; --sheen-ink: 255 255 255; --peak: 0.55; }
.kcard[data-card="fjordline"] { --c: #3E4C7C; --on: #FFFFFF; --sheen: 0.1; --key: 0.3454; --hair: 0; --sheen-ink: 255 255 255; --peak: 0.55; }
.kcard[data-card="petal"] { --c: #EDE6DA; --on: #121214; --sheen: 0.2; --key: 0.18; --hair: 0.18; --sheen-ink: 0 0 0; --peak: 0.22; }
.kcard[data-card="brickyard"] { --c: #F2C230; --on: #121214; --sheen: 0.2; --key: 0.18; --hair: 0; --sheen-ink: 0 0 0; --peak: 0.22; }
.kcard[data-card="lumen"] { --c: #2F5D46; --on: #FFFFFF; --sheen: 0.1; --key: 0.3402; --hair: 0; --sheen-ink: 255 255 255; --peak: 0.55; }
