/* Unusual Context paper, board and motion for the web. The values are the video engine's: the cork under its lamp
   and the frame's vignette,
   paper fiber laid over the paper color with an overlay blend (assets/paper-detail.png is the engine's normalized
   texture, at the strength the videos read at on a phone), shadows lit from the upper left, film grain over everything, pieces that slap down.
   Needs tokens.css (../tokens.css) and uc-marks.js for the highlighter, the marker circle, the ink filter and pins. */

/* ---- the board: the cork under its lamp, then the frame's vignette, the engine's own recipe ----
   CORK_FRAG (engine/src/gfx/shaders.ts): the cork's own color x (.26 + .34 x lamp) x a warm tint (1, .92, .82), the lamp
   falling off smoothly over 140 cq, 79% of the frame's long side. POST_FRAG: a .3 vignette over the whole frame, cards
   included, an ellipse 80% x 100% of it. The stops are computed from those formulas, not picked by eye. The lamp hangs
   over the screen, as over the videos' frame, and the cork scrolls under it. The cork tile spans about 1.3 card widths,
   as in the videos (70 cq against cards 45 to 60 cq wide). */
.uc-board { background: #af733f url(../assets/textures/cork.jpg); background-size: 760px; }
.uc-board::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  mix-blend-mode: multiply;
  background: radial-gradient(circle 79vmax at 50% 42%, #998d7d 0%, #978b7b 10%, #908476 20%, #867c6e 30%, #7a7164 40%,
    #6e655a 50%, #61594f 60%, #554e46 70%, #4b453e 80%, #453f38 90%, #423d36 100%);
}
.uc-board::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  mix-blend-mode: multiply;
  background: radial-gradient(ellipse 80% 100% at 50% 50%, #fff 21%, #fdfdfd 28%, #f3f3f3 35%, #e4e4e4 42%, #d3d3d3 49%,
    #c3c3c3 56%, #b7b7b7 63%, #b2b2b2 70%);
}
/* film grain over the whole page, like the videos' (a fixed layer, so it never scrolls with the content) */
.uc-grain::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 50;
  background: url(assets/grain.png);
  background-size: 256px;
  mix-blend-mode: soft-light;
  opacity: .42;
  pointer-events: none;
}

/* ---- paper ---- */
/* paper color, its fiber (overlay keeps the color and adds the texture), a faint light falloff from the upper left,
   and a two-layer shadow: a soft cast one and a tight contact one */
.uc-paper {
  --paper: var(--uc-paper-card);
  position: relative;
  color: var(--uc-ink);
  background-color: var(--paper);
  background-image: linear-gradient(140deg, rgb(255 255 255 / .08), rgb(255 255 255 / 0) 35%, rgb(40 25 10 / .13)),
    url(assets/paper-detail.png);
  background-size: auto, 460px;
  background-blend-mode: normal, overlay;
  box-shadow: .35rem .7rem 1.2rem rgb(18 10 4 / .5), .06rem .12rem .2rem rgb(18 10 4 / .38);
  transform: rotate(var(--tilt, 0deg));
}
.uc-label { --paper: var(--uc-paper-label); }
.uc-polaroid { --paper: var(--uc-paper-polaroid); }
.uc-tag { --paper: var(--uc-paper-tag); }

/* ---- type ---- */
/* typed: Courier Prime 700, uppercase and letterspaced, with the ink filter (rough edges, uneven density) */
.uc-typed {
  font: 700 1em/1.15 var(--uc-font-typed);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--uc-ink);
  filter: url(#uc-ink);
}
/* a card's typed header over a thin red rule (the rule is drawn ink too) */
.uc-card-head {
  margin: 0 0 1rem;
  padding-bottom: .5em;
  font: 700 .85rem/1.2 var(--uc-font-typed);
  text-transform: uppercase;
  letter-spacing: .12em;
  background: linear-gradient(var(--uc-red-rule), var(--uc-red-rule)) left bottom / 100% 1.5px no-repeat;
  filter: url(#uc-ink);
}
/* body copy on paper stays easy to read: the same ink, a lighter hand */
.uc-ink { filter: url(#uc-ink); }
/* handwriting in red marker */
.uc-hand { font: 700 1.35em/1.1 var(--uc-font-hand); color: var(--uc-marker-dark); filter: url(#uc-marker); }

/* ---- motion: pieces slap down, as in the videos (scale 1.3 -> 1 with a little overshoot, 0.32 s) ---- */
@media (prefers-reduced-motion: no-preference) {
  .uc-slap { animation: uc-slap .32s cubic-bezier(.34, 1.56, .64, 1) both; animation-delay: var(--delay, 0s); }
  .uc-pin { animation: uc-pin .2s ease-out both; animation-delay: calc(var(--delay, 0s) + .1s); }
}
@keyframes uc-slap {
  from { opacity: 0; transform: rotate(var(--tilt, 0deg)) scale(1.3); }
  25% { opacity: 1; }
  to { opacity: 1; transform: rotate(var(--tilt, 0deg)) scale(1); }
}
@keyframes uc-pin { from { opacity: 0; transform: scale(2.2); } to { opacity: 1; transform: scale(1); } }
