/* Crust Compass — old-school pizza joint. Red, cream, simple shapes. */

@font-face {
  font-family: "Yowza Mix";
  src: url("/fonts/YowzaMix-Bold.otf") format("opentype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Yowza Mix";
  src: url("/fonts/YowzaMix-Extrabold.otf") format("opentype");
  font-weight: 800;
  font-display: swap;
}

:root {
  --red: #f00;
  --cream: #fff8eb;
  --sq: 23.3px; /* checkerboard square, from the brand board */
  --mono: "Martian Mono", monospace;
}

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

html, body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  background: var(--cream);
  color: var(--red);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

#app {
  height: 100dvh;
  overflow: hidden;
  position: relative;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
}
.screen.active { display: flex; }

.stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

/* ---- type ---- */
.bayon {
  font-family: "Bayon", sans-serif;
  font-weight: 400;
  font-size: 2.4rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  max-width: 20ch;
}

.mono {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.5;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  max-width: 30ch;
}

.logo { width: min(84vw, 331px); display: block; }

/* ---- buttons: square, outlined, mono ---- */
.btn {
  appearance: none;
  background: transparent;
  border: 1.5px solid var(--red);
  border-radius: 0;
  color: var(--red);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  padding: 16px 32px;
  cursor: pointer;
}
.btn:active { background: var(--red); color: var(--cream); }
.btn-square { width: 50px; height: 50px; padding: 0; flex-shrink: 0; }
.btn-row { display: flex; gap: 16px; align-items: center; justify-content: center; flex-wrap: wrap; }
.btn-row.bottom {
  position: absolute;
  bottom: calc(28px + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  gap: 12px;
  flex-wrap: nowrap;
}

/* ---- checkerboard strips ---- */
.checker {
  position: absolute;
  left: 0;
  right: 0;
  height: calc(var(--sq) * 2);
  background:
    conic-gradient(var(--red) 25%, transparent 25% 50%, var(--red) 50% 75%, transparent 75%);
  background-size: calc(var(--sq) * 2) calc(var(--sq) * 2);
  pointer-events: none;
}
.checker-top { top: 0; }
.checker-bottom { bottom: 0; transform: scaleY(-1); }

/* ---- slices & shapes ---- */
.slice-icon { width: min(30vw, 120px); display: block; }
.slice-hero { width: min(60vw, 235px); display: block; }
.flipped { transform: rotate(160deg); opacity: 0.8; }
.pizza-shape { width: min(36vw, 150px); display: block; }

.wobble { animation: wobble 5s ease-in-out infinite; transform-origin: 50% 60%; }
@keyframes wobble {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

.spin-slow { animation: spin 14s linear infinite; }
.spinning { animation: spin 0.7s linear infinite; }
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* compass needle rotated from JS */
.needle {
  transform-origin: 50% 55%;
  will-change: transform;
  filter: drop-shadow(0 10px 18px rgba(36, 28, 21, 0.25));
}
#screen-compass.pulse .needle { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { filter: none; }
  50% { filter: drop-shadow(0 0 24px rgba(255, 0, 0, 0.5)); }
}

/* radar rings */
.radar { position: relative; display: grid; place-items: center; padding: 34px; }
.radar .ring {
  position: absolute;
  width: 100%;
  aspect-ratio: 1;
  border: 1.5px solid var(--red);
  opacity: 0;
  animation: ping 2.4s ease-out infinite;
}
.radar .ring:nth-child(2) { animation-delay: 0.8s; }
.radar .ring:nth-child(3) { animation-delay: 1.6s; }
@keyframes ping {
  0% { transform: scale(0.5); opacity: 0.7; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ---- HOT PIZZA ticker ---- */
.ticker {
  position: absolute;
  top: calc(52px + env(safe-area-inset-top));
  left: -10vw;
  width: 120vw;
  transform: rotate(-6deg);
  overflow: hidden;
  pointer-events: none;
}
.ticker-track {
  display: inline-flex;
  gap: 26px;
  white-space: nowrap;
  font-family: "Yowza Mix", sans-serif;
  font-weight: 700;
  font-size: 1.8rem;
  color: var(--red);
  animation: ticker 14s linear infinite;
  will-change: transform;
}
.ticker-track span { padding-right: 26px; }
@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---- compass screen bits ---- */
.place { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.place .bayon { font-size: 2.5rem; }
.hint { min-height: 1.2em; font-size: 0.8rem; }

.loading-copy { font-size: 1rem; }

/* ---- confetti: brand squares ---- */
#confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
#confetti span {
  position: absolute;
  top: -8%;
  width: 16px;
  height: 16px;
  background: var(--red);
  animation: fall linear forwards;
}
#confetti span.dot { border-radius: 50%; background: var(--cream); border: 3px solid var(--red); }
@keyframes fall {
  to { transform: translateY(115vh) rotate(720deg); }
}

#qr {
  border: 1.5px solid var(--red);
  background: #fff;
  padding: 8px;
}

/* ---- brand wipe transition ---- */
#wipe {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: var(--red);
  transform: translateY(101%);
  pointer-events: none;
  visibility: hidden;
}
#wipe .checker {
  background:
    conic-gradient(var(--cream) 25%, transparent 25% 50%, var(--cream) 50% 75%, transparent 75%);
  background-size: calc(var(--sq) * 2) calc(var(--sq) * 2);
}
#wipe .wipe-edge-top { top: calc(-2 * var(--sq)); transform: scaleY(-1); }
#wipe .wipe-edge-bottom { bottom: calc(-2 * var(--sq)); }
#wipe.wipe-in {
  visibility: visible;
  animation: wipe-in 0.45s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}
#wipe.wipe-out {
  visibility: visible;
  animation: wipe-out 0.45s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}
@keyframes wipe-in {
  from { transform: translateY(101%); }
  to { transform: translateY(0); }
}
@keyframes wipe-out {
  from { transform: translateY(0); }
  to { transform: translateY(-101%); }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track, .wobble, .spin-slow, .radar .ring { animation-duration: 0.01s; animation-iteration-count: 1; }
}
