/* One card on black. The card is the design's own, 630 x 880, scaled whole
   to the window (--s, from card.js); the pointer tilts it and moves the
   light in its foil.

   Drawn to be cheap to move: every word, line and frame is printed once in
   plain silver, and the foil is layers laid over it that the pointer only
   slides (transform) or fades (opacity). The graphics card moves and blends
   those; nothing is painted again while the card is handled. */

@font-face { font-family: "Fira Code"; src: url("fonts/FiraCode-Regular-latin.woff2") format("woff2"); font-weight: 100 400; font-display: block; }
@font-face { font-family: "Fira Code"; src: url("fonts/FiraCode-Medium-latin.woff2") format("woff2"); font-weight: 500 900; font-display: block; }
@font-face { font-family: "Signs"; src: url("fonts/STIXTwoMath-signs.otf") format("opentype"); font-display: block; }

:root {
  color-scheme: dark;
  --s: 0.8;
  /* The silvers the foil is printed in: white for figures, darker for labels,
     and the frame's polished edge. */
  --silver: linear-gradient(170deg, #ffffff 0%, #c9ccd3 45%, #8a8d96 60%, #f1f2f4 100%);
  --silver-dim: linear-gradient(170deg, #b9bcc4 0%, #8e9099 45%, #61636b 60%, #a6a9b1 100%);
  --silver-edge: linear-gradient(140deg, #f4f5f7 0%, #9a9da6 22%, #4a4d55 44%, #e3e5ea 62%, #6f727b 82%, #c9ccd3 100%);
  /* The foil's colours, black and rainyseason.cr's two blues, one turn of
     them every 943px along the card's diagonal (115deg): the length of that
     line across the card, so the card holds one whole turn. */
  --pearl: repeating-linear-gradient(115deg, #046aef 0, #046aef 157px, #0033ff 314px, #000000 471px, #046aef 629px, #046aef 786px, #046aef 943px);
}
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; }
body { -webkit-tap-highlight-color: transparent; }

.room {
  position: fixed;
  inset: 0;
  touch-action: none;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}

.stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 630px;
  height: 880px;
  transform: translate(-50%, -50%) scale(var(--s));
}
.card {
  position: relative;
  width: 630px;
  height: 880px;
  perspective: 1400px;
  font-family: "Fira Code", ui-monospace, monospace;
  color: #f2f3f5;
  font-variant-ligatures: none;
}

/* The card turns over when it is tapped: the pointer's tilt on the outside,
   the half turn inside it, and the two faces back to back. */
.card { cursor: pointer; outline: none; }
.turn, .flip {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  will-change: transform;
}
.flip { transition: transform 0.9s cubic-bezier(0.65, 0, 0.35, 1); }
.flip.over { transform: rotateY(180deg); }
.edge {
  position: relative;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 14px;
  border-radius: 30px;
  overflow: hidden;
  background: var(--silver-edge);
  isolation: isolate;
}
.edge.back { position: absolute; inset: 0; transform: rotateY(180deg); }
.face {
  position: relative;
  height: 100%;
  box-sizing: border-box;
  border-radius: 16px;
  overflow: hidden;
  background: #08080a;
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
  isolation: isolate;
}
.engrave { position: absolute; left: -14px; top: -14px; pointer-events: none; will-change: opacity; }

/* The engraving shows only where the light is: the face's own black laid
   over it, with a clear spot that follows the pointer. */
.spot { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.spot i {
  position: absolute;
  left: calc(50% - 1500px);
  top: calc(50% - 1500px);
  width: 3000px;
  height: 3000px;
  background: radial-gradient(circle 400px at 50% 50%, rgba(8, 8, 10, 0) 0%, rgba(8, 8, 10, 0.55) 45%, #08080a 100%);
  will-change: transform;
}

.foil, .foil-dim, .note {
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.foil, .foil-dim { padding: 0.3em 0 0.2em; margin: -0.3em 0 -0.2em; }
.foil, .note, .kb.lit { background-image: var(--silver); }
.foil-dim, .kb.dim { background-image: var(--silver-dim); }

.head {
  position: relative;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  line-height: 0.72;
  letter-spacing: 0.16em;
}
.head .tail { margin-right: -0.16em; }

.name {
  position: relative;
  margin-top: 20px;
  display: flex;
  align-items: last baseline;
  justify-content: space-between;
}
.note {
  font-size: 70px;
  font-weight: 500;
  line-height: 0.72;
  letter-spacing: -0.04em;
  padding: 0.24em 0.06em 0.12em;
  margin: -0.24em 0 -0.12em var(--noteIn, -0.113em);
}
.hz { line-height: 0.72; }
.hz .foil { font-size: 34px; font-weight: 500; }
.hz .unit { font-size: 17px; font-weight: 400; margin-left: 8px; margin-right: -0.105em; }

.window {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  margin-top: 24px;
  padding: 2px;
  border-radius: 12px;
  background: var(--silver-edge);
  display: flex;
}
.glass {
  flex: 1;
  min-width: 0;
  border-radius: 10px;
  overflow: hidden;
  background: radial-gradient(ellipse 70% 62% at 50% 46%, #202127 0%, #0b0b0d 65%, #08080a 100%);
  display: flex;
  justify-content: center;
}
/* The close-up and its foil, one picture's size: the drawing's lines and
   the key take the card's pearl as the light moves, the key most. */
.pic {
  position: relative;
  height: 100%;
  aspect-ratio: 720 / 600;
  max-width: 100%;
  overflow: hidden;
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 62%, transparent 100%);
  mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 62%, transparent 100%);
}
.near { display: block; width: 100%; height: 100%; object-fit: contain; }
.holo {
  position: absolute;
  inset: 0;
  overflow: hidden;
  -webkit-mask: var(--m) center / contain no-repeat;
  mask: var(--m) center / contain no-repeat;
}
.holo i { position: absolute; inset: -150%; will-change: transform; }
/* The other keys stand back: their lines dimmed and left out of the foil,
   so the card's own key is the one that catches the light. */
.hush {
  position: absolute;
  inset: 0;
  background: #08080a;
  opacity: 0.55;
  -webkit-mask: linear-gradient(#000, #000), var(--maskUrl) center / contain no-repeat;
  -webkit-mask-composite: source-out;
  mask: linear-gradient(#000, #000), var(--maskUrl) center / contain no-repeat;
  mask-composite: subtract;
}
/* The lines of the card's key alone brightened in the pearl. */
.holo.lines {
  mix-blend-mode: color-dodge;
  opacity: 0.6;
  -webkit-mask: var(--nearUrl) center / contain no-repeat, var(--maskUrl) center / contain no-repeat;
  -webkit-mask-composite: source-in;
  mask: var(--nearUrl) center / contain no-repeat, var(--maskUrl) center / contain no-repeat;
  mask-composite: intersect;
}
.holo.lines i { background: var(--pearl); background-size: auto; }
/* The key itself in silver, laid into its own light and shade (lacquer is
   too dark to take it, so on a black key it is laid on as light). */
.holo.key { --m: var(--maskUrl); mix-blend-mode: multiply; opacity: 0.9; }
.black .holo.key { mix-blend-mode: screen; }
.holo.key i { inset: 0; background: var(--silver); will-change: auto; }
.black .holo.key i { inset: -150%; background: var(--pearl); will-change: transform; }
/* And a bright band across it where the light catches the foil. */
.holo.sheen { --m: var(--maskUrl); mix-blend-mode: overlay; }
.holo.sheen i { background: linear-gradient(115deg, transparent 45.5%, #ffffff 50%, transparent 54.5%); }

.data {
  position: relative;
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}
.cell {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 16px 18px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}
.cell.wide { grid-column: 1 / 3; padding: 18px 0; }
.cell.right { padding: 18px 0 18px 20px; border-left: 1px solid rgba(255, 255, 255, 0.14); }
.label { font-size: 13px; line-height: 0.72; letter-spacing: 0.14em; }
.value { font-size: 34px; font-weight: 500; line-height: 0.72; }

.keys { position: relative; height: 40px; }
.kb { position: absolute; inset: 0; }
.kb.dim { opacity: 0.5; -webkit-mask: var(--kbDim) 0 0 / 546px 40px no-repeat; mask: var(--kbDim) 0 0 / 546px 40px no-repeat; }
.kb.lit { -webkit-mask: var(--kbLit) 0 0 / 546px 40px no-repeat; mask: var(--kbLit) 0 0 / 546px 40px no-repeat; }

.foot {
  position: relative;
  margin-top: 30px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.mark { font-family: Signs; font-size: 34px; line-height: 1; position: relative; top: 1px; }
.brand { font-size: 17px; line-height: 0.72; }
.rights {
  position: relative;
  margin-top: calc(18px - 0.3em);
  text-align: center;
  font-size: 10px;
  line-height: 0.72;
  letter-spacing: 0.08em;
  opacity: 0.8;
}

/* The light on the face: a soft bloom of the blue where the pointer is,
   and a bright band across the card that travels with it. */
.wash, .glint { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.wash { mix-blend-mode: color-dodge; will-change: opacity; }
.wash i {
  position: absolute;
  left: calc(50% - 1100px);
  top: calc(50% - 1100px);
  width: 2200px;
  height: 2200px;
  background: radial-gradient(circle 560px at 50% 50%, rgba(4, 106, 239, 0.9) 0%, rgba(0, 51, 255, 0.35) 45%, rgba(0, 0, 0, 0) 100%);
  will-change: transform;
}
.glint { mix-blend-mode: overlay; will-change: opacity; }
.glint i {
  position: absolute;
  inset: -900px;
  background: linear-gradient(115deg, transparent calc(50% - 85px), #ffffff 50%, transparent calc(50% + 85px));
  will-change: transform;
}

/* The pearl over the whole card, border and face: it gives its colour to
   whatever is silver beneath it and leaves the black black (colour keeps
   the light and dark of what is under it and takes only its hue). */
.pearl {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 30px;
  pointer-events: none;
  mix-blend-mode: color;
  opacity: 0.62;
}
.pearl i {
  position: absolute;
  inset: -1000px;
  background: var(--pearl);
  will-change: transform;
}

/* The back, the same on every card: middle C's sound as rings round the
   mark, always there and brightest where the light is, and the line. */
.rings { position: absolute; left: 0; top: 0; pointer-events: none; }
.spot.soft i { background: radial-gradient(circle 400px at 50% 50%, rgba(8, 8, 10, 0) 0%, rgba(8, 8, 10, 0.23) 45%, rgba(8, 8, 10, 0.58) 100%); }
.big-mark {
  position: absolute;
  left: 0;
  right: 0;
  top: 274px;
  text-align: center;
  font-family: Signs;
  font-size: 250px;
  line-height: 1;
}
.line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  line-height: 0.72;
}
.line .words { font-size: 20px; }
.line .site { font-size: 14px; letter-spacing: 0.04em; }
@media (prefers-reduced-motion: reduce) { .flip { transition: none; } }
