:root {
  --ink: #1f1b17;
  --ink-soft: #3a332c;
  --paper: #f3ebdc;
  --paper-deep: #e8dcc4;
  --mustard: #e0ad38;
  --ketchup: #c23b2e;
  --relish: #4e7a3a;
  --bun: #d99b5a;
  --display: 'Bowlby One', 'Arial Black', sans-serif;
  --mono: 'Martian Mono', ui-monospace, monospace;
  --radius: 18px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100vh;
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 85% 10%, rgba(224, 173, 56, 0.28), transparent 45%),
    radial-gradient(circle at 5% 95%, rgba(194, 59, 46, 0.14), transparent 40%);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0.18;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Layout */

.stand {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  max-width: 1240px;
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 4rem);
}

/* Pitch column */

.pitch > * {
  opacity: 0;
  animation: rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.pitch > :nth-child(2) { animation-delay: 0.08s; }
.pitch > :nth-child(3) { animation-delay: 0.18s; }
.pitch > :nth-child(4) { animation-delay: 0.28s; }
.pitch > :nth-child(5) { animation-delay: 0.38s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

.ticket {
  display: inline-block;
  margin: 0 0 1.5rem;
  padding: 0.4rem 0.9rem;
  border: 2px dashed var(--ink);
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transform: rotate(-2deg);
}

.title {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  line-height: 0.88;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.title span {
  display: block;
}

.title__hot {
  font-size: clamp(3.6rem, 10vw, 8.5rem);
  color: var(--ketchup);
  text-shadow: 5px 5px 0 var(--mustard);
}

.title__or {
  margin: 0.35rem 0 0.35rem 0.4em;
  font-family: var(--mono);
  font-size: clamp(1rem, 2vw, 1.4rem);
  font-weight: 800;
  letter-spacing: 0.4em;
  color: var(--ink-soft);
}

.title__not {
  font-size: clamp(2.6rem, 7vw, 6rem);
  color: var(--ink);
  -webkit-text-stroke: 0;
}

.lede {
  max-width: 34rem;
  margin: 1.75rem 0 2rem;
  color: var(--ink-soft);
}

.samples__label {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.samples__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.sample {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.9rem 0.35rem 0.35rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: 600 0.78rem var(--mono);
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.sample img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.sample:hover {
  background: var(--mustard);
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--ink);
}

.sample:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.sample:focus-visible,
.again:focus-visible,
.drop:focus-within {
  outline: 3px solid var(--ketchup);
  outline-offset: 3px;
}

.sample:disabled {
  opacity: 0.5;
  cursor: wait;
}

.fineprint {
  max-width: 30rem;
  margin: 2.25rem 0 0;
  font-size: 0.7rem;
  color: var(--ink-soft);
  opacity: 0.8;
}

.fineprint code {
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  background: var(--paper-deep);
  font-family: var(--mono);
}

/* Tray column */

.tray {
  position: relative;
  opacity: 0;
  animation: rise 0.8s 0.25s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.tray__frame {
  position: relative;
  aspect-ratio: 1;
  padding: 14px;
  border-radius: var(--radius);
  background:
    repeating-conic-gradient(var(--ketchup) 0 25%, var(--paper) 0 50%) 0 0 / 36px 36px;
  box-shadow: 10px 12px 0 var(--ink);
  transform: rotate(1.5deg);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tray__frame[data-state='dragging'] {
  transform: rotate(-1deg) scale(1.02);
}

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  height: 100%;
  padding: 2rem;
  border-radius: calc(var(--radius) - 8px);
  background: var(--paper);
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.drop:hover,
.tray__frame[data-state='dragging'] .drop {
  background: #fbf3e3;
}

.drop__icon {
  width: 72px;
  height: 72px;
  margin-bottom: 0.5rem;
  fill: none;
  stroke: var(--ink);
  stroke-width: 3;
  stroke-linejoin: round;
  transition: transform 0.3s ease;
}

.drop:hover .drop__icon {
  transform: rotate(-8deg) scale(1.06);
}

.drop__title {
  font-family: var(--display);
  font-size: clamp(1.4rem, 3vw, 2rem);
  text-transform: uppercase;
}

.drop__hint {
  max-width: 18rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.tray__frame:not([data-state='empty']):not([data-state='dragging']) .drop {
  display: none;
}

.shot {
  position: relative;
  height: 100%;
  margin: 0;
  overflow: hidden;
  border-radius: calc(var(--radius) - 8px);
  background: var(--ink);
}

.shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tray__frame[data-state='dragging'] .shot {
  display: none;
}

/* Scanning state */

.scan {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent 0%, rgba(224, 173, 56, 0.55) 48%, rgba(224, 173, 56, 0.9) 50%, transparent 52%);
  background-size: 100% 220%;
}

.tray__frame[data-state='loading'] .scan {
  opacity: 1;
  animation: sweep 1.4s ease-in-out infinite alternate;
}

.tray__frame[data-state='loading'] .shot img {
  filter: saturate(0.4) contrast(1.05);
}

@keyframes sweep {
  from { background-position: 0 100%; }
  to { background-position: 0 0%; }
}

/* Verdict banners */

.banner {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  font-family: var(--display);
  font-size: clamp(1.6rem, 4.2vw, 2.8rem);
  line-height: 1;
  text-transform: uppercase;
  color: #fffaf0;
}

.banner svg {
  flex: none;
  width: clamp(2.6rem, 5vw, 3.6rem);
  height: clamp(2.6rem, 5vw, 3.6rem);
  fill: #fffaf0;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.banner--hot {
  top: 0;
  background: var(--relish);
  animation: drop-in 0.55s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.banner--hot svg {
  stroke: var(--relish);
}

.banner--not {
  bottom: 0;
  background: var(--ketchup);
  animation: rise-in 0.55s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.banner--not svg {
  stroke: var(--ketchup);
}

@keyframes drop-in {
  from { transform: translateY(-100%); }
  to { transform: none; }
}

@keyframes rise-in {
  from { transform: translateY(100%); }
  to { transform: none; }
}

/* Readout */

.readout {
  position: relative;
  margin: 2.25rem 0 0 -1rem;
  padding: 1.25rem 1.4rem 1.4rem;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fbf6ec;
  box-shadow: 6px 6px 0 var(--mustard);
  transform: rotate(-1deg);
}

.readout__status {
  margin: 0;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tray__frame[data-state='loading'] ~ .readout .readout__status::after {
  content: '';
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  margin-left: 0.6em;
  border-radius: 50%;
  background: var(--ketchup);
  animation: blink 0.8s steps(2, start) infinite;
}

@keyframes blink {
  to { visibility: hidden; }
}

.meter {
  margin-top: 1rem;
}

.meter__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 0.6rem;
  font-size: 0.78rem;
}

.meter__row strong {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.25rem;
}

.meter__bar {
  height: 14px;
  margin-top: 0.35rem;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper-deep);
}

.meter__fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: repeating-linear-gradient(-45deg, var(--mustard) 0 8px, var(--bun) 8px 16px);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.scale {
  margin-top: 1.1rem;
}

.scale__title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.scale__steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0.45rem 0 0;
  padding: 0;
  list-style: none;
}

.scale__steps li {
  padding: 0.45rem 0.3rem;
  border: 2px solid var(--ink);
  border-radius: 8px;
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  opacity: 0.4;
  transition: opacity 0.3s ease, background-color 0.3s ease, transform 0.3s ease;
}

.scale__steps li[aria-current='true'] {
  background: var(--ink);
  color: var(--paper);
  opacity: 1;
  transform: translateY(-3px) rotate(-2deg);
}

.error {
  margin: 0.75rem 0 0;
  padding: 0.6rem 0.8rem;
  border-left: 4px solid var(--ketchup);
  background: rgba(194, 59, 46, 0.08);
  font-size: 0.8rem;
}

.again {
  margin-top: 1.1rem;
  padding: 0.7rem 1.3rem;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  font: 800 0.8rem var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--ketchup);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.again:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ketchup);
}

.again:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ketchup);
}

[hidden] {
  display: none !important;
}

/* Mobile */

@media (max-width: 860px) {
  .stand {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 2.5rem;
  }

  .tray__frame {
    transform: none;
    box-shadow: 6px 8px 0 var(--ink);
  }

  .readout {
    margin-left: 0;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
