/* ==========================================================================
   Case studies
   /assets/css/case-study.css — loaded after main.css on /projects/* only.

   Builds on the tokens and shared components in main.css. Most of this file is
   used by both /projects/2study and /projects/2work; the exceptions are marked
   (2Study: .showcase. 2Work: .questions, .arch--stack, .finance-preview).
   Wrap the page in .theme-2study / .theme-2work (on <body>).

   Contents
   01  Page hero: back link, intro, facts, media, "On this page"
   02  Sections: label rail + content, blocks, splits, notes
   03  Long-form text
   04  Feature grid, feature groups and disclosure
   05  Callout, numbered list, steps, questions
   06  Architecture diagrams
   07  Status list
   08  Screens: hero showcase, gallery, device row, wide figures
   09  Colour swatches
   10  Language trio
   11  Next project
   ========================================================================== */


/* ==========================================================================
   01  Page hero
   .page-hero > .container > a.back-link + .cs-hero + nav.cs-toc
   .cs-hero > .cs-hero__intro + figure.cs-hero__stage + dl.spec-grid.cs-hero__facts
   Phones and tablets: intro, media, facts. From 1120px the media sits beside the
   intro, so the product is on the first screen, and the facts run below as a strip.
   ========================================================================== */

.page-hero {
  position: relative;
  isolation: isolate;
  overflow: clip;
  padding-top: calc(var(--nav-h) + clamp(1.5rem, 0.75rem + 2.5vw, 3rem));
  padding-bottom: clamp(2.5rem, 1.5rem + 3vw, 4.5rem);
}

.page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(60% 70% at 70% -10%, rgb(var(--accent-rgb) / 0.18), transparent 70%),
    radial-gradient(40% 50% at 10% 0%, rgb(255 255 255 / 0.05), transparent 70%);
}

.page-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: var(--grain);
  background-size: 180px;
  opacity: 0.04;
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent);
  mask-image: linear-gradient(to bottom, #000 30%, transparent);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-bottom: clamp(var(--space-4), 2.5vw, var(--space-7));
  color: var(--text-2);
  font-size: var(--fs-small);
  font-weight: 500;
  transition: color var(--dur-1) var(--ease-out);
}

.back-link svg {
  width: 16px;
  height: 16px;
  transition: transform var(--dur-2) var(--ease-out);
}

.back-link:hover {
  color: var(--text);
}

.back-link:hover svg {
  transform: translateX(-3px);
}

.page-hero__id {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

/* Phones: a smaller icon keeps the name on the same line. */
@media (max-width: 639.98px) {
  .page-hero__id .app-icon--lg {
    --icon-size: 64px;
  }
}

.page-hero__title {
  font-size: var(--fs-h1);
  line-height: 1;
  letter-spacing: var(--tracking-display);
}

.page-hero__tagline {
  margin-top: var(--space-6);
  font-size: var(--fs-statement);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: var(--tracking-heading);
  max-width: 20em;
  text-wrap: balance;
}

.page-hero__lead {
  margin-top: var(--space-5);
  font-size: var(--fs-lead);
  line-height: 1.6;
  color: var(--text-2);
  max-width: var(--measure);
}

.page-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-6);
  list-style: none;
  padding: 0;
}

.page-hero__actions {
  margin-top: var(--space-7);
}

.cs-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "intro"
    "media"
    "facts";
}

.cs-hero__intro { grid-area: intro; min-width: 0; }

.cs-hero__stage {
  grid-area: media;
  min-width: 0;
  margin-top: clamp(2.5rem, 1.5rem + 3vw, 4rem);
}

/* A phone trio in the hero (2Work) is capped so the stage and its caption fit the first screen. */
@media (min-width: 768px) {
  .cs-hero__stage .device-trio {
    max-width: 560px;
  }
}

/* Key facts: a spec grid, two columns from 768px and one per fact from 1024px. */
.cs-hero__facts {
  --cols: 2;
  grid-area: facts;
  min-width: 0;
  margin-top: clamp(2.5rem, 1.5rem + 3vw, 3.5rem);
}

@media (min-width: 768px) and (max-width: 1023.98px) {
  .cs-hero__facts > .spec-grid__item:nth-child(odd) {
    padding-left: 0;
    border-left: 0;
  }

  .cs-hero__facts > .spec-grid__item:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }
}

@media (min-width: 1024px) {
  .cs-hero__facts {
    --cols: 4;
  }
}

@media (min-width: 1120px) {
  .cs-hero {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    grid-template-areas:
      "intro media"
      "facts facts";
    column-gap: clamp(3rem, 5vw, 5rem);
  }

  .cs-hero__stage {
    align-self: center;
    margin-top: 0;
  }
}

.cs-toc {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-5);
  margin-top: var(--space-7);
}

.cs-toc__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-1);
  list-style: none;
  margin: 0 -10px;
  padding: 0;
}

.cs-toc__list a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 10px;
  border-radius: var(--r-pill);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 500;
  transition: color var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out);
}

.cs-toc__list a:hover {
  color: var(--text);
  background: var(--fill-3);
}


/* ==========================================================================
   02  Sections
   section.cs-section > .container.cs-section__grid > .cs-section__label + content
   .cs-block      vertical rhythm between sub-blocks inside one section
   .cs-split      two columns from 1024px (--wide-left: 7/5); .cs-sticky pins a column
   .cs-wide       full-width media after a section's grid
   .cs-subhead    small heading above a sub-block
   .cs-note       caption-sized note under a list or figure
   ========================================================================== */

.cs-section {
  padding-block: clamp(3.5rem, 2rem + 5vw, 7rem);
  border-top: 1px solid var(--border);
  scroll-margin-top: calc(var(--anchor-gap) * -1 - 1px);
}

.cs-section__grid {
  display: grid;
  gap: var(--space-7);
}

/* A long word or tag can never widen the track. */
.cs-section__grid > * {
  min-width: 0;
}

.cs-section__label {
  display: grid;
  gap: var(--space-3);
  align-content: start;
}

.cs-section__title {
  font-size: var(--fs-h2);
  max-width: 14em;
}

@media (min-width: 1024px) {
  .cs-section__grid {
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    column-gap: clamp(3rem, 5vw, 6rem);
  }

  .cs-section__label {
    position: sticky;
    top: calc(var(--nav-h) + var(--space-7));
    align-self: start;
  }

  .cs-section__title {
    font-size: clamp(2rem, 1.2rem + 1.6vw, 2.75rem);
  }
}

.cs-block + .cs-block,
.cs-wide {
  margin-top: clamp(var(--space-9), 1.5rem + 4vw, var(--space-11));
}

.cs-block > .metrics:first-child {
  margin-top: 0;
}

.cs-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-9);
}

@media (min-width: 1024px) {
  .cs-split {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(3rem, 5vw, 6rem);
  }

  .cs-split--wide-left {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  }

  .cs-sticky {
    position: sticky;
    top: calc(var(--nav-h) + var(--space-7));
    align-self: start;
  }
}

/* Small-title look, shared with .feature-group__title. */
.cs-subhead,
.feature-group__title {
  font-size: var(--fs-h4);
  font-weight: 600;
  letter-spacing: var(--tracking-snug);
  line-height: var(--lh-snug);
}

.cs-subhead {
  margin-bottom: var(--space-5);
}

/* Caption look for notes and figure captions outside a stage. */
.cs-note,
.cs-figure > figcaption,
.arch-caption,
.arch__note {
  font-size: var(--fs-xs);
  line-height: 1.55;
  color: var(--text-3);
}

.cs-note {
  margin-top: var(--space-5);
  max-width: 44em;
}

.cs-label {
  margin-bottom: var(--space-3);
}

.prose + .cs-label,
.prose + .swatches,
.prose + .tag-list {
  margin-top: var(--space-7);
}

.steps + .prose {
  margin-top: var(--space-8);
}

/* Tag lists and dotted lists inside spec rows (Technology). */
.spec-list dd .tag-list,
.spec-list dd .dot-list {
  margin-top: 2px;
}

.spec-list dd .tag-list + small {
  margin-top: var(--space-3);
}


/* ==========================================================================
   03  Long-form text
   ========================================================================== */

.prose {
  max-width: 40rem;
  color: var(--text-2);
  font-size: var(--fs-body);
  line-height: 1.7;
}

.prose > * + * {
  margin-top: 1.1em;
}

.prose .t-lead {
  color: var(--text);
  font-size: var(--fs-lead);
}

/* One item per line with a small dot, for lists that read as a list (policy text). */
.bullet-list {
  display: grid;
  gap: var(--space-2);
  list-style: none;
  margin-inline: 0;
  padding: 0;
}

.bullet-list > li {
  position: relative;
  padding-inline-start: 1.25rem;
}

.bullet-list > li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0.35rem;
  top: 0.8em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}


/* ==========================================================================
   04  Feature grid, feature groups and disclosure
   ul.feature-grid > li.feature > h3/h4.feature__title (+ .marker) + p.feature__text
   div.feature-group > .feature-group__head (h3 + .badge) + [.callout | .cs-note] + list
   details.disclosure > summary.disclosure__summary + content: for lists of
   unreleased work, which stay one tap away instead of filling the page.
   ========================================================================== */

.feature-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.feature {
  padding-block: var(--space-6);
  border-bottom: 1px solid var(--border);
}

.feature__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.feature__text {
  margin-top: 6px;
  font-size: var(--fs-small);
  line-height: 1.55;
  color: var(--text-2);
}

/* A close-up above a feature's title (2Notch): the top of the screen, cropped tight
   around the notch panel. Two close-ups stack (Quiet alerts).
   li.feature > [img.feature__shot | div.feature__shots > img.feature__shot × 2] + title + text */
.feature__shot {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: var(--space-4);
  border-radius: 14px;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.1), var(--shadow-device);
}

.feature__shots {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.feature__shots > .feature__shot {
  margin-bottom: 0;
}

@media (min-width: 640px) {
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--space-8);
  }
}

.feature-group + .feature-group {
  margin-top: clamp(var(--space-10), 2rem + 4vw, var(--space-12));
}

.feature-group__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-5);
  margin-bottom: var(--space-5);
}

.feature-group > .callout {
  margin-bottom: var(--space-6);
}

.feature-group > .cs-note {
  margin: 0 0 var(--space-5);
}

.disclosure {
  border-top: 1px solid var(--border);
}

.disclosure:not([open]) {
  border-bottom: 1px solid var(--border);
}

.disclosure__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 56px;
  padding-block: var(--space-3);
  list-style: none;
  cursor: pointer;
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--text);
}

.disclosure__summary::-webkit-details-marker {
  display: none;
}

.disclosure__action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  color: var(--text-2);
  font-size: var(--fs-xs);
  transition: color var(--dur-1) var(--ease-out);
}

.disclosure__summary:hover .disclosure__action {
  color: var(--text);
}

.disclosure__action svg {
  width: 16px;
  height: 16px;
  transition: transform var(--dur-2) var(--ease-out);
}

.disclosure[open] .disclosure__action svg {
  transform: rotate(180deg);
}

.disclosure:not([open]) .disclosure__hide,
.disclosure[open] .disclosure__show {
  display: none;
}


/* ==========================================================================
   05  Callout, numbered list, steps, questions
   ========================================================================== */

/* Callout: a quiet note for status or caveats. */
.callout {
  display: grid;
  gap: 6px;
  padding: var(--space-5) var(--space-6);
  border: 1px solid var(--border-2);
  border-left: 2px solid var(--accent);
  border-radius: var(--r-md);
  background: var(--fill-1);
  font-size: var(--fs-small);
  line-height: 1.55;
  color: var(--text-2);
}

.callout__title {
  color: var(--text);
  font-weight: 600;
}

.callout--dev {
  border-left-color: var(--dev);
}

/* Numbered list (engineering challenges, release list).
   ol.numbered > li > .numbered__title + .numbered__text [+ .numbered__proof] */
.numbered {
  display: grid;
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: item;
  border-top: 1px solid var(--border);
}

.numbered > li {
  counter-increment: item;
  display: grid;
  align-content: start;
  grid-template-columns: 2.75rem minmax(0, 1fr);
  column-gap: var(--space-4);
  padding-block: var(--space-6);
  border-bottom: 1px solid var(--border);
}

.numbered > li::before {
  content: counter(item, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  line-height: 2;
  color: var(--accent);
}

.numbered__title {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.numbered__text,
.numbered__proof {
  grid-column: 2;
  max-width: 40em;
}

.numbered__text {
  margin-top: 6px;
  font-size: var(--fs-small);
  line-height: 1.6;
  color: var(--text-2);
}

/* The test or commit that backs a challenge. */
.numbered__proof {
  margin-top: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--text-3);
  overflow-wrap: anywhere;
}

/* Steps: a short sequence read left to right. Each step has its own top rule.
   ol.steps[style="--cols: N"] > li > .steps__title + .steps__text
   --cols sets the columns from 1024px (default 3); --cols-md (default: --cols) from 768px. */
.steps {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0 var(--space-8);
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
}

.steps > li {
  counter-increment: step;
  display: grid;
  align-content: start;
  grid-template-columns: 2.75rem minmax(0, 1fr);
  column-gap: var(--space-4);
  padding-block: var(--space-5) var(--space-6);
  border-top: 1px solid var(--border-2);
}

.steps > li::before {
  content: counter(step, decimal-leading-zero);
  grid-row: span 2;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  line-height: 2.1;
  color: var(--accent);
}

.steps__title {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.35;
}

.steps__text {
  grid-column: 2;
  margin-top: 6px;
  font-size: var(--fs-small);
  line-height: 1.55;
  color: var(--text-2);
}

@media (min-width: 768px) {
  .steps {
    grid-template-columns: repeat(var(--cols-md, var(--cols, 3)), minmax(0, 1fr));
  }

  .steps > li {
    grid-template-columns: minmax(0, 1fr);
    padding-bottom: var(--space-7);
  }

  .steps > li::before {
    grid-row: auto;
    margin-bottom: var(--space-4);
    line-height: 1.4;
  }

  .steps__text {
    grid-column: 1;
  }
}

@media (min-width: 1024px) {
  .steps {
    grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  }
}

/* Questions: large typographic questions (2Work's problem statement). */
.questions {
  display: grid;
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: question;
  border-top: 1px solid var(--border);
}

.questions > li {
  counter-increment: question;
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr);
  column-gap: var(--space-4);
  padding-block: var(--space-5);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-tagline);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.022em;
  color: var(--text);
  text-wrap: balance;
}

.questions > li::before {
  content: counter(question, decimal-leading-zero);
  padding-top: 0.55em;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  color: var(--accent);
}


/* ==========================================================================
   06  Architecture diagrams (HTML/CSS)
   div.arch-wrap > div.arch[role=group][aria-label]
     .arch__node (client) / .arch__link / .arch__node--hub (backend) / .arch__link / .arch__node
   Stacked with vertical connectors by default. A plain .arch becomes one row
   when its wrapper is at least 1000px wide (container query), with every node
   the same height. .arch--stack stays vertical at every width (2Work).
   .arch__link is decorative (aria-hidden): repeat anything essential in the
   group's aria-label or the caption.
   ========================================================================== */

.arch-wrap {
  container-type: inline-size;
}

.arch {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: stretch;
  gap: 0;
}

.arch__node {
  position: relative;
  padding: var(--space-6);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
}

.arch__node--hub {
  border-color: rgb(var(--accent-rgb) / 0.4);
  background:
    radial-gradient(100% 80% at 50% 0%, rgb(var(--accent-rgb) / 0.14), transparent 70%),
    linear-gradient(180deg, var(--surface-2), var(--surface-1));
  box-shadow: 0 0 0 4px rgb(var(--accent-rgb) / 0.05);
}

.arch__eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-3);
}

.arch__title {
  margin-top: 6px;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.arch__list {
  display: grid;
  gap: 4px;
  margin: var(--space-4) 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--text-2);
}

.arch__link {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  min-height: 84px;
  padding-block: var(--space-2);
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  letter-spacing: 0.04em;
  text-align: center;
}

.arch__link::before {
  content: "";
  width: 1px;
  height: 22px;
  background: linear-gradient(var(--border-3), rgb(var(--accent-rgb) / 0.6));
}

.arch__arrow {
  font-size: var(--fs-sm);
  line-height: 1;
  color: var(--accent);
}

.arch__arrow::before {
  content: "\2195"; /* up-down arrow */
}

.arch__link-label {
  max-width: 16em;
  text-wrap: balance;
}

.arch__note {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.arch-caption {
  margin-top: var(--space-5);
  max-width: 44em;
}

/* Sub-modules inside a node (2Work's package). */
.arch__cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.arch__sub {
  padding: var(--space-4) var(--space-5) var(--space-5);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  background: var(--fill-1);
}

.arch__sub-title {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text);
}

.arch__sub .arch__list {
  margin-top: var(--space-2);
}

/* Wide enough for two short columns inside a full-width node. */
@container (min-width: 560px) {
  .arch__cols {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .arch__list--cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--space-6);
  }
}

@container (min-width: 1000px) {
  .arch:not(.arch--stack) {
    grid-template-columns: minmax(0, 1fr) minmax(7rem, 0.5fr) minmax(0, 1.1fr) minmax(7rem, 0.5fr) minmax(0, 1fr);
    align-items: stretch;
  }

  /* The connector runs edge to edge, touching both nodes; only the label is inset. */
  .arch:not(.arch--stack) .arch__link-label {
    padding-inline: var(--space-2);
  }

  .arch:not(.arch--stack) .arch__link::before {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, var(--border-3), rgb(var(--accent-rgb) / 0.6), var(--border-3));
  }

  .arch:not(.arch--stack) .arch__arrow::before {
    content: "\2194"; /* left-right arrow */
  }

  /* In a row the nodes are narrow again: one column per list. */
  .arch:not(.arch--stack) .arch__list--cols {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Stacked layers: connectors point down (data flows one way). */
.arch--stack .arch__link {
  min-height: 76px;
}

.arch--stack .arch__link-label {
  max-width: 24em;
}

.arch--stack .arch__arrow::before {
  content: "\2193"; /* downwards arrow */
}


/* ==========================================================================
   07  Status list: released vs in development
   ========================================================================== */

.status-list {
  display: grid;
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.status-list > li {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
  padding-block: var(--space-5);
  border-bottom: 1px solid var(--border);
}

.status-list__name {
  font-weight: 600;
}

.status-list__text {
  font-size: var(--fs-small);
  color: var(--text-2);
}

.status-list .badge {
  justify-self: start;
}

.status-list + .btn-row,
.numbered + .btn-row {
  margin-top: var(--space-8);
}

@media (min-width: 768px) {
  .status-list .badge {
    justify-self: end;
  }

  .status-list > li {
    grid-template-columns: minmax(10rem, 1fr) minmax(0, 2fr) 11rem;
    align-items: baseline;
    column-gap: var(--space-6);
  }
}


/* ==========================================================================
   08  Screens
   Hero showcase (2Study): figure.stage > .showcase > .showcase__main (iPad) + .showcase__side (iPhone)
   Gallery: .stage.stage--gallery > .device-row > figure.device-figure
   Wide figures: .stage--wide (one iPad) and .media-banner (a dark landscape screen)
   Finance preview (2Work): figure.stage.stage--formula.finance-preview > .device + .formula + figcaption
   ========================================================================== */

/* The iPhone overlaps the iPad's right edge and sits slightly below it. */
.showcase {
  position: relative;
  max-width: 1040px;
  margin-inline: auto;
  padding-bottom: 6%;
}

.showcase__main {
  width: 82%;
}

.showcase__side {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 1;
  width: 30%;
  transition: transform var(--dur-4) var(--ease-out);
}

@media (min-width: 640px) {
  .showcase {
    padding-bottom: 3%;
  }

  .showcase__main {
    width: 84%;
  }

  .showcase__side {
    width: 24%;
  }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .stage:hover .showcase__side {
    transform: translateY(-1.5%);
  }
}

/* A row of screens. Wraps to two columns on phones. */
.device-row {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  gap: clamp(1rem, 3vw, 2.5rem);
  align-items: start;
}

@media (max-width: 767.98px) {
  .device-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* An odd last screen centres under the two above it. */
  .device-row > .device-figure:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - clamp(0.5rem, 1.5vw, 1.25rem));
  }
}

.device-figure {
  display: grid;
  gap: var(--space-4);
}

/* Device figures sit on a lit stage, so their captions use --text-2. */
.device-figure figcaption {
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--text-2);
  text-align: center;
}

.stage--gallery {
  padding: clamp(2rem, 1rem + 4vw, 4rem) clamp(1rem, 4%, 4rem) clamp(1.5rem, 1rem + 2vw, 2.5rem);
}

.stage--gallery .device-row {
  max-width: 1080px;
  margin-inline: auto;
  row-gap: var(--space-8);
}

.stage--gallery .device-figure figcaption {
  max-width: 17em;
  margin-inline: auto;
}

/* Wide screens on a stage: an iPad and a landscape banner share one width. */
.stage--wide .device--ipad,
.stage--wide .media-banner {
  max-width: 820px;
  margin-inline: auto;
}

.cs-figure + .cs-figure {
  margin-top: clamp(var(--space-8), 1rem + 4vw, var(--space-10));
}

.cs-figure > figcaption {
  margin-top: var(--space-4);
}

/* The Coming soon screen beside the safe-to-spend formula (2Work). Stacks on phones. */
.finance-preview {
  gap: var(--space-7);
  margin-bottom: var(--space-6);
}

.finance-preview__device {
  width: min(56%, 220px);
}

/* The formula sizes itself to its own column, not to the whole stage. */
.finance-preview .formula {
  container-type: inline-size;
}

.finance-preview .formula__label {
  text-wrap: balance;
}

.finance-preview .formula__legend {
  grid-template-columns: minmax(0, 1fr);
}

.finance-preview .stage__caption {
  margin-top: 0;
}

@media (min-width: 640px) {
  .finance-preview {
    grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
    align-items: center;
    column-gap: clamp(var(--space-6), 4%, var(--space-9));
  }

  .finance-preview__device {
    width: 100%;
  }

  .finance-preview .stage__caption {
    grid-column: 1 / -1;
  }
}

@container (min-width: 460px) {
  .finance-preview .formula__legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* A dark landscape screen (the full-screen focus timer). */
.media-banner {
  overflow: hidden;
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  background: #000;
}

.media-banner img {
  width: 100%;
}

/* A short crop that only stays sharp at a smaller width (2Work's Live Activity). */
.media-banner--sm {
  max-width: 520px;
  margin-inline: auto;
}

.gallery-banner {
  margin-top: var(--space-8);
}


/* ==========================================================================
   09  Colour swatches
   ul.swatches > li.swatch > span.swatch__chip[style="--c: #hex"] + .swatch__name + .swatch__value
   Tiles: a colour bar, then the token name and its value. One row of five from 768px.
   ========================================================================== */

/* ul.swatches, not .swatches: the padding has to beat the reset on ul[role="list"]. */
ul.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6rem, 1fr));
  gap: var(--space-6) var(--space-4);
  list-style: none;
  margin: 0;
  padding: var(--space-6) 0 0;
  border-top: 1px solid var(--border);
}

@media (min-width: 768px) {
  .swatches {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.swatch {
  display: grid;
  align-content: start;
  gap: 2px;
}

.swatch__chip {
  height: 56px;
  margin-bottom: var(--space-3);
  border-radius: var(--r-md);
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.14);
}

.swatch__name {
  font-size: var(--fs-small);
  font-weight: 500;
  line-height: 1.3;
  color: var(--text);
}

.swatch__value {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  line-height: 1.45;
  color: var(--text-3);
  text-wrap: balance;
}


/* ==========================================================================
   10  Language trio
   ul.lang-trio > li.lang[lang][dir] > p.lang__name + p.lang__meta
   Hebrew and Arabic cells are dir="rtl", so their content sits on the right.
   A spec grid that follows shares the trio's bottom rule.
   ========================================================================== */

.lang-trio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
  border-block: 1px solid var(--border);
}

.lang-trio + .spec-grid {
  border-top: 0;
}

.lang {
  padding: var(--space-6) var(--space-4) var(--space-5);
}

.lang + .lang {
  border-left: 1px solid var(--border);
}

.lang:first-child {
  padding-left: 0;
}

.lang:last-child {
  padding-right: 0;
}

.lang__name {
  font-size: clamp(1.5rem, 0.9rem + 2.6vw, 3rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text);
}

/* Joined scripts must never be letter-spaced. */
.lang:not([lang="en"]) .lang__name {
  letter-spacing: 0;
}

.lang__meta {
  margin-top: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* Small phones: one language per row; Hebrew and Arabic rows align right. */
@media (max-width: 479.98px) {
  .lang-trio {
    grid-template-columns: minmax(0, 1fr);
  }

  .lang,
  .lang:first-child,
  .lang:last-child {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    padding: var(--space-5) 0;
  }

  .lang + .lang {
    border-left: 0;
    border-top: 1px solid var(--border);
  }

  .lang__meta {
    margin-top: 0;
  }
}


/* ==========================================================================
   11  Next project
   nav.next-project > .eyebrow + a.next-project__link.theme-x (icon, name, arrow)
                    + .next-project__kicker + a.link-arrow.next-project__back
   ========================================================================== */

.next-project {
  display: grid;
  gap: var(--space-4);
  padding-block: clamp(3.5rem, 2rem + 5vw, 7rem);
  border-top: 1px solid var(--border);
}

.next-project__link {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: clamp(var(--space-4), 2vw, var(--space-6));
  min-height: 44px;
  font-size: var(--fs-h2);
  font-weight: 600;
  letter-spacing: var(--tracking-heading);
  line-height: 1.05;
}

.next-project__link > svg {
  width: 0.6em;
  height: 0.6em;
  color: var(--text-2);
  transition: transform var(--dur-3) var(--ease-out), color var(--dur-2) var(--ease-out);
}

.next-project__link:hover > svg {
  transform: translateX(6px);
  color: var(--text);
}

.next-project__link .app-icon {
  --icon-size: clamp(52px, 1.5rem + 4vw, 80px);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.08), 0 12px 32px -12px rgb(var(--accent-rgb) / 0.55);
  transition: transform var(--dur-3) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .next-project__link:hover .app-icon {
    transform: translateY(-2px);
  }
}

.next-project__kicker {
  max-width: var(--measure);
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: var(--text-2);
}

.next-project__back {
  justify-self: start;
  margin-top: var(--space-4);
  color: var(--text-2);
  transition: color var(--dur-1) var(--ease-out);
}

.next-project__back:hover {
  color: var(--text);
}

.next-project__back:hover svg {
  transform: translateX(-3px);
}


/* ==========================================================================
   12  2Awake: window grid and support questions
   .stage--gallery > .window-grid > figure.device-figure > img.mac-window + figcaption
   ul.faq > li > h3.faq__q + .faq__a
   ========================================================================== */

.window-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-8);
  max-width: 1080px;
  margin-inline: auto;
}

@media (min-width: 768px) {
  .window-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(1.5rem, 3vw, 2.5rem);
  }

  /* An odd last window centres under the two above it. */
  .window-grid > .device-figure:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - clamp(0.75rem, 1.5vw, 1.25rem));
  }
}

.stage--gallery .window-grid .device-figure figcaption {
  max-width: 26em;
}

.faq {
  display: grid;
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.faq > li {
  padding-block: var(--space-6);
  border-bottom: 1px solid var(--border);
}

.faq__q {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.faq__a {
  margin-top: var(--space-3);
  max-width: 40rem;
  color: var(--text-2);
  line-height: 1.7;
}

.faq__a > * + * {
  margin-top: var(--space-3);
}

.faq__a strong {
  color: var(--text);
  font-weight: 600;
}

/* The availability note in the 2Awake hero. */
.page-hero__note {
  margin-top: var(--space-6);
  max-width: var(--measure);
}

/* A one-paragraph callout flows as text, so a link inside it stays in the sentence
   (as a grid, the link and the words around it became separate rows). A title in
   it still gets its own line. The div.callout with a title paragraph keeps the grid. */
p.callout {
  display: block;
}

p.callout > .callout__title {
  display: block;
  margin-bottom: 6px;
}
