/* =========================================================
   THEME
   ========================================================= */
:root {
  /* COLOURS — change them here, they update everywhere */
  --primary: #7D00FF;    /* violet: main texts, big words, my chat bubbles */
  --secondary: #FF5500;  /* orange: small texts, counter, restart, hints */
  --bg: #FFFFFF;

  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --edge: 8px; /* minimum gap between items and the screen edge */

  /* THE THREE TEXT SIZES */
  --fs-s: clamp(18px, 4.8vw, 25px);   /* small: info at the screen edges, notes */
  --fs-m: clamp(19px, 5.3vw, 29px);   /* medium: every other text (like "Click and drag…") */
  --fs-l: clamp(34px, 9.5vw, 96px);   /* large: titles, years */

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
}

/* =========================================================
   NO SCROLL, EVER
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  background: var(--page, var(--bg)) !important;
  transition: background-color .35s ease;
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--primary);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  position: fixed;   /* stops iOS rubber-band scrolling */
  inset: 0;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  touch-action: none;       /* we handle all gestures ourselves */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: crosshair;
  outline: none;
}
#stage:focus-visible { box-shadow: inset 0 0 0 3px var(--primary); }

/* =========================================================
   ITEMS
   .item   = position (moved by JS with translate)
   .inner  = tilt + appear animation
   ========================================================= */
.item {
  position: absolute;
  left: 0;
  top: 0;
  touch-action: none;
  cursor: grab;
  will-change: transform;
}
.item.dragging { cursor: grabbing; }

.inner {
  transform: rotate(var(--tilt, 0deg));
  transform-origin: center;
  animation: pop-in 420ms cubic-bezier(.2, 1.6, .4, 1) both;
  transition: transform 160ms ease;
}
.item.dragging .inner {
  transform: rotate(var(--tilt, 0deg)) scale(1.04);
}
.item.leaving .inner {
  animation: pop-out 320ms ease-in forwards;
}

/* text beats */
.item.text .inner {
  font-size: var(--fs-m);
  line-height: 1.05;
  font-weight: 700;
  white-space: pre-line;
  max-width: min(80vw, 520px);
  padding: 2px 4px;
}
.item.text.big .inner {
  font-size: var(--fs-l);
  line-height: 0.92;
  letter-spacing: -0.02em;
  max-width: 90vw;
}
.item.text.small .inner {
  font-size: var(--fs-s);
  font-weight: 400;
  color: var(--secondary);
}

/* image / video placeholders */
.item.media .inner {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--fill, #ddd);
  overflow: hidden;
}
.media .tag {
  position: absolute;
  left: 8px;
  top: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.media .tag small { font-weight: 400; opacity: .7; }

/* video placeholder extras: play triangle + looping progress bar */
.video .play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform: translate(-35%, -50%);
  border-style: solid;
  border-width: 16px 0 16px 26px;
  border-color: transparent transparent transparent var(--primary);
}
.video .bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  width: 100%;
  background: var(--secondary);
  transform-origin: left;
  animation: loop-bar 4s linear infinite;
}

/* typed text: blinking caret while typing */
.inner.caret::after {
  content: "";
  display: inline-block;
  width: 0.08em;
  height: 0.9em;
  margin-left: 0.05em;
  vertical-align: -0.08em;
  background: var(--primary);
  animation: blink 0.8s steps(2, start) infinite;
}

/* burst photos: snappier entrance, quicker exit */
.item.quick .inner { animation-duration: 260ms; }
.item.leaving-fast .inner { animation: pop-out 200ms ease-in forwards; }

/* chat */
.item.chat .inner {
  width: min(86vw, 460px);
  padding: 10px;
  background: var(--bg);
  border: 1.5px solid var(--primary);
  border-radius: 14px;
  font-size: var(--fs-m);
  line-height: 1.25;
}
.chat-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  padding: 0 0 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--secondary);
  color: var(--secondary);
}
.chat-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bubble {
  max-width: 80%;
  padding: 7px 11px;
  border-radius: 16px;
  word-wrap: break-word;
  animation: bubble-in 240ms cubic-bezier(.2, 1.5, .4, 1) both;
}
.bubble.them {
  align-self: flex-start;
  color: var(--secondary);
  border: 1.5px solid var(--secondary);
  border-bottom-left-radius: 4px;
}
.bubble.me {
  align-self: flex-end;
  background: var(--primary);
  color: var(--bg);
  border-bottom-right-radius: 4px;
}
.bubble.dots { display: flex; gap: 4px; padding: 10px 12px; }
.bubble.dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: dot 1s ease-in-out infinite;
}
.bubble.dots i:nth-child(2) { animation-delay: .15s; }
.bubble.dots i:nth-child(3) { animation-delay: .3s; }

/* intro title: big but a bit smaller than "big" so the whole title fits */
.item.text.title .inner {
  font-size: var(--fs-l);
  line-height: 0.95;
  letter-spacing: -0.02em;
  max-width: min(90vw, 1000px);
}

/* subtitle under the title: orange, readable */
.item.text.sub .inner {
  font-size: var(--fs-m);
  font-weight: 500;
  color: var(--secondary);
}
.item.align-center .inner { text-align: center; }

/* body copy: regular weight, comfortable reading width */
.item.text.body .inner {
  font-size: var(--fs-m);
  font-weight: 400;
  line-height: 1.25;
  max-width: min(82vw, 460px);
}
/* small orange note, e.g. a year */
.item.text.note .inner {
  font-size: var(--fs-s);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--secondary);
}

/* lines that appear one at a time */
.line { display: block; visibility: hidden; }
.line.on { visibility: visible; }

/* words that appear one at a time */
.word { visibility: hidden; }
.word.on { visibility: visible; }

/* real photos */
.item.photo .inner { position: relative; width: 100%; height: 100%; overflow: hidden; background: none; }
.item.photo img {
  display: block;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}
.item.photo .pic { width: 100%; height: 100%; object-fit: cover; }
.item.polaroid .inner {
  background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 4px 14px rgba(0,0,0,.14);
}
.item.pixelated img { image-rendering: pixelated; image-rendering: crisp-edges; image-rendering: pixelated; }

/* REVEAL — the colour wash that slides off the photo and back, like the GANNI gif.
   The mask is a soft-edged gradient twice the photo's height that slides up/down. */
.wash {
  position: absolute;
  inset: 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 45.45%, #000 54.55%);
          mask-image: linear-gradient(to bottom, transparent 45.45%, #000 54.55%);
  -webkit-mask-size: 100% 220%;   /* soft edge = 20% of the photo, fully off-photo at both ends */
          mask-size: 100% 220%;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: 0 100%;
          mask-position: 0 100%;
  animation: wash-loop 4.5s infinite;
}
.wash.once { animation-name: wash-once; animation-duration: 1.6s; animation-iteration-count: 1; animation-fill-mode: forwards; }
.wash.solid { background: var(--wash); }
.wash .mask {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.wash .sil {
  position: absolute;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: drop-shadow(var(--w) 0 0 var(--wash));
}

@keyframes wash-loop {
  0%, 18%   { -webkit-mask-position: 0 100%; mask-position: 0 100%; animation-timing-function: cubic-bezier(.45,0,.55,1); }
  46%, 64%  { -webkit-mask-position: 0 0;    mask-position: 0 0;    animation-timing-function: cubic-bezier(.45,0,.55,1); }
  94%, 100% { -webkit-mask-position: 0 100%; mask-position: 0 100%; }
}
/* photo hidden until its coloured silhouette is ready */
.inner.waiting .pic, .inner.waiting .wash { visibility: hidden; }
@keyframes wash-once {
  0%, 15% { -webkit-mask-position: 0 100%; mask-position: 0 100%; animation-timing-function: cubic-bezier(.45,0,.55,1); }
  100%    { -webkit-mask-position: 0 0;    mask-position: 0 0; }
}

/* strike-through: a line drawn across a phrase */
.strike { position: relative; }
.strike::after {
  content: "";
  position: absolute;
  left: -2%;
  right: -2%;
  top: 52%;
  height: 0.1em;
  min-height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
}
.strike.on::after { animation: strike 420ms cubic-bezier(.6,0,.3,1) forwards; }
@keyframes strike { to { transform: scaleX(1); } }

/* STACK — photos slide up from below in stop-motion steps, then leave upwards */
.item.stacked .inner { animation: stack-in 760ms both; }
.item.leaving-stack .inner { animation: stack-out 640ms both; }
@keyframes stack-in {
  0%   { transform: translateY(110vh) rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  14%  { transform: translateY(62vh)  rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  28%  { transform: translateY(32vh)  rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  42%  { transform: translateY(14vh)  rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  56%  { transform: translateY(5vh)   rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  70%  { transform: translateY(1.5vh) rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  84%, 100% { transform: translateY(0) rotate(var(--tilt)); }
}
@keyframes stack-out {
  0%   { transform: translateY(0)      rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  16%  { transform: translateY(-1.5vh) rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  32%  { transform: translateY(-6vh)   rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  48%  { transform: translateY(-18vh)  rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  64%  { transform: translateY(-40vh)  rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  80%  { transform: translateY(-75vh)  rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  100% { transform: translateY(-130vh) rotate(var(--tilt)); }
}

/* stack variants: arrive from the top / leave downwards (away from the texts) */
.item.stacked.from-top .inner { animation-name: stack-in-top; }
.item.leaving-stack.down .inner { animation-name: stack-out-down; }
@keyframes stack-in-top {
  0%   { transform: translateY(-110vh) rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  14%  { transform: translateY(-62vh)  rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  28%  { transform: translateY(-32vh)  rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  42%  { transform: translateY(-14vh)  rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  56%  { transform: translateY(-5vh)   rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  70%  { transform: translateY(-1.5vh) rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  84%, 100% { transform: translateY(0) rotate(var(--tilt)); }
}
@keyframes stack-out-down {
  0%   { transform: translateY(0)     rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  16%  { transform: translateY(1.5vh) rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  32%  { transform: translateY(6vh)   rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  48%  { transform: translateY(18vh)  rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  64%  { transform: translateY(40vh)  rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  80%  { transform: translateY(75vh)  rotate(var(--tilt)); animation-timing-function: steps(1, end); }
  100% { transform: translateY(130vh) rotate(var(--tilt)); }
}

/* video: sound button + subtitles */
.sound {
  position: absolute;
  right: 6px;
  top: 6px;
  padding: 6px 8px;
  border: 0;
  background: var(--secondary);
  color: #FFFFFF;
  font: 700 11px/1 var(--font);
  letter-spacing: 0.06em;
  cursor: pointer;
  touch-action: manipulation;
}
.subs {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 8%;
  text-align: center;
  font: 700 clamp(12px, 3.4vw, 18px)/1.2 var(--font);
  color: #FFFFFF;
  text-shadow: 0 0 4px rgba(0,0,0,.9), 0 1px 2px rgba(0,0,0,.9);
  visibility: hidden;
  pointer-events: none;
}

/* links inside texts */
.item.text a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 0.07em;
  text-underline-offset: 0.15em;
  cursor: pointer;
  touch-action: manipulation;
}

/* cursor that shows a link is clickable: pixel arrow glides in, clicks twice, fades */
.cursor-hint {
  position: absolute;
  width: 22px;              /* 11 × 17 pixel grid → 2 px per square */
  height: 34px;
  margin: 0;                /* the arrow tip (top-left square) sits on the point */
  pointer-events: none;
  z-index: 2;
  image-rendering: pixelated;
  animation: cursor-move 3s ease-out forwards;
}
.cursor-hint svg { display: block; animation: cursor-press 3s ease-in-out forwards; transform-origin: 0 0; }
@keyframes cursor-move {
  0%   { opacity: 0; transform: translate(34px, 30px); }
  12%  { opacity: 1; }
  30%  { transform: translate(0, 0); }
  85%  { opacity: 1; transform: translate(0, 0); }
  100% { opacity: 0; transform: translate(0, 0); }
}
@keyframes cursor-press {
  0%, 36%, 46%, 56%, 66%, 100% { transform: scale(1); }
  41%, 61% { transform: scale(.82); }
}

/* DECK — cards fly out of a point and land fanned out */
.item.card .inner { box-shadow: 0 1px 2px rgba(0,0,0,.14), 0 6px 18px rgba(0,0,0,.16); }
.item.dealt .inner { animation: deal 520ms cubic-bezier(.2,.9,.25,1.05) both; }
@keyframes deal {
  0%   { opacity: 0; transform: translate(var(--fx, 0), var(--fy, 0)) rotate(0deg) scale(.15); }
  25%  { opacity: 1; }
  100% { opacity: 1; transform: rotate(var(--tilt)) scale(1); }
}

/* POSTCARD — after 00_REFERENCES/cartoline: coloured-frame cards and cream
   stamp-edged cards, the city name in a retro display font with a solid shadow */
.item.postcard .inner {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 2.75%;
  background: var(--frame);
  box-shadow: 0 2px 4px rgba(0,0,0,.16), 0 10px 26px rgba(0,0,0,.20);
}
.item.pc-rect .pc-pic { border-radius: 6% / 9%; }
/* wavy-edged cream card: the outline is an SVG mask set in JS; shadow on the outer item */
.item.pc-wavy .inner {
  background: #F6EEE3;
  padding: 3.5%;
  box-shadow: none;
  -webkit-mask-size: 100% 100%;
          mask-size: 100% 100%;
}
.item.pc-wavy { filter: drop-shadow(0 6px 14px rgba(0,0,0,.22)); }
.item.pc-wavy .pc-pic { border-radius: 2px; }
.pc-pic {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.pc-pic .pic { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6%;
  padding: 0 5% 0.12em;
  overflow: hidden;
  text-align: center;
  line-height: 1;
  white-space: nowrap;
  text-shadow:
    1px 1px 0 var(--shade), 2px 2px 0 var(--shade), 3px 3px 0 var(--shade),
    4px 4px 0 var(--shade), 5px 5px 0 rgba(0,0,0,.35);
}

/* a text sitting on top of photos gets a white label behind it */
.item.text.boxed .inner {
  background: var(--bg);
  padding: 6px 9px;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
}

/* screen recording shown like a phone */
.item.phone .inner {
  border-radius: 9% / 4.2%;
  border: 5px solid #111111;
  box-shadow: 0 8px 22px rgba(0,0,0,.22);
  background: #111111;
}

/* MARQUEE — giant, vertically stretched, endlessly scrolling word */
.marquee {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
  pointer-events: none;           /* taps go through to the canvas */
  color: var(--primary);
}
.marquee.color-secondary { color: var(--secondary); }
.marquee span {
  display: inline-block;
  white-space: nowrap;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  transform-origin: left center;
  will-change: transform;
  animation: marquee linear infinite;
}
@keyframes marquee {
  from { transform: translateX(var(--from)) scaleY(var(--sy)); }
  to   { transform: translateX(var(--to))   scaleY(var(--sy)); }
}
.marquee.leaving { animation: none; }
.marquee.leaving span { opacity: 0; transition: opacity .3s; }

strong { font-weight: 800; }

/* CODE column — the CV streaming like code */
.codecol {
  position: absolute;
  overflow: hidden;
  pointer-events: none;
  color: #FFFFFF;
  font: 400 clamp(11px, 2.9vw, 13px)/1.45 ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
.codecol.full { inset: calc(var(--band-t) + 8px) 14px calc(var(--band-b) + 8px) 14px; opacity: .9; }
.codecol.half { top: calc(var(--band-t) + 8px); bottom: calc(var(--band-b) + 8px); width: 46vw; }
.codecol.half.left { left: 2vw; }
.codecol.half.right { right: 2vw; }
.codefeed { transition: transform .25s ease-out; padding-bottom: 18px; }
.codefeed > div { animation: code-in .18s ease-out both; }
.codecol .c-head { margin-top: .9em; font-weight: 700; opacity: .75; }
.codecol .c-year { opacity: .6; }
@keyframes code-in { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
body:not(.dark-page) .codecol { color: var(--primary); }

/* BOOK — 3D: front + back covers, spine, page edges */
.item.book .inner { width: 100%; height: 100%; perspective: 1400px; overflow: visible; background: none; }
.book3d {
  position: relative;
  width: var(--w);
  height: var(--h);
  transform-style: preserve-3d;
  animation: book-in 1.2s cubic-bezier(.2,.8,.2,1) both, book-turn 9s ease-in-out 1.2s infinite;
}
.bf { position: absolute; backface-visibility: hidden; }
.bf.front, .bf.back { width: var(--w); height: var(--h); }
.bf.front { transform: translateZ(calc(var(--d) / 2)); box-shadow: inset 3px 0 4px rgba(0,0,0,.22), inset -2px 0 3px rgba(255,255,255,.25); }
.bf.back  { transform: rotateY(180deg) translateZ(calc(var(--d) / 2)); }
.bf .cover { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.bf.spine {
  width: var(--d); height: var(--h); left: calc(50% - var(--d) / 2);
  background: var(--spine);
  transform: rotateY(-90deg) translateZ(calc(var(--w) / 2));
  box-shadow: inset 0 0 6px rgba(0,0,0,.35);
}
.bf.pages-r {
  width: var(--d); height: calc(var(--h) - 4px); top: 2px; left: calc(50% - var(--d) / 2);
  background: linear-gradient(90deg, #b9b2a3, #ebe5d8 35%, #d6cfbf), repeating-linear-gradient(0deg, #f6f2e8 0 1px, #d8d1c2 1px 2px);
  background-blend-mode: multiply;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.12);
  transform: rotateY(90deg) translateZ(calc(var(--w) / 2 - 2px));
}
.bf.pages-t, .bf.pages-b {
  width: calc(var(--w) - 4px); height: var(--d); left: 2px; top: calc(50% - var(--d) / 2);
  background: repeating-linear-gradient(0deg, #fbfaf6 0 1px, #e3e0d8 1px 2px);
}
.bf.pages-t { transform: rotateX(90deg) translateZ(calc(var(--h) / 2 - 2px)); }
.bf.pages-b { transform: rotateX(-90deg) translateZ(calc(var(--h) / 2 - 2px)); }
.item.book { filter: drop-shadow(0 18px 22px rgba(0,0,0,.28)); }
.book-year {
  position: absolute;
  left: 50%;
  bottom: 100%;
  margin-bottom: .18em;
  translate: -50% 0;                             /* composes with the pop-in animation */
  font: 700 var(--fs-m)/1 var(--font);           /* site font, medium size */
  color: var(--primary);
  background: #FFFFFF;                           /* white pill */
  padding: .1em .5em .12em;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  animation: pop-in 420ms cubic-bezier(.2, 1.6, .4, 1) .9s both;
}
@keyframes book-in {   /* no opacity here: animating opacity flattens the 3D book (no page edges) */
  0%   { transform: rotateX(0deg) rotateY(calc(var(--rest) - 70deg)) scale(.85); }
  100% { transform: rotateX(0deg) rotateY(var(--rest)) scale(1); }
}
@keyframes book-sway {
  0%, 100% { transform: rotateX(10deg) rotateY(var(--rest)); }
  50%      { transform: rotateX(7deg) rotateY(calc(var(--rest) * 0.55)); }
}

/* text colour override */
.item.text.color-secondary .inner { color: var(--secondary); }
.item.text.color-primary .inner { color: var(--primary); }
.item.text.color-white .inner { color: #FFFFFF; }
body.dark-page .ui { color: #FFFFFF; }   /* on a coloured page the UI turns white */
/* …and so do texts, the caret and the marquee */
body.dark-page .item.text:not(.color-secondary) .inner { color: #FFFFFF; }
body.dark-page .inner.caret::after { background: #FFFFFF; }
body.dark-page .marquee:not(.color-secondary) { color: #FFFFFF; }
body.dark-page .item.text.boxed .inner { background: var(--primary); box-shadow: 0 0 0 2px #FFFFFF; }
body.dark-page .item.text.box-light.boxed .inner, body.dark-page .item.text.box-light .inner { background: #FFFFFF; color: var(--primary); box-shadow: 0 4px 14px rgba(0,0,0,.18); padding: 6px 9px; }
body.dark-page .item.text.box-light .inner.caret::after { background: var(--primary); }
.item.text.color-white .inner.caret::after { background: #FFFFFF; }

/* =========================================================
   FIXED CONTROLS
   ========================================================= */
.ui {
  position: fixed;
  z-index: 100000;
  font: 400 var(--fs-s)/1 var(--font);   /* small size, regular weight */
  letter-spacing: 0.03em;
  color: var(--secondary);
}
.ui-progress {
  top: calc(var(--safe-t) + 12px);
  left: calc(var(--safe-l) + 12px);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.ui-progress.bump { animation: bump 300ms ease; }
/* desktop / tablet landscape: UI 10% smaller than the body texts */
@media (orientation: landscape) and (min-width: 601px) {
  :root { --fs-s: clamp(16px, 4.3vw, 22.5px); }   /* small info a bit smaller on desktop */
}

/* the two UI bands: counter + RESTART on top, contact links at the bottom.
   They are painted in the page colour above every item, so nothing ever covers the UI;
   placement and dragging keep things between them. */
:root {
  --band-t: calc(var(--safe-t) + var(--fs-s) + 24px);
  --band-b: calc(var(--safe-b) + var(--fs-s) + 24px);
}
.ui-band {
  position: fixed;
  left: 0; right: 0;
  z-index: 99999;                       /* above all items, below the UI texts */
  background: var(--page, var(--bg));
  pointer-events: none;
  transition: background .3s;
}
.ui-band-top { top: 0; height: var(--band-t); }
.ui-band-bottom { bottom: 0; height: var(--band-b); }

/* contact links: always at the bottom, EMAIL ME left, ACTUAL PORTFOLIO right */
.ui-contact {
  left: calc(var(--safe-l) + 4px);
  right: calc(var(--safe-r) + 4px);
  bottom: calc(var(--safe-b) + 4px);
  display: flex;
  justify-content: space-between;
}
.ui-contact .ui-email { order: -1; }
.ui-cv { margin-left: auto; margin-right: 1.6em; }   /* CV sits right before ACTUAL PORTFOLIO */
.ui-link { white-space: nowrap; }
@media (max-width: 600px) { .ui-cv { margin-right: .6em; } .ui-link { padding-left: 4px; padding-right: 4px; } }
.ui-portfolio { order: 1; }
.ui-link {
  color: inherit;
  text-decoration: none;
  padding: 8px;
  touch-action: manipulation;
}
.ui-link:hover, .ui-link:focus-visible { text-decoration: underline; outline: none; }
.ui-link[hidden] { display: none; }
.ui-restart {
  top: calc(var(--safe-t) + 4px);
  right: calc(var(--safe-r) + 4px);
  padding: 8px;               /* bigger tap target than it looks */
  background: none;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}
.ui-restart:hover, .ui-restart:focus-visible { text-decoration: underline; outline: none; }

/* =========================================================
   ANIMATIONS
   ========================================================= */
@keyframes pop-in {
  0%   { opacity: 0; transform: rotate(calc(var(--tilt, 0deg) * -2)) scale(.3); }
  100% { opacity: 1; transform: rotate(var(--tilt, 0deg)) scale(1); }
}
@keyframes pop-out {
  0%   { opacity: 1; transform: rotate(var(--tilt, 0deg)) scale(1); }
  30%  { opacity: 1; transform: rotate(var(--tilt, 0deg)) scale(1.08); }
  100% { opacity: 0; transform: rotate(calc(var(--tilt, 0deg) + 12deg)) scale(.2); }
}
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(6px) scale(.85); }
  to   { opacity: 1; transform: none; }
}
@keyframes dot {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-4px); opacity: 1; }
}
@keyframes loop-bar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes blink { to { visibility: hidden; } }
@keyframes bump {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

@media (prefers-reduced-motion: reduce) {
  .book3d { animation: none; transform: rotateX(8deg) rotateY(var(--rest)); }
  .marquee span { animation: none; transform: translateX(4vw) scaleY(var(--sy)); }
  .wash { display: none; }
  .inner, .item.leaving .inner, .item.leaving-fast .inner, .item.leaving-stack .inner, .item.dealt .inner, .bubble,
  .bubble.dots i, .inner.caret::after, .video .bar, .ui-progress.bump {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }
  .inner { transition: none; }
}

/* iMessage photo bubble: grey bubble with a tail at the bottom-left */
.item.imsg .inner {
  overflow: visible;
  background: #E9E9EB;
  padding: 5px;
  border-radius: 22px;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.item.imsg .inner img { border-radius: 17px; display: block; width: 100%; height: 100%; object-fit: cover; }
.item.imsg .inner::before,
.item.imsg .inner::after {
  content: "";
  position: absolute;
  bottom: 0;
  height: 22px;
}
.item.imsg .inner::before { left: -7px; width: 22px; background: #E9E9EB; border-bottom-right-radius: 16px 14px; }
.item.imsg .inner::after  { left: -10px; width: 10px; background: var(--page, var(--bg)); border-bottom-right-radius: 10px; }

/* ZINE — stapled paper zine whose pages turn in 3D */
.item.zine .inner { width: 100%; height: 100%; overflow: visible; background: none; perspective: 2400px; }
.zine-book {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform .8s cubic-bezier(.45,.05,.3,1);
}
.zine-book.closed { transform: translateX(calc(var(--pw) * -0.5)); }   /* closed: only the cover, centred */
.zbase, .zleaf { position: absolute; left: 50%; top: 0; width: 50%; height: 100%; }
.zleaf {
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform .95s cubic-bezier(.45,.05,.3,1);
}
.zleaf.turned { transform: rotateY(-179.5deg); }
.zface, .zbase {
  background-color: #F4F1E9;
  box-shadow: 0 10px 22px rgba(0,0,0,.22), 0 1px 2px rgba(0,0,0,.18);
}
.zface {
  position: absolute; inset: 0;
  overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.zface.back { transform: rotateY(180deg); }
/* the photo, printed on the paper (multiply = ink on paper), a bit crooked */
.zimg {
  position: absolute; left: 10%; top: 10%; width: 80%; height: 80%;
  object-fit: contain;
  transform: translate(var(--zx, 0), var(--zy, 0)) rotate(var(--zt, 0deg));
  mix-blend-mode: multiply;
  filter: saturate(.92) contrast(1.03);
  pointer-events: none;
}
.zimg.bleed { left: 0; top: 0; width: 100%; height: 100%; object-fit: cover; transform: none; }
/* paper grain + the fold shading near the spine, over the print */
.zface::after, .zbase::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .45  0 0 0 0 .42  0 0 0 0 .38  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
  opacity: .5;
}
.zface.front::before, .zbase::before, .zface.back::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
}
.zface.front::before, .zbase::before { background: linear-gradient(to right, rgba(0,0,0,.22), rgba(0,0,0,.05) 7%, transparent 16%); }
.zface.back::before  { background: linear-gradient(to left,  rgba(0,0,0,.22), rgba(0,0,0,.05) 7%, transparent 16%); }
/* while a leaf turns, its paper darkens and lightens like it's catching the light */
.zleaf.turning .zface::before { animation: z-light .95s ease-in-out; }
@keyframes z-light { 0%, 100% { opacity: 1; } 50% { opacity: 1; box-shadow: inset 0 0 0 999px rgba(0,0,0,.12); } }
.zstaples { position: absolute; left: calc(50% - 1.5px); top: 0; width: 3px; height: 100%; transform: translateZ(2px); pointer-events: none; transition: opacity .3s; }
.zstaples::before, .zstaples::after {
  content: ""; position: absolute; left: 0; width: 3px; height: 11%;
  background: linear-gradient(to right, #8d8d8d, #e2e2e2, #8d8d8d); border-radius: 2px;
}
.zstaples::before { top: 22%; }
.zstaples::after { bottom: 22%; }
.zine-book.closed .zstaples { opacity: 0; }

/* CARDS — wall of project covers seen through a window; the camera moves, the window stays */
.item.cards .inner { width: 100%; height: 100%; overflow: hidden; background: none; border-radius: 4px; }
.cards-wall {
  position: absolute; left: 0; top: 0;
  transform-origin: 0 0;
  transition: transform .75s cubic-bezier(.65,0,.25,1);
  will-change: transform;
}
.pcard {
  position: absolute;
  border-radius: 14px;
  overflow: hidden;
  background: #E9E9EB;
  box-shadow: 0 6px 16px rgba(0,0,0,.14);
}
.pcard-img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.pcard-pill {
  position: absolute; left: 8%; right: 8%; top: 44%;
  display: flex; align-items: center; justify-content: space-between; gap: .5em;
  background: #FFFFFF; color: #111111; text-decoration: none;
  border-radius: 999px;
  padding: .45em .45em .45em .9em;
  font: 500 clamp(11px, 1.1vw, 14px)/1.1 var(--font);
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  touch-action: manipulation;
}
.pcard-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard-go {
  flex: none; width: 1.7em; height: 1.7em; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary); color: #FFFFFF; font-weight: 700;
}
@media (prefers-reduced-motion: reduce) { .cards-wall { transition-duration: .01s; } }

/* SLIDES — big straight photos sliding in from the right, nothing else */
.item.slide .inner { width: 100%; height: 100%; animation: slide-in .55s cubic-bezier(.2,.8,.2,1) both; }
.item.slide .pic { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
@keyframes slide-in { from { transform: translateX(110vw); } to { transform: none; } }

/* COLLAGE — full-screen changing panels + one white project card in front */
.collage { position: absolute; left: 0; right: 0; overflow: hidden; }
.collage-bg { position: absolute; inset: 0; }
.collage-tile { position: absolute; object-fit: cover; display: block; pointer-events: none; }
.collage-card {
  position: absolute; top: var(--cy); transform: translateY(-50%);
  display: flex; flex-direction: column; gap: .5em;
  background: #FFFFFF; color: var(--primary); text-decoration: none;
  padding: 14px 14px 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  touch-action: manipulation;
}
.collage-title { font: 700 var(--fs-m)/1 var(--font); text-transform: uppercase; letter-spacing: -.01em; }
.collage-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; pointer-events: none; }

/* LAPTOP — 3D, seen from above-front; .open lifts the lid */
.item.laptop .inner { width: 100%; height: 100%; overflow: visible; background: none; perspective: 2400px; perspective-origin: 50% 20%; }
.lt-rig {
  position: absolute; left: 50%; top: 58%;
  width: var(--W); height: var(--D);
  margin: calc(var(--D) / -2) 0 0 calc(var(--W) / -2);
  transform-style: preserve-3d;
  transform: rotateX(58deg) rotateZ(-32deg);
}
.lt-base {
  position: absolute; inset: 0;
  border-radius: calc(var(--W) * .03);
  background: linear-gradient(160deg, #f1f2f4, #d4d6da 60%, #c4c7cc);
  box-shadow: 0 0 0 1px rgba(0,0,0,.08), 30px 40px 60px rgba(0,0,0,.25);
  transform-style: preserve-3d;
}
.lt-front {   /* the thin front edge of the base */
  position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--W) * .018);
  background: linear-gradient(#cfd2d6, #9fa3a8);
  transform-origin: 50% 100%; transform: rotateX(-90deg);
  border-radius: 0 0 6px 6px;
}
.lt-keys {
  position: absolute; left: 8%; right: 8%; top: 9%; height: 46%;
  border-radius: 6px;
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(var(--W) * .052), #c9ccd1 calc(var(--W) * .052) calc(var(--W) * .058)),
    repeating-linear-gradient(0deg, transparent 0 calc(var(--W) * .05), #c9ccd1 calc(var(--W) * .05) calc(var(--W) * .057)),
    #1d1e21;
  box-shadow: inset 0 0 0 2px #b9bcc1;
}
.lt-pad { position: absolute; left: 32%; right: 32%; top: 62%; bottom: 7%; border-radius: 8px;
  background: linear-gradient(160deg, #e6e7ea, #cfd1d5); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.lt-lid {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  transform-origin: 50% 0;
  transform: translateZ(2px) rotateX(0deg);
  transform-style: preserve-3d;
  transition: transform 1.3s cubic-bezier(.3,.1,.2,1);
}
.item.laptop.open .lt-lid { transform: translateZ(2px) rotateX(108deg); }
.item.laptop.closing .lt-lid { transition-duration: .55s; transition-timing-function: cubic-bezier(.6,0,.9,.6); }
.lt-shell, .lt-display { position: absolute; inset: 0; border-radius: calc(var(--W) * .03); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.lt-shell { background: linear-gradient(160deg, #e9eaed, #c9ccd1); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.lt-display { transform: rotateX(180deg); background: #0d0d0e; padding: calc(var(--W) * .022) calc(var(--W) * .022) calc(var(--W) * .04); }
.lt-screen { position: relative; width: 100%; height: 100%; overflow: hidden; background: #FFFFFF; border-radius: 2px; }
.lt-site { display: block; width: 100%; height: auto; pointer-events: none; }
.lt-ribbons { position: absolute; right: 9%; top: 0; display: flex; gap: calc(var(--W) * .015); }
.lt-ribbon {
  display: grid; place-items: center;
  width: calc(var(--W) * .06); height: calc(var(--W) * .085); padding-bottom: calc(var(--W) * .018);
  font: 700 calc(var(--W) * .024)/1 var(--font);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
}
/* FLIPBOOK — open magazine from above, pages turning fast */
.item.flipbook .inner { width: 100%; height: 100%; overflow: visible; background: none; perspective: 2200px; }
.fb-half, .fb-leaf { position: absolute; top: 0; width: 50%; height: 100%; }
.fb-half { background: #F7F5F0 no-repeat; background-size: 200% 100%; box-shadow: 0 12px 30px rgba(0,0,0,.25); }
.fb-l { left: 0; }
.fb-r { left: 50%; }
.fb-l.blank { visibility: hidden; }
.fb-gutter { position: absolute; left: 47%; width: 6%; top: 0; height: 100%; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,.18) 45%, rgba(0,0,0,.22) 50%, rgba(0,0,0,.18) 55%, transparent); }
.fb-leaf { left: 50%; transform-origin: 0 50%; transform-style: preserve-3d; animation: fb-turn linear both; z-index: 2; }
.fb-face { position: absolute; inset: 0; background: #F7F5F0 no-repeat; background-size: 200% 100%; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.fb-face.plain { background: #EDEAE2; }
.fb-back { transform: rotateY(180deg); }
@keyframes fb-turn { from { transform: rotateY(0); } to { transform: rotateY(-180deg); } }

/* FLICK pile */
.item.flick .inner { width: 100%; height: 100%; box-shadow: 0 6px 16px rgba(0,0,0,.18); }
.item.flick .pic { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }

/* chat: a centred line, like a system message ("And Vaste Programme was born.") */
.bubble.note { align-self: center; background: none; color: var(--primary); font-size: .7em; padding: .4em 0 0; border: 0; box-shadow: none; }

/* RECEIPT — thermal paper, monospace, torn zigzag bottom; .crumpled = paper ball */
.item.receipt .inner { background: none; overflow: visible; }
.rc-paper {
  position: relative; margin: 0;
  background-color: #FBFAF7;
  color: #222222;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  line-height: 1.25;
  white-space: pre;
  padding: 1.6em 1.4em 2.6em;
  box-shadow: 0 10px 24px rgba(0,0,0,.22);
  background-image:
    linear-gradient(172deg, transparent 0 30%, rgba(0,0,0,.05) 31%, transparent 34%),
    linear-gradient(8deg, transparent 0 58%, rgba(0,0,0,.045) 59%, transparent 62%),
    linear-gradient(95deg, transparent 0 46%, rgba(255,255,255,.6) 47%, transparent 50%);
  -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - 10px) no-repeat,
                conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 14px 10px repeat-x;
          mask: linear-gradient(#000 0 0) top / 100% calc(100% - 10px) no-repeat,
                conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 14px 10px repeat-x;
  transform-origin: 50% 0;
  animation: rc-print 2.2s steps(18, end) both;     /* prints out line by line */
  transition: transform .5s cubic-bezier(.5,0,.3,1.4), border-radius .5s;
}
@keyframes rc-print { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }


/* BACK arrow — left edge, middle */
.ui-back {
  left: calc(var(--safe-l) + 6px); top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; padding: 10px 6px;
  background: none; border: 0; cursor: pointer; touch-action: manipulation;
}
.ui-back svg { width: 100%; height: 100%; display: block; }
.ui-back[hidden] { display: none; }
.ui-back:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
/* while replaying (going back), skip the entrance animations */
body.fast .inner, body.fast .rc-paper, body.fast .book3d, body.fast .lt-lid { animation-duration: 1ms !important; transition-duration: 1ms !important; }

/* a list running behind texts: lighter, so the texts stay readable */
.codecol.faint { opacity: .4; }

/* after landing, the books turn slowly back and forth (no opacity: it would flatten the 3D) */
@keyframes book-turn {
  0%, 100% { transform: rotateX(0deg) rotateY(var(--rest)); }
  50%      { transform: rotateX(0deg) rotateY(calc(var(--rest) + 28deg)); }
}

/* WIPE — white panel sweeping left → right */
.wipe-panel { position: absolute; left: 0; right: 0; background: #FFFFFF; animation: wipe-lr ease-in-out both; pointer-events: none; }
@keyframes wipe-lr { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* LANYARD — strap from the top, metal clip, card; swings like a pendulum */
.lanyard { position: absolute; width: 0; height: 0; pointer-events: none; }
.ly-swing { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: auto; cursor: grab; touch-action: none; }
.ly-strap {
  position: absolute; left: calc(var(--cw) * -.06); top: -40px;
  width: calc(var(--cw) * .12); height: calc(var(--strap) + 40px);
  background: linear-gradient(90deg, #5e0f12, #7c1a1d 30%, #8e2326 50%, #7c1a1d 70%, #5e0f12);
  box-shadow: 2px 0 6px rgba(0,0,0,.18);
}
.ly-clip {
  position: absolute; left: calc(var(--cw) * -.05); top: calc(var(--strap) - 6px);
  width: calc(var(--cw) * .1); height: calc(var(--cw) * .16);
  border-radius: 40% 40% 30% 30%;
  background: linear-gradient(90deg, #8d9096, #f2f3f5 45%, #a6a9ae 60%, #6f7277);
  box-shadow: 0 2px 4px rgba(0,0,0,.3);
}
.ly-clip i { position: absolute; left: 30%; right: 30%; top: 18%; height: 40%; border-radius: 40%; background: rgba(0,0,0,.25); }
.ly-card {
  position: absolute; left: calc(var(--cw) * -.5); top: calc(var(--strap) + var(--cw) * .13);
  width: var(--cw);
  border-radius: calc(var(--cw) * .04);
  overflow: hidden; background: #FFFFFF;
  box-shadow: 0 14px 28px rgba(0,0,0,.25), 0 0 0 1px rgba(0,0,0,.06);
}
.ly-card img { display: block; width: 100%; height: auto; pointer-events: none; }
.ly-swing.swing { animation: ly-swing 2.2s cubic-bezier(.3,.05,.3,1) both; }
.ly-swing.nudge { animation: ly-nudge 1.8s ease-out both; }
@keyframes ly-swing {
  0%   { transform: rotate(88deg); }
  38%  { transform: rotate(-22deg); }
  58%  { transform: rotate(10deg); }
  75%  { transform: rotate(-4deg); }
  88%  { transform: rotate(1.5deg); }
  100% { transform: rotate(0deg); }
}
@keyframes ly-nudge {
  0% { transform: rotate(0); } 20% { transform: rotate(-12deg); } 45% { transform: rotate(7deg); }
  65% { transform: rotate(-3deg); } 82% { transform: rotate(1deg); } 100% { transform: rotate(0); }
}
@media (prefers-reduced-motion: reduce) { .ly-swing.swing, .ly-swing.nudge { animation: none; } }

.ly-swing.out { animation: ly-out .75s cubic-bezier(.5,0,.8,.4) both; }
@keyframes ly-out { from { transform: rotate(0deg); } to { transform: rotate(95deg); } }

/* MAILICON — envelope with a notification dot; a real mailto link */
.item.mailicon .inner { background: none; overflow: visible; animation: pop-in 420ms cubic-bezier(.2,1.6,.4,1) both, mi-wiggle 2.4s ease-in-out 1s infinite; }
.mi-link { display: block; position: relative; width: 84px; color: var(--primary); touch-action: manipulation; }
.mi-link svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 6px 10px rgba(0,0,0,.18)); }
.mi-dot { position: absolute; right: -8px; top: -10px; width: 26px; height: 26px; border-radius: 50%; background: var(--secondary); color: #FFFFFF; font: 700 14px/26px var(--font); text-align: center; }
@keyframes mi-wiggle { 0%, 80%, 100% { rotate: 0deg; } 85% { rotate: -9deg; } 90% { rotate: 7deg; } 95% { rotate: -4deg; } }

/* receipt total: bigger on its own line */
.rc-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.55em; line-height: 1.15; margin: .15em 0; }
@media (max-width: 600px) { .rc-total { font-size: 1.9em; } }

/* CRUMPLE — the paper folds in on itself in a few jerky steps (jagged outline, creases),
   ending as a small lumpy ball that drops a little and stays draggable */
.item.receipt.crumpled .rc-paper {
  -webkit-mask: none; mask: none;
  transform-origin: 50% 40%;
  animation: rc-crumple .7s cubic-bezier(.55,0,.4,1) forwards;
  transition: none;
}
.item.receipt.crumpled .rc-paper::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(115deg, transparent 42%, rgba(0,0,0,.18) 44%, transparent 47%),
    linear-gradient(35deg, transparent 30%, rgba(0,0,0,.16) 32%, transparent 35%),
    linear-gradient(160deg, transparent 58%, rgba(0,0,0,.2) 60%, transparent 63%),
    linear-gradient(75deg, transparent 66%, rgba(255,255,255,.7) 68%, transparent 71%),
    radial-gradient(circle at 35% 30%, rgba(255,255,255,.6), transparent 45%),
    radial-gradient(circle at 70% 75%, rgba(0,0,0,.28), transparent 60%);
  animation: rc-creases .7s ease-in forwards;
}
@keyframes rc-creases { from { opacity: 0; } to { opacity: 1; } }
@keyframes rc-crumple {
  0%   { transform: none; clip-path: polygon(0 0, 25% 0, 50% 0, 75% 0, 100% 0, 100% 25%, 100% 50%, 100% 75%, 100% 100%, 75% 100%, 50% 100%, 25% 100%, 0 100%, 0 75%, 0 50%, 0 25%); color: #222; }
  30%  { transform: scale(.82, .7) rotate(-6deg) skewX(4deg); clip-path: polygon(4% 3%, 28% 8%, 52% 1%, 77% 9%, 97% 4%, 92% 27%, 99% 49%, 91% 73%, 96% 97%, 72% 91%, 49% 98%, 24% 90%, 3% 96%, 9% 72%, 1% 51%, 8% 26%); color: rgba(34,34,34,.7); }
  60%  { transform: scale(.6, .3) rotate(14deg) skewY(-6deg); clip-path: polygon(14% 10%, 32% 18%, 55% 6%, 74% 20%, 90% 12%, 82% 33%, 94% 52%, 80% 68%, 88% 90%, 66% 80%, 47% 94%, 30% 78%, 10% 88%, 20% 64%, 6% 46%, 18% 30%); color: rgba(34,34,34,.3); }
  85%  { transform: scale(.46, .16) rotate(-10deg) translateY(30%); clip-path: polygon(22% 18%, 38% 10%, 56% 16%, 72% 8%, 86% 24%, 80% 40%, 92% 56%, 78% 70%, 82% 88%, 62% 82%, 46% 92%, 32% 80%, 14% 84%, 22% 64%, 10% 48%, 20% 34%); color: transparent; }
  100% { transform: scale(.42, .145) rotate(-4deg) translateY(55%); clip-path: polygon(24% 20%, 40% 12%, 57% 18%, 72% 11%, 84% 26%, 79% 41%, 89% 56%, 77% 69%, 80% 86%, 62% 80%, 47% 89%, 33% 79%, 16% 82%, 23% 63%, 12% 48%, 21% 35%); color: transparent; }
}
