/*
 * Product design case study (see case-study-template.html).
 * Layout: sticky vertical section nav on the left, content on the right.
 * Motion is driven by case-study.js and turned off for reduced-motion users.
 */

:root {
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --accent: #7457d6;
  --line: rgba(0, 0, 0, 0.12);
  --surface: rgba(0, 0, 0, 0.03);
  --shimmer: rgba(0, 0, 0, 0.06);
}

:root[data-theme="dark"] {
  --accent: #a891f5;
  --line: rgba(255, 255, 255, 0.14);
  --surface: rgba(255, 255, 255, 0.04);
  --shimmer: rgba(255, 255, 255, 0.08);
}

/* small capitalized labels */
.cs-caps {
  font-family: var(--mono);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.cs-muted {
  color: var(--muted);
}

/* ---------- loader ---------- */

.cs-loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.cs-loader[hidden] {
  display: none;
}

.cs-loader.done {
  opacity: 0;
  visibility: hidden;
}

.cs-loader-inner {
  width: min(80vw, 32rem);
}

.cs-loader-count {
  font-size: 4rem;
  letter-spacing: -0.02em;
  color: var(--ink-strong);
}

.cs-loader-bar {
  height: 1px;
  margin: 1.2rem 0;
  background: var(--line);
}

.cs-loader-bar span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
}

.cs-loader-log {
  color: var(--muted);
}

.cs-loader-log::after {
  content: "_";
  animation: cs-blink 0.8s steps(1) infinite;
}

/* ---------- layout ---------- */

.case-study {
  display: grid;
  grid-template-columns: minmax(14rem, 2fr) 10fr;
  column-gap: var(--gap);
  padding: var(--pad) var(--pad) 0;
}

.case-study[hidden] {
  display: none;
}

.cs-body {
  min-width: 0;
  padding: 0;
}

/* ---------- vertical nav ---------- */

.cs-nav {
  position: sticky;
  top: var(--pad);
  align-self: start;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--pad) * 2);
}

.cs-nav-title {
  margin-bottom: 2rem;
  color: var(--ink-strong);
}

.cs-nav ol {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--line);
}

.cs-nav a {
  position: relative;
  display: flex;
  gap: 1rem;
  padding: 0.55rem 0 0.55rem 1.2rem;
  font-size: 1.1rem;
  color: var(--muted);
}

.cs-nav a .cs-caps {
  font-size: 0.85rem;
  line-height: 1.9;
}

/* the active marker sits on the rail */
.cs-nav a::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1px;
  width: 2px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.cs-nav a:hover {
  color: var(--ink-strong);
}

.cs-nav a.active {
  color: var(--ink-strong);
}

.cs-nav a.active::before {
  transform: scaleY(1);
}

.cs-nav-progress {
  margin-top: 2.4rem;
  color: var(--muted);
}

.cs-nav-track {
  height: 1px;
  margin-bottom: 0.8rem;
  background: var(--line);
}

.cs-nav-track span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--ink-strong);
  transform: scaleX(0);
  transform-origin: left;
}

/* ---------- sections ---------- */

.cs-section {
  padding-bottom: 9rem;
  scroll-margin-top: var(--pad);
}

.cs-eyebrow {
  margin-bottom: 2.4rem;
  color: var(--muted);
}

.cs-label {
  margin-bottom: 1rem;
  color: var(--muted);
}

.cs-title {
  margin: 0;
  font-size: 7rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--ink-strong);
}

.cs-lede {
  max-width: 48rem;
  margin-top: 2.4rem;
  font-size: 2rem;
  line-height: 1.35;
}

.cs-statement {
  max-width: 60rem;
  font-size: 3rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink-strong);
}

.cs-section h3 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--ink-strong);
}

.cs-meta {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2rem;
  margin: 4rem 0;
  padding: 1.6rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.cs-meta dt {
  margin-bottom: 0.4rem;
  color: var(--muted);
}

.cs-meta dd {
  margin: 0;
}

/* a full-width how-might-we after the research */
.cs-hmw {
  margin-top: 4rem;
}

/* a second labeled row of cards in the same section */
.cs-group {
  margin-top: 6rem;
}

.cs-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
  margin-top: 4rem;
}

/* ---------- frames (image slots) ---------- */

.cs-frame {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--surface);
}

.cs-frame img {
  display: block;
  width: 100%;
  margin: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.cs-frame img.loaded {
  opacity: 1;
}

/* several images in one stage */
.cs-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 1.6rem;
}

@media (max-width: 767px) {
  .cs-gallery {
    grid-template-columns: 1fr;
  }
}

/* looping demo video in place of an image */
.cs-frame > video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* keep the video's own shape, so nothing is cropped */
.cs-frame-full > video {
  aspect-ratio: auto;
}

/* demo video shown uncropped, with a play/pause button */
.cs-player {
  position: relative;
}

/* one shared shape, letterboxed so nothing is cropped */
.cs-player > video {
  aspect-ratio: 2 / 1;
  object-fit: contain;
  background: #000;
}

.cs-play {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  padding: 0.5rem 0.9rem;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  cursor: pointer;
  transition: background 0.3s ease;
}

.cs-play:hover {
  background: var(--accent);
}

/* stand-in for an image; swap for an <img> */
.cs-skeleton {
  aspect-ratio: 16 / 9;
  background: linear-gradient(100deg, transparent 30%, var(--shimmer) 50%, transparent 70%) 0 0 / 250% 100%;
  animation: cs-shimmer 1.8s linear infinite;
}

.cs-sources .cs-skeleton {
  aspect-ratio: 4 / 3;
}

/* ---------- metrics ---------- */

/* equal space between metrics, whatever each number's width */
/* even gaps between metrics, however wide each number is */
.cs-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 3rem 7rem;
}

.cs-statement + .cs-metrics,
.cs-statement + .cs-decisions,
.cs-statement + .cs-sources {
  margin-top: 4rem;
}

/* breathing room between the hero image and the numbers under it */
.cs-frame-hero + .cs-metrics {
  margin-top: 6rem;
}

.cs-metric-value {
  margin-bottom: 0.8rem;
  font-size: 5rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--ink-strong);
}

.cs-metric .cs-caps {
  color: var(--muted);
}

/* ---------- cards ---------- */

.cs-sources,
.cs-decisions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.6rem;
}

.cs-card {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  padding: 1.6rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  transition: border-color 0.3s ease, transform 0.3s ease;
}

.cs-card:hover {
  border-color: var(--accent);
}

.cs-card .cs-muted {
  display: block;
  margin-bottom: 0.2rem;
}

/* what a customer finding means for the design, at the foot of its card */
.cs-card-so {
  margin: auto 0 0;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  color: var(--ink-strong);
}

.cs-tag {
  color: var(--accent);
}

/* ---------- group headings inside a section ---------- */

.cs-group-head h3 {
  font-size: 2.2rem;
}

* + .cs-group-head {
  margin-top: 8rem;
}

.cs-eyebrow + .cs-group-head {
  margin-top: 0;
}

/* a block that opens with its own group heading */
.cs-choice + .cs-canvas {
  margin-top: 8rem;
}

/* one line under a group heading */
.cs-group-sub {
  max-width: 60rem;
  margin: -0.8rem 0 2.4rem;
  color: var(--muted);
}

/* ---------- user profile ---------- */

.cs-profile {
  display: grid;
  grid-template-columns: 3fr 7fr;
  align-items: start;
  gap: 1.6rem var(--gap);
}

.cs-profile-name {
  margin: 1.2rem 0 0;
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--ink-strong);
}

.cs-profile-name + .cs-muted {
  margin: 0.2rem 0 0;
}

.cs-profile-quote {
  margin: 0 0 2.4rem;
  font-size: 2.2rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--ink-strong);
}

.cs-profile-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 var(--gap);
  margin: 0;
}

.cs-profile-facts div {
  padding: 0.8rem 0;
  border-top: 1px solid var(--line);
}

.cs-profile-facts dt {
  margin-bottom: 0.4rem;
  color: var(--muted);
}

.cs-profile-facts dd {
  margin: 0;
}

@media (max-width: 767px) {
  .cs-profile,
  .cs-profile-facts {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- numbered lists ---------- */

.cs-insights {
  margin-top: 4rem;
}

.cs-insights ol,
.cs-log,
.cs-takeaways,
.cs-notes {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cs-insights li,
.cs-log li,
.cs-takeaways li {
  display: grid;
  grid-template-columns: 6rem 1fr;
  padding: 1.2rem 0;
  border-top: 1px solid var(--line);
}

.cs-insights li .cs-caps,
.cs-log li .cs-caps,
.cs-takeaways li .cs-caps {
  color: var(--muted);
  line-height: 1.9;
}

.cs-log {
  margin-top: 2.4rem;
}

.cs-log li {
  grid-template-columns: 12rem 1fr;
}

.cs-takeaways li {
  font-size: 2rem;
  line-height: 1.3;
  color: var(--ink-strong);
}

.cs-takeaways li .cs-caps {
  line-height: 2.6;
}

/* ---------- process stages ---------- */

.cs-stage {
  display: grid;
  grid-template-columns: 7fr 3fr;
  gap: 1.6rem var(--gap);
  padding-left: 2.4rem;
  border-left: 1px solid var(--line);
  position: relative;
}

.cs-stage + .cs-stage {
  padding-top: 5rem;
}

/* a stage track after a section statement */
.cs-statement + .cs-stage {
  margin-top: 5rem;
}

/* node on the timeline */
.cs-stage::before {
  content: "";
  position: absolute;
  left: -0.45rem;
  width: 0.8rem;
  height: 0.8rem;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: var(--bg);
}

.cs-stage + .cs-stage::before {
  top: 5rem;
}

.cs-stage.in::before {
  background: var(--accent);
  transition: background 0.4s ease 0.3s;
}

/* a subtitle stands alone: no mono label after it. Mono labels stay one short phrase, with no "· qualifier" */
.cs-stage-head {
  grid-column: 1 / -1;
  margin-top: -0.3rem;
}

/* prototype slot under each fidelity's design */
.cs-proto {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 1.6rem;
}

.cs-proto .cs-frame iframe,
.cs-proto .cs-frame video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}

.cs-proto-note {
  margin-top: 1.6rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}

.cs-notes li {
  padding: 0.8rem 0;
  border-top: 1px solid var(--line);
}

/* a stage item that spans both columns */
.cs-wide {
  grid-column: 1 / -1;
}

/* a numbered point above its image, set apart from the one before */
.cs-point {
  max-width: 48rem;
}

.cs-point:not(:nth-child(2)) {
  margin-top: 3.2rem;
}

/* a full-width reference image that leads the explorations after it */
.cs-moodboard {
  margin-bottom: 3.2rem;
}

/* a row of phone screens that scrolls sideways once it runs out of room */
.cs-screens {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 15rem;
  gap: 1.2rem;
  margin: 0;
  padding: 0 0 1.2rem;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x proximity;
}

.cs-screens li {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  scroll-snap-align: start;
  color: var(--muted);
}

.cs-screens img,
.cs-screen-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 390 / 844;
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  background: var(--surface);
}

/* many small screens at once, for explorations */
.cs-screen-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cs-screen-grid img {
  border-radius: 0.8rem;
}

@media (max-width: 767px) {
  .cs-screen-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ---------- click-through prototype tour ---------- */

.cs-tour-stage {
  position: relative;
}

/* a tour with nothing beside it takes the stage's full width */
.cs-tour-wide {
  grid-column: 1 / -1;
}

.cs-tour-steps {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cs-tour-steps li {
  display: none;
}

.cs-tour-steps li.active {
  display: block;
}

/* pulsing target over the control that moves the flow forward */
.cs-tour-hotspot {
  position: absolute;
  width: 2.4rem;
  height: 2.4rem;
  margin: -1.2rem 0 0 -1.2rem;
  padding: 0;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  box-shadow: 0 0 0 1px #fff;
  cursor: pointer;
  transition: left 0.4s ease, top 0.4s ease;
}

.cs-tour-hotspot::after {
  content: "";
  position: absolute;
  inset: -2px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  animation: cs-tour-pulse 1.6s ease-out infinite;
}

@keyframes cs-tour-pulse {
  to {
    opacity: 0;
    transform: scale(2.4);
  }
}

.cs-tour-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 1.6rem;
  margin-top: 1.2rem;
}

.cs-tour-count {
  color: var(--muted);
}

.cs-tour-caption {
  margin: 0;
}

/* why the step helps, under its caption */
.cs-tour-why {
  margin: 0.2rem 0 0;
  color: var(--accent);
}

.cs-tour-hotspot[hidden],
.cs-tour-box[hidden] {
  display: none;
}

/* hairline outline on a secondary area: a panel, the command bar, an icon */
.cs-tour-box {
  position: absolute;
  border: 1px solid var(--accent);
  border-radius: 0.4rem;
  pointer-events: none;
  transition: left 0.4s ease, top 0.4s ease, width 0.4s ease, height 0.4s ease;
}

.cs-tour-nav {
  display: flex;
  gap: 0.4rem;
}

.cs-tour-nav button {
  padding: 0.2rem 0.7rem;
  font-size: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--ink-strong);
  cursor: pointer;
  transition: border-color 0.3s ease, color 0.3s ease;
}

.cs-tour-nav button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.cs-tour-nav button:disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* tour with an audit beside it, outside the process timeline */
.cs-split {
  display: grid;
  grid-template-columns: 7fr 3fr;
  gap: 1.6rem var(--gap);
  margin-top: 4rem;
}

.cs-split-title {
  grid-column: 1 / -1;
}

/* audit bullets: the current step's item turns accent */
.cs-audit {
  margin: 0;
  padding-left: 1.2em;
}

.cs-audit li {
  padding: 0.4rem 0;
  cursor: pointer;
  transition: color 0.3s ease;
}

.cs-audit li:hover,
.cs-audit li.active {
  color: var(--accent);
}

@media (max-width: 767px) {
  .cs-split {
    grid-template-columns: minmax(0, 1fr);
  }

  .cs-tour-bar {
    grid-template-columns: 1fr auto;
  }

  .cs-tour-caption,
  .cs-tour-text {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .cs-tour-hotspot {
    width: 1.6rem;
    height: 1.6rem;
    margin: -0.8rem 0 0 -0.8rem;
  }
}

/* ---------- Figma canvas viewer: tabs, pan and zoom ---------- */

.cs-profile + .cs-canvas {
  margin-top: 6rem;
}

/* a section that opens straight onto the rounds strip */
.cs-eyebrow + .cs-rounds-wrap {
  margin-top: 0;
}

.cs-canvas + .cs-canvas,
.cs-canvas + .cs-demo {
  margin-top: 6rem;
}

.cs-canvas-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.2rem;
}

/* same as the overview page's filter buttons */
.cs-canvas-tabs button {
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.cs-canvas-tabs button:hover,
.cs-canvas-tabs button[aria-selected="true"] {
  color: var(--ink-strong);
}

.cs-canvas-tabs button[aria-selected="true"] {
  border-color: var(--ink-strong);
}

.cs-canvas-stage {
  position: relative;
  min-height: 16rem;
  cursor: zoom-in;
  touch-action: pan-y;
  user-select: none;
}

.cs-canvas-stage.zoomed {
  cursor: grab;
  touch-action: none;
}

.cs-canvas-stage.dragging {
  cursor: grabbing;
}

.cs-canvas-view[hidden] {
  display: none;
}

.cs-canvas-inner {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
}

.cs-canvas-inner.anim {
  transition: transform 0.35s ease;
}

.cs-canvas-inner img {
  height: 100%;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* pins keep their size while the canvas scales under them */
.cs-canvas-pin {
  position: absolute;
  margin: 0;
  padding: 0;
  border: 0;
  box-shadow: 0 0 0 2px #fff;
  cursor: pointer;
  transform: translate(-50%, -50%) scale(calc(1 / var(--z, 1)));
}

.cs-canvas-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 1.6rem;
  margin-top: 1.2rem;
}

.cs-canvas-caption {
  margin: 0;
}

/* numbered pin on the canvas, matched to the list below */
.cs-pin {
  display: inline-grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--accent);
  font-family: var(--mono);
  font-size: 0.8rem;
  color: #fff;
  vertical-align: 0.1rem;
}

/* 1–3 down the left column, 4–6 down the right */
.cs-pains {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(3, auto);
  grid-auto-flow: column;
  gap: 0 var(--gap);
  margin: 1.6rem 0 0;
  padding: 0;
  list-style: none;
}

.cs-pains[hidden] {
  display: none;
}

.cs-pains li {
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  padding: 0.8rem 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
  transition: color 0.3s ease;
}

.cs-pains li .cs-caps {
  color: var(--muted);
  line-height: 1.9;
}

.cs-pains li:hover,
.cs-pains li.active {
  color: var(--accent);
}

/* ---------- decisions with the options explored ---------- */

.cs-choice + .cs-choice {
  margin-top: 5rem;
}

.cs-choice-head {
  display: flex;
  align-items: baseline;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin-bottom: 1.6rem;
}

.cs-choice-head .cs-tag {
  margin: 0;
}

.cs-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.6rem;
}

.cs-option {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin: 0;
}

.cs-option figcaption p {
  margin: 0.4rem 0 0;
}

.cs-option .cs-caps {
  color: var(--muted);
}

/* options we moved past fade back; hover brings them up to compare */
.cs-option-out .cs-frame img.loaded {
  opacity: 0.45;
  filter: grayscale(1);
  transition: opacity 0.3s ease, filter 0.3s ease;
}

.cs-option-out:hover .cs-frame img.loaded {
  opacity: 1;
  filter: none;
}

.cs-option-out figcaption p {
  color: var(--muted);
}

.cs-option-in .cs-frame {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.cs-option-in .cs-caps {
  color: var(--accent);
}

/* ---------- design rounds strip ---------- */

.cs-rounds-wrap {
  margin-top: 6rem;
}

.cs-rounds {
  display: grid;
  grid-auto-columns: 15rem;
  grid-auto-flow: column;
  gap: 1.2rem;
  margin: 0;
  padding: 0 0 1.2rem;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}

.cs-rounds li {
  scroll-snap-align: start;
}

.cs-rounds .cs-frame {
  aspect-ratio: 4 / 3;
}

.cs-rounds .cs-frame img {
  height: 100%;
  object-fit: cover;
}

.cs-rounds .cs-caps {
  margin: 0.8rem 0 0.2rem;
  color: var(--accent);
}

.cs-rounds p:last-child {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.3;
}

@media (max-width: 767px) {
  .cs-options,
  .cs-pains {
    grid-template-columns: minmax(0, 1fr);
  }

  .cs-pains {
    grid-template-rows: none;
    grid-auto-flow: row;
  }
}

/* ---------- AI layer ---------- */

.cs-ai {
  display: grid;
  grid-template-columns: 6fr 4fr;
  gap: var(--gap);
  margin-top: 4rem;
}

.cs-ai-demo {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  padding: 1.6rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--surface);
}

.cs-ai-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
}

.cs-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--accent);
  animation: cs-pulse 1.6s ease-in-out infinite;
}

.cs-ai-prompt,
.cs-ai-reply {
  display: grid;
  grid-template-columns: 5rem 1fr;
}

.cs-ai-prompt {
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.cs-ai-reply {
  min-height: 6rem;
  font-size: 1.4rem;
  color: var(--ink-strong);
}

.cs-ai-reply .cs-caret {
  grid-column: 2;
}

.cs-caret {
  display: inline-block;
  width: 0.5em;
  height: 1em;
  background: var(--accent);
  animation: cs-blink 0.8s steps(1) infinite;
}

.cs-ai-foot {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--muted);
}

.cs-ai-meter,
.cs-bar-track {
  position: relative;
  flex: 1;
  height: 0.3rem;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.cs-ai-meter span,
.cs-bar-track span {
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.2s cubic-bezier(0.2, 0.7, 0.2, 1) 0.2s;
}

.in .cs-ai-meter span,
.in .cs-bar-track span {
  transform: scaleX(var(--v));
}

.cs-states {
  margin: 0;
}

.cs-states div {
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.cs-states dt {
  margin-bottom: 0.3rem;
  color: var(--accent);
}

.cs-states dd {
  margin: 0;
}

/* ---------- validation ---------- */

.cs-bars {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.cs-bar p {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.cs-bar-track {
  display: block;
}

.cs-chart {
  display: block;
  width: 100%;
  height: 14rem;
  overflow: visible;
}

.cs-chart line {
  stroke: var(--line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.cs-chart .cs-chart-launch {
  stroke-dasharray: 3 3;
}

.cs-chart polyline {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.8s cubic-bezier(0.4, 0, 0.2, 1) 0.2s;
}

.in .cs-chart polyline {
  stroke-dashoffset: 0;
}

.cs-chart-key {
  display: flex;
  justify-content: space-between;
  margin-top: 0.8rem;
}

/* ---------- visual system spec: line + vertex states (cad-visual-system.js) ---------- */

.cs-sys-lede {
  max-width: 48rem;
  margin-top: 2.4rem;
}

.cs-sys-rules {
  margin-top: 4rem;
}

.cs-sys-block {
  margin-top: 8rem;
}

.cs-sys-block > .cs-stage-head {
  margin-bottom: 1.6rem;
}

.cs-section code {
  font-family: var(--mono);
  font-size: 0.9em;
}

/* live specimen: the viewport stays dark in both themes, like the app, until the Background control says otherwise;
   --cad-ground is set on the specimen alone, so the diagrams and tiles below keep their own ground */
.cs-try {
  position: relative;
  aspect-ratio: 2 / 1;
  background: var(--cad-ground, #1e1e1e);
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.cs-try.holding {
  touch-action: none;
}

.cs-try:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

.cs-try-cloud,
.cs-try-svg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

/* under the specimen: two color wells on the left, two plain text actions on the right */
.cs-try-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.6rem;
  margin-top: 1.2rem;
}

.cs-try-colors,
.cs-try-actions {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.cs-try-colors label {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  cursor: pointer;
}

.cs-try-colors input {
  appearance: none;
  -webkit-appearance: none;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: none;
  overflow: hidden;
  cursor: pointer;
}

.cs-try-colors input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.cs-try-colors input::-webkit-color-swatch {
  border: 0;
  border-radius: 50%;
}

.cs-try-colors input::-moz-color-swatch {
  border: 0;
  border-radius: 50%;
}

.cs-try-colors input:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

.cs-try-actions button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: color 0.3s ease;
}

.cs-try-actions button:hover {
  color: var(--ink-strong);
}

/* the state in words, for screen readers only */
.cs-try-hint {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* spec tables: one row per state, specimens drawn at 1:1 on the app's dark ground */
.cs-spec-row {
  display: grid;
  align-items: center;
  gap: 0.6rem 2rem;
  padding: 1.2rem 0;
  border-top: 1px solid var(--line);
}

.cs-spec-comp .cs-spec-row {
  grid-template-columns: 16rem minmax(0, 360px) minmax(24rem, 1fr);
}

.cs-spec-row p {
  margin: 0;
}

.cs-spec-th {
  padding: 0 0 0.8rem;
  border-top: 0;
  color: var(--muted);
}

.cs-spec-group {
  display: block;
  padding-top: 2.4rem;
  color: var(--muted);
}

.cs-spec-row svg {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 0.3rem;
  background: var(--cad-ground, #1e1e1e);
}

/* the state name: plain text. Under a line-state diagram it is a button that shows that state on the specimen */
.cs-spec-name {
  justify-self: start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-strong);
  font: inherit;
  text-align: left;
}

button.cs-spec-name {
  cursor: pointer;
}

button.cs-spec-name:hover {
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

/* line states: one annotated panel per state, tldraw-style, same frame every time */
.cs-diagrams {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3.2rem 1.6rem;
}

.cs-diagram,
.cs-vtile,
.cs-compare figure {
  margin: 0;
}

.cs-diagram svg,
.cs-vtile svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.4rem;
  background: var(--cad-ground, #1e1e1e);
}

.cs-diagram figcaption,
.cs-vtile figcaption {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  margin-top: 1rem;
}

.cs-diagram figcaption p,
.cs-vtile figcaption p {
  margin: 0;
}

/* vertex states: magnified tiles with a dimension mark, Bjango-style */
.cs-vtiles {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2.4rem 1.6rem;
}

.cs-vtile figcaption p {
  color: var(--muted);
}

/* side by side with other CAD tools: one row per moment, Digital Surveyor last */
.cs-compare-head {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  gap: 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.cs-compare-head p {
  max-width: 60rem;
  margin: 0;
}

.cs-compare-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.2rem;
  margin: 1.6rem 0 5.6rem;
}

.cs-compare-row:last-child {
  margin-bottom: 0;
}

.cs-compare-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cs-compare svg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  border-radius: 0.4rem;
  background: #1e1e1e;
}

.cs-compare figcaption {
  margin-top: 0.8rem;
}

.cs-compare figcaption .cs-caps {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--muted);
}

.cs-compare-ds figcaption .cs-caps {
  color: var(--ink-strong);
}

.cs-compare-ds svg {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

.cs-compare-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* research screenshots from the other tools, cropped to the line work */
.cs-compare img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 0.4rem;
  background: #1e1e1e;
}

.cs-group-head + .cs-compare {
  margin-top: 2.4rem;
}

/* problem: the old editor, then the one question the system answers */
/* just the recording: no frame, no letterbox */
.cs-sys-before {
  margin-top: 4rem;
  border: 0;
  background: none;
}

.cs-sys-before > video {
  height: auto;
  aspect-ratio: auto;
  background: none;
}

.cs-hmw {
  margin-top: 4rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
}

.cs-hmw .cs-statement {
  margin: 0;
}

/* the shipped editor under the live specimen: two 4:3 recordings, each with its steps */
.cs-sys-shipped {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3.2rem var(--gap);
  margin-top: 4rem;
}

.cs-sys-video > video {
  height: auto;
  aspect-ratio: 4 / 3;
}

.cs-sys-shipped .cs-label {
  margin: 1.2rem 0 0.4rem;
}

.cs-sys-steps {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cs-sys-steps li {
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  padding: 0.8rem 0;
  border-top: 1px solid var(--line);
}

.cs-sys-steps li .cs-caps {
  color: var(--muted);
  line-height: 1.9;
}

.cs-stage-head + .cs-sys-shipped {
  margin-top: 0;
}

/* the same states on two hard backgrounds: stills from the recording, magnified so the keyline shows */
.cs-bgstates {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.6rem;
  margin-top: 4rem;
}

.cs-bgstates > .cs-label {
  grid-column: 1 / -1;
  margin: 1.6rem 0 0;
}

.cs-bgstates > .cs-label:first-child {
  margin-top: 0;
}

.cs-bgstate {
  margin: 0;
}

.cs-bgstate .cs-frame img {
  height: auto;
}

.cs-bgstate figcaption {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  margin-top: 1rem;
}

.cs-bgstate figcaption p {
  margin: 0;
  color: var(--muted);
}

/* a ring around the keyline in the still, with a leader down to its label; 27% and 57.8% sit on the line */
.cs-bgstate-marked {
  position: relative;
}

.cs-bgstate-mark {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cs-bgstate-mark::before {
  content: "";
  position: absolute;
  left: 27%;
  top: 57.8%;
  width: 3.2rem;
  height: 3.2rem;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, -50%);
}

.cs-bgstate-mark::after {
  content: "";
  position: absolute;
  left: calc(27% - 1px);
  top: calc(57.8% + 1.6rem);
  bottom: 3rem;
  width: 2px;
  background: #fff;
}

.cs-bgstate-mark > span {
  position: absolute;
  left: 0.8rem;
  bottom: 0.8rem;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  white-space: nowrap;
}

/* edge cases and comparison open on a statement, then the grid */
.cs-statement + .cs-cases,
.cs-statement + .cs-compare {
  margin-top: 4.8rem;
}

/* edge cases: avoid / do pairs */
.cs-cases {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4.8rem var(--gap);
}

.cs-case {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.cs-case p {
  margin: 0;
}

.cs-case-fig {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.cs-case-fig figure {
  margin: 0;
}

.cs-case-fig svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.4rem;
  background: #1e1e1e;
}

/* avoid / do as a mark, not a word: a red circled cross and a green circled check. The word stays in the markup for screen readers */
.cs-case-fig figcaption {
  display: flex;
  margin-top: 0.8rem;
  font-size: 0;
  line-height: 0;
}

.cs-case-fig figcaption::before {
  content: "";
  width: 2rem;
  height: 2rem;
  background: center / contain no-repeat;
}

.cs-case-fig .cs-case-no::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='10' fill='%23E5484D'/%3E%3Cpath d='M6.6 6.6l6.8 6.8M13.4 6.6l-6.8 6.8' stroke='%23fff' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
}

.cs-case-fig .cs-case-yes::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='10' fill='%2330A46C'/%3E%3Cpath d='M5.8 10.4l2.8 2.8 5.6-6' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.cs-sys-keys kbd {
  font: inherit;
}

.cs-two > .cs-insights {
  margin-top: 0;
}

/* pulsing vertices: the cross-section preview */
.cs-pulse {
  animation: cs-pulse 1.6s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

@media (prefers-reduced-motion: reduce) {
  .cs-pulse {
    animation: none;
  }
}

@media (max-width: 767px) {
  .cs-try {
    aspect-ratio: 4 / 3;
  }

  .cs-spec-th {
    display: none;
  }

  .cs-spec-comp .cs-spec-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .cs-cases,
  .cs-diagrams,
  .cs-compare-head,
  .cs-sys-shipped,
  .cs-bgstates {
    grid-template-columns: minmax(0, 1fr);
  }

  .cs-vtiles,
  .cs-compare-row,
  .cs-compare-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cs-compare-head {
    gap: 0.6rem;
  }
}

/* ---------- scroll reveal ---------- */

.js-motion [data-reveal] {
  opacity: 0;
  transform: translateY(1.6rem);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: var(--delay, 0s);
}

.js-motion [data-reveal].in {
  opacity: 1;
  transform: none;
}

@keyframes cs-shimmer {
  to { background-position: -250% 0; }
}

@keyframes cs-blink {
  50% { opacity: 0; }
}

@keyframes cs-pulse {
  50% { opacity: 0.3; transform: scale(0.8); }
}

@media (prefers-reduced-motion: reduce) {
  .cs-skeleton,
  .cs-dot,
  .cs-caret,
  .cs-loader-log::after,
  .cs-tour-hotspot::after {
    animation: none;
  }
}

/* ---------- mobile: nav becomes a horizontal strip ---------- */

@media (max-width: 767px) {
  .case-study {
    display: block;
    padding: 0 var(--pad);
  }

  .cs-nav {
    position: sticky;
    top: 0;
    z-index: 10;
    max-height: none;
    margin: 0 calc(var(--pad) * -1) 3rem;
    padding: 0 var(--pad);
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }

  .cs-nav-title {
    display: none;
  }

  .cs-nav ol {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    border-left: 0;
  }

  .cs-nav ol::-webkit-scrollbar {
    display: none;
  }

  .cs-nav a {
    padding: 1.2rem 1.6rem 1.2rem 0;
    white-space: nowrap;
  }

  .cs-nav a::before {
    top: auto;
    bottom: 0;
    left: 0;
    right: 1.6rem;
    width: auto;
    height: 2px;
    transform: scaleX(0);
  }

  .cs-nav a.active::before {
    transform: scaleX(1);
  }

  /* progress becomes a hairline under the strip */
  .cs-nav-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    margin: 0;
  }

  .cs-nav-progress p {
    display: none;
  }

  .cs-nav-track {
    margin: 0;
    background: transparent;
  }

  .cs-section {
    padding-bottom: 6rem;
    scroll-margin-top: 5rem;
  }

  .cs-title {
    font-size: 4.6rem;
  }

  .cs-statement {
    font-size: 2.4rem;
  }

  .cs-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cs-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3rem 2rem;
  }

  .cs-metric-value {
    font-size: 4rem;
  }

  .cs-two,
  .cs-sources,
  .cs-decisions,
  .cs-ai,
  .cs-stage {
    grid-template-columns: minmax(0, 1fr);
  }

  .cs-stage {
    padding-left: 1.6rem;
  }

  .cs-log li {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }
}

/* ---------- product design overview (product-design.html) ---------- */

.pd-overview {
  padding: var(--pad) var(--pad) 0;
}

.pd-overview[hidden] {
  display: none;
}

.pd-meta {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 6rem;
}

.pd-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 3.2rem;
}

.pd-filter button {
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.pd-filter button:hover,
.pd-filter button[aria-pressed="true"] {
  color: var(--ink-strong);
}

.pd-filter button[aria-pressed="true"] {
  border-color: var(--ink-strong);
}

/* icon-only sort button, first in the filter row */
.pd-filter .pd-sort {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 0.9rem;
}

.pd-sort svg {
  display: block;
  width: 1.4rem;
  height: 1.4rem;
}

/* tooltip above the sort icon, from its data-tooltip */
.pd-sort {
  position: relative;
}

.pd-sort::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 0.8rem);
  left: 0;
  padding: 0.5rem 0.8rem;
  border-radius: 0.4rem;
  background: var(--ink-strong);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(0.3rem);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.pd-sort:hover::after,
.pd-sort:focus-visible::after {
  opacity: 1;
  transform: none;
}

.pd-filter button span {
  margin-left: 0.3em;
  color: var(--muted);
}

.pd-case[hidden] {
  display: none;
}

.pd-cases {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6rem var(--gap);
}

.pd-case-featured {
  grid-column: 1 / -1;
}

.pd-case-link {
  display: block;
  color: var(--ink);
}

.pd-case-link:hover {
  color: var(--ink);
}

.pd-case-cover {
  transition: border-color 0.3s ease;
}

/* a plain cover: the site purple with a white mark in the middle */
.pd-cover-apple {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  background: #9370db;
}

.pd-cover-apple svg {
  width: 13%;
  transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.pd-case-link:hover .pd-cover-apple svg {
  transform: scale(1.06);
}

.pd-case-cover img,
.pd-case-cover video,
.pd-case-cover .cs-skeleton {
  transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.pd-case-featured .pd-case-cover .cs-skeleton {
  aspect-ratio: 21 / 9;
}

.pd-case-link:hover .pd-case-cover {
  border-color: var(--accent);
}

.pd-case-link:hover .pd-case-cover img,
.pd-case-link:hover .pd-case-cover video,
.pd-case-link:hover .pd-case-cover .cs-skeleton {
  transform: scale(1.02);
}

.pd-case-body {
  margin-top: 1.6rem;
}

.pd-case-title {
  margin: 0;
  font-size: 2.4rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink-strong);
  transition: color 0.3s ease;
}

.pd-case-link:hover .pd-case-title {
  color: var(--accent);
}

.pd-arrow {
  display: inline-block;
  margin-left: 0.4em;
  opacity: 0;
  transform: translateX(-0.4em);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.pd-case-link:hover .pd-arrow,
.pd-case-link:focus-visible .pd-arrow {
  opacity: 1;
  transform: none;
}

/* key stats under the summary: number on top, label below */
.pd-case-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem 3.2rem;
  margin: 1.6rem 0 0;
}

.pd-case-stats div {
  display: flex;
  flex-direction: column-reverse;
}

.pd-case-stats dt {
  margin-top: 0.2rem;
  color: var(--muted);
}

.pd-case-stats dd {
  margin: 0;
  font-size: 2rem;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink-strong);
}

.pd-case-summary {
  max-width: 44rem;
  margin-top: 0.6rem;
}

@media (max-width: 767px) {
  .pd-overview {
    padding: 0 var(--pad);
  }

  .pd-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 4rem;
  }

  .pd-cases {
    grid-template-columns: minmax(0, 1fr);
    gap: 4rem;
  }

  .pd-case-featured .pd-case-cover .cs-skeleton {
    aspect-ratio: 16 / 9;
  }

  .pd-arrow {
    opacity: 1;
    transform: none;
  }
}

/* ---------- case study: back and next links ---------- */

.cs-nav .cs-back {
  display: block;
  width: fit-content;
  margin-bottom: 2.4rem;
  padding-left: 0;
  color: var(--muted);
}

.cs-back:hover {
  color: var(--ink-strong);
}

.cs-next {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 4rem 0;
  border-top: 1px solid var(--line);
  color: var(--ink-strong);
}

.cs-next:hover {
  color: var(--accent);
}

.cs-next-title {
  font-size: 4rem;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.cs-next:hover .pd-arrow {
  opacity: 1;
  transform: none;
}

@media (max-width: 767px) {
  .cs-nav .cs-back {
    margin: 1.2rem 0 0;
  }

  .cs-next-title {
    font-size: 3rem;
  }
}

/* ---------- icon library (iconography) ---------- */

/* each icon is an SVG used as a mask, so it takes the text color in both themes
   and keeps its 100 / 70 / 40 opacity tones */
.cs-icon-glyph {
  display: block;
  width: 2.4rem;
  height: 2.4rem;
  background: var(--ink-strong);
  -webkit-mask: var(--src) center / contain no-repeat;
  mask: var(--src) center / contain no-repeat;
  transition: background-color 0.2s ease;
}

/* icons always sit on the dark theme, whatever the page theme */
.cs-icon-hero,
.cs-icons,
.cs-icon-spec {
  --ink-strong: #fff;
  --muted: #8a8a8a;
  --accent: #a891f5;
  --line: rgba(255, 255, 255, 0.14);
  --surface: rgba(255, 255, 255, 0.04);
  background-color: #1c1c1c;
}

.cs-icon-hero {
  padding: 6rem 4.8rem;
}

.cs-icon-mosaic {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 5.6rem 0;
  justify-items: center;
}

.cs-icon-mosaic .cs-icon-glyph {
  width: 3.2rem;
  height: 3.2rem;
}

.cs-icon-hero + .cs-metrics {
  margin-top: 6rem;
}

.cs-icon-category + .cs-icon-category {
  margin-top: 9rem;
  scroll-margin-top: var(--pad);
}

/* hairline grid: the list draws the top/left edges, each cell its right/bottom */
.cs-icons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  margin: 1.6rem 0 0;
  padding: 0;
  overflow: hidden;
  list-style: none;
  border-radius: 0.6rem;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.cs-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  min-height: 11rem;
  padding: 1.6rem 0.8rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transition: background-color 0.2s ease;
}

.cs-icon:hover {
  background: var(--surface);
}

.cs-icon:hover .cs-icon-glyph {
  background: var(--accent);
}

/* mouse, trackpad and key hints are wider than the square icons */
.cs-icon-wide .cs-icon-glyph {
  width: 4.8rem;
  height: 3.2rem;
}

.cs-icon-name {
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.3;
  text-align: center;
  color: var(--muted);
}

/* principle cards: one icon blown up, optionally over its 16 px grid */
.cs-icon-spec {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
}

.cs-icon-spec .cs-icon-glyph {
  position: relative;
  width: 50%;
  height: 50%;
}

.cs-icon-spec-grid::before {
  content: "";
  position: absolute;
  width: 50%;
  height: 50%;
  outline: 1px solid var(--line);
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 6.25% 6.25%;
}

@media (max-width: 767px) {
  .cs-icon-hero {
    padding: 3.2rem 1.6rem;
  }

  .cs-icon-mosaic {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3.2rem 0;
  }

  .cs-icons {
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  }

  .cs-icon {
    min-height: 9.6rem;
  }
}

/* ---------- apple-internal-website: statement highlights, quotes with a face ---------- */

/* highlighted phrases in a statement */
.cs-statement b {
  font-weight: inherit;
  color: var(--accent);
}

/* quotes with a face */
.cs-quotes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.6rem var(--gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.cs-quotes li {
  display: grid;
  grid-template-columns: 4.8rem 1fr;
  align-items: center;
  gap: 1.6rem;
  padding: 1.6rem 0;
  border-top: 1px solid var(--line);
}

.cs-quotes img {
  width: 4.8rem;
  height: 4.8rem;
  border-radius: 50%;
  object-fit: cover;
}

.cs-quotes blockquote {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1.35;
  color: var(--ink-strong);
}

.cs-quotes b {
  font-weight: 500;
  color: var(--accent);
}

/* ---------- a row of finished badges, animated ---------- */

.cs-frame .cs-badges {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  gap: 2.4rem;
  padding: 4rem 3.2rem;
  background: #fefefe;
}

.cs-badges img {
  width: 100%;
  height: auto;
}

/* tall pages side by side, cropped to their top */
.cs-rounds-tall {
  grid-auto-columns: minmax(12rem, 1fr);
}

.cs-rounds-tall .cs-frame {
  aspect-ratio: 9 / 16;
  background: #fff;
}

.cs-rounds-tall .cs-frame img {
  object-position: top;
}

/* ---------- a live site inside a laptop frame ---------- */

.cs-laptop {
  margin: 0;
}

.cs-laptop-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem 1.6rem;
  margin-bottom: 1.6rem;
}

.cs-laptop-bar .cs-canvas-tabs {
  margin: 0;
}

.cs-laptop-open {
  color: var(--muted);
}

.cs-laptop-open:hover {
  color: var(--ink-strong);
}

/* the frame image's screen is see-through; the site sits behind it */
.cs-laptop-device {
  position: relative;
  aspect-ratio: 3220 / 2100;
}

.cs-laptop-screen {
  position: absolute;
  left: 10.2484%;
  top: 10.381%;
  width: 79.5031%;
  height: 79.2381%;
  overflow: hidden;
  background: #fff;
}

/* laid out at the laptop's own 1512 px width, then scaled to fit */
.cs-laptop-screen iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 1512px;
  height: 983px;
  border: 0;
  transform-origin: 0 0;
  transform: scale(var(--s, 0.5));
}

.cs-laptop-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
}

.cs-laptop + .cs-states,
.cs-meta + .cs-laptop,
.cs-statement + .cs-laptop {
  margin-top: 4rem;
}

@media (max-width: 767px) {
  .cs-quotes {
    grid-template-columns: minmax(0, 1fr);
  }

  .cs-frame .cs-badges {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 2.4rem 1.6rem;
  }

  .cs-rounds-tall {
    grid-auto-columns: 11rem;
  }
}

/* a confidentiality note right under the title */
.cs-nda {
  margin-top: 1.6rem;
}

/* the wordmark sits in the sticky nav, so home is always one click away */
.cs-nav .cs-home {
  display: block;
  width: fit-content;
  margin-bottom: 2.4rem;
  padding: 0;
  font-family: var(--font);
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04rem;
  color: var(--ink);
}

.cs-nav .cs-home::before {
  display: none;
}

.cs-nav .cs-home:hover {
  color: var(--hover);
}

/* the nav carries the wordmark, so the header keeps only the theme switch */
.cs-header-home .heading {
  visibility: hidden;
}

/* pull the nav up over the header, so its wordmark starts exactly where the
   header's would be (the same spot as on every other page) and stays there
   once the nav sticks. The header is its padding plus the 3rem wordmark. */
.cs-header-home ~ .case-study .cs-nav {
  margin-top: calc((var(--pad) * 2 + 3rem) * -1);
}

/* phones: the wordmark sits in the sticky strip, at the header's spot */
@media (max-width: 767px) {
  .cs-nav {
    flex-flow: row wrap;
    align-items: baseline;
  }

  /* the strip covers the header, so lift the theme switch above it */
  .cs-header-home {
    position: relative;
    z-index: 11;
    pointer-events: none;
  }

  .cs-header-home .theme-toggle,
  .cs-header-home .lang-toggle {
    pointer-events: auto;
  }

  .cs-nav .cs-home {
    flex: 1 0 100%;
    margin: 0;
    padding-top: var(--pad);
  }

  .cs-nav .cs-back {
    margin: 1.2rem 0 0;
  }

  .cs-nav ol {
    flex: 1 0 100%;
  }
}

/* ---------- rider journey & design opportunities (ported from map-work) ---------- */

.cs-slide {
  padding: 3rem;
  border: 1px solid var(--line);
  --slide-bg: #f7f7f7;
  border-radius: 0.6rem;
  background: var(--slide-bg);
  overflow-x: auto;
}

:root[data-theme="dark"] .cs-slide {
  --slide-bg: #262626;
}

/* ---------- Rider Journey, laid out like the original research slide ----------
   Six steps on one line, then a branch: up (dotted) to a transfer, which loops
   back to "locate bus stop", or down (solid) to the destination. Heights are
   fixed so the connectors can be drawn with plain borders:
   illustrations calc(8.5 * var(--u)) tall, the line calc(11 * var(--u)) below their top edge. */

.cs-slide {
  container-type: inline-size;
}

/* --u is 1/84 of the slide, so the whole drawing scales with it and always
   fits: nothing scrolls sideways. On a phone it stops shrinking and scrolls. */
.cs-rj {
  --u: max(100cqw / 84, 0.62rem);
  --rj-gap: calc(1.4 * var(--u));
  --rj-label: calc(7 * var(--u)); /* the column that names the touch point rows */
  --rj-col: calc((100% - var(--rj-label) - 7 * var(--rj-gap)) / 8.2); /* the last column is 2.2 wide */
  min-width: calc(84 * var(--u));
  --rj-ink: #8f8f8f;
  --rj-soft: #c4c4c4;
}

:root[data-theme="dark"] .cs-rj {
  --rj-ink: #8a8a8a;
  --rj-soft: #5c5c5c;
}

.cs-rj-map {
  position: relative;
  padding-top: calc(7 * var(--u));
  padding-left: calc(var(--rj-label) + var(--rj-gap));
}

.cs-rj-steps {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr)) minmax(0, 2.2fr);
  gap: var(--rj-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.cs-rj-steps > li {
  position: relative;
  min-width: 0;
}

/* the photo of each step, as on the original slide */
.cs-rj-photo {
  display: block;
  width: 100%;
  height: calc(11.6 * var(--u));
  margin: 0;
  object-fit: cover;
}

/* the illustration of each step sits on the line, where the slide had a dot:
   big enough to read, small enough to leave the photo in charge */
.cs-rj-dot {
  position: absolute;
  z-index: 1;
  top: calc(12.8 * var(--u));
  left: 0;
  width: calc(4.4 * var(--u));
  height: calc(4.4 * var(--u));
  margin: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 calc(0.35 * var(--u)) var(--slide-bg);
}

/* the line from each step to the next one, 15u below the top of the photos */
.cs-rj-steps > li:not(.cs-rj-end)::before {
  content: "";
  position: absolute;
  top: calc(15 * var(--u) - 1.5px);
  left: calc(2.2 * var(--u));
  width: calc(100% + var(--rj-gap));
  border-top: 3px solid var(--rj-ink);
}

/* planning happens before the rider reaches the system: lighter, dotted */
.cs-rj-steps > li:first-child::before {
  border-top: 3px dotted var(--rj-soft);
}

.cs-rj h4 {
  margin: calc(6.8 * var(--u)) 0 calc(0.8 * var(--u));
  font-size: calc(1.25 * var(--u));
  font-weight: 700;
  line-height: 1.15;
  text-transform: uppercase;
  color: var(--ink-strong);
}

.cs-rj-steps ul {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: calc(1.05 * var(--u));
  line-height: 1.3;
}

.cs-rj-steps ul li + li {
  margin-top: calc(0.6 * var(--u));
}

/* the last column: transfer above the line, destination below it */
.cs-rj-end {
  min-height: calc(30 * var(--u));
}

.cs-rj-connect,
.cs-rj-arrive {
  position: absolute;
  left: calc(3.4 * var(--u));
  right: 0;
  padding-left: calc(5.2 * var(--u));
}

.cs-rj-connect {
  top: calc(-5.5 * var(--u));
}

.cs-rj-arrive {
  top: calc(16.2 * var(--u));
}

.cs-rj-end .cs-rj-photo {
  width: calc(5.5 * var(--u));
  height: calc(7.3 * var(--u));
  margin-left: calc(-5.2 * var(--u));
}

.cs-rj-end .cs-rj-dot {
  top: calc(7.9 * var(--u));
}

.cs-rj-end h4 {
  margin: calc(1.4 * var(--u)) 0 calc(0.6 * var(--u));
}

/* dotted branch up to the transfer, solid trunk down to the destination */
.cs-rj-end::before,
.cs-rj-end::after {
  content: "";
  position: absolute;
  left: calc(2.2 * var(--u) - 1.5px);
  width: calc(1.4 * var(--u));
}

.cs-rj-end::before {
  top: calc(4.6 * var(--u) - 1.5px);
  height: calc(10.4 * var(--u));
  border-top: 3px dotted var(--rj-soft);
  border-left: 3px dotted var(--rj-soft);
  border-top-left-radius: calc(1 * var(--u));
}

.cs-rj-end::after {
  top: calc(15 * var(--u));
  height: calc(11.3 * var(--u) + 1.5px);
  border-bottom: 3px solid var(--rj-ink);
  border-left: 3px solid var(--rj-ink);
  border-bottom-left-radius: calc(1 * var(--u));
}

/* the transfer loops back to "locate bus stop" */
.cs-rj-loop {
  position: absolute;
  top: calc(0.4 * var(--u));
  left: calc(var(--rj-label) + var(--rj-col) + 2 * var(--rj-gap) + 4.4 * var(--u));
  right: calc(2.2 * var(--rj-col) - 6.15 * var(--u));
  height: calc(1.1 * var(--u));
  border: 3px dotted var(--rj-soft);
  border-bottom: 0;
  border-radius: calc(1 * var(--u)) calc(1 * var(--u)) 0 0;
}

.cs-rj-loop::before {
  content: "";
  position: absolute;
  left: -3px;
  top: calc(1 * var(--u));
  height: calc(5.2 * var(--u));
  border-left: 3px dotted var(--rj-soft);
}

.cs-rj-loop::after {
  content: "";
  position: absolute;
  right: calc(-0.65 * var(--u) - 1.5px);
  top: calc(0.4 * var(--u));
  border: calc(0.65 * var(--u)) solid transparent;
  border-top: calc(0.9 * var(--u)) solid var(--rj-soft);
  border-bottom: 0;
}

/* touch point rows: the name in the label column, each cell under its step */
.cs-rj-row {
  display: grid;
  grid-template-columns: var(--rj-label) minmax(0, 1fr);
  gap: var(--rj-gap);
  align-items: start;
  margin-top: calc(2.4 * var(--u));
  padding-top: calc(1.2 * var(--u));
  border-top: 1px solid var(--line);
}

.cs-rj-row + .cs-rj-row {
  margin-top: calc(1.2 * var(--u));
}

.cs-rj-row p {
  margin: 0;
  font-size: calc(1.05 * var(--u));
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink-strong);
}

.cs-rj-row ul {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr)) minmax(0, 2.2fr);
  gap: var(--rj-gap);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: calc(1.05 * var(--u));
  line-height: 1.3;
  color: var(--muted);
}

/* the last cell lines up with the transfer and destination text above it */
.cs-rj-row li:last-child {
  padding-left: calc(8.6 * var(--u));
}

/* ---------- Design Opportunities, in the same slide format ---------- */

.cs-do {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: calc(7 * var(--u));
  margin: 0;
  padding: calc(1 * var(--u)) 0;
  list-style: none;
}

.cs-do > li {
  position: relative;
  display: flex;
  flex-direction: column;
}

.cs-do h4 {
  flex: 1;
  margin: 0 0 calc(1.4 * var(--u));
}

.cs-do img {
  display: block;
  margin: 0;
  border-radius: 50%;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
}

/* the arrow from one move to the next, level with the circles */
.cs-do > li:not(:last-child)::after {
  content: "→";
  position: absolute;
  right: calc(-3.5 * var(--u));
  bottom: calc((84 * var(--u) - 21 * var(--u)) / 8);
  transform: translate(50%, 50%);
  font-size: calc(2 * var(--u));
  line-height: 1;
  color: var(--rj-ink);
}


@media (max-width: 767px) {
  .cs-slide {
    padding: 2rem;
  }
}

/* a line of context between a group's label and its board */
.cs-group-note {
  max-width: 60rem;
  margin-bottom: 1.6rem;
}
