/* Ten physical objects, two neutral groups. Their colours never encode a group. */
.hero .magnet-demo {
  container-type: inline-size;
  min-width: 0;
  margin: 0;
  padding: clamp(1rem, 3vw, 3rem);
  align-self: center;
}

.magnet-demo h2 {
  font-size: clamp(2rem, 3.5vw, 3rem);
  line-height: 1.15;
}

.magnet-intro {
  margin-top: .65rem;
  font-size: 1.125rem;
}

.magnet-groups {
  display: grid;
  gap: .8rem;
  margin-top: 1.4rem;
}

.magnet-group {
  min-width: 0;
  padding: .65rem;
  border: 1px solid var(--craie-line);
  border-radius: .25rem;
}

.magnet-group h3 {
  margin-bottom: .6rem;
  font-family: var(--font-body);
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.3;
}

.magnet-tray {
  display: grid;
  grid-template-columns: repeat(5, minmax(44px, 1fr));
  grid-template-rows: repeat(2, minmax(44px, auto));
  gap: .2rem;
}

.magnet-slot {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  aspect-ratio: 1;
  border-radius: 50%;
}

.magnet-slot:empty::after {
  content: "";
  width: .3rem;
  height: .3rem;
  border-radius: 50%;
  background: var(--craie-line);
}

.magnet-object {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 3.25rem;
  min-width: 44px;
  height: auto;
  min-height: 44px;
  aspect-ratio: 1;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #202b28;
  background: var(--magnet-blue);
  box-shadow: 1px 3px 5px rgb(0 0 0 / 35%), inset 0 1px 1px rgb(255 255 255 / 50%);
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.magnet-object[data-colour="orange"] { background: var(--magnet-orange); }
.magnet-object[data-colour="green"] { background: var(--magnet-green); }
.magnet-object:disabled { cursor: default; opacity: 1; }
.magnet-object:hover:enabled { box-shadow: 1px 4px 7px rgb(0 0 0 / 45%), inset 0 1px 1px rgb(255 255 255 / 60%); }
.magnet-object:focus-visible,
.magnet-object[aria-pressed="true"] {
  outline: 2px solid var(--craie-ink);
  outline-offset: 3px;
}
.magnet-object.is-dragging {
  position: fixed;
  z-index: 100;
  margin: 0;
  pointer-events: none;
  cursor: grabbing;
  box-shadow: 2px 8px 12px rgb(0 0 0 / 45%), inset 0 1px 1px rgb(255 255 255 / 60%);
}
.magnet-object.is-origin { opacity: 0; }
.magnet-group.is-drop-target {
  outline: 2px dashed var(--craie-ink);
  outline-offset: 3px;
}
.magnet-group.is-select-target { cursor: pointer; }

.magnet-demo figcaption {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .25rem;
  margin-top: 1rem;
  font-size: 1.125rem;
}
.magnet-equation {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 400;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.magnet-controls { margin-top: 1rem; }
.magnet-hint {
  max-width: 48ch;
  font-size: 1.125rem;
  line-height: 1.45;
}
.magnet-move {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 12rem;
  min-height: 44px;
  margin-top: .7rem;
  padding: .5rem .9rem;
  border: 1px solid var(--craie-ink);
  border-radius: .25rem;
  color: var(--craie-ink);
  background: transparent;
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.3;
  cursor: pointer;
  touch-action: manipulation;
}
.magnet-move:hover:enabled { background: var(--craie-sage); }
.magnet-move:disabled { border-color: var(--craie-line); color: var(--craie-ink-soft); cursor: default; }

@container (min-width: 500px) {
  .magnet-groups { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 380px) {
  .hero .magnet-demo { padding-inline: 1rem; }
  .magnet-group { padding: .5rem; }
}

@media (forced-colors: active) {
  .magnet-object { border: 1px solid ButtonText; }
  .magnet-object[aria-pressed="true"] { outline: 3px solid Highlight; }
}
