/* Max's Website — the fortune cookie */

body.fortune-page {
  min-height: 100vh;
  margin: 0;
  font-family: "Trebuchet MS", sans-serif;
  color: #3a1410;
  /* a takeaway-shop red, with a faint pattern */
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 210, 160, 0.16), transparent 60%),
    repeating-linear-gradient(45deg, #a8281f 0 14px, #b02d23 14px 28px);
}
.table {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 30px 16px 60px;
}
.fc-back {
  padding: 6px 16px;
  font: 700 14px "Trebuchet MS", sans-serif;
  color: #3a1410;
  text-decoration: none;
  background: #f4ecd2;
  border: 3px solid #2a0c08;
  box-shadow: 3px 3px 0 #2a0c08;
}
.fc-title {
  margin: 6px 0 0;
  font: 700 clamp(28px, 5vw, 44px) Georgia, serif;
  color: #f6cd7c;
  letter-spacing: 2px;
  text-shadow: 3px 3px 0 #2a0c08;
}

/* the cookie: one frame of the sprite strip at a time */
.cookie {
  --fw: 96;
  --fh: 56;
  --s: 5;                                 /* screen px per art pixel */
  position: relative;
  width: calc(var(--fw) * var(--s) * 1px);
  height: calc((var(--fh) + 16) * var(--s) * 1px);
  max-width: 94vw;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.plate {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 4%;
  height: 26%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, #ffffff, #e9e2d0 60%, #c9bfa8);
  border: 4px solid #2a0c08;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25);
}
.cookie-sprite {
  position: absolute;
  left: 0;
  top: calc(var(--s) * 13px);           /* sitting on the plate */
  width: calc(var(--fw) * var(--s) * 1px);
  height: calc(var(--fh) * var(--s) * 1px);
  max-width: 94vw;
  background: url("assets/sprites/fortune-cookie.png") no-repeat 0 0 / 800% 100%;
  background-position-x: calc(var(--frame, 0) * 100% / 7);
  image-rendering: pixelated;
  transform: translate(var(--jx, 0), var(--jy, 0)) rotate(var(--jr, 0deg));
}
.cookie:focus-visible { outline: 3px dashed #f6cd7c; outline-offset: 6px; }
.fc-hint { margin: -6px 0 0; color: #f4ecd2; font-weight: 700; letter-spacing: 1px; }

/* the slip slides out */
.slip {
  position: relative;
  width: min(560px, 92vw);
  padding: 14px 26px 10px;
  text-align: center;
  background: #fffdf4;
  border: 3px solid #2a0c08;
  box-shadow: 6px 8px 0 rgba(0, 0, 0, 0.3);
  animation: slide 0.5s steps(6) both;
}
.slip::before, .slip::after {           /* the little red side stripes */
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  width: 6px;
  background: #c23b2b;
}
.slip::before { left: 8px; }
.slip::after { right: 8px; }
@keyframes slide {
  from { transform: translateY(-40px) scaleX(0.2); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.slip-text { margin: 0 0 8px; font: 20px Georgia, serif; line-height: 1.4; }
.slip-lucky { margin: 0; font-size: 12px; letter-spacing: 1px; color: #c23b2b; text-transform: uppercase; }
.slip-lucky span { font: 700 13px Consolas, "Courier New", monospace; letter-spacing: 2px; }
.fc-again {
  padding: 6px 16px;
  font: 700 14px "Trebuchet MS", sans-serif;
  color: #3a1410;
  background: #f6cd7c;
  border: 3px solid #2a0c08;
  box-shadow: 3px 3px 0 #2a0c08;
  cursor: pointer;
}
.fc-again:active { transform: translate(3px, 3px); box-shadow: none; }

@media (max-width: 560px) {
  .cookie { --s: 3.6; }
}
