@font-face {
  font-family: 'Caveat'; font-weight: 700; font-display: swap;
  src: url(/fonts/caveat-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Caveat'; font-weight: 700; font-display: swap;
  src: url(/fonts/caveat-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF;
}
@font-face {
  font-family: 'PT Mono'; font-weight: 400; font-display: swap;
  src: url(/fonts/ptmono-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'PT Mono'; font-weight: 400; font-display: swap;
  src: url(/fonts/ptmono-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF;
}

:root {
  --cork: #b98d5c;
  --cork-dark: #8a6236;
  --paper: #fbf7ee;
  --rule: #c9d8ea;
  --margin: #e28a8a;
  --ink: #1f2b47;
  --ink-soft: #5b6478;
  --stamp: #c4262e;
  --hand: 'Caveat', 'Segoe Print', cursive;
  --type: 'PT Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  color: var(--ink);
  font-family: var(--type);
  background-color: var(--cork);
  background-image:
    radial-gradient(rgba(70, 40, 10, .28) 1px, transparent 1.6px),
    radial-gradient(rgba(255, 236, 200, .16) 1px, transparent 1.6px),
    radial-gradient(ellipse at 30% 20%, rgba(255, 220, 170, .18), transparent 60%);
  background-size: 7px 7px, 11px 11px, 100% 100%;
  background-position: 0 0, 3px 5px, 0 0;
}

.card {
  position: relative;
  background:
    linear-gradient(var(--margin), var(--margin)) 0 var(--head, 64px) / 100% 2px no-repeat,
    repeating-linear-gradient(to bottom, transparent 0 calc(var(--line, 32px) - 1px), var(--rule) calc(var(--line, 32px) - 1px) var(--line, 32px)) 0 calc(var(--head, 64px) + 2px) / 100% 100% no-repeat,
    var(--paper);
  box-shadow: 0 1px 1px rgba(60, 35, 10, .25), 0 14px 28px -8px rgba(50, 28, 6, .55);
  transform: rotate(var(--tilt, 0deg));
}

.pin::before {
  content: '';
  position: absolute;
  top: -9px;
  left: calc(50% - 10px);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8a80, #d32f2f 45%, #7f1010 100%);
  box-shadow: 0 3px 4px rgba(40, 10, 0, .45);
  z-index: 2;
}

.polaroid {
  display: block;
  padding: 6% 6% 18%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(40, 20, 0, .35);
  transform: rotate(var(--ptilt, -3deg));
}

.polaroid img, .polaroid .nophoto {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #d9d4c7;
}

.polaroid .nophoto {
  display: grid;
  place-items: center;
  color: #8d877a;
  font: 700 3em/1 var(--hand);
}

.hand { font-family: var(--hand); font-weight: 700; }

.stamp {
  position: absolute;
  padding: .25em .5em;
  border: .14em solid var(--stamp);
  border-radius: .2em;
  color: var(--stamp);
  font-family: var(--type);
  line-height: 1.15;
  letter-spacing: .04em;
  text-align: center;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: multiply;
  transform: rotate(-8deg);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.8' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2.2 1.5'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.8' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2.2 1.5'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.stamp.on { animation: slam .34s cubic-bezier(.2, .9, .3, 1.15) forwards; }

@keyframes slam {
  0% { opacity: 0; transform: rotate(-8deg) scale(2.3); }
  65% { opacity: .9; transform: rotate(-8deg) scale(.96); }
  100% { opacity: .88; transform: rotate(-8deg) scale(1); }
}

.thud { animation: thud .3s .2s; }

@keyframes thud {
  35% { transform: rotate(var(--tilt, 0deg)) translateY(4px) scale(.995); }
}

.caret::after {
  content: '▌';
  margin-left: 1px;
  color: var(--ink-soft);
  animation: blink 1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .stamp.on { animation: none; opacity: .88; }
  .thud, .caret::after { animation: none; }
}
