/* Use cases (/use-cases): four people, each with the music they had and the score they left with. One wide sheet
   turns through the four of them (a quiet line of their names above it chooses): what a person brought lies on the
   sheet's tone like a thing on a desk, and the score they got is white paper that slides over it from the right, its
   left edge an orange pencil line with Starling standing on it. The line can be dragged, both sides play, and the
   asks under the sheet change what the paper shows (use-cases.js). Tokens from brand.css; engraving rules from
   styles.css; the engravings and their sounds from scripts/use_cases.py. */

.uc {
  --sheet-h: 400px;
  --rest: 40%;
  overflow-x: clip;
}

/* ── First screen ─────────────────────────────────────────────────────────────────────────────────────────────── */

.uc-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 460px);
  column-gap: var(--space-10);
  align-items: end;
  padding-top: var(--space-7);
}
.uc-kicker,
.case-tab,
.cmp-tag > span,
.more-head {
  font: 500 12px / 1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.uc-kicker {
  margin: 0 0 var(--space-5);
}
.uc h1,
.uc h2 {
  margin: 0;
  font-family: var(--poster);
  font-weight: 800;
  line-height: 0.94;
  letter-spacing: -0.005em;
  text-transform: uppercase;
  text-wrap: balance;
}
.uc h1 {
  font-size: var(--display-2);
}
.uc h1 span,
.uc-end h2 span {
  display: block;
}
.uc-hero-side {
  display: grid;
  justify-items: start;
  gap: var(--space-6);
  padding-bottom: var(--space-1);
}
.uc-lede {
  margin: 0;
  font-size: var(--lede);
  line-height: var(--lh-body);
  color: var(--ink-soft);
  text-wrap: pretty;
}

/* ── The four people: their names choose, one sheet shows ─────────────────────────────────────────────────────── */

.uc-cases {
  padding-top: var(--space-8);
}
/* One quiet line of names; the one showing is in ink over an orange rule. */
.case-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-7);
  margin: 0;
  padding: 0;
  list-style: none;
}
.case-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 13px;
  text-decoration: none;
  transition: color 0.2s;
}
.case-tab:hover {
  color: var(--ink-soft);
}
.case-tab[aria-current] {
  color: var(--ink);
}
.case-tab[aria-current]::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: var(--space-2);
  left: 0;
  height: 2px;
  background: var(--accent);
}
.case-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}
/* With the script the four share one place, so nothing below moves when the sheet turns to the next person; without
   it they follow one another down the page. */
.case {
  scroll-margin-top: var(--space-6);
}
.js .cases {
  display: grid;
}
.js .case {
  grid-area: 1 / 1;
  min-width: 0;
  transition:
    opacity 0.35s var(--ease),
    visibility 0s;
}
.js .case:not(.is-sel) {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.25s var(--ease),
    visibility 0s 0.25s;
}
html:not(.js) .case + .case {
  padding-top: var(--space-11);
}
.case-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: var(--space-6);
  align-items: end;
  margin-top: var(--space-2);
}
.uc .case h2 {
  font-size: var(--display-3);
  line-height: 1.05;
}
.story-more {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  margin-bottom: calc(-1 * var(--space-2));
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}
.story-more .icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--soft);
  stroke-width: 1.7;
  transition:
    transform 0.3s var(--ease),
    stroke 0.2s;
}
.story-more:hover .icon {
  stroke: var(--accent);
  transform: translateX(3px);
}

/* The sheet: what they brought underneath, the new score a sheet of white paper that slides over it from the right.
   Its left edge is the pencil line; use-cases.js moves the paper, Starling and the picture underneath together. */
.cmp {
  position: relative;
  margin: var(--space-10) 0 0;
}
.cmp-sheet {
  position: relative;
  height: var(--sheet-h);
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--layer-1);
  box-shadow: var(--ring);
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  cursor: ew-resize;
}
.cmp-had,
.cmp-got {
  position: absolute;
  inset: 0;
}
.cmp-got {
  background: var(--white);
  transform: translateX(var(--rest));
  will-change: transform;
}
.cmp-got::before {
  content: "";
  position: absolute;
  z-index: 3;
  top: 0;
  bottom: 0;
  left: -1px;
  width: 2px;
  background: var(--accent);
}
/* With the script and motion, a sheet starts on what the person brought, the new paper only peeking in. */
@media (prefers-reduced-motion: no-preference) {
  .js .cmp-got,
  .js .cmp-perch {
    transform: translateX(calc(100% - 22px));
  }
}

.uc-view {
  position: absolute;
  inset: 0;
  display: grid;
  align-items: center;
  justify-items: start;
  padding: var(--space-10) var(--space-7) calc(var(--space-10) + var(--space-3)) var(--space-9);
  opacity: 0;
  visibility: hidden;
}
/* inherit, not visible: a person's sheet that is not showing must stay out of reach of pointers and keys. */
.uc-view.is-on {
  opacity: 1;
  visibility: inherit;
}
/* A score that has slid along to the note playing stays under its own paper. */
.cmp-got .uc-view {
  overflow: hidden;
}
/* Drawn back to the sheet's edge, the new paper shows as a blank margin: no half a clef in it. */
.cmp-got > :is(.uc-view, .cmp-tag, .cmp-player) {
  transition: opacity 0.2s;
}
.cmp-got.is-shut > :is(.uc-view, .cmp-tag, .cmp-player) {
  opacity: 0;
}
/* Without the script nothing plays or moves: the sheet shows the two sides and the asks read as a line of text. */
html:not(.js) :is(.cmp-player, .cmp-knob) {
  display: none;
}
.uc-view > .engraved {
  display: block;
  max-width: none;
  transform: translateX(var(--pan, 0px));
  transition: transform 0.5s var(--ease);
}
.uc .engraved .note {
  transition:
    color 0.15s,
    fill 0.15s;
}
.uc .engraved .note.is-playing {
  color: var(--accent);
  fill: var(--accent);
}

/* What they brought lies on the tone like a thing on a desk, whole, between its name and its player: a video, a
   photo, a recording, a printed page. It keeps to the part of the sheet still showing (use-cases.js sets the width),
   so it steps aside and grows smaller as the new paper comes over, and is never cut. */
.cmp-had .uc-view {
  right: auto;
  width: var(--rest);
  justify-items: center;
  padding-inline: var(--space-4);
}
@media (prefers-reduced-motion: no-preference) {
  .js .cmp-had .uc-view {
    width: calc(100% - 22px);
  }
}
.cmp-had video,
.photo-frame img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(var(--sheet-h) - 2 * var(--space-10) - var(--space-3));
}
.cmp-had video,
.photo-frame,
.memo,
.page {
  border-radius: var(--radius-sm);
  box-shadow: var(--ring);
}
.cmp-had video {
  background: #111;
}
/* A phone photo of a printed page, a little crooked, as it came in; Starling's reading line goes down it. */
.photo-frame {
  position: relative;
  max-width: 100%;
  overflow: hidden;
  background: #3d3329;
}
.scan {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0;
}
/* A voice memo: the recording's shape on its own card. What has sounded is in ink, the rest pale. */
.memo {
  width: min(100%, 520px);
  padding: var(--space-7) var(--space-5);
  background: var(--white);
}
.memo-wave {
  display: block;
  width: 100%;
  height: 96px;
  fill: var(--ink);
}
.memo-wave rect {
  transform-box: fill-box;
  transform-origin: center;
}
.memo.is-sounding .memo-wave rect {
  fill: var(--soft);
}
.memo.is-sounding .memo-wave rect.is-played {
  fill: var(--ink);
}
/* The hymnal's page: its four voices on white paper, made smaller to fit what shows (use-cases.js, fit). */
.page {
  position: absolute;
  top: calc(50% - var(--space-2));
  left: 50%;
  padding: var(--space-4) var(--space-5);
  background: var(--white);
  transform: translate(-50%, -50%);
}
.page .engraved {
  display: block;
}

/* The link the team opens: a panel in tone on the new paper, its score and link raised on white. */
.uc-view[data-kind="share"] {
  right: auto;
  width: calc(100% - var(--rest));
  justify-items: center;
  padding-inline: var(--space-7);
}
.share-card {
  display: grid;
  gap: var(--space-3);
  width: min(100%, 360px);
  padding: var(--space-5);
  border-radius: var(--radius-md);
  background: var(--layer-1);
}
.share-thumb {
  padding: var(--space-3);
  border-radius: var(--radius-xs);
  background: var(--white);
  box-shadow: var(--ring);
}
.share-thumb .engraved {
  display: block;
  width: 100%;
}
.share-title {
  margin: 0;
  font: 600 16px / var(--lh-snug) var(--sans);
}
.share-link {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-1) var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--white);
  box-shadow: var(--ring);
  font: 400 14px / var(--lh-heading) var(--mono);
  color: var(--ink-soft);
}
.share-link .icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}
/* A long address ends in an ellipsis before Copy, as a link field does. */
.share-url {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Each side says what it is, top left: a label in small capitals over its name. On a picture it sits on white. */
.cmp-tag {
  position: absolute;
  z-index: 2;
  top: var(--space-3);
  left: var(--space-3);
  display: grid;
  gap: var(--space-1);
  max-width: calc(100% - var(--space-6));
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-xs);
  background: var(--white);
}
.cmp-tag b {
  font: 600 14px / var(--lh-heading) var(--sans);
  color: var(--ink);
}
.cmp-tag b span {
  white-space: nowrap;
}
.cmp-got .cmp-tag {
  left: var(--space-4);
}
/* What they brought keeps its name inside the part that shows at rest. */
.cmp-had .cmp-tag {
  max-width: calc(var(--rest) - var(--space-6));
}
.stage-label.is-new,
.stage-status.is-new {
  animation: ink-in 0.5s var(--ease);
}
@keyframes ink-in {
  from {
    filter: blur(6px);
    opacity: 0;
  }
}

/* Each side plays, bottom left: the app's round button and how long it runs. */
.cmp-player {
  position: absolute;
  z-index: 2;
  bottom: var(--space-3);
  left: var(--space-3);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding-right: var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--white);
  box-shadow: var(--ring);
}
.cmp-got .cmp-player {
  left: var(--space-4);
}
.cmp-player[hidden] {
  display: none;
}
.cmp-play {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
.cmp-play::before {
  content: "";
  grid-area: 1 / 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.15s;
}
.cmp-play:active::before {
  transform: scale(0.94);
}
.cmp-play .icon {
  grid-area: 1 / 1;
  z-index: 1;
  width: 16px;
  height: 16px;
  color: var(--paper);
  fill: currentColor;
}
.cmp-play:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -4px;
}
/* The handle already wears an orange ring: focus adds a second one outside it. */
.cmp-knob:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}
.cmp-time {
  font: 500 13px / 1 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}

/* The line's handle: a paper disc on the line, floating over both sides. */
.cmp-knob {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: ew-resize;
  touch-action: none;
}
.cmp-knob::before {
  content: "";
  grid-area: 1 / 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 0 0 2px var(--accent);
  transition: transform 0.2s var(--ease);
}
.cmp-knob:hover::before,
.cmp-sheet.is-dragging .cmp-knob::before {
  transform: scale(1.08);
}
.cmp-knob .icon {
  grid-area: 1 / 1;
  z-index: 1;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Starling stands on the sheet's top edge, on the line, and says what it is doing beside it. One bird a screen: only
   the sheet being played shows it (use-cases.js, live). */
.cmp-perch {
  position: absolute;
  z-index: 3;
  top: 0;
  right: 0;
  left: 0;
  height: 0;
  pointer-events: none;
  transform: translateX(var(--rest));
  transition: opacity 0.3s;
}
.cmp-perch img {
  position: absolute;
  bottom: -4px;
  left: -27px;
  width: 42px;
  height: 50px;
  object-fit: contain;
}
.stage-status {
  position: absolute;
  bottom: var(--space-2);
  left: var(--space-7);
  font-size: 14px;
  line-height: var(--lh-snug);
  color: var(--ink-soft);
  white-space: nowrap;
}
.cmp-perch.is-flip .stage-status {
  right: calc(100% + var(--space-7));
  left: auto;
}

/* Under the sheet, what happened in order: what they brought, then each thing they asked. The one showing is in ink,
   with a rule under it that fills until the next comes in (use-cases.js, --dwell); any of them can be pressed. */
.steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--space-8);
  margin: var(--space-3) 0 0;
  padding: 0;
  list-style: none;
}
.step {
  min-width: 0;
}
.step-go {
  position: relative;
  display: block;
  min-height: 44px;
  padding: var(--space-3) 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 17px / var(--lh-snug) var(--sans);
  text-align: start;
  cursor: pointer;
  transition: color 0.2s;
}
.step-go:hover {
  color: var(--ink-soft);
}
.step-go:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}
.step.is-on .step-go {
  color: var(--ink);
}
.step.is-on .step-go::before,
.step.is-on .step-go::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--space-1);
  height: 2px;
  background: var(--line);
}
.step.is-on .step-go::after {
  background: var(--accent);
  transform-origin: left center;
}
.step.is-timed .step-go::after {
  animation: step-fill var(--dwell, 4s) linear both;
}
@keyframes step-fill {
  from {
    transform: scaleX(0);
  }
}
/* What people ask, in each language's own quotation marks (site.js, quoted). */
.uc q {
  quotes: "\201C" "\201D";
}
.uc:is(:lang(zh-Hant), :lang(ja)) q {
  quotes: "\300C" "\300D";
}
.uc:lang(de) q {
  quotes: "\201E" "\201C";
}
.uc:lang(fr) q {
  quotes: "\AB\A0" "\A0\BB";
}
/* Chinese breaks at its punctuation, not inside a word (打印), and only splits a word when a line can't fit. */
.uc:lang(zh) :is(p, h1, h2, q, .step-say) {
  word-break: keep-all;
  overflow-wrap: break-word;
}
/* Japanese has no spaces to keep a word whole at (付/けて, アメイジング・グ/レイス): the browser breaks between
   phrases instead, where it can tell them apart, and anywhere otherwise. */
.uc:lang(ja) {
  word-break: auto-phrase;
}

/* ── More, and the way in ─────────────────────────────────────────────────────────────────────────────────────── */

.uc-more {
  padding-top: var(--space-11);
}
.uc-more h2 {
  max-width: none;
  font-size: var(--display-3);
}
.more-head,
.more-list a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr);
  gap: var(--space-4);
  align-items: center;
}
.more-head {
  margin-top: var(--space-8);
  padding-bottom: var(--space-3);
}
.more-head span:last-child {
  grid-column: 3;
}
.more-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--hair-strong);
}
.more-list li {
  border-bottom: 1px solid var(--hair-strong);
}
.more-list a {
  min-height: 60px;
  padding: var(--space-3) 0;
  color: var(--ink);
  text-decoration: none;
  font-size: 18px;
  line-height: var(--lh-snug);
  transition: background-color 0.2s;
}
.more-list a:hover {
  background: var(--layer-1);
}
.more-list .icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--soft);
  stroke-width: 1.7;
  transition:
    transform 0.3s var(--ease),
    stroke 0.2s;
}
.more-list a:hover .icon {
  stroke: var(--accent);
  transform: translateX(4px);
}
.more-to {
  font-weight: 500;
  text-wrap: balance;
}
.more-from {
  color: var(--ink-soft);
  text-wrap: balance;
}

.uc-end {
  margin-top: var(--space-11);
  padding: var(--space-11) 0;
  background: var(--layer-1);
}
.uc-end-inner {
  display: grid;
  justify-items: center;
  gap: var(--space-6);
  text-align: center;
}
.uc-end h2 {
  font-size: var(--display-2);
  max-width: none;
}
.uc-end p {
  max-width: 46ch;
  margin: 0;
  font-size: var(--lede);
  line-height: var(--lh-body);
  color: var(--ink-soft);
}

/* ── Phones and narrow windows ────────────────────────────────────────────────────────────────────────────────── */

@media (max-width: 960px) {
  .uc-hero {
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--space-6);
    padding-top: var(--space-7);
  }
}
@media (max-width: 760px) {
  .uc {
    --rest: 38%;
  }
  .uc-hero {
    padding-top: var(--space-5);
  }
  .uc-lede {
    font-size: 17px;
  }
  .uc-cases {
    padding-top: var(--space-7);
  }
  /* The names stay on one line in every language: the line runs to the screen's edges and slides sideways, the one
     showing kept in view (use-cases.js, select). */
  .case-tabs {
    flex-wrap: nowrap;
    gap: 0 var(--space-5);
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .case-tabs::-webkit-scrollbar {
    display: none;
  }
  .case-tab {
    white-space: nowrap;
  }
  /* The way to the tool page comes after the asks, quieter than they are. */
  .case {
    display: flex;
    flex-direction: column;
  }
  .case-head {
    display: contents;
  }
  .uc .case h2 {
    margin-top: var(--space-2);
  }
  .cmp {
    margin-top: var(--space-9);
  }
  .story-more {
    order: 1;
    align-self: flex-start;
    margin: var(--space-3) 0 0;
    color: var(--ink-soft);
  }
  .cmp-sheet {
    border-radius: var(--radius-sm);
  }
  .uc-view {
    padding: var(--space-10) var(--space-4) var(--space-10) var(--space-7);
  }
  .cmp-had .uc-view {
    padding-inline: var(--space-2);
  }
  .cmp-had video,
  .photo-frame img {
    max-height: calc(var(--sheet-h) - 2 * var(--space-10));
  }
  .memo {
    padding: var(--space-5) var(--space-2);
  }
  .memo-wave {
    height: 72px;
  }
  .page {
    padding: var(--space-3);
  }
  .cmp-tag {
    top: var(--space-2);
    left: var(--space-2);
    padding: var(--space-1) var(--space-2);
  }
  .cmp-got .cmp-tag {
    left: var(--space-3);
  }
  .cmp-had .cmp-tag {
    max-width: calc(var(--rest) - var(--space-3));
  }
  .cmp-tag > span {
    font-size: 11px;
  }
  .cmp-tag b {
    font-size: 13px;
  }
  .cmp-player {
    bottom: var(--space-2);
    left: var(--space-2);
    padding-right: var(--space-3);
  }
  .cmp-got .cmp-player {
    left: var(--space-3);
  }
  .cmp-knob::before {
    width: 32px;
    height: 32px;
  }
  .cmp-knob .icon {
    width: 16px;
    height: 16px;
  }
  .cmp-perch img {
    left: -21px;
    width: 34px;
    height: 40px;
  }
  .stage-status {
    left: var(--space-6);
    font-size: 13px;
  }
  .cmp-perch.is-flip .stage-status {
    right: calc(100% + var(--space-6));
  }
  /* The asks stack, each a row to press. */
  .steps {
    display: grid;
    justify-items: start;
    gap: 0;
    margin-top: var(--space-2);
  }
  .step-go {
    font-size: 16px;
  }
  /* The phone's sheet holds the link and its note; the score it opens is the one just before. */
  .uc-view[data-kind="share"] {
    padding-inline: var(--space-3);
  }
  .share-card {
    gap: var(--space-2);
    padding: var(--space-3);
  }
  .share-thumb {
    display: none;
  }
  .share-title {
    font-size: 14px;
  }
  /* Too narrow for the address and Copy side by side: Copy takes its own row. */
  .share-link {
    grid-template-columns: 18px minmax(0, 1fr);
    row-gap: var(--space-2);
    padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3);
  }
  .share-link .btn-mini {
    grid-column: 1 / -1;
    justify-content: center;
  }
  .more-list a,
  .more-head {
    grid-template-columns: minmax(0, 1.2fr) 20px minmax(0, 1fr);
    gap: var(--space-3);
  }
  .more-list a {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .uc *,
  .uc *::before,
  .uc *::after {
    animation: none !important;
    transition: none !important;
  }
}
