@import url('https://fonts.googleapis.com/css2?family=Geist:wght@500;600&display=swap');

/* Tip 005: an insert line for drag-to-reorder, with neighbours that ripple away from it. */

.tip-stage:has(> .tip-credit) { padding: 0; }

.area-top,
.area-bottom {
  position: absolute;
  left: 0;
  right: 0;
}

/* Above: one list at a time on plain white. */
.area-top {
  top: 0;
  height: 720px;
  background: #ffffff;
}

/* Below: the caption and the rule, in dark mode. */
.area-bottom {
  top: 720px;
  bottom: 0;
  background: #151515;
}

.sortable {
  margin: 0;
  padding: 0;
  list-style: none;
}

/*
 * Radii nest: an inner box p inside a container of radius R gets R - p, so
 * both corners share one centre. Cards are 28 with their tile 16 in (12);
 * the dock is 36 with its icons 16 in (20). Every corner is continuous.
 */

/* ---------- Cards ---------- */

/* Containers stay untransformed: ripple.js measures items with offsetLeft/Top. */
.cards {
  position: absolute;
  top: 142px;
  left: 0;
  right: 0;
  display: grid;
  gap: 12px;
  width: 624px;
  margin: 0 auto;
}

.card {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 88px;
  padding: 0 15px;
  border: 1px solid #ebebef;
  border-radius: 28px;
  corner-shape: superellipse(1.25);
  background: #ffffff;
  color: #13112b;
  box-shadow: 0 1px 2px rgba(20, 22, 16, 0.04), 0 8px 24px -16px rgba(20, 22, 16, 0.16);
  box-sizing: border-box;
}

.tile {
  display: grid;
  place-items: center;
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  corner-shape: superellipse(1.25);
  background: var(--tile);
  color: var(--ink, #ffffff);
}

.tile svg,
.app svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.card-text {
  display: grid;
  flex: 1;
  gap: 4px;
}

.card-text b { font: 600 23px/1.2 var(--tip-font-sans); }
.card-text small { color: #7c7a93; font: 400 18px/1.2 var(--tip-font-sans); }

.card-time {
  flex: none;
  color: #7c7a93;
  font: 500 18px/1 'Geist', var(--tip-font-sans);
  font-variant-numeric: tabular-nums;
}

/* The queue's title sits above the list, lined up with the cards' text. */
.queue-head {
  position: absolute;
  top: 90px;
  left: 0;
  right: 0;
  width: 592px;
  margin: 0 auto;
  color: #13112b;
  font: 600 24px/1 var(--tip-font-sans);
}

.grip {
  flex: none;
  width: 28px;
  height: 28px;
  fill: #b9b8c6;
}

/* ---------- Dock ---------- */

.dock {
  position: absolute;
  top: 304px;
  left: 0;
  right: 0;
  width: 688px;
  height: 112px;
  margin: 0 auto;
  padding: 15px;
  border: 1px solid #ebebef;
  border-radius: 36px;
  corner-shape: superellipse(1.25);
  background: #f5f5f7;
  box-sizing: border-box;
}

.dock ol {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.app {
  display: grid;
  place-items: center;
  flex: none;
  width: 80px;
  height: 80px;
  overflow: hidden;
  border-radius: 20px;
  corner-shape: superellipse(1.25);
  background: var(--app);
  color: var(--ink, #ffffff);
  box-shadow: inset 0 0 0 1px rgba(20, 22, 16, 0.06), 0 2px 4px rgba(20, 22, 16, 0.08);
}

.tile svg { width: 32px; height: 32px; }
.app svg { width: 44px; height: 44px; }

/* ---------- Dragging ---------- */

.drag-layer {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
}

.drag-layer > * {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0;
}

.drag-layer > .card { box-shadow: 0 2px 4px rgba(20, 22, 16, 0.06), 0 24px 40px -16px rgba(20, 22, 16, 0.28); }
.drag-layer > .app { box-shadow: 0 20px 32px -12px rgba(20, 22, 16, 0.36); }

/* Lumno's insert line: a faint pill in the gap, grown from its middle. It
   only hints at the drop; the items making way carry the motion. */
.insert-line {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 8;
  border-radius: 999px;
  background: rgba(19, 17, 43, 0.16);
  opacity: 0;
}

.insert-line[data-for="x"] { width: 3px; height: 72px; }
.insert-line[data-for="y"] { width: 576px; height: 3px; }

/* The cursor: an arrow, a pointing hand over something draggable, a gripping
   hand while dragging. It swaps in a single frame. The pointing hand's
   hotspot is its fingertip; the gripping hand's is its centre. */
.tip-pointer .hand {
  width: 76px;
  height: 76px;
  transition: none;
}

.tip-pointer .hand-point { left: -31px; top: -12px; transform-origin: 31px 12px; }
.tip-pointer .hand-grabbing { left: -38px; top: -38px; transform-origin: 50% 50%; }

.tip-pointer:not([data-cursor="arrow"]) svg:not(.hand),
.tip-pointer:not([data-cursor="point"]) .hand-point,
.tip-pointer:not([data-cursor="grabbing"]) .hand-grabbing { display: none; }

/* ---------- The rule ---------- */

/* Each step shows its own scene, caption and rule; step 2 starts hidden. */
.tip-stage [data-step="2"] { opacity: 0; }

.rule {
  position: absolute;
  left: 0;
  right: 0;
  margin: 0 auto;
}

.rule[data-axis="x"] { top: 1036px; width: 720px; height: 184px; }
.rule[data-axis="y"] { top: 976px; width: 680px; height: 384px; }

.rule-body { position: absolute; inset: 0; }
.rule-body > * { position: absolute; left: 0; top: 0; }

.rule-head {
  color: #6f6f6f;
  font: 500 22px/36px var(--tip-font-mono);
}

.rule[data-axis="y"] .rule-head { width: 100px; text-align: center; }

/* Dock step: icon-sized squares. */
.rule-tile {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  corner-shape: superellipse(1.25);
  background: #2a2a2a;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Card step: card outlines, a cover square 8px in and a title stub. The
   radii nest: 16 outside, 16 - 8 = 8 inside. */
.rule-card {
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 16px;
  width: 400px;
  height: 52px;
  padding: 0 8px;
  border-radius: 16px;
  corner-shape: superellipse(1.25);
  background: #2a2a2a;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  box-sizing: border-box;
}

.rule-card::before,
.rule-card::after {
  content: "";
  border-radius: 4px;
  corner-shape: superellipse(1.25);
  background: #3a3a3a;
}

.rule-card::before { flex: none; width: 36px; height: 36px; border-radius: 8px; }
.rule-card::after { flex: none; width: 168px; height: 12px; border-radius: 6px; }

/* The item being dragged: lighter, and lifted with a shadow. */
.rule-ghost {
  z-index: 1;
  transform-origin: 0 0;
  background: #4a4a4a;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 12px 24px -8px rgba(0, 0, 0, 0.6);
}

.rule-ghost.rule-card::before,
.rule-ghost.rule-card::after { background: #6a6a6a; }

.rule-line {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
}

.rule[data-axis="x"] .rule-line { width: 3px; height: 80px; }
.rule[data-axis="y"] .rule-line { width: 400px; height: 3px; transform-origin: 50% 50%; }

.rule-value {
  width: 100px;
  text-align: center;
  font: 600 28px/36px 'Geist', var(--tip-font-sans);
  font-variant-numeric: tabular-nums;
}

.rule[data-axis="x"] .rule-value { margin-left: -50px; }
/* A rolling number: the old value and the new one share the same box. */
.rule-value { height: 36px; }
.rule-value span { position: absolute; inset: 0; }

.rule-value.is-nudge { color: #f5f5f5; }
.rule-value.is-delay { color: #7a7a7a; }

/* ---------- Captions ---------- */

.caption {
  position: absolute;
  left: 0;
  right: 0;
  top: 788px;
  display: grid;
  justify-items: center;
  gap: 20px;
  color: #ededed;
  text-align: center;
}

.caption .code {
  margin: 0;
  padding: 24px 40px;
  border-radius: 24px;
  corner-shape: superellipse(1.25);
  background: #1f1f1f;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  color: #d4d4d4;
  font: 500 30px/1.6 var(--tip-font-mono);
  text-align: left;
}

.code .fn { color: #9ecbff; }
.code .num { color: #fcd116; }

.tip-credit { bottom: 34px; color: #8f8f8f; }
.tip-credit img { filter: invert(1); }
