/* Tilt card — from Bencho's "Tilt card" (MIT, bencho.dev/licence), ported to this site's
   plain HTML/JS by tilt-card.js. Used on the CRED page for the CRED Money card.

   --surface-2 is Bencho's token for the card's own ground, seen only before the picture
   loads. This site has no design tokens, so it is defined here on the component's root
   (nothing leaks out): the near-black the dark case studies sit on, so a card still
   loading reads as an empty slot on the black page rather than a pale flash. */

/* The slot on the case-study canvas: same box the CRED Money video used to fill.
   Not .case-media on purpose — that clips, and a card that sinks and turns needs its
   corners and its shadow to be allowed past the edge of the box. */
.tlt-slot{height:calc(var(--h)*var(--unit));z-index:1;display:flex;align-items:center;justify-content:center}
/* The CRED card is shown at 60% of the slot's size, centred in it, so the page layout around
   it is unchanged. */
.tlt-slot > .tlt{width:60%;height:60%}
@media (max-width:680px){.tlt-slot{height:auto;aspect-ratio:var(--w)/var(--h)}}

/* ══ Tilt ═══════════════════════════════════════════════════
   A picture card that gives under the pointer. Almost nothing
   is here: the rotation, both gradients and the shadow are
   written per frame from the pointer's position, and a rule
   in this file that also had an opinion about any of them
   would be a second author. What is left is the things that
   are true whatever the pointer is doing. */
.tlt {
  --surface-2: #111;
  position: relative;
  width: 100%;
  height: 100%;
  /* a finger dragged across the card should tilt it, not scroll the page from under it */
  touch-action: none;
  /* The frame is what the pointer is measured against and it
     is deliberately the ONLY thing in here that never moves.
     The perspective lives on it rather than on the card for
     the usual reason: on the card itself, `perspective` is
     applied per element and the vanishing point rides along
     with the rotation instead of staying put in the room. */
}

.tlt-card {
  position: absolute;
  inset: 0;
  background-color: var(--surface-2);
  background-size: cover;
  background-position: center;
  /* `cover` and a fixed frame, so the crop is the one
     the picture was cut to (assets/case-studies/cred/cred-money-card.webp,
     the card lifted flat from the old video) rather than a second
     one on top of it */
  overflow: hidden;
  /* NO `will-change`. It would hold a composited layer for
     every copy of this block on the wall, permanently, to
     save one frame on a hover that may never come — the same
     bookkeeping CLAUDE.md objects to for permanent rAF. The
     browser promotes this on its own once the transform
     starts moving. */
}

/* ── the dent and the rim ───────────────────────────────────
   One element, two gradients, both placed from the pointer —
   the dark one under it and the light one at its mirror. It
   inherits the corner rather than being told one, so the knob
   only has to reach the card. */
.tlt-sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}
