/* ===========================================================================
   The research card.

   One shape for every round of user research on the site. Four things, always
   in this order: what was tested, how many people, when, and what the round
   settled.

   The two numbers are drawn rather than only written. The sample is one mark
   per person, so five and fifty are told apart before they are read; fifty
   wraps into a block and five is a short row. The date is a marker on the
   project's own run, so a column of cards reads as a timeline down the page.

   One colour. The marks, the timeline marker and the arrow on a change all
   use it; nothing else is coloured. Grey means a number nobody has given me
   yet, and grey appears nowhere else.

   Draft: loaded only by drafts/research-card.html until the shape is agreed.
   Built by tools/build-research-cards.py.
   =========================================================================== */

/* The page's own colours, not a second set. ink / ink-soft / line / accent
   are style.css; the card sits on --paper and is cut from --paper-soft.
   .rc-round carries the same tokens so a round can announce itself inside a
   case study, where the draft page's own chrome does not exist. */
.rc-page,
.rc-round {
  --rc-ink: var(--ink);
  --rc-soft: var(--ink-soft);
  --rc-faint: var(--case-line, var(--line));
  --rc-accent: var(--case-accent, var(--accent));
  --rc-accent-deep: var(--case-accent-deep, var(--accent-deep));
}
body.rc-page { background: var(--case-paper, var(--paper)); color: var(--rc-ink); }

.rc-bar {
  position: sticky; top: 0; z-index: 9;
  display: flex; align-items: center; gap: .9rem; flex-wrap: wrap;
  padding: .55rem clamp(1rem, 3.5vw, 2.6rem);
  background: var(--rc-ink); color: var(--paper);
  font-family: var(--font-body); font-size: .76rem;
}
.rc-bar b { font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; }

.rc-main { padding-block: clamp(3rem, 7vw, 6rem) clamp(5rem, 11vw, 9rem); }

.rc-kicker {
  margin: 0;
  font-family: var(--font-body);
  font-size: .7rem; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: var(--rc-soft);
}

.rc-intro { max-width: 44rem; }
.rc-intro h1 {
  margin: .6rem 0 1.1rem;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 5.4vw, 4rem); font-weight: 600;
  letter-spacing: -.025em; line-height: 1;
}
.rc-intro p { margin: 0; max-width: 58ch; color: var(--rc-soft); line-height: 1.6; }

.rc-sec { margin-top: clamp(4rem, 9vw, 7rem); }
.rc-sec > h2 {
  margin: .5rem 0 .3rem;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.5rem); font-weight: 600;
  letter-spacing: -.022em; line-height: 1.04;
}
.rc-span { margin: 0 0 clamp(1.8rem, 4vw, 2.8rem); color: var(--rc-soft); font-size: .85rem; }

/* ---------- the card ------------------------------------------------------ */

/* A card on the warm page: white, a hairline, and one soft shadow. The page
   is the background; the card is the thing standing on it. */
/* A grid, so the rounds stay in the order they happened: filling by height
   instead put the fourth card beside the first. A card left alone at the end
   of a row takes the whole row and lays its findings out across it. */
.rc-grid {
  --rc-gap: clamp(1.1rem, 2.2vw, 1.6rem);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: var(--rc-gap);
}
@media (min-width: 62rem) {
  .rc-grid { grid-template-columns: repeat(3, 1fr); }
  .rc-card:last-child:nth-child(3n + 1) { grid-column: span 3; }
  .rc-card:last-child:nth-child(3n + 2) { grid-column: span 2; }
  .rc-card:last-child:nth-child(3n + 1) .rc-signals { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rc-card:last-child:nth-child(3n + 2) .rc-signals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rc-card:last-child:nth-child(3n + 1) .rc-signals,
  .rc-card:last-child:nth-child(3n + 2) .rc-signals {
    display: grid;
    gap: 1.35rem clamp(1.8rem, 3vw, 2.6rem);
  }
  /* The track stays the length it is on the other cards. Stretched across a
     whole row, a marker at the same month would sit somewhere else entirely,
     and the point of the track is that the cards can be compared. */
  .rc-card:last-child:nth-child(3n + 1) .rc-time,
  .rc-card:last-child:nth-child(3n + 2) .rc-time { max-width: 24rem; }
  /* The grid owns the gaps now. */
  .rc-card:last-child:nth-child(3n + 1) .rc-signals > li,
  .rc-card:last-child:nth-child(3n + 2) .rc-signals > li { margin: 0; }
}

.rc-card {
  padding: clamp(1.3rem, 2.4vw, 1.7rem) clamp(1.3rem, 2.4vw, 1.6rem)
           clamp(1.45rem, 2.6vw, 1.8rem);
  background: var(--case-surface-strong, var(--paper-soft));
  border: 1px solid var(--rc-faint);
  border-radius: 1rem;
  box-shadow: 0 18px 44px rgba(52, 39, 27, 0.07);
}

.rc-subject {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2vw, 1.75rem); font-weight: 600;
  letter-spacing: -.02em; line-height: 1.08;
  text-wrap: balance;
}

/* ---------- the sample, drawn ---------------------------------------------- */

.rc-sample { display: grid; gap: .5rem; margin-top: .9rem; }
.rc-sitting { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.rc-dots {
  display: grid;
  grid-template-columns: repeat(auto-fit, 7px);
  gap: 4px;
  width: max-content; max-width: 11rem;
}
.rc-dots {
  align-self: center;
}
.rc-dots i {
  display: block; box-sizing: border-box;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--rc-accent);
}
/* A count that is three or four: the three that are certain, then an open one.
   It has to out-weigh .rc-dots i, which fills every mark. */
.rc-dots i.rc-maybe {
  background: none;
  border: 1.25px solid var(--rc-accent);
}
/* Fifty marks want to read as a block rather than a very long row. */
.rc-dots-dense { grid-template-columns: repeat(10, 6px); gap: 3px; }
.rc-dots-dense i { width: 6px; height: 6px; }

.rc-dots-unknown i { background: none; border: 1px solid var(--rc-faint); }

.rc-n {
  font-family: var(--font-body);
  font-size: .86rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.rc-unknown { color: var(--rc-soft); font-weight: 500; }

.rc-how {
  font-family: var(--font-body);
  font-size: .81rem; line-height: 1.4;
  color: var(--rc-soft);
}

/* ---------- the date, on the project's own run ----------------------------- */

.rc-time { display: flex; align-items: center; gap: .7rem; margin-top: .95rem; }

.rc-track {
  position: relative;
  flex: 1; min-width: 3rem; height: 1px;
  background: var(--rc-faint);
}
.rc-track::before,
.rc-track::after {
  content: ""; position: absolute; top: -2.5px;
  width: 1px; height: 6px; background: var(--rc-faint);
}
.rc-track::before { left: 0; }
.rc-track::after { right: 0; }
.rc-track-unknown { background: none; border-top: 1px dashed var(--rc-faint); }

.rc-mark {
  position: absolute; top: 50%;
  width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px;
  border-radius: 50%; background: var(--rc-accent);
}
.rc-band {
  position: absolute; top: 50%;
  height: 5px; margin-top: -2.5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rc-accent) 72%, transparent);
}

.rc-time .rc-when {
  flex: none;
  font-family: var(--font-body);
  font-size: .78rem; font-variant-numeric: tabular-nums;
  color: var(--rc-soft);
}

/* ---------- the signals ---------------------------------------------------- */

.rc-signals {
  counter-reset: rc;
  margin: 1.25rem 0 0; padding: 1.25rem 0 0; list-style: none;
  border-top: 1px solid var(--rc-faint);
}
.rc-signals > li {
  counter-increment: rc;
  position: relative;
  padding-left: 1.9rem;
}
.rc-signals > li + li { margin-top: 1.25rem; }
.rc-signals > li::before {
  content: counter(rc, decimal-leading-zero);
  position: absolute; left: 0; top: .22em;
  font-family: var(--font-body);
  font-size: .68rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--rc-accent-deep) 58%, transparent);
}

.rc-signals h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.08rem, 1.45vw, 1.26rem); font-weight: 600;
  letter-spacing: -.012em; line-height: 1.18;
  text-wrap: pretty;
}
.rc-change {
  position: relative;
  margin: .42rem 0 0; padding-left: 1.1rem;
  font-family: var(--font-body);
  font-size: .88rem; line-height: 1.5;
  color: var(--rc-soft);
}
.rc-change::before {
  content: "\2192";
  position: absolute; left: 0; top: 0;
  color: var(--rc-accent);
}

/* ---------- the gaps ------------------------------------------------------- */

.rc-gaps { margin: 1.4rem 0 0; padding: 0; list-style: none; max-width: 52rem; }
.rc-gaps li {
  padding: .75rem 0;
  border-top: 1px solid var(--rc-faint);
  font-family: var(--font-body);
  font-size: .88rem; line-height: 1.55; color: var(--rc-soft);
}
.rc-gaps li b { color: var(--rc-ink); font-weight: 600; }

.rc-sec > p:not(.rc-span) { max-width: 58ch; color: var(--rc-soft); line-height: 1.6; }

@media (max-width: 520px) {
  .rc-dots { max-width: 100%; }
}


/* ===========================================================================
   A round announcing itself inside a case study.

   Same two drawings as the card, without the box: the case study is already
   the box. It replaces a line that only named the round, so the name keeps
   the rule it had and the numbers are drawn underneath it.
   =========================================================================== */

.rc-round { margin-top: 2.6rem; }
.pd-growth .pd-method > .rc-round { margin-top: var(--sp-stage); }

/* The round is named the way the card names it: the display face, at heading
   size. A small accent label with a rule after it read as a caption, which is
   not what the title of a round should look like. */
.rc-card-round .rc-subject {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 2.3vw, 2.05rem); font-weight: 600;
  letter-spacing: -.02em; line-height: 1.06;
  color: var(--rc-ink);
  text-wrap: balance;
}

.rc-round-data {
  margin-top: .8rem;
  display: flex; align-items: center; gap: .85rem 2.2rem; flex-wrap: wrap;
}
.rc-round-data .rc-sample { margin-top: 0; }
.rc-round-data .rc-time { margin-top: 0; flex: 1 1 15rem; max-width: 26rem; }

/* In Market Research the round is followed by the finding itself, which was
   sitting 5px under the date. */
.rc-round + h3 { margin-top: 1.05rem; }

/* The evidence follows directly under the round, as it did before. */
.rc-round + .pd-ways,
.rc-round + .paira-findings,
.rc-round + .paira-screen-grid { margin-top: var(--sp-tight, 1.7rem); }
.pd-growth .rc-round + .pd-ways,
.pd-growth .rc-round + .paira-findings { margin-top: var(--sp-tight); }


/* ---------- the same card, inside a case study ----------------------------

   On the draft page a card is one round and its findings. On the case study
   it is one round and the evidence that round produced, which is sometimes
   three screens and sometimes a bar chart, so it carries more air.
   -------------------------------------------------------------------------- */

.rc-card-round {
  padding: clamp(1.5rem, 3vw, 2.2rem);
  background: var(--case-surface-strong, var(--paper-soft));
  border: 1px solid var(--rc-faint);
  border-radius: 1rem;
  box-shadow: 0 18px 44px rgba(52, 39, 27, 0.06);
}

/* The card's own padding is the space above the round; the header's margin
   would sit on top of it. */
.rc-card-round > .rc-round { margin-top: 0; }

/* The card takes the margin the round used to carry, so each act keeps the
   rhythm it already had. */
.pd-growth .pd-method > .rc-card-round { margin-top: var(--sp-stage); }
.pd-growth .pd-method > p + .rc-card-round { margin-top: var(--sp-block); }

/* Inside the card the evidence hugs the round, rather than keeping the
   distance it kept when both sat loose on the page. */
.rc-card-round > .rc-round + * { margin-top: var(--sp-tight, 1.7rem); }
.rc-card-round > :last-child { margin-bottom: 0; }

/* Act 2's round shares a row with the quote beside it; the card should start
   level with it rather than below the row's own rule. */
.paira-research-step > .rc-card-round { align-self: stretch; }


/* ---------- the findings, numbered, across the card ----------------------- */

@media (min-width: 62rem) {
  .rc-card-round > .rc-signals {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem clamp(1.8rem, 3vw, 2.6rem);
  }
  .rc-card-round > .rc-signals > li { margin: 0; }
}

/* What a round shipped, introduced rather than explained. */
.rc-exhibit {
  margin: var(--sp-block, 2.4rem) 0 .9rem;
  font-family: var(--font-body);
  font-size: .82rem; font-weight: 600; line-height: 1.4;
  color: var(--rc-soft);
}

/* An aside about how a round was run is not the round's finding, so it does
   not get the size of one. */
.paira-case-page .rc-card-round .paira-findings-note {
  margin-top: 1.5rem;
  font-size: .84rem; line-height: 1.6;
  max-width: 78ch;
}

/* ---------- three screens compared, all one size -------------------------- */

/* The shipped screen used to be drawn wider than the two it was compared
   with, which made it look like the better picture rather than the chosen
   one. Four columns instead, so every screen is the same width, and one
   aspect ratio so they are the same height too. */
.pd-ways-even { grid-template-columns: repeat(2, minmax(0, 1fr)) auto minmax(0, 1fr); }
.pd-ways-even .pd-ways-set { display: contents; }
.pd-ways-even .pd-ways-tried .pd-way:nth-of-type(1) { grid-column: 1; grid-row: 1; }
.pd-ways-even .pd-ways-tried .pd-way:nth-of-type(2) { grid-column: 2; grid-row: 1; }
.pd-ways-even .pd-ways-arrow { grid-column: 3; grid-row: 1; align-self: center; }
.pd-ways-even .pd-ways-shipped .pd-way { grid-column: 4; grid-row: 1; }
.pd-ways-even .pd-ways-label-tried { grid-column: 1 / 3; grid-row: 2; }
.pd-ways-even .pd-ways-label-shipped { grid-column: 4; grid-row: 2; }
.pd-ways-even .pd-way img { aspect-ratio: 786 / 1704; object-fit: cover; }

@media (max-width: 760px) {
  .pd-ways-even { grid-template-columns: 1fr; }
  .pd-ways-even .pd-ways-set { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pd-ways-even .pd-ways-shipped { grid-template-columns: minmax(0, 1fr); }
  .pd-ways-even .pd-ways-tried .pd-way:nth-of-type(1),
  .pd-ways-even .pd-ways-tried .pd-way:nth-of-type(2),
  .pd-ways-even .pd-ways-arrow,
  .pd-ways-even .pd-ways-shipped .pd-way,
  .pd-ways-even .pd-ways-label-tried,
  .pd-ways-even .pd-ways-label-shipped { grid-column: auto; grid-row: auto; }
}
