/* Coffee bean tray: the cooling tray of a small roastery seen from above, on a dark stone counter. The beans are drawn
   on a canvas over a burlap floor that carries the stamp of the roastery. */
:root {
  --counter: #1d1a18;       /* the stone counter */
  --counter-glow: #4a3a2c;  /* the morning light on the counter */
  --wood: #b27c4b;          /* the frame of the tray */
  --wood-dark: #6f4526;     /* its shaded side and the grain */
  --burlap: #c6a878;        /* the burlap floor */
  --burlap-thread: #8e7049; /* the threads of the weave */
  --stamp: #8f2f1d;         /* the ink of the stamp */
  --bean-light: #8f5632;    /* the lightest beans of the batch */
  --bean-dark: #351a0c;     /* the darkest ones */
  --crease: #1a0b05;        /* the cut in the middle of a bean */
  --chaff: #e2c693;         /* the silver skin in the cut, and the flakes that fly */
  --paper: #f1e7d3;         /* the tag */
  --ink: #2b1c13;           /* the words on the tag */
  --muted: #6f5847;         /* the smaller words */
  --accent: #b4482b;        /* the kicker */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--counter);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 460px;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 60% at 18% 8%, color-mix(in srgb, var(--counter-glow) 70%, transparent), transparent 70%),
    radial-gradient(circle at 70% 90%, color-mix(in srgb, #000 30%, transparent), transparent 60%),
    var(--counter);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------------------------------------------------------------- the tray */
.tray {
  position: absolute;
  inset: clamp(10px, 3.4vmin, 40px);
  z-index: 1;
}

/* the wooden frame: GSAP leaves it alone, the shake moves it from the script */
.tray__frame {
  position: absolute;
  inset: 0;
  padding: clamp(10px, 1.7vmin, 20px);
  border-radius: clamp(16px, 2.6vmin, 30px);
  background:
    repeating-linear-gradient(92deg, transparent 0 11px, color-mix(in srgb, var(--wood-dark) 22%, transparent) 11px 12px, transparent 12px 27px),
    repeating-linear-gradient(1deg, transparent 0 17px, color-mix(in srgb, var(--wood-dark) 16%, transparent) 17px 19px, transparent 19px 41px),
    linear-gradient(160deg, color-mix(in srgb, var(--wood) 80%, #fff) 0, var(--wood) 30%, var(--wood-dark) 100%);
  box-shadow:
    inset 0 2px 0 color-mix(in srgb, #fff 30%, transparent),
    inset 0 -3px 0 color-mix(in srgb, #000 22%, transparent),
    0 30px 60px -18px #000,
    0 8px 18px -6px color-mix(in srgb, #000 70%, transparent);
}

.tray__bed {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: clamp(8px, 1.2vmin, 14px);
}

.tray__floor {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  container-type: size;
  background:
    repeating-linear-gradient(0deg, color-mix(in srgb, var(--burlap-thread) 38%, transparent) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--burlap-thread) 30%, transparent) 0 1px, transparent 1px 4px),
    radial-gradient(ellipse at 50% 45%, var(--burlap), color-mix(in srgb, var(--burlap) 72%, var(--burlap-thread)));
}

.tray__beans {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* the inner edge of the frame, over the beans: the tray has a depth */
.tray__lip {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    inset 0 12px 16px -8px color-mix(in srgb, #000 70%, transparent),
    inset 10px 0 14px -10px color-mix(in srgb, #000 55%, transparent),
    inset 0 -1px 0 color-mix(in srgb, #fff 18%, transparent),
    inset 0 0 0 1px color-mix(in srgb, var(--wood-dark) 80%, transparent);
}

/* ---------------------------------------------------------------- the stamp on the burlap */
.stamp {
  color: var(--stamp);
  filter: url(#ink);
  opacity: 0.86;
}

.stamp__in {
  display: flex;
  align-items: center;
  gap: 4cqmin;
  rotate: -3deg;
}

.stamp__seal {
  flex: none;
  width: 30cqmin;
  height: 30cqmin;
  overflow: visible;
}

.stamp__ring {
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  font-size: 17px;
  font-weight: 800;
  font-stretch: 112%;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  fill: currentColor;
}

.stamp__words p {
  margin: 0;
}

.stamp__name {
  font-weight: 900;
  font-stretch: 125%;
  font-size: min(12.5cqw, 24cqh);
  line-height: 0.82;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.stamp__line {
  margin-top: 0.7em !important;
  font-weight: 760;
  font-stretch: 118%;
  font-size: min(2.2cqw, 4.2cqh);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* the warm light of the window over everything */
.light {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse 75% 65% at 30% 20%, color-mix(in srgb, #ffd9a0 16%, transparent), transparent 65%),
    radial-gradient(ellipse 120% 100% at 50% 50%, transparent 55%, color-mix(in srgb, #000 42%, transparent));
}

/* ---------------------------------------------------------------- the tag */
.tag {
  position: absolute;
  left: clamp(22px, 5vmin, 64px);
  top: clamp(22px, 5vmin, 60px);
  z-index: 3;
  width: min(300px, 34vw);
  transform-origin: 50% 18px;
}

.tag__card {
  position: relative;
  padding: 34px 24px 22px;
  border-radius: 6px 6px 10px 10px;
  background:
    radial-gradient(circle at 80% 10%, color-mix(in srgb, #fff 45%, transparent), transparent 55%),
    var(--paper);
  box-shadow:
    0 1px 0 color-mix(in srgb, #fff 60%, transparent) inset,
    0 18px 30px -12px color-mix(in srgb, #000 75%, transparent),
    0 3px 6px color-mix(in srgb, #000 35%, transparent);
  rotate: -4deg;
  transition: rotate 0.7s cubic-bezier(0.34, 1.8, 0.5, 1), translate 0.7s cubic-bezier(0.34, 1.8, 0.5, 1), box-shadow 0.4s ease;
}

.tag__hole {
  position: absolute;
  left: 50%;
  top: 12px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: var(--counter);
  box-shadow: inset 0 2px 3px #000, 0 0 0 4px color-mix(in srgb, var(--wood-dark) 35%, transparent);
}

.tag p,
.tag h1,
.tag dl,
.tag dd {
  margin: 0;
}

.tag__kicker {
  font-size: 11px;
  font-weight: 700;
  font-stretch: 120%;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.tag__title {
  margin-top: 6px !important;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 520;
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
  line-height: 0.98;
  letter-spacing: -0.02em;
}

.tag__line {
  margin-top: 12px !important;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}

.tag__facts {
  display: flex;
  gap: 26px;
  margin-top: 16px !important;
  padding-top: 12px;
  border-top: 1px dashed color-mix(in srgb, var(--muted) 45%, transparent);
}

.tag__facts dt {
  font-size: 10px;
  font-weight: 680;
  font-stretch: 116%;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.tag__facts dd {
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: 20px;
  font-weight: 560;
}

/* ---------------------------------------------------------------- the elastic pill */
.pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  margin-top: 18px;
  padding: 0 22px;
  border: 0;
  background: none;
  color: var(--paper);
  font: inherit;
  font-size: 15px;
  font-weight: 640;
  cursor: pointer;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}

.pill::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 999px;
  background: var(--ink);
  transition: inset 0.6s cubic-bezier(0.34, 1.8, 0.5, 1), transform 0.25s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.pill__text {
  display: grid;
  font-stretch: 100%;
  transition: font-stretch 0.6s cubic-bezier(0.34, 1.8, 0.5, 1);
}

/* the widest words, invisible and flat, keep their place */
.pill__text::before {
  content: attr(data-text);
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-stretch: 125%;
}

.pill:active::before {
  transform: scale(1.04, 0.86);
}

.pill:focus-visible {
  outline: none;
}

.pill:focus-visible::before {
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--accent);
}

@media (hover: hover) and (pointer: fine) {
  .tag:hover .tag__card {
    rotate: -1.5deg;
    translate: 0 -4px;
    box-shadow:
      0 1px 0 color-mix(in srgb, #fff 60%, transparent) inset,
      0 28px 40px -14px color-mix(in srgb, #000 80%, transparent),
      0 4px 8px color-mix(in srgb, #000 35%, transparent);
  }

  .pill:hover::before {
    inset: -2px -6px;
  }

  .pill:hover .pill__text {
    font-stretch: 125%;
  }
}

/* ---------------------------------------------------------------- the hint */
.hint {
  position: absolute;
  left: 50%;
  bottom: clamp(26px, 6vmin, 64px);
  z-index: 3;
  margin: 0;
  translate: -50% 0;
  pointer-events: none;
}

.hint span {
  display: block;
  padding: 10px 18px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--counter) 78%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--paper);
  font-size: 13px;
  font-weight: 600;
  font-stretch: 108%;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.defs {
  position: absolute;
  width: 0;
  height: 0;
}

/* ---------------------------------------------------------------- phone */
@media (max-width: 720px) {
  .tag {
    left: 22px;
    right: 22px;
    top: 22px;
    width: auto;
  }

  .tag__card {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 0 12px;
    padding: 28px 16px 16px;
    rotate: -1.5deg;
  }

  .tag__kicker,
  .tag__title {
    grid-column: 1;
  }

  .tag__title {
    font-size: 26px;
  }

  .tag__line,
  .tag__facts {
    display: none;
  }

  .pill {
    grid-column: 2;
    grid-row: 1 / span 2;
    min-height: 40px;
    margin: 0;
    padding: 0 16px;
    font-size: 13px;
  }

  .stamp__in {
    flex-direction: column;
    text-align: center;
    gap: 3cqh;
  }

  .stamp__seal {
    width: 44cqw;
    height: 44cqw;
  }

  .stamp__name {
    font-size: 15cqw;
  }

  .stamp__line {
    font-size: 3.4cqw;
    letter-spacing: 0.2em;
  }
}
