/* The stage: the why at the top left, the products set down around it. */
.main {
  flex: 1;
  display: grid;
  align-items: center;
  padding-block: 4px 12px;
}
.stage {
  position: relative;
  container-type: inline-size;
  width: var(--stage);
  aspect-ratio: 16 / 9;
  margin-inline: auto;
}
.why {
  position: absolute;
  left: 0;
  top: 1.6cqw;
  width: max-content;
  max-width: 43cqw;
}
h1 {
  font-size: 8.6cqw;
  font-weight: 650;
  line-height: 0.96;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.why p {
  margin-top: 2cqw;
  font-size: max(1rem, 1.5cqw);
  line-height: 1.5;
  color: var(--ink-2);
  text-wrap: balance;
}

.group {
  display: contents;
}
.group-label {
  position: absolute;
  left: calc(var(--x) * 1cqw);
  top: calc(var(--y) * 1cqw);
  font-size: max(12px, 1.2cqw);
  font-weight: 600;
  color: var(--ink-2);
}
.piece {
  --size: calc(var(--s) * 1cqw);
  position: absolute;
  left: calc(var(--x) * 1cqw);
  top: calc(var(--y) * 1cqw);
  display: grid;
  align-content: start;
  justify-items: center;
  width: calc(var(--size) + 5cqw);
  translate: -50% calc(var(--size) / -2);
  text-decoration: none;
  color: var(--ink);
  border-radius: 8px;
}
.piece img {
  width: var(--size);
  height: var(--size);
  object-fit: contain;
  rotate: calc(var(--r) * 1deg);
  filter: drop-shadow(1px 3px 2px rgb(40 28 14 / 0.3))
    drop-shadow(7px 12px 12px rgb(40 28 14 / 0.16));
  transition:
    transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1),
    filter 0.28s ease;
}
.piece.card img {
  border: 0.42cqw solid var(--slip);
  border-radius: 0.5cqw;
  object-fit: cover;
}
.label {
  display: grid;
  justify-items: center;
  width: max-content;
  margin-top: 0.9cqw;
}
.name {
  font-size: max(13px, 1.3cqw);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.name i {
  font-style: normal;
  color: var(--ink-2);
}
.line {
  font-size: max(12px, 1.1cqw);
  line-height: 1.4;
  color: var(--ink-2);
  white-space: nowrap;
  opacity: 0;
  translate: 0 -3px;
  transition:
    opacity 0.2s ease,
    translate 0.2s ease;
}
.piece:hover img,
.piece:focus-visible img {
  transform: translateY(-0.5cqw) scale(1.05);
  filter: drop-shadow(2px 5px 3px rgb(40 28 14 / 0.26))
    drop-shadow(12px 20px 18px rgb(40 28 14 / 0.2));
}
.piece:hover .line,
.piece:focus-visible .line {
  opacity: 1;
  translate: 0 0;
}
@media (hover: none) {
  .line {
    opacity: 1;
    translate: 0 0;
  }
}

/* Each magnet is set down in turn; field.js switches its field on as it
   lands. Without motion the sheet is shown already settled. */
@media (prefers-reduced-motion: no-preference) {
  .js .piece img {
    animation: land 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) backwards paused;
    animation-delay: calc(var(--i) * 75ms);
  }
  .go .piece img {
    animation-play-state: running;
  }
}
@media (prefers-reduced-motion: reduce) {
  .scatter {
    display: none;
  }
}
@keyframes land {
  0% {
    opacity: 0;
    transform: translateY(-1.4cqw) scale(1.16);
  }
  55% {
    opacity: 1;
  }
  100% {
    transform: none;
  }
}

/* Phones and tablets: the same sheet, read top to bottom. */
@media (max-width: 999px) {
  :root {
    --stage: 100%;
  }
  .main {
    align-items: start;
    padding-block: 20px 28px;
  }
  .stage {
    aspect-ratio: auto;
    display: grid;
    gap: 44px;
  }
  .why {
    position: static;
    width: auto;
    max-width: none;
  }
  h1 {
    font-size: clamp(3.25rem, 17vw, 5rem);
  }
  .why p {
    margin-top: 18px;
    font-size: 1.0625rem;
  }
  .products {
    display: grid;
    gap: 40px;
  }
  .group {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 30px 8px;
  }
  .group-label {
    position: static;
    grid-column: 1 / -1;
    margin-bottom: -10px;
    font-size: 0.8125rem;
  }
  .piece {
    --size: 68px;
    position: relative;
    left: auto;
    top: auto;
    grid-column: span 6;
    width: auto;
    translate: none;
  }
  .group:last-child .piece {
    grid-column: span 4;
  }
  .piece.card img {
    border-width: 3px;
    border-radius: 4px;
  }
  .label {
    width: auto;
    margin-top: 10px;
  }
  .name {
    font-size: 0.875rem;
  }
  .line {
    font-size: 0.75rem;
    text-align: center;
    white-space: normal;
  }
  .foot-in {
    justify-content: flex-start;
  }
}
@media (min-width: 560px) and (max-width: 999px) {
  .main {
    padding-block: 36px 40px;
  }
  .stage {
    gap: 64px;
  }
  .products {
    gap: 56px;
  }
  .piece,
  .group:last-child .piece {
    --size: 88px;
    grid-column: span 3;
  }
}
