@font-face {
  font-family: Anton;
  src: url(assets/anton.ttf) format("truetype");
  font-display: swap;
}
:root {
  --red: #c1331e;
  --ink: #680007;
  --header: clamp(4.75rem, 9.1vh, 6.4rem);
  --edge: clamp(.75rem, 1.5vw, 1.25rem);
  color: var(--ink);
  background: var(--red);
  font-family: system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; }
button { color: inherit; cursor: pointer; }
button:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
.page {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: var(--header) minmax(0, 1fr);
  padding-bottom: 100px;
  height: 100svh;
  min-height: 25rem;
  overflow: hidden;
  background: var(--red);
}
.page::after {
  content: "";
  position: absolute;
  z-index: 5;
  inset: 0;
  pointer-events: none;
  background: url(assets/grain.png);
  opacity: .061;
  mix-blend-mode: multiply;
}
header {
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #470005;
  padding-left: max(var(--edge), env(safe-area-inset-left));
  /* Account for the inset of the glyph inside the speaker’s 44px button. */
  padding-right: max(calc(var(--edge) - 8px), env(safe-area-inset-right));
  pointer-events: none;
}
.brand { display: flex; align-items: center; gap: .6rem; }
.brand img, .pixel-type { image-rendering: pixelated; }
.brand img { width: 2.85rem; height: auto; transform: rotate(-8deg); }
.wordmark { font: 1.72rem/.96 Anton,Impact,sans-serif; letter-spacing: -.028em; }
.pizzeria {
  display: block;
  margin: .42rem 0 0 .12rem;
  font: .64rem/1 ui-monospace,Menlo,monospace;
  letter-spacing: .22em;
  text-transform: uppercase;
}
.sound {
  pointer-events: auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
}
.sound:hover { color: #240407; }
.sound[hidden], .sound-waves, .sound[aria-pressed=true] .muted-mark { display: none; }
.sound[aria-pressed=true] .sound-waves { display: block; }

.hero, .poster { position: relative; isolation: isolate; height: 100%; }
.poster {
  --scene-unit: max(.29rem, calc((100svh - clamp(4.75rem, 9.1vh, 6.4rem) - 5.3rem) / 100));
}
.poster-title {
  display: contents;
  font: 400 min(32.4vw, 61svh)/.85 Anton, Impact, sans-serif;
}
.real-type, .pixel-type { position: absolute; display: block; pointer-events: none; user-select: none; }
.real-type {
  z-index: 0;
  /* Cancel the R's side bearing so the ink meets the viewport. */
  left: -.043em;
  top: 13%;
  color: var(--ink);
  letter-spacing: -.05em;
  text-transform: uppercase;
  transform-origin: left center;
}
.pixel-type {
  z-index: 0;
  right: -.25vw;
  top: 46%;
  width: 52.5%;
  /* Match the uppercase ink height of RED in the shared headline font. */
  height: .859375em;
  height: 1cap;
  transform-origin: right center;
}
.foreground-letter { z-index: 2; }
.stage {
  position: absolute;
  z-index: 1;
  --size: min(94.6vw, calc(139.7 * var(--scene-unit)), 89.1rem);
  --lens: calc(1.4 * var(--size));
  left: 51%;
  top: calc(61% - .03 * var(--size));
  width: var(--size);
  /* Cast the shadow in screen space, behind the foreground lettering. */
  filter: drop-shadow(clamp(15px, 2.5vw, 42px) clamp(17px, 3.8vh, 38px) clamp(10px, 1.2vw, 21px) rgba(77, 37, 16, .34));
  aspect-ratio: 1;
  transform-origin: 52% 36%;
  translate: -50% -50%;
  pointer-events: none;
}
.pizza {
  --pose: perspective(var(--lens)) rotateZ(-16deg) rotateX(22deg) rotateY(25deg);
  position: absolute;
  inset: 0;
  isolation: isolate;
  user-select: none;
  -webkit-user-select: none;
  transform-origin: 53% 37%;
  transform: var(--pose);
}
.photograph, .photo, .pull, .cheese-texture { position: absolute; inset: 0; pointer-events: none; }
.photo {
  display: block;
  width: 100%;
  height: 100%;
  /* The three cutouts are filled by continuous pieces of the same photograph. */
  clip-path: polygon(0 0,100% 0,100% 100%,66% 100%,66% 53%,58% 53%,58% 100%,45% 100%,45% 65%,36% 65%,36% 100%,18% 100%,18% 73.4%,8% 73.4%,8% 100%,0 100%);
}
.cheese-texture { background: url(assets/slice.webp) center / 100% 100% no-repeat; }
.pull { transform: scaleY(var(--rest)); }
.pull-tip { transform-origin: 13% 73.4%; --rest: .24; --relaxed: .267; --period: 3.2s; --phase: -.6s; }
.pull-middle { transform-origin: 40% 65%; --rest: .68; --relaxed: .733; --period: 3.65s; --phase: -1.8s; }
.pull-short { transform-origin: 61% 53%; --rest: .76; --relaxed: .842; --period: 3.4s; --phase: -1.25s; }
.pull-tip .cheese-texture { clip-path: inset(73.25% 82% 0 8%); }
.pull-middle .cheese-texture { clip-path: inset(64.92% 55% 0 36%); }
.pull-short .cheese-texture { clip-path: inset(52.92% 34% 0 58%); }

#toppings, #bits { position: absolute; inset: 0; pointer-events: none; }
.piece, .ghost { position: absolute; width: 11%; aspect-ratio: 1; translate: -50% -50%; pointer-events: none; }
.piece img, .ghost {
  display: block;
  image-rendering: pixelated;
  transform: matrix(1,.05,-.12,.85,0,0);
  filter: drop-shadow(1px 2px 1px #64230b99) drop-shadow(2px 4px 3px #75310c59);
}
.piece img { width: 100%; }
.ghost { opacity: .52; }
.ghost[hidden] { display: none; }
.surface { position: absolute; inset: 0; width: 100%; height: 100%; background: transparent; border: 0; padding: 0; pointer-events: auto; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.pizza:has(.surface:focus-visible) { outline: 2px dashed var(--ink); outline-offset: 0; }
.bit { position: absolute; width: .42rem; height: .42rem; pointer-events: none; }

@media (prefers-reduced-motion: no-preference) {
  .stage { --launch: perspective(var(--lens)) translate3d(0,5%,calc(-.34 * var(--size))) rotateZ(-27deg) rotateX(8deg) rotateY(7deg) scale(.72); }
  .js .poster:not(.entered) .pizza { transform: var(--launch); }
  .entered .pizza { animation: leap 1420ms both; }
  .js .poster:not(.entered) :is(.real-type,.pixel-type) { opacity: 0; }
  .entered .real-type { animation: type-rise 560ms both; }
  .entered .pixel-type { animation: type-rise 560ms 105ms both; }
  .entered .pull { animation: edge-bounce var(--period) var(--phase) ease-in-out infinite; }
}
@keyframes edge-bounce {
  0%,100% { transform: scaleY(var(--rest)); }
  50% { transform: scaleY(var(--relaxed)); }
}
@keyframes leap {
  0% { transform: var(--launch); animation-timing-function: cubic-bezier(.42,.03,.22,.96); }
  51% { transform: perspective(var(--lens)) translate3d(0,-1.4%,calc(.1 * var(--size))) rotateZ(-13deg) rotateX(26deg) rotateY(29deg); animation-timing-function: cubic-bezier(.28,.04,.25,1); }
  76% { transform: perspective(var(--lens)) translateZ(calc(-.021 * var(--size))) rotateZ(-17deg) rotateX(21deg) rotateY(24deg); animation-timing-function: ease-out; }
  100% { transform: var(--pose); }
}
@keyframes type-rise {
  0% { opacity: 0; transform: translateY(clamp(12px,2.8vh,26px)); animation-timing-function: cubic-bezier(.22,.68,.25,1); }
  65% { opacity: 1; transform: translateY(-3px); animation-timing-function: ease-in-out; }
  100% { opacity: 1; transform: none; }
}
@media (max-width: 740px), (max-aspect-ratio: 5/6) {
  :root { --header: 4.25rem; }
  .brand img { width: 2.3rem; }
  .wordmark { font-size: 1.45rem; }
  .poster { --scene-unit: max(.20rem,calc((100svh - 16rem) / 100)); }
  .stage {
    --size: min(137.5vw, calc(126.5 * var(--scene-unit)), 77rem);
    left: 49%;
    top: calc(59% - .03 * var(--size));
    filter: drop-shadow(16px 22px 12px rgba(77, 37, 16, .32));
  }
  .poster-title { font-size: min(48vw, 52svh); }
  .real-type { top: clamp(1%,calc(50% - 62vw),16%); }
  .pixel-type { top: 57%; width: 63.25%; }
}
@media (min-aspect-ratio: 23/10) and (min-width: 741px) {
  .real-type { top: 4%; }
}
