/* The whole site's styles: the homepage ("Offset Diamonds"), case study pages, company pages and
   the 404. Built from the handoff prototype; values that can't change without recomputing others
   are noted where they are. Company pages restyle it by overriding the tokens below with their
   theme (see TOKENS in src/edition.mjs). The color, font and radius values in :root below are
   design tokens: `npm run tokens:export` copies them into design/tokens.json for Figma, and
   `npm run tokens:apply` writes edited ones back here. */
:root {
  color-scheme: light;
  --canvas: #F8F7F3;
  --white: #FFFFFF;
  --ink: #16263D;
  --soft: #46566B;
  --rule: rgba(22, 38, 61, 0.22);
  --tint: #DCE7F0;
  --accent: #16263D;
  --on-accent: #FFFFFF;
  --radius: 10px;
  --display: "Newsreader", Georgia, "Times New Roman", serif;
  --body: "Figtree", "Segoe UI", Helvetica, Arial, sans-serif;
  --pad: clamp(16px, 1.7vw, 32px);
  --bar-gap: var(--pad);                            /* space around the top bar */
  --bar-in: 21px;                                   /* the top bar's side padding and border: content lines up with the name inside it */
  --W: calc(100vw - (var(--bar-gap) + var(--bar-in)) * 2);   /* one content width for the intro and every step, lined up with the text in the top bar */
  --D: calc(86vw + 86vh);                           /* diamond size: always larger than the screen. Shrink content, never this. */
  --off: -14vw;                                     /* diamond centre sits left of the screen centre */
  --peak-x: 82vw;                                   /* the waiting diamond's tip pokes up from the bottom here */
  --peak: 15vh;                                     /* and this far */
  --move: 1.05s cubic-bezier(0.7, 0, 0.2, 1);
  --settle: 0.8s;                                   /* when a moving shape has arrived: text and arrows fade in after this */
  --pointer: #AEAEB2;                               /* the gray flowchart arrows */
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: var(--body); font-size: 18px; line-height: 1.6; }
/* Company pages can change the display weight, case and tracking with their theme */
h1, h2, h3 { font-family: var(--display); font-weight: var(--display-weight, 500); text-transform: var(--display-transform, none); margin: 0; letter-spacing: var(--display-tracking, -0.015em); text-wrap: balance; }
p, figure, blockquote { margin: 0; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
a { color: var(--ink); text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
a:focus-visible, input:focus-visible + span { outline: 3px solid #2F6FDB; outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Fixed, so focusing it never scrolls the page back to the intro */
.skip { position: fixed; z-index: 30; left: 16px; top: -60px; padding: 10px 16px; background: var(--ink); color: var(--white); border-radius: 8px; }
.skip:focus { top: 16px; }
.eyebrow { display: block; font-weight: 600; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--soft); }

/* Top bar: the name and the step links, which double as the step indicator */
.top { position: sticky; z-index: 20; top: var(--bar-gap); margin: var(--bar-gap) var(--bar-gap) 0; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 2px 24px; padding: 9px 20px; background: var(--header-bg, var(--white)); color: var(--header-text, var(--ink)); border: 1px solid var(--rule); border-radius: calc(var(--radius, 10px) + 2px); }
.top .name { font-family: var(--display); font-weight: 600; font-size: 20px; text-decoration: none; padding: 9px 0; }
.top nav { display: flex; flex-wrap: wrap; gap: 0 24px; }
.top nav a { text-decoration: none; font-weight: 500; font-size: 15.5px; min-height: 44px; display: inline-flex; align-items: center; color: var(--soft); border-bottom: 2px solid transparent; }
.top nav a:hover { color: var(--ink); }
.top nav a[aria-current="step"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
/* The menu button. It appears only at 820px and narrower, and only once script has run. */
.menu { display: none; }
@media (max-width: 820px) {
  .top.has-menu { flex-wrap: nowrap; }
  .top.has-menu .menu { display: grid; place-items: center; width: 44px; height: 44px; margin-right: -10px; padding: 0; border: 0; border-radius: 8px; background: none; color: inherit; cursor: pointer; }
  .top.has-menu .menu:focus-visible { outline: 3px solid #2F6FDB; outline-offset: 0; }
  .menu svg { width: 24px; height: 24px; }
  .menu path { stroke: currentColor; stroke-width: 2; stroke-linecap: round; fill: none; }
  .menu .x, .top.open .menu .bars { display: none; }
  .top.open .menu .x { display: inline; }
  /* The links drop down under the bar */
  .top.has-menu nav { display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0; flex-direction: column; gap: 0; padding: 6px 20px; background: var(--header-bg, var(--white)); border: 1px solid var(--rule); border-radius: inherit; box-shadow: 0 18px 40px -18px rgba(22, 38, 61, 0.35); }
  .top.has-menu.open nav { display: flex; }
  .top.has-menu nav a { font-size: 17px; min-height: 48px; align-self: stretch; border-bottom: 1px solid var(--rule); }
  .top.has-menu nav a:last-child { border-bottom: 0; }
  .top.has-menu nav a[aria-current] { border-bottom-color: var(--rule); box-shadow: inset 3px 0 0 var(--ink); padding-left: 12px; margin-left: -20px; padding-left: 17px; }
}

/* Intro */
.intro { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: clamp(32px, 5vw, 80px); align-items: start; --ph: min(340px, 100%); }
.intro .eyebrow { margin-bottom: 18px; }
.intro h1 { font-size: clamp(36px, 4.5vw, 68px); line-height: 1.04; }
.intro .sub { margin-top: 24px; font-size: clamp(18px, 1.4vw, 21px); max-width: 27em; color: var(--soft); }
.intro .sub strong { font-weight: 600; color: var(--ink); }
.begin { display: inline-flex; align-items: center; gap: 10px; margin-top: 28px; font-weight: 600; font-size: 17px; text-decoration: none; min-height: 48px; padding: 0 22px; background: var(--accent, var(--ink)); color: var(--on-accent, var(--white)); border: 0; border-radius: var(--radius, 8px); font-family: inherit; cursor: pointer; }
.begin:hover { filter: brightness(1.12); }

/* Homepage intro: a navy panel with the photo and the headline, and a way past the questions */
.hero { grid-template-columns: auto minmax(0, 1fr); gap: clamp(20px, 2.2vw, 40px); align-items: center; color: var(--white); --ph: clamp(120px, 16vw, 240px); }
.hero .portrait { position: relative; width: var(--ph); aspect-ratio: 1; margin: 10px 0 0 16px; }
.hero .portrait img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; background: #E7E4DC; }
/* The offset ring, like the outlines beside the panel and the diamonds */
.hero .portrait::before { content: ""; position: absolute; z-index: 1; inset: 0; transform: translate(-16px, -9px) scale(1.02); border: 1px solid var(--canvas); border-radius: 50%; }
/* The text stays left of the panel's curve, which ends at 84.5vw */
.hero .say { max-width: calc(82vw - var(--ph) - 110px); }
.hero .eyebrow { color: var(--hero-eyebrow, #AEAEB2); margin-bottom: 16px; }
.hero h1 { font-weight: 400; font-size: clamp(40px, 5.55vw, 84px); line-height: 0.975; letter-spacing: 0.0125em; color: var(--hero-h1, var(--tint)); max-width: 9em; text-wrap: wrap; }
.hero .sub { margin-top: 16px; max-width: 40em; color: var(--hero-sub, #C7C7CC); }
.hero .sub strong { color: var(--hero-strong, var(--white)); font-weight: 700; }
.pill { position: absolute; left: 0; top: -4.4vh; width: 84.5vw; height: 87.7vh; border-radius: 0 999px 999px 0; background: var(--ink); }
.pill::before { content: ""; position: absolute; left: 0; top: 0; right: -18px; bottom: -13px; border: 1px solid var(--ink); border-left: 0; border-radius: 0 999px 999px 0; }
.skip-to { display: inline-flex; flex-direction: column; align-items: center; gap: 0; font-weight: 600; font-size: 17px; text-transform: uppercase; color: var(--ink); }

/* Step content */
.content { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 18px clamp(32px, 5vw, 80px); align-items: start; }
.content > .eyebrow, .content > h2, .content > .answers { grid-column: 1 / -1; }
.slide h2 { font-size: clamp(32px, 3.6vw, 54px); line-height: 1.05; max-width: 18em; }
.question .content { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
.question .content > * { max-width: 1040px; }
.question .eyebrow { margin-bottom: 24px; }
.question h2 { margin-bottom: 8px; }
.question .answers { padding: 8px 0 16px; margin-bottom: 0; }
.question .panel { margin-top: 24px; }
.question .panel p { max-width: none; }
.question .cards { margin-top: 32px; max-width: 802px; }

/* Answers: a real radio group, each option in its own box */
.answers { display: flex; flex-wrap: wrap; gap: 10px; padding-bottom: 26px; border-bottom: 1px solid var(--rule); margin-bottom: 8px; }
.answers label { position: relative; cursor: pointer; }
.answers input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.answers span { display: inline-flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 20px 0 14px; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--rule); color: var(--soft); font-weight: 500; font-size: 17px; }
.answers span::before { content: ""; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--soft); box-shadow: inset 0 0 0 4px transparent; flex: none; }
.answers label:hover span { color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.answers input:checked + span { color: var(--ink); font-weight: 600; background: color-mix(in srgb, var(--white) 75%, transparent); box-shadow: inset 0 0 0 2px var(--ink); }
.answers input:checked + span::before { border-color: var(--ink); background: var(--ink); box-shadow: inset 0 0 0 4px var(--white); }

/* Description panel and its small visual */
.panel { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.panel h3 { font-size: clamp(24px, 2.2vw, 32px); line-height: 1.15; max-width: 16em; }
.panel p { max-width: 31em; font-size: 17px; }
.people, .count { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 6px; }
.people i { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--ink); display: block; }
.people i.res { border-radius: 4px; }
.people i.first { background: var(--ink); }
.count i { width: 14px; height: 14px; border-radius: 50%; background: var(--ink); display: block; }
.panel .cap { font-size: 14.5px; color: var(--soft); }
.heard { margin: 4px 0 0; padding: 0; list-style: none; width: 100%; max-width: 30em; }
.heard li { padding: 10px 0; border-top: 1px solid var(--rule); font-family: var(--display); font-size: 19px; line-height: 1.35; font-style: italic; }
.heard li:first-child { border-top: 0; }
/* Each figure takes its natural width, so a phrase like "2 weeks to ½ day" stays on one line */
.nums { display: flex; flex-wrap: wrap; gap: 16px 40px; width: 100%; margin-top: 4px; }
.nums > div { flex: 0 1 auto; min-width: min(210px, 100%); max-width: 100%; }
.nums strong { display: block; font-family: var(--display); font-weight: 500; font-size: clamp(30px, 2.8vw, 42px); line-height: 1.05; }
.nums span { display: block; margin-top: 6px; font-size: 15.5px; color: var(--soft); }
/* An inline chip, not a block (the prototype's chip stretched full width) */
.nums .chip { display: inline-block; margin: 0 0 0 4px; font-size: 12.5px; font-weight: 600; line-height: 1.5; border: 1px solid var(--ink); border-radius: 4px; padding: 0 7px; white-space: nowrap; color: var(--ink); vertical-align: 1px; }

/* Case study cards. On question steps they stay small enough to sit inside the diamond: on
   short screens the diamond's lower right edge comes in, so the card narrows with the height. */
.cards { max-width: clamp(240px, 37vh, 340px); }
.card { background: var(--white); border: 1px solid var(--rule); border-radius: var(--radius, 10px); overflow: hidden; box-shadow: 0 18px 40px -18px rgba(22, 38, 61, 0.35); color: var(--ink); display: flex; flex-direction: column; }
.card .thumb { aspect-ratio: 16 / 7; background: var(--canvas); border-bottom: 1px solid var(--rule); overflow: hidden; }
.card .thumb img, .card .thumb video { display: block; width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card .eyebrow { font-size: 12.5px; }
.card h3 { font-size: clamp(20px, 1.6vw, 24px); line-height: 1.15; }
.card .meta { font-size: 15px; color: var(--soft); }
.card .inside { font-size: 16px; }
.card a { font-weight: 600; font-size: 16px; min-height: 44px; display: inline-flex; align-items: center; align-self: flex-start; margin-top: auto; }

/* The horizontal card on question steps: image left, highlights right */
.card.row { flex-direction: row; background: var(--canvas); box-shadow: none; }
/* The image keeps its own 16:10 and is never stretched to the text's height, so it's never cropped */
.card.row .thumb { flex: 0 0 45%; align-self: flex-start; aspect-ratio: 16 / 10; border-bottom: 0; }
.card.row .body { padding: 18px 16px 16px 28px; gap: 10px; justify-content: center; }
.card.row h3 { font-size: clamp(22px, 1.95vw, 28px); line-height: 1.14; letter-spacing: -0.01em; }
.card .hl { margin: 0; padding-left: 1.1em; font-size: 15px; line-height: 1.45; color: var(--soft); }
.card .hl strong { font-weight: 700; }
.card .hl li::marker { font-size: 0.8em; }
.card.row a { font-size: 15px; min-height: 24px; margin-top: 2px; }

/* All work on the homepage: the same cards as the questions, at the same size, one under another
   (two across on very wide screens) */
.stack { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 802px), 802px)); gap: 16px; max-width: none; margin-top: 28px; grid-auto-rows: 1fr; }
/* Every card is as tall as the tallest; images stay whole at 16:10 */

/* All work */
.content.wide { grid-template-columns: minmax(0, 1fr); gap: 18px; }
.grid { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 20px; margin-top: 10px; }
/* Portfolio cards show their image large, at the same 16:10 as the case study covers */
.grid .card .thumb { aspect-ratio: 16 / 10; }
.grid .card h3 { font-size: clamp(19px, 1.5vw, 23px); }
.grid .body { padding: 16px 18px 14px; gap: 6px; }
@media (max-width: 1100px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid .card .thumb { aspect-ratio: 16 / 7; } }

/* Contact: navy diamond, white text */
.end { color: var(--white); }
.end h2 { font-size: clamp(34px, 4vw, 60px); }
.end a { color: var(--white); }
.end .say { display: flex; flex-direction: column; gap: 18px; }
.ways { display: flex; flex-wrap: wrap; gap: 4px 30px; font-weight: 600; font-size: 18px; }
.ways a { min-height: 44px; display: inline-flex; align-items: center; }
.end .content { align-items: center; }
.quote .body { padding: 28px; gap: 14px; }
.quote blockquote { font-family: var(--display); font-size: 21px; line-height: 1.4; font-style: italic; }
.quote .by { font-size: 14px; color: var(--soft); }

/* ---------- Without script: ordinary stacked sections ---------- */
html:not(.flow) .snaps, html:not(.flow) .go, html:not(.flow) .shape { display: none; }
html:not(.flow) .intro { width: var(--W); margin: 0 auto; padding: 72px 0; }
html:not(.flow) .slide { background: var(--fill); padding: 72px 0; }
html:not(.flow) .content { width: var(--W); margin: 0 auto; }

/* ---------- With script: one fixed stage of diamonds, one screen of scroll per step ---------- */
html.flow { scroll-snap-type: y mandatory; scroll-behavior: smooth; scrollbar-width: none; }
/* No scrollbar: each scroll moves one whole step, and without it 100vw is the visible width, so the
   content lines up exactly with the text in the top bar */
html.flow::-webkit-scrollbar { display: none; }
.flow .top { position: fixed; left: 0; right: 0; margin-top: 0; }
.flow .snap { height: 100vh; height: 100svh; scroll-snap-align: start; scroll-snap-stop: always; }
/* Stops partway through a step that's taller than the screen (all case studies); fit() adds them */
.flow .more { scroll-snap-align: end; scroll-snap-stop: always; }
.flow .stage { position: fixed; inset: 0; overflow: hidden; }
/* --chrome is the height of anything fixed above the top bar (the company page bar). --k is set by
   fit() in home.mjs when the intro has to shrink to fit. */
.flow .intro { position: absolute; z-index: 15; left: calc(50% - var(--W) / 2); width: var(--W); top: calc(50% + 33px + var(--chrome, 0px) / 2); transform: translateY(-50%) scale(var(--k, 1)); transform-origin: 0 50%; transition: transform var(--move), opacity 0.45s ease var(--settle); }
.flow .intro.gone { transform: translateY(calc(-50% - 14vh)) scale(var(--k, 1)); opacity: 0; pointer-events: none; transition: transform var(--move), opacity 0.25s ease; }

.flow .slide { position: absolute; left: calc(50% + var(--off)); top: 50%; width: var(--D); height: var(--D); margin: calc(var(--D) / -2) 0 0 calc(var(--D) / -2); transition: transform var(--move), opacity 0.7s ease; will-change: transform; }
.flow .shape { position: absolute; inset: 0; filter: drop-shadow(0 10px 14px rgba(22, 38, 61, 0.16)) drop-shadow(0 34px 60px rgba(22, 38, 61, 0.22)); }
/* The shadow sits on the parent, or the clip would cut it away */
.flow .shape::before { content: ""; position: absolute; inset: 0; background: var(--fill); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
/* One diagonal: steps wait bottom right, play in the middle, leave top left. The scroll arrow's
   position below is derived from is-next and --D; change one, recompute the other. */
.flow .slide.is-active { transform: none; opacity: 1; }
/* Waiting: scaled to 0.36 and placed so its top tip sits at --peak-x, --peak above the bottom edge.
   0.36 × (43vw + 43vh) is its half-diagonal, since --D is 86vw + 86vh. */
.flow .slide:is(.is-next, .is-opening) { transform: translate(calc(var(--peak-x) - 50vw - var(--off)), calc(50vh - var(--peak) + 0.36 * (43vw + 43vh))) scale(0.36); opacity: 1; }
.flow .slide.is-far { transform: translate(98vw, 108vh) scale(0.3); opacity: 0; }
.flow .slide.is-past { transform: translate(-72vw, -78vh) scale(0.42); opacity: 0; pointer-events: none; }
/* Content is centred on the screen, not the diamond: left undoes the diamond's offset */
.flow .content { position: absolute; top: 50%; left: calc(50% - var(--off)); width: var(--W); transform: translate(-50%, -50%); opacity: 0; transition: opacity 0.25s ease; }
/* A sheet (all case studies) isn't a diamond once you're on it: it opens to fill the screen, like
   every step does on phones, and the page scrolls on through its content. The 8 points let the shape grow from
   the diamond's tips into the corners. */
.flow .sheet .shape::before { clip-path: polygon(50% 0, 50% 0, 100% 50%, 100% 50%, 50% 100%, 50% 100%, 0 50%, 0 50%); transition: clip-path var(--move); }
.flow .sheet:is(.is-active, .is-past) .shape::before { clip-path: polygon(0 0, 100% 0, 100% 0, 100% 100%, 100% 100%, 0 100%, 0 100%, 0 0); }
.flow .sheet .edge { transition: transform var(--move), opacity 0.4s ease; }
.flow .sheet:is(.is-active, .is-past) .edge { opacity: 0; }
.flow .sheet .content { display: block; overflow: hidden; padding: 24px 0 calc(var(--peak) + 48px); }
/* The shape moves in first; its words fade in on top once it has arrived. Leaving, they fade out at once. */
.flow .slide.is-active .content { opacity: 1; transition: opacity 0.45s ease var(--settle); }

/* The intro's panel. It leaves up and to the left with the intro. */
.flow .backdrop { position: absolute; inset: 0; z-index: 1; pointer-events: none; transition: transform var(--move), opacity 0.6s ease; }
.flow .backdrop.gone { transform: translate(-30vw, -40vh); opacity: 0; }
.flow .backdrop .skip-to { transition: opacity 0.45s ease var(--settle); }
.flow .backdrop.gone .skip-to { opacity: 0; transition: opacity 0.25s ease; }
/* The arrows wait for the shapes too: script adds .settling while a step changes */
.go, .pointer { transition: opacity 0.45s ease; }
html.settling :is(.go, .pointer) { opacity: 0; transition: none; }
.flow .backdrop .skip-to { position: absolute; z-index: 16; left: calc(50% - var(--W) / 2); bottom: 36px; pointer-events: auto; }
html:not(.flow) .pill { display: none; }
html:not(.flow) .hero { box-shadow: 0 0 0 100vmax var(--ink); clip-path: inset(0 -100vmax); background: var(--ink); }
html:not(.flow) .backdrop { width: var(--W); margin: 0 auto; padding: 24px 0; }
.pointer[hidden] { display: none; }
/* The homepage intro sits in the middle of the panel, not the screen */
.flow .hero { top: calc((83.3vh + 88px) / 2 - 3vh); }

/* The outline beside each diamond, offset like a second pass of the pen */
.edge { display: none; }
.flow .edge { display: block; position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; transform: translate(0.7%, 0.2%) scale(1.012); transition: transform var(--move); pointer-events: none; }
.edge path { fill: none; stroke: var(--line, var(--ink)); stroke-width: 1px; vector-effect: non-scaling-stroke; transition: stroke-width var(--move); }
/* The waiting diamond is drawn at 0.36, so its line is thicker to look the same */
.flow .slide:is(.is-next, .is-opening) .edge path { stroke-width: 2.8px; }
/* As in Figma: the same left tip, a little bigger and lower, so the line crosses the diamond's edges */
.flow .slide:is(.is-next, .is-opening) .edge { transform: translate(1.95%, 2.35%) scale(1.039); }

/* A gray arrow pointing into the waiting diamond, just above its upper left edge */
.pointer { position: absolute; z-index: 19; left: calc(var(--peak-x) - 182px); top: calc(100vh - var(--peak) - 22px); width: 110px; height: 4px; background: var(--pointer); transform: rotate(45deg); transform-origin: 0 50%; }
.pointer::after { content: ""; position: absolute; right: -14px; top: -8px; border-top: 10px solid transparent; border-bottom: 10px solid transparent; border-left: 16px solid var(--pointer); }

/* Scroll arrow on the tip of the waiting diamond */
/* The next-step arrow sits inside the waiting diamond's tip, centred under it */
.go { position: absolute; z-index: 19; left: calc(var(--peak-x) - 28px); top: min(100vh - var(--peak) + 48px, 100vh - 72px); width: 56px; height: 56px; border-radius: 50%; background: var(--ink); border: 1px solid #FFFFFF; display: grid; place-items: center; box-shadow: 0 8px 18px -6px rgba(22, 38, 61, 0.5); }
.go[hidden] { display: none; }
.go:hover { background: var(--soft); }
.go svg { width: 22px; height: 22px; }
.go path { stroke: var(--white); stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

html.flow:not(.ready) :is(.intro, .slide, .content, .backdrop, .skip-to) { transition: none; }
@media (prefers-reduced-motion: reduce) {
  html.flow { scroll-behavior: auto; }
  .flow .slide, .flow .intro, .flow .content, .flow .slide.is-active .content, .flow .backdrop, .flow .backdrop .skip-to { transition: none; }
}

/* ---------- Phones and narrow windows ---------- */
@media (max-width: 820px) {
  :root { --off: -8vw; --peak-x: 74vw; --peak: 12vh; }
  :root { --bar-gap: 8px; --bar-in: 13px; }
  .top { padding: 6px 12px; }
  .top nav { gap: 0 14px; }
  .top nav a { font-size: 14px; }
  .intro { grid-template-columns: minmax(0, 1fr); gap: 18px; --ph: 96px; }
  .hero { grid-template-columns: minmax(0, 1fr); --ph: 96px; }
  .hero .portrait { margin: 10px 0 0 12px; }
  .hero .portrait::before { transform: translate(-8px, -5px) scale(1.02); }
  .hero h1 { font-size: 38px; }
  /* On phones the panel is a tall block with one big rounded corner, so the curve never crosses the text */
  .pill { top: -10vh; height: 86vh; }
  .flow .hero { top: calc(96px + var(--chrome, 0px)); }
  .flow .backdrop .skip-to { bottom: 22px; font-size: 15px; }
  .pointer { display: none; }
  .question .cards { max-width: 260px; margin-top: 16px; }
  .card.row { flex-direction: column; }
  .question .panel { margin-top: 12px; }
  .intro h1 { font-size: 36px; }
  .flow .intro { top: calc(146px + var(--chrome, 0px)); transform: scale(var(--k, 1)); transform-origin: 0 0; }
  .flow .intro.gone { transform: translateY(-14vh) scale(var(--k, 1)); }
  .content { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .question .panel, .question .cards { grid-column: 1; grid-row: auto; }
  .answers { padding-bottom: 14px; margin-bottom: 2px; }
  .panel { gap: 8px; }
  .panel p { font-size: 16px; }
  .heard li { font-size: 16.5px; padding: 7px 0; }
  .cards, .grid { max-width: 260px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .flow body:not(.ed-page) .grid .card .thumb { display: block; aspect-ratio: 16 / 10; }
  .stack { margin-top: 16px; gap: 10px; }
  .grid .card h3 { font-size: 17px; }
  .grid .card .meta { font-size: 13px; }
  .card .thumb, .card .inside { display: none; }
  .card .body, .grid .body { padding: 12px 16px 6px; gap: 4px; }
  .quote .body { padding: 16px; }
  .quote blockquote { font-size: 17px; }
  /* The step you're on fills the screen; only the next one is still a diamond. The 8 points let the
     shape grow from the diamond's tips into the corners as it arrives. */
  .flow .shape::before { clip-path: polygon(50% 0, 50% 0, 100% 50%, 100% 50%, 50% 100%, 50% 100%, 0 50%, 0 50%); transition: clip-path var(--move); }
  .flow .slide:is(.is-active, .is-past) .shape::before { clip-path: polygon(0 0, 100% 0, 100% 0, 100% 100%, 100% 100%, 0 100%, 0 100%, 0 0); }
  .flow .slide:is(.is-active, .is-past) .edge { opacity: 0; }
  .flow .edge { transition: transform var(--move), opacity 0.4s ease; }
  /* With the whole screen to use, cards take the full width */
  .flow :is(.cards, .question .cards, .grid) { max-width: none; }
  .flow .card .inside { display: block; }
  /* The arrow moves to the corner; the content leaves room for it (see fit() in home.mjs) */
  .go { left: calc(var(--peak-x) - 25px); top: calc(100vh - var(--peak) + 20px); width: 50px; height: 50px; }
  html:not(.flow) .cards, html:not(.flow) .grid { max-width: none; }
}

/* The panel is a flowchart's start pill, running off the left edge with one round end. Its round end
   is half its height, so at 820px and narrower, and on screens not much wider than they are tall
   (an upright tablet), it would read as a half circle. There it becomes a full-width band, with its
   outline as one line underneath. */
@media (max-width: 820px), (max-aspect-ratio: 11/10) {
  .pill { left: 0; width: 100vw; border-radius: 0; }
  .pill::before { left: 0; right: 0; top: auto; bottom: -13px; height: 0; border: 0; border-bottom: 1px solid var(--ink); border-radius: 0; }
  .hero .say { max-width: none; }
}

/* ---------- Case study pages: the same design, without the diamonds ---------- */
.cs-page .top { position: sticky; }
.cs-grid { width: var(--W); margin: 0 auto; padding: clamp(40px, 6vw, 88px) 0 clamp(56px, 8vw, 112px); display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); gap: clamp(32px, 5vw, 80px); align-items: start; }
.cs-main { min-width: 0; max-width: 820px; }

/* On this page */
.contents { position: sticky; top: 104px; }
.contents .eyebrow { margin-bottom: 12px; }
.contents ul { margin: 0; padding: 0; list-style: none; border-left: 1px solid var(--rule); }
.contents a { display: block; padding: 7px 0 7px 14px; margin-left: -1px; border-left: 2px solid transparent; font-size: 15px; line-height: 1.35; color: var(--soft); text-decoration: none; }
.contents a:hover { color: var(--ink); }
.contents a[aria-current] { color: var(--ink); font-weight: 600; border-left-color: var(--ink); }

/* Hero */
.cs-hero { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.back { font-weight: 600; font-size: 16px; min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; color: var(--soft); }
.back:hover { color: var(--ink); text-decoration: underline; }
.cs-hero h1 { font-size: clamp(36px, 4.5vw, 64px); line-height: 1.05; }
.cs-summary { font-size: clamp(18px, 1.4vw, 21px); color: var(--soft); max-width: 36em; }
.sample-note { padding: 10px 14px; border: 1px dashed var(--ink); border-radius: 8px; font-size: 15px; }
.cs-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px 32px; width: 100%; margin: 12px 0 0; padding: 20px 0 0; border-top: 1px solid var(--rule); }
.cs-meta dt { font-weight: 600; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--soft); }
.cs-meta dd { margin: 4px 0 0; font-size: 17px; }

/* Cover and images: white cards with the homepage's soft shadow */
.cs-cover { margin-top: clamp(32px, 4vw, 48px); }
.cs-cover > img, .cs-cover > video, .prose figure > img, .prose figure > video { display: block; width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 10px; background: var(--white); box-shadow: 0 18px 40px -18px rgba(22, 38, 61, 0.35); }

/* Body text */
.prose { margin-top: clamp(40px, 5vw, 64px); max-width: 720px; font-size: 18px; line-height: 1.7; }
.prose > * + * { margin-top: 1em; }
.prose h2 { margin-top: 2.2em; font-size: clamp(28px, 2.6vw, 38px); line-height: 1.12; scroll-margin-top: 100px; }
.prose h3 { margin-top: 1.8em; font-size: clamp(22px, 1.8vw, 26px); line-height: 1.2; }
.prose h4 { margin-top: 1.5em; font-family: var(--body); font-size: 17px; font-weight: 600; }
.prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: 0.6em; }
.prose > :first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.4em; }
.prose li::marker { color: var(--soft); }
.prose strong { font-weight: 600; }
.prose blockquote { margin-left: 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--ink); font-family: var(--display); font-size: 22px; line-height: 1.45; font-style: italic; }
.prose blockquote p { margin: 0; }
.prose figure { margin-top: 2em; margin-bottom: 2em; }
.prose figcaption { margin-top: 10px; font-size: 15px; color: var(--soft); }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5em 0; }
.prose code { font-size: 0.9em; padding: 1px 6px; background: var(--white); border: 1px solid var(--rule); border-radius: 4px; }

/* Image placeholders (the case study files' ![placeholder: …]) */
.img-placeholder { position: relative; aspect-ratio: 16 / 9; display: grid; place-items: center; border: 1px dashed var(--soft); border-radius: 10px; background: #E7E4DC; color: var(--soft); overflow: hidden; }
.img-placeholder svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.img-placeholder path { stroke: var(--rule); stroke-width: 1; fill: none; }
.img-placeholder-label { position: relative; display: grid; gap: 4px; padding: 0 24px; text-align: center; font-weight: 600; font-size: 15px; }
.img-placeholder-label small { font-weight: 400; }

/* Next case study */
.next-cs { margin-top: clamp(48px, 6vw, 80px); padding: 24px 28px; gap: 8px; text-decoration: none; transition: box-shadow 0.2s ease; }
.next-cs .t { font-family: var(--display); font-size: clamp(24px, 2.2vw, 32px); line-height: 1.15; }
.next-cs:hover { box-shadow: 0 22px 48px -16px rgba(22, 38, 61, 0.45); }
.next-cs:hover .t { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1.5px; }

/* Contact: the navy of the homepage's last step */
.cs-contact { background: var(--ink); color: var(--white); padding: clamp(56px, 8vw, 104px) 0 32px; }
.cs-contact .inner { width: var(--W); margin: 0 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }
.cs-contact h2 { font-size: clamp(34px, 4vw, 60px); line-height: 1.05; max-width: 14em; }
.cs-contact a { color: var(--white); }
.cs-contact .legal { margin-top: clamp(32px, 5vw, 64px); font-size: 14px; color: #B9C4D3; }
.cs-contact a:focus-visible { outline-color: #9DC1FF; }

@media (max-width: 820px) {
  .cs-grid { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 24px; }
  .contents { display: none; }
  .cs-page .top nav a { min-height: 40px; }
  .prose { font-size: 17px; }
  .next-cs { padding: 18px 20px; }
}


/* ---------- Company pages: the same stage of diamonds, in each company's colors and type ---------- */
.ed-page { --chrome: 32px; font-size: var(--size-body, 18px); }
.ed-page .top .name { display: inline-flex; align-items: center; color: var(--header-text, var(--ink)); }
.ed-page .top .logo { display: block; height: 30px; width: auto; }
/* The top bar follows the company's card color unless its theme sets one, so dark themes stay dark */
.ed-page .top { background: var(--header-bg, var(--white)); }
.ed-page .top nav a { color: var(--header-text, var(--soft)); }
.ed-page .top nav a:hover, .ed-page .top nav a[aria-current] { color: var(--header-text, var(--ink)); }
.flow .ed-page .top { top: calc(var(--chrome) + min(var(--bar-gap), 10px)); }
.ed-page :is(a, input, button):focus-visible { outline: 3px solid var(--accent, #2F6FDB); outline-offset: 3px; }
.ed-page .begin { gap: 10px; }

/* The "An edition of uxmatt.com made for …" bar. It always stays. */
.ed-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; height: var(--chrome); padding: 0 max(16px, calc(50% - var(--W) / 2)); font-size: 14px; white-space: nowrap; overflow: hidden; background: var(--ink); color: var(--canvas); }
.ed-bar span { overflow: hidden; text-overflow: ellipsis; }
.ed-bar strong { font-weight: 600; }
.flow .ed-bar { position: fixed; z-index: 21; top: 0; left: 0; right: 0; }

/* Intro: the homepage's pill, photo and type, with longer headlines than the homepage's, so a smaller
   scale. Its colors (--hero-*) come from the company's palette, set in edition.mjs. */
.ed-page .hero h1 { font-size: clamp(30px, 3.4vw, var(--size-hero, 56px)); line-height: 1.08; letter-spacing: normal; max-width: 18em; }
.ed-page .hero .sub { max-width: 34em; }

/* What you need: like a homepage question, with the needs listed down the left */
.choose .content { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.choose .needs { grid-column: 1; grid-row: 3; flex-direction: column; flex-wrap: nowrap; gap: 8px; padding: 0; border: 0; margin: 0; }
.choose .needs legend { margin-bottom: 10px; float: left; width: 100%; }
.choose .needs label { display: block; }
.choose .needs span { display: flex; width: 100%; min-height: 48px; padding: 10px 16px 10px 12px; font-size: 16px; line-height: 1.35; }
.choose .cards { grid-column: 2; grid-row: 3; max-width: none; align-self: start; margin-top: 34px; }
.proof .body { padding: 24px 26px; gap: 10px; }
.proof p { font-size: 17px; line-height: 1.6; }

/* Disciplines and work */
.disc { list-style: none; padding: 0; margin-bottom: 0; }
.disc .body { padding: 20px 20px 18px; }
.disc p { font-size: 15.5px; line-height: 1.5; color: var(--soft); }
.ed-page .grid { max-width: none; }

/* Approach: the plan's parts as options, each one's text below */
.phases .prose { grid-column: 1 / -1; margin: 0; max-width: 820px; font-size: 17px; line-height: 1.6; }
.phases .prose > * + * { margin-top: 0.7em; }
.phases .prose li + li { margin-top: 0.35em; }
.phases .prose.lead { color: var(--soft); }

/* Contact: the end of the flow */
.ed-page .end .eyebrow { color: inherit; opacity: 0.8; }
.ed-page .end h2 span { opacity: 0.85; }
.ed-page .end .cards { max-width: 440px; }
.how .body { padding: 24px 26px; }
.how p { font-size: 15.5px; line-height: 1.55; color: var(--soft); }

/* Password page: only the edition bar, and the sign-in in the middle of the page */
.ed-welcome { min-height: 100vh; min-height: 100svh; display: grid; grid-template-rows: auto 1fr; }
.welcome { place-self: center; width: min(460px, calc(100% - 32px)); padding: 48px 0; text-align: center; }
.welcome h1 { font-size: clamp(30px, 3.4vw, 44px); line-height: 1.1; margin-top: 12px; }
.welcome .sub { margin-top: 14px; color: var(--soft); }
.welcome .gate { width: 100%; margin-top: 28px; text-align: left; }
.gate { display: grid; gap: 8px; width: min(420px, 100%); margin-top: 18px; }
.gate label { font-weight: 600; font-size: 15px; }
.gate .row { display: flex; gap: 10px; }
.gate input { flex: 1; min-width: 0; min-height: 48px; padding: 0 14px; font: inherit; color: var(--ink); background: var(--white); border: 1px solid var(--soft); border-radius: var(--radius, 8px); }
.gate .begin { margin: 0; }
.gate .error { font-weight: 600; }
.help { margin-top: 18px; font-size: 15px; color: var(--soft); }
.help a { color: var(--ink); }

/* Without script: the bar sits on top and the page reads as stacked sections */
html:not(.flow) .ed-page .top { position: sticky; }

@media (max-width: 820px) {
  .ed-page { --chrome: 28px; }
  .ed-bar { font-size: 12.5px; }
  .ed-bar .role { display: none; }
  .ed-page .hero h1 { font-size: 30px; }
  .choose .content { grid-template-columns: minmax(0, 1fr); }
  .choose .needs, .choose .cards { grid-column: 1; grid-row: auto; margin-top: 0; }
  .choose .needs span { min-height: 44px; padding: 8px 12px 8px 10px; font-size: 15px; }
  .ed-page .cards, .ed-page .grid { max-width: none; }
  .ed-page .grid { grid-template-columns: minmax(0, 1fr); }
  .proof .body, .how .body { padding: 16px 18px; }
  .phases .prose { font-size: 16px; }
}

/* 404 */
.lost { width: var(--W); margin: 0 auto; padding: clamp(64px, 12vw, 160px) 0; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.lost h1 { font-size: clamp(36px, 4.5vw, 64px); line-height: 1.05; }
