/* The sprint board with the column that folds into a deck: the board of a product team in dark glass on a near black
   page with a little grain. A light rides the board's 1px edge and follows the pointer (.board__rim, masked to the
   edge, and .board__glow inside). Every column's width is set by the script each frame; inside it the open part
   (header and cards) and the folded strip (the name standing up, a small deck, the count) sit on top of each other.
   GSAP moves the cards (.card) and the strip's pieces; the CSS styles only their children. */
:root {
  --page: #070709;            /* the page */
  --board: #111115;           /* the board */
  --board-2: #0c0c0f;         /* the bottom of the board */
  --column: rgba(255, 255, 255, 0.028); /* the columns */
  --card: #1a1a20;            /* the cards */
  --card-2: #15151a;          /* the bottom of the cards */
  --ink: #f1f0f5;             /* the words */
  --muted: #8b8a96;           /* the small words */
  --iris: #8d7dff;            /* the first accent: Payments, the light */
  --mint: #5fe0b4;            /* the second accent: Forms, the progress */
  --peach: #f2b27f;           /* the third accent: Design */
}

* {
  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;
}

/* a soft iris light behind the board and a fine grain over the page */
body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    radial-gradient(60% 45% at 50% 38%, color-mix(in srgb, var(--iris) 14%, transparent), transparent 70%),
    radial-gradient(40% 30% at 70% 80%, color-mix(in srgb, var(--mint) 6%, transparent), transparent 70%);
}

body::after {
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

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

.stage {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 16px;
  overflow: hidden;
}

/* ---------------------------------------------------------------- the board */
.board {
  --mx: 30%;
  --my: 0%;
  --ch: clamp(54px, 13.4vh, 72px);
  position: relative;
  width: 100%;
  max-width: 640px;
  padding: clamp(10px, 2.6vh, 16px);
  border-radius: 22px;
  background: linear-gradient(180deg, var(--board), var(--board-2));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 50px 90px -40px rgba(0, 0, 0, 0.95),
    0 18px 30px -18px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(0, 0, 0, 0.6);
  opacity: 0;
}

/* the light on the edge: a radial gradient at the light's place, masked to a 1px ring */
.board__rim {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(240px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.62), color-mix(in srgb, var(--iris) 30%, rgba(255, 255, 255, 0.08)) 40%, rgba(255, 255, 255, 0.07) 75%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}

.board__glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(320px circle at var(--mx) var(--my), color-mix(in srgb, var(--iris) 9%, transparent), transparent 70%);
  pointer-events: none;
}

.board__head {
  position: relative;
  container-type: inline-size;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 4px clamp(8px, 2vh, 14px);
}

.board__title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
}

/* on a narrow board the sprint chip steps aside so the points always fit */
@container (max-width: 330px) {
  .board__chip {
    display: none;
  }
}

.board__mark {
  width: 20px;
  height: 20px;
  flex: none;
  fill: color-mix(in srgb, var(--iris) 22%, #15151b);
  stroke: var(--iris);
  stroke-width: 1.3;
  stroke-linecap: round;
}

.board__mark rect {
  stroke: color-mix(in srgb, var(--iris) 55%, transparent);
  stroke-width: 1;
}

.board__name {
  font-size: 14px;
  font-weight: 620;
  font-variation-settings: 'wdth' 104;
  letter-spacing: 0.005em;
}

.board__chip {
  font-size: 10.5px;
  font-weight: 520;
  color: var(--muted);
  padding: 3px 8px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09);
}

.board__score {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.board__pts b {
  color: var(--ink);
  font-weight: 600;
}

.board__bar {
  position: relative;
  width: clamp(36px, 12vw, 72px);
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.board__fill {
  position: absolute;
  inset: 0 50% 0 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--iris), var(--mint));
  box-shadow: 0 0 10px color-mix(in srgb, var(--mint) 50%, transparent);
}

/* ---------------------------------------------------------------- the columns */
.board__cols {
  position: relative;
  display: flex;
  gap: 8px;
}

.col {
  position: relative;
  flex: none;
  width: 33%;
  min-width: 0;
  padding: 7px;
  border-radius: 14px;
  background: var(--column);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.col__open {
  position: relative;
  container-type: inline-size;
}

/* in a narrow column the counts step aside so the names and codes stay whole */
@container (max-width: 150px) {
  .col__count,
  .card__pts {
    display: none;
  }
}

.col__head {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 0 0 5px;
  margin-bottom: 7px;
  white-space: nowrap;
}

.col__name {
  font-size: 12px;
  font-weight: 600;
  font-variation-settings: 'wdth' 100;
  overflow: hidden;
}

.col__count {
  font-size: 10.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.col__btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.2s, color 0.2s;
}

.col__btn svg,
.col__open-icon {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.col__btn:focus-visible,
.col__strip:focus-visible {
  outline: 2px solid var(--iris);
  outline-offset: -2px;
}

@media (hover: hover) {
  .col__btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--ink);
  }
}

.col__cards {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------------------------------------------------------------- the cards */
.card {
  position: relative;
  height: var(--ch);
}

.card__face {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: clamp(6px, 1.4vh, 9px) 10px;
  border-radius: 11px;
  background: linear-gradient(180deg, var(--card), var(--card-2));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 0 0 1px rgba(255, 255, 255, 0.055),
    0 8px 16px -10px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
  overflow: hidden;
  cursor: grab;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s;
}

@media (hover: hover) {
  .card__face:hover {
    transform: translateY(-2px);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.1),
      inset 0 0 0 1px rgba(255, 255, 255, 0.1),
      0 14px 22px -12px rgba(0, 0, 0, 0.95);
  }
}

.card__face:active {
  transform: scale(0.985);
}

.card__tag {
  font-size: 9.5px;
  font-weight: 620;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.card__tag--a { color: var(--iris); }
.card__tag--b { color: var(--mint); }
.card__tag--c { color: var(--peach); }

.card__title {
  margin: 0;
  font-size: 12.5px;
  font-weight: 540;
  line-height: 1.32;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, #000 78%, transparent);
  mask-image: linear-gradient(90deg, #000 78%, transparent);
}

.card--done .card__title {
  color: #b9b8c3;
}

.card__foot {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.card__id {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.card__pts {
  padding: 1px 5px;
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  color: #c9c8d2;
}

.card__who {
  display: grid;
  place-items: center;
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 7.5px;
  font-weight: 650;
  color: #e9e8f0;
  background: linear-gradient(140deg, #3a3550, #24242c);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

/* ---------------------------------------------------------------- the folded strip */
.col__strip {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 0 11px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  -webkit-tap-highlight-color: transparent;
}

.col.is-folded .col__strip {
  pointer-events: auto;
}

.col.is-folded .col__open {
  pointer-events: none;
}

.col__open-icon {
  color: var(--muted);
  transition: color 0.2s;
}

@media (hover: hover) {
  .col__strip:hover .col__open-icon {
    color: var(--ink);
  }
}

.col__vertical {
  display: block;
}

.col__word {
  display: block;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 12px;
  font-weight: 600;
  font-variation-settings: 'wdth' 104;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* the small deck: three cards seen from the edge, the front one lowest */
.col__deck {
  position: relative;
  width: 20px;
  height: 22px;
  margin-top: auto;
}

.col__deck i {
  position: absolute;
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(180deg, #24242b, #19191e);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15), 0 3px 5px -2px rgba(0, 0, 0, 0.8);
}

.col__deck i:nth-child(1) { top: 8px; left: 0; width: 20px; z-index: 3; }
.col__deck i:nth-child(2) { top: 4px; left: 1.5px; width: 17px; z-index: 2; opacity: 0.8; }
.col__deck i:nth-child(3) { top: 0; left: 3px; width: 14px; z-index: 1; opacity: 0.6; }

.col__num {
  font-size: 10.5px;
  font-weight: 560;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* the small check on the cards that are done, drawn in SVG */
.card__face {
  position: relative;
}

.card__ok {
  position: absolute;
  top: clamp(5px, 1.3vh, 8px);
  right: 8px;
  width: 14px;
  height: 14px;
  fill: color-mix(in srgb, var(--mint) 14%, transparent);
  stroke: var(--mint);
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card__ok circle {
  stroke: color-mix(in srgb, var(--mint) 45%, transparent);
}
