/* Refraction case-study layer. Long-form content stays readable on the poster's
   black ground. */
:root {
  --case-bg: var(--ref-black);
  --case-fg: var(--ref-text);
  --case-muted: var(--ref-text-note);
  --case-panel: var(--ref-control-surface);
  --case-line: #ffffff33;
  /* The stage's mark: white, faint enough that text crossing it reads. */
  --case-mark-alpha: .09;
  --case-inner: min(900px, calc(100vw - 48px));
  /* The ray that lights the stage. The page draws one of the seven per
     visit into data-ink (inline script in project.html's <head>); this is
     only what a page without JS gets. */
  --case-accent: var(--ref-spectrum-4);
  /* Type set on the ray. Black on six of the seven; ink 0 is the one dark
     enough to need white, as it is on the What I do plates. */
  --case-accent-ink: var(--ref-black);
}

/* The spectrum is the prism's own ink, and this is the second place it
   may leave the artwork: each case study stands in one of its rays. */
:root[data-ink="0"] { --case-accent: var(--ref-spectrum-0); --case-accent-ink: var(--ref-white); }
:root[data-ink="1"] { --case-accent: var(--ref-spectrum-1); }
:root[data-ink="2"] { --case-accent: var(--ref-spectrum-2); }
:root[data-ink="3"] { --case-accent: var(--ref-spectrum-3); }
:root[data-ink="4"] { --case-accent: var(--ref-spectrum-4); }
:root[data-ink="5"] { --case-accent: var(--ref-spectrum-5); }
:root[data-ink="6"] { --case-accent: var(--ref-spectrum-6); }

body { background: var(--case-bg); color: var(--case-fg); }

/* ---------- The stage ----------
   A fixed ground under the whole case study: the poster's black, one ray
   of light pooled in the middle, and the project's mark laid over it in
   faint white — its logo where it has one, its name where it doesn't.
   Everything readable crosses it, so it stays dark. The page content
   scrolls over it; the Klein closing panel is opaque and covers it at the
   end. */
.pcase__stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 52% at 50% 54%, color-mix(in srgb, var(--case-accent) 26%, transparent), transparent 72%),
    var(--ref-black);
}
.pcase__mark {
  display: block;
  padding: 0 .06em;
  color: var(--ref-white);
  /* Faded as a whole, not per glyph: a translucent colour doubles up
     where the tight tracking overlaps letters. */
  opacity: var(--case-mark-alpha);
  font-family: var(--ref-font-display);
  font-size: 22vw;
  font-weight: var(--ref-display-weight);
  line-height: .9;
  letter-spacing: var(--ref-display-tracking);
  white-space: nowrap;
}
/* A logo file is the mask and the mark's white is the ink, so a real
   mark lands in exactly the tone the word had. */
.pcase__mark.has-logo {
  width: 72vw;
  height: 44vh;
  padding: 0;
  background: var(--ref-white);
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}

/* The bar's backdrop is a scrim, so it is painted in the colour of what is
   under it: this page's black ground, and the Klein closing panel once the bar
   reaches it — which is all .is-ondark means here (updateNav in project.html).
   Painted black over Klein it read as a band laid over the panel. */
.mainnav { --nav-scrim-rgb: var(--ref-black-rgb); }
.mainnav.is-ondark { --nav-scrim-rgb: var(--ref-klein-rgb); }
/* A Klein box on the Klein panel is invisible, so it turns white; the hover
   fill turns it back to Klein (the painting rules are in chrome.css). */
.mainnav.is-ondark .mainnav__cta {
  --cta-box: var(--ref-white);
  --cta-arrow: var(--ref-klein);
  --cta-fill-ink: var(--ref-klein);
}
/* Transparent, so the stage shows through: the page is the story laid
   over it. Surfaces that need their own ground (cover, metadata, tiles,
   closing panel) still paint one. */
.pcase {
  position: relative;
  z-index: 1;
  padding-top: 132px;
  background: transparent;
  color: var(--case-fg);
}
.pcase__inner { max-width: var(--case-inner); }
.pcase__back,
.pcase__pre,
.pcase__meta-label,
.pcase__chapter-badge,
.pcase__chapter-cap,
.pcase__pull-l,
.pnav__cap,
.pnav__count,
.pcta__pre,
.pcase__coda { font-family: var(--ref-font-label); font-weight: var(--label-weight); }
/* Labels on the stage or the Klein panel step back by opacity. The ones
   set on a solid ray (the tags, the metadata and pull-stat labels) keep
   the ray's full ink: dimmed, black on a mid-tone ray drops under AA. */
.pcase__back,
.pcase__chapter-cap,
.pnav__cap,
.pnav__count,
.pcta__pre,
.pcase__coda { color: var(--label-ink); }
.pcase__back { min-height: 44px; }
/* The kicker's tags are the section tag's: solid ray, ray ink. The plain
   no-JS line is a label on the stage. */
.pcase__pre { color: var(--label-ink); }
.pcase__pre-tag { background: var(--case-accent); color: var(--case-accent-ink); }
.pcase__title,
.pcase__chapter-h,
.pcase__pull-n,
.pnav__name,
.pcta__h {
  font-family: var(--ref-font-display);
  font-weight: var(--ref-display-weight);
  letter-spacing: -.055em;
}
.pcase__title {
  max-width: 12ch;
  font-size: clamp(56px, 10vw, 112px);
  line-height: .88;
}
.pcase__lede { max-width: 62ch; color: var(--case-muted); }

.pcase__thumb,
.pcase__slot {
  border-color: var(--case-line);
  border-radius: 0;
  background: var(--ref-black);
  box-shadow: none;
}
/* A phone plate is narrower than its column: painted, the list around it
   would be a black slab beside the screen, over the stage's mark. */
.pcase__slot.pcase__slot--phone:has(img) { background: none; }
/* The figures around the frames stay clear: staged, each one is a whole
   screen tall, and a painted one would be a black column down the stage. */
.pcase__chapter-media,
.pcase__steps-media,
.pcase__beat-media { background: none; }
.pcase__ph { color: var(--label-ink); font-family: var(--ref-font-label); font-weight: var(--label-weight); }
/* Same treatment as the pull stats below: solid cells of the stage's ray,
   everything in the ink that ray takes, 2px of ground between cells and
   no rules above or below. */
.pcase__meta {
  gap: 2px;
  border: 0;
  background: none;
}
.pcase__meta-cell { background: var(--case-accent); }
.pcase__meta-label,
.pcase__meta-value,
.pcase__meta-value em { color: var(--case-accent-ink); }
/* One ink leaves weight to mark the figures the accent used to. */
.pcase__meta-value em { font-weight: 800; }

.pcase__chapter { border-color: var(--case-line); }
.pcase__chapter-h {
  max-width: 16ch;
  color: var(--case-fg);
  font-size: clamp(38px, 5.6vw, 66px);
  line-height: .94;
}
.pcase__chapter-text,
.pcase__chapter-text p,
.pcase__chapter-text li,
.pcase__beat,
.pcase__steps-text { color: var(--case-muted); }
.pcase__chapter-text strong,
.pcase__beat strong,
.pcase__steps-text strong { color: var(--case-fg); }
.pcase__beat { border-color: var(--case-line); }
/* Pull stats are set like the section tag: solid blocks of the stage's
   ray, figure and label in the ink that ray takes. No rules above or
   below; a 2px gap of ground is what separates the three. */
.pcase__pull {
  gap: 2px;
  border: 0;
  background: none;
}
.pcase__pull-cell {
  border-radius: 0;
  background: var(--case-accent);
}
.pcase__pull-n,
.pcase__pull-n em,
.pcase__pull-l { color: var(--case-accent-ink); }
.pcase__pull .pcase__glyph[data-glyph]::after { color: var(--case-accent-ink); }

.pnav--inline { background: var(--case-line); border-color: var(--case-line); }
.pnav--inline .pnav__arrow {
  min-height: 112px;
  border-radius: 0;
  background: var(--case-bg);
  color: var(--case-muted);
}
.pnav--inline .pnav__arrow:hover { background: var(--case-panel); color: var(--case-fg); }
.pnav__name { color: var(--case-fg); }

.navmenu__pnav {
  margin-bottom: 24px;
  border-color: var(--ref-line-control);
}
.navmenu__pnav-link {
  min-height: 56px;
  border-radius: 0;
  color: var(--ref-text-note);
}
.navmenu__pnav-link:hover,
.navmenu__pnav-link:active { background: var(--ref-control-surface); color: var(--ref-white); }
.navmenu__pnav-cap { color: var(--label-ink); font-family: var(--ref-font-label); font-weight: var(--label-weight); }
.navmenu__pnav-name { color: inherit; font-family: var(--ref-font-display); font-weight: 800; }

.pcta { background: var(--ref-klein); color: var(--ref-white); }
.pcta__inner { max-width: 980px; text-align: left; }
.pcta__h {
  max-width: 15ch;
  margin-inline: 0;
  font-size: clamp(56px, 8vw, 104px);
  line-height: .9;
}
.pcta__p { margin-inline: 0; }
.pcta__actions { justify-content: flex-start; }
.pcta__btn {
  min-height: 48px;
  border: 1px solid var(--ref-white);
  border-radius: 0;
  box-shadow: none;
  font-family: var(--ref-font-label);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.pcta__btn:hover { transform: none; box-shadow: none; background: var(--ref-black); color: var(--ref-white); }

@media (max-width: 600px) {
  .pcase { padding: 112px var(--ref-gutter-mobile) 0; }
  .pcase__inner,
  .pcase__chapters { max-width: 100%; }
  .pcase__title { font-size: clamp(54px, 17vw, 74px); }
  .pcase__chapter-h { font-size: clamp(34px, 10.5vw, 52px); }
  .pcase .pcta { padding-inline: var(--ref-gutter-mobile); }
  .pcta__h { font-size: clamp(48px, 14vw, 68px); }
}

/* Stacked layouts (below the staged 1100px one): the pinned title is a band
   over the reading column, so it stays small, and the beats are read in
   passing rather than staged, so none of them waits at half ink. */
@media (max-width: 1099px) {
  html.js .pcase__chapter--steps .pcase__beat,
  html.js .pcase__chapter--steps .pcase__beat.is-active,
  html.js .pcase__chapter--steps .pcase__beat.is-past {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 600px) {
  html .pcase__chapter-h.pcase__chapter-h--pin {
    max-width: none;
    margin-top: 10px;
    font-size: clamp(20px, 6vw, 26px);
    line-height: 1.08;
  }
}

/* Stacked layouts: a beat is as tall as its words, not 46vh of empty
   screen, and the text and image of one beat sit close while beats stay
   apart. */
@media (max-width: 1099px) {
  html.js .pcase__beat,
  html.js .pcase__beat-media { min-height: 0; }
  .pcase__chapter-grid--steps { row-gap: 20px; }
  .pcase__chapter { margin-bottom: 72px; }
  .pcase__chapter:last-child { margin-bottom: 0; }
}
@media (max-width: 600px) {
  .pcase__chapter { margin-bottom: 56px; }
  .pcase__chapter-grid { gap: 20px; padding-top: 18px; }
}

/* The image's slide-in offsets it 40px down until it is active, which on one
   column drops its caption onto the next beat's title. */
@media (max-width: 1099px) {
  html.js .pcase__beat-media,
  html.js .pcase__beat-media.is-active {
    opacity: 1;
    transform: none;
  }
}
