/* Grumbo, "Sticker pop": everything outlined, hard shadows, flat colour. See DESIGN.md. */

:root {
  --bg: #ffd43b;
  --ink: #111111;
  --paper: #ffffff;
  --pop: #ff4f9a;
  --line: 3px solid var(--ink);
  --lift: 5px 5px 0 var(--ink);
  --display: 'Lilita One', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --body: 'Rubik', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --move: cubic-bezier(.2, .8, .2, 1);
  --sticker: clamp(112px, 11vw, 168px);
}

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

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

/* ---------- End state board ---------- */
/* Two rows. Top: Grumbo on the left, one aligned column on the right (name, CA, thesis).
   Bottom: the five stickers in one straight row with a + between each, like a recipe. */

.board {
  --gutter: clamp(24px, 5vh, 56px);
  --sticker: clamp(96px, min(10vw, 15vh), 150px);
  --frame: min(440px, 50vh, 40vw);
  --hero-gap: clamp(40px, 5vw, 72px);
  --copy: 460px;
  /* the sticker row spans exactly the hero's width, so both rows share their outer edges */
  --row: calc(var(--frame) + var(--hero-gap) + var(--copy));
  --plus-gap: calc((var(--row) - 5 * var(--sticker)) / 4);
  height: 100vh;
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--gutter) 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--gutter);
}

.hero {
  display: grid;
  grid-template-columns: var(--frame) var(--copy);
  justify-content: center;
  align-items: center;
  gap: var(--hero-gap);
}

.slop-frame {
  width: var(--frame);
  aspect-ratio: 1;
  cursor: pointer;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.slop-name {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(72px, 13vh, 132px);
  line-height: .95;
  letter-spacing: .01em;
  color: var(--paper);
  -webkit-text-stroke: 8px var(--ink);
  paint-order: stroke fill;
  text-shadow: 6px 6px 0 var(--ink);
}

/* Sits tight under the name, in the same voice as the sticker labels */
.named {
  margin-top: -12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.ca {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 6px 6px 6px 18px;
  background: var(--paper);
  border: var(--line);
  border-radius: 999px;
  box-shadow: var(--lift);
}

.ca-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.ca-value { flex: 1; min-width: 0; font-family: var(--mono); font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ca-copy, .replay {
  position: relative;
  font-family: var(--display);
  font-size: 17px;
  line-height: 1;
  color: var(--ink);
  border: var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: transform .15s var(--move), box-shadow .15s var(--move), opacity .15s;
}

.ca-copy { flex: none; padding: 9px 18px 8px; background: var(--pop); }
.ca-copy:disabled { opacity: .45; cursor: default; }

.replay {
  align-self: flex-start;
  padding: 10px 20px 9px;
  background: var(--paper);
  box-shadow: 4px 4px 0 var(--ink);
}
.replay:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.replay:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.ca-copy:not(:disabled):active { transform: translate(1px, 2px); }

/* Copy and Mix again keep their look but get a 44px tap area */
.ca-copy::before, .replay::before { content: ''; position: absolute; inset: -6px -4px; }

/* The thesis card: same width and left edge as the CA pill above it */
.thesis-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 22px 22px;
  background: var(--paper);
  border: var(--line);
  border-radius: 18px;
  box-shadow: 6px 6px 0 var(--ink);
}

.thesis-title { font-family: var(--display); font-weight: 400; font-size: 24px; line-height: 1; }
.thesis { display: flex; flex-direction: column; gap: 8px; }
.thesis p { text-wrap: pretty; }
.thesis p:last-child { font-weight: 700; }

/* The recipe row: five stickers on one line, a + between each, labels on one baseline */
.ingredients {
  list-style: none;
  display: flex;
  align-items: flex-start;
  align-self: center;
  width: var(--row);
  gap: var(--plus-gap);
}

.ingredient {
  position: relative;
  width: var(--sticker);
  text-align: center;
}

.ingredient + .ingredient::before {
  content: '+';
  position: absolute;
  left: calc(var(--plus-gap) / -2);
  top: calc(var(--sticker) / 2);
  transform: translate(-50%, -50%);
  font-family: var(--display);
  font-size: 40px;
  line-height: 1;
}

.ingredient-art { width: var(--sticker); height: var(--sticker); transform: rotate(var(--tilt)); }
.ingredient:nth-child(1) { --tilt: -5deg; }
.ingredient:nth-child(2) { --tilt: 4deg; }
.ingredient:nth-child(3) { --tilt: -3deg; }
.ingredient:nth-child(4) { --tilt: 5deg; }
.ingredient:nth-child(5) { --tilt: -4deg; }

.ingredient-name { font-family: var(--display); font-size: 24px; line-height: 1; margin-top: 6px; }
.ingredient-meta { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-top: 4px; white-space: nowrap; }

/* Board pieces pop in once the mix lands */
.board .ingredient,
.board .thesis-card,
.board .slop-name,
.board .named,
.board .ca,
.board .slop-frame {
  transition: opacity .5s var(--move), translate .5s var(--move);
}

.is-intro .board .ingredient,
.is-intro .board .thesis-card,
.is-intro .board .slop-name,
.is-intro .board .named,
.is-intro .board .ca {
  opacity: 0;
  translate: 0 10px;
}

.is-intro .board .slop-frame { opacity: 0; }

.is-done .board .slop-name { transition-delay: .1s; }
.is-done .board .named { transition-delay: .15s; }
.is-done .board .ca { transition-delay: .2s; }
.is-done .board .ingredient { transition-delay: calc(.3s + var(--i) * .06s); }
.is-done .board .thesis-card { transition-delay: .6s; }

/* ---------- The show ---------- */

.show {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.tile {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  will-change: transform, opacity;
}

.tile-model { order: 2; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.tile-name { order: 1; font-family: var(--display); font-size: 24px; line-height: 1; }

.drop {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform, opacity;
}

.drop { border: 2px solid var(--ink); }

/* Starburst behind Grumbo when the mix pops; the hero sits above it */
.burst { position: fixed; z-index: 0; pointer-events: none; will-change: transform, opacity; }
.burst svg { display: block; width: 100%; height: 100%; overflow: visible; }

/* ---------- Idle life ---------- */

.bob {
  width: 100%;
  height: 100%;
  animation: bob 1.6s cubic-bezier(.45, 0, .55, 1) infinite;
  animation-delay: calc(var(--i) * -.4s);
  transform-origin: 50% 85%;
}

@keyframes bob {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  45% { transform: translateY(-8px) scale(.98, 1.03); }
  55% { transform: translateY(-8px) scale(.98, 1.03); }
  90% { transform: translateY(0) scale(1.03, .97); }
}

.is-done .slop-frame img {
  animation: jelly 3.2s cubic-bezier(.45, 0, .55, 1) infinite 1s;
  transform-origin: 50% 90%;
}

@keyframes jelly {
  0%, 100% { transform: scale(1, 1); }
  20% { transform: scale(1.03, .97); }
  40% { transform: scale(.98, 1.03) translateY(-4px); }
  60% { transform: scale(1.02, .985); }
  80% { transform: scale(.995, 1.01); }
}


.is-done .ingredient-art img {
  animation: bob 2.4s cubic-bezier(.45, 0, .55, 1) infinite;
  animation-delay: calc(var(--i) * -.6s);
  transform-origin: 50% 85%;
}

.slop-name span { display: inline-block; }
.is-done .slop-name span {
  animation: drop-in .7s cubic-bezier(.3, 1.5, .5, 1) backwards;
  animation-delay: calc(.35s + var(--i) * .06s);
}

@keyframes drop-in {
  0% { transform: translateY(-60px) rotate(-12deg); opacity: 0; }
  60% { opacity: 1; }
  100% { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .bob, .is-done .slop-frame img, .is-done .ingredient-art img, .is-done .slop-name span { animation: none; }
}

/* Clicking around Grumbo shouldn't select text; the CA stays selectable */
.slop-name, .slop-frame, .tile, .ingredient { -webkit-user-select: none; user-select: none; }

/* ---------- Narrow screens: stack and scroll ---------- */

@media (max-width: 1099px) {
  body { overflow: auto; }
  .board {
    height: auto;
    min-height: 100vh;
    justify-content: flex-start;
    gap: 40px;
    padding: 28px 20px 64px;
  }
  .hero { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 20px; }
  .ingredients { width: 100%; justify-content: center; }
  .ingredient-meta { white-space: normal; }
  .slop-frame { width: min(100%, 380px); }
  .hero-copy { width: 100%; max-width: 460px; align-items: center; }
  .slop-name { font-size: 76px; -webkit-text-stroke-width: 7px; text-shadow: 5px 5px 0 var(--ink); }

  .ingredients {
    --sticker: min(26vw, 132px);
    flex-wrap: wrap;
    gap: 24px 10px;
  }
  .ingredient + .ingredient::before { content: none; }
  .ingredient-name { font-size: 21px; }
}

/* JetBrains Mono ink sits high in the pill: centre it by its pixels */
.ca-label, .ca-value { position: relative; top: 1px; }

/* Keyboard focus: an ink ring, same weight as every outline */
.ca-copy:focus-visible, .replay:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* Short laptop screens: a smaller name and a tighter card, so both rows fit */
@media (min-width: 1100px) and (max-height: 880px) {
  .slop-name { font-size: clamp(64px, 12vh, 132px); }
  .hero-copy { gap: 16px; }
  .thesis-card { font-size: 14px; padding: 16px 20px 18px; gap: 10px; }
}
