/* Mendwell print card held with oat paper tape */
:root {
  --wall: #efe8db;            /* the warm wall behind the card */
  --wall-light: #f7f2e8;      /* the soft light in the middle of the wall */
  --paper: #fbf8f2;           /* the cotton rag of the card */
  --ink: #2a241c;             /* titles */
  --muted: #8a7f6e;           /* small words */
  --accent: #c4492b;          /* Mendwell tomato */
  --tape: rgba(222, 201, 156, 0.72);       /* the oat tape, seen from the front */
  --tape-back: rgba(241, 231, 207, 0.93);  /* the tape's back, matte and lighter */
  --tape-edge: rgba(130, 98, 46, 0.2);     /* the darker line along the long edges */
}

@property --peel {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

* { box-sizing: border-box; margin: 0; }

html, body { height: 100%; }

body {
  background: var(--wall);
  color: var(--ink);
  font-family: "Instrument Sans Variable", system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse 60% 55% at 50% 44%, var(--wall-light), transparent 72%),
    var(--wall);
  --w: min(78vw, 58vh, 500px);
}

.wall__grain,
.card__grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .28 0 0 0 0 .18 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.11;
  mix-blend-mode: multiply;
}

.card__grain { opacity: 0.07; border-radius: inherit; }

.board {
  position: relative;
  width: var(--w);
  transform: translateY(-2.5vh);
}

.piece {
  position: relative;
  width: 100%;
  transform-origin: 50% 0;
}

/* ---- the card ---- */
.card {
  --sway: 0;
  position: relative;
  width: 100%;
  padding: calc(var(--w) * 0.05) calc(var(--w) * 0.05) calc(var(--w) * 0.08);
  background: var(--paper);
  border-radius: 3px;
  box-shadow:
    0 0 0 0.5px rgba(80, 60, 30, 0.08),
    0 1px 1px rgba(60, 42, 20, 0.06),
    0 calc(6px + var(--sway) * 4px) calc(14px + var(--sway) * 8px) -4px rgba(60, 42, 20, calc(0.12 + var(--sway) * 0.04)),
    0 calc(24px + var(--sway) * 10px) calc(44px + var(--sway) * 18px) -20px rgba(60, 42, 20, calc(0.24 + var(--sway) * 0.06));
}

.print {
  position: relative;
  aspect-ratio: 1024 / 745;
  overflow: hidden;
  background: #e8dfcf;
}

.print img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.print__shade {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(40, 30, 15, 0.07), inset 0 0 calc(var(--w) * 0.05) rgba(60, 42, 20, 0.08);
  background: linear-gradient(118deg, rgba(255, 255, 255, 0.1), transparent 38%, transparent 70%, rgba(255, 255, 255, 0.05));
}

.caption {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1em;
  padding-top: calc(var(--w) * 0.042);
}

.kicker {
  font-size: max(9px, calc(var(--w) * 0.024));
  font-weight: 560;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.title {
  margin-top: 0.28em;
  font-family: "Fraunces Variable", Georgia, serif;
  font-weight: 380;
  font-variation-settings: "opsz" 48, "SOFT" 60;
  font-size: calc(var(--w) * 0.06);
  line-height: 1.02;
  letter-spacing: -0.015em;
}

.spec {
  margin-top: 0.45em;
  font-size: max(9px, calc(var(--w) * 0.025));
  color: var(--muted);
  letter-spacing: 0.01em;
}

.price {
  font-family: "Fraunces Variable", Georgia, serif;
  font-weight: 420;
  font-variation-settings: "opsz" 72;
  font-size: calc(var(--w) * 0.068);
  line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.price__cur {
  font-size: 0.55em;
  vertical-align: 0.6em;
  margin-right: 0.06em;
  color: var(--muted);
}

/* ---- the tape (the technique of the site: a face cut at --peel-cut, a flap mirrored over the fold) ---- */
.tape {
  --L: calc(var(--w) * 0.33);
  --H: calc(var(--L) * 0.3);
  --peel-to: 32;
  --peel-cut: calc(var(--peel) * var(--peel-to) * 1%);
  --sx: 0;
  --sy: 1;
  --press: 0;
  position: absolute;
  width: var(--L);
  height: var(--H);
  transform: translate(-50%, -50%) rotate(var(--r));
  z-index: 2;
}

.tape--tl { left: 6.5%; top: 5%; }
.tape--tr { left: 93.5%; top: 5%; }
.tape--b { left: 52%; top: 99%; }

.tape__move {
  position: absolute;
  inset: 0;
  filter: drop-shadow(calc(var(--sx) * 0.6px) calc(var(--sy) * 0.6px) 0.6px rgba(90, 64, 24, 0.12));
}

.skin {
  position: absolute;
  inset: 0;
  clip-path: var(--zig, none);
  background-color: var(--tape);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1 .25' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .34 0 0 0 0 .16 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E"),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 4px, rgba(120, 90, 40, 0.05) 4px 5px, transparent 5px 9px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 30%, transparent 75%, rgba(120, 90, 40, 0.1));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -1px 0 var(--tape-edge);
}

.skin--back {
  background-color: var(--tape-back);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.3 .3' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .4 0 0 0 0 .22 0 0 0 .3 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0) 55%, rgba(255, 255, 255, 0.4) 100%);
  filter: brightness(calc(1 + var(--peel) * 0.08));
}

.face {
  position: absolute;
  inset: 0;
  clip-path: polygon(var(--peel-cut) -50%, 150% -50%, 150% 150%, var(--peel-cut) 150%);
}

.flap {
  position: absolute;
  top: 0;
  width: 100%;
  height: 100%;
  left: calc(-100% + 2 * var(--peel-cut) - 0.5px);
  clip-path: polygon(-50% -50%, var(--peel-cut) -50%, var(--peel-cut) 150%, -50% 150%);
  transform: scaleX(-1);
}

/* the shadow of the lifted flap, falling on the tape and on the card */
.lift {
  position: absolute;
  top: 6%;
  bottom: 6%;
  left: var(--peel-cut);
  width: calc(var(--peel-cut) * 0.96);
  background: rgba(70, 48, 16, 0.5);
  border-radius: 2px;
  filter: blur(calc(1.5px + var(--peel) * 2.5px));
  opacity: calc(min(1, var(--peel) * 1.4) * var(--lift-a, 0.3));
  transform: translate(calc(var(--sx) * (1px + var(--peel) * 3.5px)), calc(var(--sy) * (1px + var(--peel) * 3.5px)));
}

/* where the tape was, the card keeps a faint sheen of glue */
.mark {
  position: absolute;
  inset: 0;
  clip-path: polygon(-50% -50%, var(--peel-cut) -50%, var(--peel-cut) 150%, -50% 150%);
  opacity: calc(min(1, var(--peel) * 3) * 0.85);
}

.mark::before {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: var(--zig, none);
  background:
    linear-gradient(100deg, rgba(255, 253, 244, 0.34), rgba(255, 253, 244, 0) 40%, rgba(255, 253, 244, 0.22) 80%),
    rgba(150, 118, 64, 0.07);
}

/* the round of the fold: a light ridge with a soft dark side */
.fold {
  position: absolute;
  top: 0.5px;
  bottom: 0.5px;
  left: calc(var(--peel-cut) - 2.5px);
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(120, 88, 36, 0.22), rgba(255, 253, 245, 0.75) 55%, rgba(255, 253, 245, 0.2));
  opacity: min(1, calc(var(--peel) * 8));
}

.tape__hit {
  position: absolute;
  inset: -10px -4px;
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  border-radius: 3px;
  -webkit-tap-highlight-color: transparent;
}

.tape__hit:focus-visible {
  outline: 1.5px solid var(--accent);
  outline-offset: -6px;
}

.hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(14px, 4.5vh);
  text-align: center;
  font-size: max(11px, min(1.6vh, 13px));
  letter-spacing: 0.02em;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .tape { --peel: 0; }
}
