/* The print studio board: three pale trays on a white page, every job a sheet of paper with its little proof
   printed in two riso inks. */
:root {
  --page: #ffffff;          /* the page */
  --tray: #f1f2f4;          /* a column */
  --tray-over: #e9ebef;     /* the column a sheet is over */
  --paper: #ffffff;         /* a job's sheet */
  --ink: #17191f;           /* the words */
  --muted: #676d79;         /* the client, the icons */
  --hair: rgba(20, 24, 34, 0.1);  /* the hairline round a sheet */
  --well: #e3e6eb;          /* the place that opens for a sheet */
  --count: #e2e5ea;         /* behind a count */
  --shade: #1e2230;         /* the paper turned away from the light */

  /* the riso inks, as they print */
  --riso-fluo-pink: #ff48b0;
  --riso-blue: #0078bf;
  --riso-teal: #00838a;
  --riso-orange: #ff6c2f;
  --riso-green: #00a95c;
  --riso-yellow: #ffe800;
  --riso-burgundy: #914e72;
  --riso-purple: #765ba7;
  --riso-black: #1d1d1f;

  /* the same inks, dark enough to be read as words */
  --text-fluo-pink: #c81f7a;
  --text-blue: #0067a6;
  --text-teal: #00747a;
  --text-orange: #c94b12;
  --text-green: #007a43;
  --text-yellow: #8a6d00;
  --text-burgundy: #86446a;
  --text-purple: #6a4f9c;
  --text-black: #1b1c20;
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
}

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

/* the board keeps its top where it is when a column grows */
.stage {
  min-height: 100svh;
  display: grid;
  justify-items: center;
  align-content: start;
  padding: max(24px, calc(50svh - 232px)) 16px 32px;
}

.board {
  max-width: 100%;
  user-select: none;
  -webkit-user-select: none;
}

.board__track {
  display: flex;
  align-items: stretch;
  gap: 14px;
}

/* ---------------------------------------------------------------- a column */
.col {
  flex: none;
  width: 252px;
  min-height: 424px;
  padding: 12px 10px 10px;
  border-radius: 18px;
  background: var(--tray);
  transition: background-color 0.3s;
}

.col.is-over {
  background: var(--tray-over);
}

.col__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 4px 12px 6px;
}

.col__icon {
  display: grid;
  color: var(--muted);
}

.col__icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.col__name {
  flex: 1;
  margin: 0;
  font-size: 14.5px;
  font-weight: 650;
  font-stretch: 92%;
  letter-spacing: -0.005em;
}

/* the count turns over like a paper tab when it changes */
.col__count {
  display: inline-grid;
  overflow: hidden;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border-radius: 7px;
  background: var(--count);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 22px;
  text-align: center;
  perspective: 120px;
}

.col__count > span {
  grid-area: 1 / 1;
  backface-visibility: hidden;
}

.col__list {
  position: relative;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.col__list:empty::after {
  content: 'No jobs here';
  display: block;
  padding: 26px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ---------------------------------------------------------------- a job */
.job {
  position: relative;
}

/* the place that opens where a sheet will land */
.job::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 7px;
  background: var(--well);
  box-shadow: inset 0 1px 2px rgba(16, 22, 38, 0.1);
  opacity: 0;
  transition: opacity 0.18s;
}

.job.is-slot::before {
  opacity: 1;
}

.job.is-slot > .card {
  opacity: 0;
}

.card {
  appearance: none;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto auto;
  column-gap: 12px;
  width: 100%;
  height: 92px;
  margin: 0;
  padding: 12px 12px 0 14px;
  border: 0;
  border-radius: 7px;
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--hair), 0 1px 2px rgba(16, 22, 38, 0.06);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  line-height: 1.25;
  text-align: left;
  cursor: grab;
  outline: none;
  touch-action: pan-x pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow 0.2s, transform 0.25s cubic-bezier(0.23, 1, 0.32, 1);
}

.card__title {
  overflow: hidden;
  font-weight: 620;
  font-stretch: 94%;
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.card__client {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.card__art {
  grid-column: 2;
  grid-row: 1 / span 2;
  width: 27px;
  height: 36px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--hair), 0 1px 2px rgba(16, 22, 38, 0.12);
}

.card__foot {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  font-size: 12.5px;
}

.card__size {
  font-weight: 560;
  font-variant-numeric: tabular-nums;
}

.card__inks {
  display: flex;
  gap: 9px;
  font-weight: 620;
}

@media (hover: hover) and (pointer: fine) {
  .card:hover {
    box-shadow: inset 0 0 0 1px rgba(20, 24, 34, 0.14), 0 2px 4px rgba(16, 22, 38, 0.08), 0 8px 18px -8px rgba(16, 22, 38, 0.22);
    transform: translateY(-1px);
  }
}

.card:focus-visible {
  box-shadow: inset 0 0 0 1px var(--hair), 0 0 0 2px var(--page), 0 0 0 4px var(--ink);
}

html[data-using='pointer'] .card:focus-visible {
  box-shadow: inset 0 0 0 1px var(--hair), 0 1px 2px rgba(16, 22, 38, 0.06);
}

/* ---------------------------------------------------------------- the sheet in the air */
.layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  pointer-events: none;
}

.paper {
  position: absolute;
  inset: 0;
  perspective: 640px;
}

.paper__body {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

/* a strip of the sheet: a copy of the job cut to its width, turned to follow the paper */
.paper__strip {
  position: absolute;
  left: 0;
  top: 0;
  overflow: hidden;
  transform-origin: 0 0;
  will-change: transform;
}

.paper__shade {
  position: absolute;
  inset: 0;
}

.card--ghost {
  position: absolute;
  top: 0;
  box-shadow: inset 0 0 0 1px var(--hair);
  transition: none;
}

/* lifted with the keys: the ring of the focus goes with the sheet */
.card--ghost.is-keys {
  box-shadow: inset 0 0 0 2px var(--ink);
}

.paper__shadow {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 9px;
  background: rgba(16, 22, 38, 0.5);
  will-change: transform, filter;
}

html.is-grabbing,
html.is-grabbing * {
  cursor: grabbing !important;
}

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

/* ---------------------------------------------------------------- the phone: the columns scroll sideways */
@media (max-width: 860px) {
  .board {
    width: calc(100% + 32px);
    max-width: none;
    margin: 0 -16px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 16px;
    scrollbar-width: none;
  }

  .board::-webkit-scrollbar {
    display: none;
  }

  .board__track {
    width: max-content;
    padding: 0 16px;
  }

  .col {
    width: min(264px, 74vw);
    scroll-snap-align: start;
  }

  html.is-carrying .board {
    scroll-snap-type: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  @media (hover: hover) {
    .card:hover {
      transform: none;
    }
  }
}
