/* The kanban board with the work in progress limit: the sprint board of a product team on a white page. A soft grey
   panel with a 1px edge that catches the light, three columns, white cards with layered shadows. The cards sit in
   one layer over the columns and are placed by the script; GSAP moves the card (.card), the CSS dresses its face
   (.card__face), so the two transforms never fight. */
:root {
  --page: #ffffff;          /* the page */
  --panel: #f6f6f4;         /* the board */
  --panel-deep: #efefec;    /* the bottom of the board */
  --column: rgba(20, 20, 30, 0.035); /* the columns */
  --card: #ffffff;          /* the cards */
  --ink: #17171c;           /* the words */
  --muted: #8b8b94;         /* the small words */
  --accent: #4f46e5;        /* the room a column makes for a card */
  --warn: #d97a1e;          /* the limit that is reached */
  --done: #1f9d6b;          /* the check in Done */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 12px;
  overflow: hidden;
}

/* ---------------------------------------------------------------- the board */
.board {
  --pad: clamp(9px, min(2.4vw, 2.6vh), 16px);
  --gap: clamp(5px, min(1.4vw, 1.5vh), 8px);
  position: relative;
  width: min(640px, 94vw);
  padding: var(--pad);
  border-radius: clamp(14px, 3vw, 20px);
  background: linear-gradient(180deg, var(--panel), var(--panel-deep));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 0 0 1px rgba(20, 20, 30, 0.06),
    0 1px 2px rgba(20, 20, 30, 0.05),
    0 8px 18px -8px rgba(20, 20, 30, 0.1),
    0 34px 64px -30px rgba(20, 20, 30, 0.22);
  opacity: 0;
  user-select: none;
  -webkit-user-select: none;
}

.board__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px calc(var(--pad) * 0.9);
}

.board__title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.board__mark {
  flex: none;
  width: clamp(24px, min(5vw, 5vh), 30px);
  height: clamp(24px, min(5vw, 5vh), 30px);
  padding: 5px;
  border-radius: 8px;
  background: linear-gradient(160deg, #5b53f0, #3b33c9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 2px 6px -2px rgba(79, 70, 229, 0.6);
  fill: none;
  stroke: #ffffff;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.board__name {
  margin: 0;
  font-size: clamp(12.5px, min(2.4vw, 2.6vh), 15px);
  font-weight: 640;
  font-stretch: 104%;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.board__meta {
  margin: 1px 0 0;
  font-size: clamp(10px, min(1.8vw, 2vh), 11.5px);
  color: var(--muted);
  font-weight: 480;
}

.board__team {
  display: flex;
  flex: none;
}

.board__team .ava + .ava {
  margin-left: -4px;
}

.ava {
  display: inline-grid;
  place-items: center;
  width: clamp(20px, min(4vw, 4vh), 24px);
  height: clamp(20px, min(4vw, 4vh), 24px);
  border-radius: 7px;
  font-size: clamp(8px, min(1.5vw, 1.6vh), 9px);
  font-weight: 650;
  letter-spacing: 0.02em;
  color: #ffffff;
  box-shadow: 0 0 0 2px var(--panel), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.ava--a { background: linear-gradient(160deg, #3d3d48, #22222a); }
.ava--b { background: linear-gradient(160deg, #6a64f2, #4f46e5); }
.ava--c { background: linear-gradient(160deg, #3fb48a, #1f9d6b); }

.ava--s {
  width: 17px;
  height: 17px;
  border-radius: 5px;
  font-size: 7px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* ---------------------------------------------------------------- the columns */
.board__cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
}

.col {
  position: relative;
  border-radius: clamp(10px, 2vw, 13px);
  background: var(--column);
  box-shadow: inset 0 0 0 1px rgba(20, 20, 30, 0.035);
  padding: calc(var(--gap) + 2px) var(--gap) var(--gap);
  transition: background-color 0.35s ease, box-shadow 0.35s ease;
}

.col.is-over {
  background: color-mix(in srgb, var(--accent) 5%, var(--column));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}

.col.is-refusing {
  background: color-mix(in srgb, var(--warn) 7%, var(--column));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 40%, transparent);
}

.col__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 0 3px calc(var(--gap) + 1px);
}

.col__name {
  font-size: clamp(10px, min(1.9vw, 2.1vh), 12px);
  font-weight: 620;
  font-stretch: 102%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.count {
  display: inline-flex;
  align-items: center;
  flex: none;
  height: 18px;
  padding: 0 6px;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(20, 20, 30, 0.07), 0 1px 1px rgba(20, 20, 30, 0.04);
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  overflow: hidden;
  transition: color 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

.count__n {
  position: relative;
  display: inline-block;
  min-width: 0.6em;
  height: 18px;
  line-height: 18px;
  text-align: center;
}

.count__n > span {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
}

.col.is-full .count {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 9%, #ffffff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 30%, transparent);
}

.col__body {
  position: relative;
}

.col__hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--gap) + 2px);
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: clamp(9px, min(1.7vw, 1.9vh), 10.5px);
  font-weight: 560;
  color: var(--warn);
  opacity: 0;
  pointer-events: none;
}

.col__hint svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* ---------------------------------------------------------------- the cards */
.board__layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.card {
  --lift: 0;
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  outline: none;
  opacity: 0;
  will-change: transform;
}

.card.is-held {
  cursor: grabbing;
  z-index: 5;
}

.card.is-flying {
  z-index: 4;
}

.card__face {
  position: relative;
  display: grid;
  gap: clamp(3px, 0.8vh, 6px);
  padding: clamp(7px, min(1.6vw, 1.6vh), 10px) clamp(7px, 1.6vw, 10px);
  border-radius: clamp(8px, 1.6vw, 10px);
  background: var(--card);
  box-shadow:
    inset 0 0 0 1px rgba(20, 20, 30, 0.07),
    0 1px 1px rgba(20, 20, 30, 0.04),
    0 2px 5px -2px rgba(20, 20, 30, 0.08);
  transition: transform 0.18s cubic-bezier(0.3, 0.7, 0.4, 1);
}

/* the long shadow of a card in the hand: its own layer, so only its opacity moves */
.card__face::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    0 10px 16px -8px rgba(20, 20, 30, 0.18),
    0 26px 40px -16px rgba(20, 20, 30, 0.26),
    0 44px 60px -30px rgba(40, 34, 120, 0.22);
  opacity: var(--lift);
  pointer-events: none;
}

/* the light along the top edge that the card catches when it is lifted */
.card__face::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 30%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) calc(var(--lift) * 18%), transparent);
  opacity: var(--lift);
  pointer-events: none;
}

@media (hover: hover) {
  .card:not(.is-held):not(.is-flying):hover .card__face {
    transform: translateY(-1px);
    box-shadow:
      inset 0 0 0 1px rgba(20, 20, 30, 0.1),
      0 1px 1px rgba(20, 20, 30, 0.04),
      0 6px 12px -6px rgba(20, 20, 30, 0.16);
  }
}

.card:focus-visible .card__face {
  box-shadow:
    inset 0 0 0 1px rgba(20, 20, 30, 0.07),
    0 0 0 2px var(--panel),
    0 0 0 4px var(--accent);
}

.tag {
  justify-self: start;
  padding: 1px 6px;
  border-radius: 5px;
  font-size: clamp(8.5px, min(1.6vw, 1.7vh), 10px);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.5;
}

.tag--design { color: #4f46e5; background: rgba(79, 70, 229, 0.09); }
.tag--backend { color: #4a4a55; background: rgba(20, 20, 30, 0.06); }
.tag--growth { color: #16855a; background: rgba(31, 157, 107, 0.1); }

.card__title {
  margin: 0;
  font-size: clamp(10.5px, min(2vw, 2.2vh), 13px);
  font-weight: 600;
  font-stretch: 100%;
  letter-spacing: -0.005em;
  line-height: 1.22;
  transition: color 0.4s ease;
}

.card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.card__meta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: clamp(8.5px, min(1.6vw, 1.7vh), 10px);
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.card__meta svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
}

.card__check {
  position: absolute;
  top: clamp(6px, 1.4vh, 9px);
  right: clamp(6px, 1.4vw, 9px);
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--done);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}

.card__check circle {
  stroke: color-mix(in srgb, var(--done) 35%, transparent);
}

.card.is-done .card__title {
  color: #6c6c76;
}

/* ---------------------------------------------------------------- the room a column makes */
.slot {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: clamp(8px, 1.6vw, 10px);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 26%, transparent);
  opacity: 0;
}

/* ---------------------------------------------------------------- the pilot's hand */
.hand {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  margin: -3px 0 0 -5px;
  fill: #17171c;
  stroke: #ffffff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.22));
  opacity: 0;
  z-index: 8;
}

@media (max-width: 420px) {
  .board__team .ava:nth-child(3) {
    display: none;
  }
  .card__meta svg {
    display: none;
  }
  .col__head {
    padding-left: 1px;
    padding-right: 0;
  }
  .col__name {
    font-stretch: 84%;
    letter-spacing: -0.01em;
  }
  .count {
    padding: 0 4px;
  }
}
