/* Shared editorial typography, reading widths and actions. */
:root {
  --site-font: D-DIN, Arial, sans-serif;
  --type-title: clamp(2.35rem, 4.25vw, 4rem);
  --type-section: clamp(1.7rem, 3vw, 2.75rem);
  --type-subsection: clamp(1.23rem, 2vw, 1.55rem);
  --type-body: clamp(1.0625rem, 1.32vw, 1.1875rem);
  --type-lead: clamp(1.125rem, 1.55vw, 1.375rem);
  --reading-width: 50rem;
  --article-width: 64rem;
  --section-accent: light-dark(#454545, #dedede);
  --section-rule: light-dark(#858585, #a8a8a8);
  --section-tint: light-dark(#f5f5f5, #242424);
  --teal-accent: light-dark(#256357, #77dfce);
}

main[data-section="work"], .home-section#featured {
  --section-accent: light-dark(#514f7b, #d5d7ff);
  --section-rule: light-dark(#8a78b9, #b9b4ec);
  --section-tint: light-dark(#f3effa, #242032);
}

main[data-section="tools"], .home-section#why {
  --section-accent: light-dark(#41601f, #c8f582);
  --section-rule: light-dark(#6b8c37, #a8c776);
  --section-tint: light-dark(#f1f6e9, #21291b);
}

main[data-section="methods"] {
  --section-accent: var(--teal-accent);
  --section-rule: light-dark(#4a887c, #77dfce);
  --section-tint: light-dark(#edf6f3, #182824);
}

:root[data-color-mode="light"] {
  --bg: #fff;
  --text: #202023;
  --muted: #505055;
  --line: #d7d4da;
}

[data-color-mode="light"] :is(.site-header, .page-index, .home-index) {
  background: #fff;
}

[data-color-mode="light"] :is(.home-why, .home-feature, .cap-invitation) {
  background: var(--section-tint);
}

[data-color-mode="light"] .editorial-conclusion {
  background: var(--section-tint);
  border-inline-start-color: var(--section-rule);
}

[data-color-mode="light"] .editorial-shell article a:not(.text-link),
[data-color-mode="light"] main :is(.inline-link, .home-case-link, .audit-method-links a),
[data-color-mode="light"] main .section-accent-link {
  color: var(--section-accent);
  text-underline-offset: .2em;
}

[data-color-mode="light"] main :is(.story-row, .cap-practice, .approach, .home-section) h2,
[data-color-mode="light"] main[data-section="tools"] :is(.tool-hero, .editorial-conclusion, .message-box, .tool-intro) :is(h2, h3) {
  color: var(--section-accent);
}

[data-color-mode="light"] main .page-index a[aria-current],
[data-color-mode="light"] .home-section .text-link {
  text-decoration-color: var(--section-rule);
}

@media screen {
  :root {
    --gutter: clamp(1rem, 4vw, 4.25rem);
  }

  main {
    font-family: var(--site-font);
    font-size: var(--type-body);
    line-height: 1.62;
    --heading-gap: clamp(.65rem, 1.4vw, 1.2rem);
    --section-space: clamp(3.25rem, 6vw, 5.75rem);
  }

  main[id] h1:not(.opening-message),
  .page-photo ~ .work-shell .work-opening h1,
  main:has(> .page-photo) :is(.editorial-heading, .tool-intro, .study-page > header, .models > header) h1 {
    font: 700 var(--type-title)/1.08 var(--site-font);
    letter-spacing: -.025em;
  }


  main :is(h2, h3):not(.orbit-copy h3) {
    font-family: var(--site-font);
    letter-spacing: -.014em;
  }

  main h2:not(.story h2, .audit-expertise-card h2) {
    font-size: var(--type-section);
    line-height: 1.15;
    max-inline-size: none;
  }

  main :is(h3, .story h2) {
    font-size: var(--type-subsection);
    line-height: 1.25;
  }

  main :is(p, li):not([class]),
  .editorial-shell article p:not([class]),
  .editorial-shell article li:not([class]) {
    font-size: var(--type-body);
    line-height: 1.62;
  }

  main[id] :is(.cap-lead, .home-lead, .briefing-standfirst, .standfirst, .tool-deck),
  main .cap-opening .cap-offer > .cap-lead {
    font-size: var(--type-lead);
    line-height: 1.52;
    max-inline-size: var(--reading-width);
  }

  main :is(.about-intro, .cap-opening, .research-intro, .work-opening, .contact, .tools-intro, .conversation-hero) {
    padding-block-end: clamp(2rem, 4.5vw, 4.5rem);
  }

  .hero .hero-copy {
    max-inline-size: min(100%, 47ch);
    font-size: var(--type-lead);
    line-height: 1.48;
  }

  .cap-offer,
  .about-intro > div,
  .research-intro .intro-description,
  .work-opening .opening-aside,
  .tools-intro p,
  .conversation-hero p,
  .contact > p,
  .contact p.contact-guidance {
    max-inline-size: var(--reading-width);
  }

  .research-intro .intro-description,
  .work-opening .opening-aside {
    font-size: var(--type-body);
    line-height: 1.62;
  }

  .work-opening .opening-aside > p,
  .research-intro .intro-description > p,
  .about-intro > div > p:not(.reading-time),
  .cap-offer > p,
  .editorial-heading > p:not([class]),
  .editorial-shell .toolkit-intro p,
  .editorial-shell .editorial-conclusion p,
  .toolkit-guide .tool-section p:not([class]) {
    max-inline-size: min(100%, var(--reading-width));
  }

  main[id] :is(.cap-practice, .cap-invitation, .tool-section, .message-box, .approach) > h2,
  main[id] .space-toolkit .tool-section > h2 {
    font-family: var(--site-font);
    font-size: var(--type-section);
    line-height: 1.15;
  }

  main[id] :is(.card, .cap-practice .study-grid, .briefing-copy) p:not([class]) {
    font-size: var(--type-body);
    line-height: 1.62;
  }

  .work-opening {
    display: block;
  }

  .work-opening .opening-aside {
    margin-block-start: 1rem;
  }

  .story-row > div:last-child > p,
  .research-project .project-summary,
  .approach p {
    max-inline-size: var(--reading-width);
  }

  .editorial-shell > article,
  .editorial-shell > :is(.space-toolkit, .models, .practice-lesson),
  .briefing-article > article {
    inline-size: min(100%, var(--article-width));
    max-inline-size: none;
    margin-inline: 0;
  }

  .editorial-shell :is(.tool-intro, .tool-prose, .toolkit-intro, .study-prose),
  .editorial-shell article section > p,
  .editorial-shell article section > :is(ul, ol):not([class]),
  .editorial-shell article .editorial-conclusion > p,
  .message-box > p,
  .study-page .study-prose,
  .study-page > header > p:not(.reading-time) {
    max-inline-size: var(--reading-width);
  }

  .editorial-shell > .page-photo {
    inline-size: 100%;
    max-inline-size: none;
    padding-inline: 0;
  }

  .editorial-shell > .toolkit-guide {
    inline-size: 100%;
  }

  .toolkit-guide > :not(.tool-hero),
  .toolkit-guide > .tool-hero > :not(.page-photo) {
    max-inline-size: var(--article-width);
  }

  .toolkit-guide .tool-hero .page-photo {
    max-inline-size: none;
  }

  main > :is(.about-intro, .conversation-hero).shell {
    max-inline-size: none;
    margin-inline: auto;
  }

  .tool-hero h1,
  .briefing-article .editorial-heading h1 {
    max-inline-size: 25ch;
  }

  main :is(.audit-actions, .home-offer-links, .home-about-actions, .tool-quick-links, .message-controls, .example-links, .contact-links, .briefing-controls) {
    align-items: stretch;
    gap: .65rem;
  }

  main :is(.button, .action-link, .text-link:not(.inline), button.watch-film, button[type="submit"], .tool-quick-links a) {
    min-block-size: 44px;
    max-inline-size: 100%;
    box-sizing: border-box;
    text-align: center;
    justify-content: center;
    align-items: center;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  main :is(.briefing-controls, .message-controls, .audience-tabs) button {
    min-block-size: 44px;
    font-family: var(--site-font);
    white-space: normal;
  }

  main :is(.audit-actions, .home-offer-links, .home-about-actions, .contact-links) > :is(.button, .text-link) {
    margin: 0;
  }

  main :is(.button, .action-link, .text-link, button, summary):focus-visible {
    outline: 2px solid var(--section-accent);
    outline-offset: 3px;
  }
}

@media screen and (min-width: 821px) {
  .story-row {
    grid-template-columns: minmax(13rem, .72fr) minmax(0, 2fr);
    column-gap: clamp(2rem, 5vw, 5rem);
  }

}

@media screen and (max-width: 760px) {
  main :is(.audit-actions, .home-offer-links, .home-about-actions) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  main :is(.audit-actions, .home-offer-links, .home-about-actions) > :is(.button, .text-link) {
    inline-size: 100%;
  }

  main :is(.audit-actions, .home-offer-links, .home-about-actions) > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    inline-size: min(100%, 20rem);
  }

  [data-color-mode="light"] .home-section :is(.home-offer-links, .home-about-actions) .text-link {
    justify-content: center;
    text-align: center;
  }

  .site-nav .nav-contact {
    text-align: center;
    justify-content: center;
    min-block-size: 44px;
  }
}

@media screen and (max-width: 390px) {
  main :is(.audit-actions, .home-offer-links, .home-about-actions) {
    grid-template-columns: minmax(0, 1fr);
  }

  main :is(.audit-actions, .home-offer-links, .home-about-actions) > :last-child:nth-child(odd) {
    inline-size: 100%;
  }
}

main[data-section] {
  --editorial-accent: var(--section-accent);
}

.editorial-shell .toolkit-guide .anchor-diagram figcaption span:nth-child(2) {
  color: var(--teal-accent);
}

.editorial-shell .toolkit-guide :is(.toolkit-check input, .toolkit-progress progress) {
  accent-color: var(--teal-accent);
}

:lang(en) .toolkit-guide .tool-hero .tool-kicker {
  text-transform: none;
}

[data-color-mode="light"] .space-toolkit.toolkit-guide {
  --mint: var(--section-accent);
  --lav: var(--section-accent);
}

[data-color-mode="light"] main[data-section="tools"] :is(.toolkit-guide .tool-kicker, .toolkit-guide .step-number, .space-toolkit .tool-section h2, .toolkit-guide .toolkit-label) {
  color: var(--section-accent);
}

[data-color-mode="light"] main[data-section] :is(button[aria-pressed="true"], button[aria-selected="true"]):not(.atlas-word) {
  background-color: var(--section-tint);
  border-color: var(--section-rule);
  color: var(--section-accent);
}

[data-color-mode="light"] main .word-atlas .atlas-cloud button.atlas-word[aria-pressed="true"] {
  color: var(--section-accent);
}

:lang(fr) main h1:not(.opening-message) {
  hyphens: auto;
  overflow-wrap: break-word;
}

@media screen and (min-width: 701px) {
  .audit-expertise-grid > .audit-expertise-card:not(:first-child) {
    grid-row: span 3;
    grid-template-rows: subgrid;
    row-gap: .85rem;
  }
}

@media screen and (max-width: 760px) {
  :root { --type-body: 1.1875rem; --type-lead: 1.25rem; }
}

/* The heading, lead and main copy share the same left edge in both languages. */
@media screen {
  main h1:not(.opening-message)::before {
    content: "";
    display: block;
    inline-size: 2.5rem;
    block-size: 3px;
    margin-block-end: .8rem;
    background: var(--section-rule);
  }

  main > :is(.cap-practice, .cap-invitation, .story-row, .message-box, .about-evidence) h2::before,
  main .cap-demo > .editorial-conclusion h2::before {
    content: "";
    display: block;
    inline-size: 2rem;
    block-size: 2px;
    margin-block-end: .65rem;
    background: var(--section-rule);
  }

  main :is(.about-intro, .cap-opening, .research-intro, .work-opening, .cv-intro, .contact, .tools-intro, .conversation-hero, .demo-intro, .editorial-heading, .tool-intro, .tool-hero, .study-page > header, .models > header, .message-box) h1 + p:not(.reading-time),
  main :is(.work-opening .opening-aside, .research-intro .intro-description, .editorial-heading, .toolkit-intro, .study-page > header, .models > header, .tool-intro) > p:is(.editorial-deck, :first-child, :not([class])):first-of-type,
  main :is(.editorial-heading, .study-page > header, .models > header, .tool-intro) > .reading-time + p:not(.editorial-byline),
  main .toolkit-guide .tool-hero .tool-deck,
  main .message-box h1 ~ p:not([class]):first-of-type {
    font-size: var(--type-lead);
    line-height: 1.52;
    max-inline-size: var(--reading-width);
    margin-inline: 0;
    text-align: start;
  }

  main .work-shell .work-opening { display: block; }

  main .work-opening .opening-aside {
    justify-self: start;
    margin-inline: 0;
    text-align: start;
  }

  main .about-intro p:not(.reading-time) {
    font-size: var(--type-lead);
    line-height: 1.52;
  }
  main .contact > p,
  main .study-page > header > p,
  main .editorial-heading > .editorial-deck {
    margin-inline: 0;
    max-inline-size: var(--reading-width);
  }

  main .cap-offer,
  main .about-intro > div,
  main .conversation-hero > div,
  main .cv-intro > div,
  main .study-page > header,
  main .demo-intro,
  main .tool-intro,
  main .editorial-heading {
    justify-self: start;
    text-align: start;
  }

  main .work-invitation,
  main .work-invitation > p {
    text-align: start;
  }

  main .work-invitation > p { margin-inline: 0; }

  main.editorial-shell > .models {
    padding-inline: 0;
    background: transparent;
  }
}


/* Keep text and media aligned without forcing breaks inside ordinary words. */
@media screen {
  main :is(h1:not(.opening-message), h2, h3) { text-wrap: balance; overflow-wrap: break-word; }
  main :is(.story-row, .research-project, .approach, .project-grid, .writing-grid, .tool-list) > * {
    min-inline-size: 0;
  }
  main :is(.story-row, .research-project, .approach, .project-grid, .writing-grid, .tool-list) p {
    overflow-wrap: break-word;
    text-wrap: pretty;
  }
  main :is(.story-row, .approach) > div > :first-child:not(.page-section-label) { margin-block-start: 0; }
  main :is(.story-row, .research-project, .approach) {
    row-gap: clamp(1rem, 2.3vw, 2rem);
    padding-block: clamp(2rem, 4.6vw, 4.5rem);
  }
  main .contact .contact-links { display: flex; align-items: center; flex-wrap: wrap; }
  main .contact ul.contact-guidance { margin-block-end: 0; padding-inline-start: 1.2em; }
  main .contact ul.contact-guidance li + li { margin-block-start: .45rem; }
  main #enquiry-subject-hint { display: block; color: var(--muted); margin-block-start: .3rem; }
}

/* Keep portfolio sections on the same two-column rhythm as the homepage. */
.work-page .film-feature-layout,
.work-page .digital-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: clamp(1.25rem, 4.5vw, 4.5rem);
}

.work-page .film-feature-copy .film-topline,
.work-page .film-feature-copy .film-bottom {
  position: static;
  display: block;
  padding: 0;
}

.work-page .film-feature-copy .film-topline {
  display: flex;
  justify-content: flex-start;
  column-gap: 1rem;
  margin-block-end: .55rem;
  color: var(--muted);
}

.work-page .work-shell > .page-index > .shell { width: 100%; padding-inline: 0; }
.work-page .film-bottom { margin-block-start: 1.1rem; }
.work-page .film-bottom p { line-height: 1.62; }
.work-page .film-bottom .film-series { margin-block-end: .45rem; }
.work-page :is(.film-preview, .project-figure) { margin: 0; min-width: 0; }
.work-page .film-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.work-page :is(.film-preview, .project-figure) figcaption,
main p.visual-credit {
  margin: .55rem 0 0;
  color: var(--muted);
  font-size: .91rem;
  line-height: 1.45;
}
.work-page .project-figure figcaption a { text-decoration: underline; text-underline-offset: .15em; }
.work-page .projects-heading { border: 0; padding-block-start: 0; margin-block-end: .8rem; }
.work-page .project-grid { gap: clamp(1.5rem, 3.5vw, 3rem); margin-block-end: 0; }
.work-page .project-info { padding-block-start: .9rem; }
.work-page .project-info h3 { margin-block-end: .6rem; }
.work-page .project-info .project-type { margin-block-end: .4rem; }
.work-page .digital-layout h2 { margin-block-end: 0; }
.work-page .digital-layout .digital-details { margin-block-start: 1rem; }

@media screen and (min-width: 821px) {
  main { --reading-width: 100%; }

  main :is(.about-intro > div, .research-intro .intro-description, .tools-intro p,
    .conversation-hero p, .contact > p, .cap-offer, .cap-offer > p,
    .about-intro > div > p:not(.reading-time), .research-intro .intro-description > p,
    .editorial-heading > p:not([class]), .editorial-heading > .editorial-deck,
    .study-page > header > p, .toolkit-guide .toolkit-intro,
    .toolkit-guide .toolkit-intro p, .toolkit-guide .tool-section > p,
    .story-row > div > p, .research-project .project-summary, .approach p) {
    max-inline-size: none;
  }

  main :is(.about-intro, .conversation-hero):has(> div:only-child) {
    grid-template-columns: minmax(0, 1fr);
  }

  main.editorial-shell > :is(article, .space-toolkit, .models, .practice-lesson),
  main.briefing-article > article {
    inline-size: 100%;
  }

  main.editorial-shell article section > p,
  main :is(.editorial-shell, .space-study) .study-prose,
  main .toolkit-guide > :not(.tool-hero),
  main .toolkit-guide > .tool-hero > :not(.page-photo) {
    max-inline-size: none;
  }

  main .work-shell .work-opening {
    display: grid;
    grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr);
    grid-template-rows: auto 1fr;
    align-items: start;
    column-gap: clamp(1.25rem, 4.5vw, 4.5rem);
  }
  .work-page .work-opening > h1 { grid-area: 1 / 1; }
  .work-page .work-opening > .reading-time { grid-area: 2 / 1; }
  .work-page .work-opening > .opening-aside { grid-area: 1 / 2 / span 2; margin: 0; }
  .work-page .work-opening > .opening-aside > p { max-inline-size: none; }

  .work-page .film-feature-layout { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }
  .work-page .digital-layout { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }
  .work-page .digital-layout > div > p { margin-block-start: 0; }
}

@media screen and (min-width: 965px) {
  .work-page .project-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media screen and (min-width: 821px) and (max-width: 964px) {
  .work-page .project-grid > :last-child { grid-column: 1 / -1; }
  .work-page .project-grid > :last-child .project-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(1.5rem, 3.5vw, 3rem);
  }
}

@media screen and (min-width: 1500px) {
  :root { --max: clamp(1240px, 84vw, 96rem); }

  /* A full-width toolkit still uses reading-sized illustrations. */
  main .toolkit-guide .translation-list .translation-heading > .toolkit-visual,
  main .toolkit-guide .briefing-step > .toolkit-visual {
    inline-size: min(calc(100% - 2 * var(--exercise-padding)), 30rem);
    justify-self: center;
  }
}

@media screen and (min-width: 821px) {
  main #engagements > p { max-inline-size: none; }
}
