/* ==========================================================================
   Emperor Design — stylesheet
   1. Tokens  2. Reset  3. Typography  4. Layout  5. Header  6. Hero
   7. Components  8. Portfolio  9. Forms  10. Footer  11. Motion  12. Utilities
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  --bg: #121212;
  --surface: #191919;
  --surface-2: #212121;
  --text: #ffffff;
  --text-muted: #a3a3a3;
  --border: #2c2c2c;
  --accent: #23b9cc;
  --accent-deep: var(--accent);
  --recommendation-bg: var(--surface);
  /* The brand teal itself, held back to a panel-strength opacity so the light
     text on top stays readable. */
  --accent-soft: color-mix(in srgb, var(--accent) 38%, transparent);
  --accent-contrast: #06262b;
  /* Text-safe accent: stays bright in dark mode, darkens for light surfaces. */
  --accent-text: var(--accent);
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 16px 40px -20px rgb(0 0 0 / 70%);

  --font-sans: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Roboto Slab", ui-serif, Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Design tokens. The CMS can change these in assets/css/design.css. */
  --type-h1: 1;
  --type-h2: 1;
  --type-h3: 1;
  --type-h4: 1;
  --type-body: 1;
  --type-lead: 1;
  --body-leading: 1.65;

  --step--1-base: clamp(0.82rem, 0.8rem + 0.1vw, 0.9rem);
  --step-0-base: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --step-1-base: clamp(1.2rem, 1.1rem + 0.45vw, 1.5rem);
  --step-2-base: clamp(1.5rem, 1.3rem + 0.9vw, 2rem);
  --step-3-base: clamp(1.8rem, 1.4rem + 1.8vw, 3rem);
  --step-4-base: clamp(2.4rem, 1.7rem + 3.2vw, 4.75rem);

  --step--1: var(--step--1-base);
  --step-0: var(--step-0-base);
  --step-1: var(--step-1-base);
  --step-2: var(--step-2-base);
  --step-3: var(--step-3-base);
  --step-4: var(--step-4-base);

  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1.25rem;
  --space-4: 2rem;
  --space-5: 3rem;
  --space-6: 4.5rem;
  --space-7: 7rem;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  /* 1250px at a 16px root; padding-inline still adds 40px a side on desktop. */
  --container: 78.125rem;
  /* Logo lockup is 3:1 — 200px wide renders 67px tall. */
  --logo-w: 200px;
  --logo-h: calc(var(--logo-w) / 3);
  --header-h: calc(var(--logo-h) + 1.5rem);
  /* Extra space above and below the header contents (logo, nav, buttons). */
  --header-pad-top: 1.875rem;
  --header-pad-bottom: 1.875rem;

  /* Ambient background glow: soft teal pools at the page edges. Sizes use vw so
     they stay in the margins on wide screens and shrink on phones. */
  --glow-lg: clamp(18rem, 34vw, 40rem);
  --glow-md: clamp(15rem, 27vw, 33rem);
  --glow: color-mix(in srgb, var(--accent) 30%, transparent);
  --glow-soft: color-mix(in srgb, var(--accent) 18%, transparent);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

:root[data-theme="light"] {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #fbfaf7;
  --text: #15323a;
  --text-muted: #5b7078;
  --lead: #46616a;
  --border: #dfe2df;
  /* Palette from the penguin head study. */
  --accent: #0e7482;
  --accent-deep: #0e7482;
  --accent-soft: #e7f8fa;
  --accent-contrast: #ffffff;
  --accent-text: #0e7482;
  --ink: #15323a;
  --paper: #f6f4ef;
  --recommendation-bg: #15323a;
  --recommendation-text: #eaf7f9;
  --recommendation-muted: #b9d5da;
  --shadow: 0 1px 2px rgb(21 50 58 / 5%), 0 12px 32px -18px rgb(21 50 58 / 22%);
  /* Teal reads stronger on paper, so the ambient pools sit back further. */
  --glow: color-mix(in srgb, var(--accent) 16%, transparent);
  --glow-soft: color-mix(in srgb, var(--accent) 10%, transparent);
}

/* 2. Reset ---------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(
    var(--header-h) + var(--header-pad-top) + var(--header-pad-bottom) + 1rem
  );
}

body {
  margin: 0;
  background-color: var(--bg);
  /* Four soft teal pools, two per side, spaced down the document so they pass
     by as the page scrolls. No-repeat and no fixed attachment: on phones the
     image spans the document naturally instead of jittering. */
  background-image:
    radial-gradient(
      var(--glow-lg) var(--glow-lg) at -2% 10%,
      var(--glow),
      transparent 70%
    ),
    radial-gradient(
      var(--glow-md) var(--glow-md) at 102% 34%,
      var(--glow-soft),
      transparent 70%
    ),
    radial-gradient(
      var(--glow-md) var(--glow-md) at -1% 62%,
      var(--glow-soft),
      transparent 70%
    ),
    radial-gradient(
      var(--glow-lg) var(--glow-lg) at 101% 88%,
      var(--glow),
      transparent 70%
    );
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: calc(var(--step-0) * var(--type-body));
  line-height: var(--body-leading);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

button {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

ul,
ol {
  padding-left: 1.15rem;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-5) 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: var(--accent);
  color: var(--accent-contrast);
}

/* 3. Typography ----------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  margin: 0 0 0.6em;
  line-height: 1.12;
  font-weight: 600;
  text-wrap: balance;
}

h1,
h2 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

h3,
h4 {
  font-family: var(--font-sans);
  letter-spacing: -0.015em;
}

h1 {
  font-size: calc(var(--step-4) * var(--type-h1));
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.03em;
}

h2 {
  font-size: calc(var(--step-3) * var(--type-h2));
  letter-spacing: -0.028em;
}

h3 {
  font-size: calc(var(--step-1) * var(--type-h3));
}

h4 {
  font-size: calc(var(--step-0) * var(--type-h4));
}

p {
  margin: 0 0 1em;
  text-wrap: pretty;
}

p:last-child {
  margin-bottom: 0;
}

.lead {
  font-size: calc(1.25rem * var(--type-lead));
  line-height: 1.55;
  color: var(--lead, var(--text-muted));
  max-width: 34ch;
}

/* Inner-page standfirst: the summary under the page title runs the width of the
   container rather than a narrow measure. The hero keeps the 34ch measure above. */
.page-intro .lead {
  max-width: none;
}

/* Page intros close with a tighter 60px gap before the first content block. */
.section.page-intro {
  padding-bottom: 60px;
}

/* Services standfirst: the summary and its call to action sit in two columns on
   wide screens, with the button against the right edge of the container. */
.intro-split {
  display: grid;
  gap: 1rem;
  margin-top: 2.5rem;
}

.intro-split .lead {
  margin-bottom: 0;
}

.intro-split__action {
  margin: 0;
}

/* Hidden on wide screens; the hero label uses it to break cleanly on phones. */
.br-mobile {
  display: none;
}

.eyebrow {
  margin: 0 0 var(--space-3);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

:root[data-theme="light"] .eyebrow {
  color: var(--accent-deep);
}

/* Home page section eyebrows, excluding the hero, get extra space below. */
main > .hero ~ .section .eyebrow {
  padding-bottom: 20px;
}

/* About page Clients eyebrow. */
main > .section[aria-labelledby="clients-heading"] .eyebrow {
  padding-bottom: 20px;
}

/* The rule trails the label instead of leading it, so the label itself now sits
   flush with the left edge of the headline column below. Inline-block (not flex)
   so a label that wraps keeps the rule on its last line. */
.eyebrow::after {
  content: "";
  display: inline-block;
  width: 1.75rem;
  height: 1px;
  margin-left: 0.6rem;
  vertical-align: 0.32em;
  background: var(--accent);
}

/* 4. Layout --------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1.15rem, 4vw, 2.5rem);
}

.section {
  padding-block: 5.5rem;
  position: relative;
}

/* Inner content sections sit close to the block above them. The page intro
   keeps its full spacing beneath the header. */
main > .section:not(.page-intro) {
  padding-top: 30px;
}

/* Home content sections share a consistent 60px top and bottom. */
main > .hero ~ .section {
  padding-block: 60px;
}

.section--tight {
  padding-block: 4rem;
}

/* Home section dividers and the footer divider stop at the page container
   instead of running to the viewport edges. The 1px strip is clipped to the
   container's content box, so the line starts and ends with the text. */
.hero ~ .section + .section::before,
.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, var(--container));
  height: 1px;
  padding-inline: clamp(1.15rem, 4vw, 2.5rem);
  background: var(--border);
  background-clip: content-box;
  pointer-events: none;
}

.section-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.section-head h2,
.section-head p {
  margin-bottom: 0;
}

.section-head p {
  color: var(--text-muted);
  max-width: 58ch;
}

/* Home services intro: the single sentence is short enough to stay on one
   line at desktop widths when it is not capped to the reading measure. */
.section-head--wide p {
  max-width: none;
}

.prose {
  max-width: 60ch;
}

.prose h2 {
  margin-top: var(--space-5);
}

.prose h3 {
  margin-top: var(--space-4);
}

.prose a:not(.btn) {
  color: var(--accent-text);
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

.prose a:not(.btn):hover {
  text-decoration-color: currentColor;
}

.prose ul li,
.prose ol li {
  margin-bottom: 0.5em;
}

/* 5. Header --------------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -120%);
  z-index: 100;
  padding: 0.65rem 1.1rem;
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.18s var(--ease);
}

.skip-link:focus-visible {
  transform: translate(-50%, 0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: var(--header-pad-top);
  padding-bottom: var(--header-pad-bottom);
  background: var(--header-bg, color-mix(in srgb, var(--bg) 82%, transparent));
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease),
    backdrop-filter 0.3s var(--ease), padding 0.3s var(--ease),
    margin-bottom 0.3s var(--ease);
}

/* Home page: the header floats over the hero photograph instead of sitting on a
   bar of its own. It stays fixed, so the page starts at the top of the image, and
   turns into a dark glass bar once the visitor scrolls past the top. */
.site-header--overlay {
  position: fixed;
  inset: 0 0 auto;
  background: var(--header-bg, rgb(12 13 14 / 88%));
  border-bottom-color: transparent;
  backdrop-filter: none;
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease),
    backdrop-filter 0.3s var(--ease), padding 0.3s var(--ease);
}

/* Scrolled: the bar tightens by giving up its top and bottom padding. The logo,
   nav and buttons keep their size, so only the breathing room goes. */
.site-header.is-scrolled {
  padding-block: 0;
}

/* Sticky headers on the inner pages stay in the flow. The padding they give up
   is added back as a bottom margin in the same transition, so the content below
   keeps its position and only the bar itself gets shorter. */
.site-header:not(.site-header--overlay).is-scrolled {
  margin-bottom: calc(var(--header-pad-top) + var(--header-pad-bottom));
}

.site-header--overlay.is-scrolled,
.site-header--overlay[data-nav-open="true"] {
  background: var(--header-bg, rgb(12 13 14 / 88%));
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom-color: rgb(255 255 255 / 10%);
}

.site-header--overlay .site-nav a {
  color: rgb(255 255 255 / 74%);
}

.site-header--overlay .site-nav a:hover {
  color: #fff;
}

.site-header--overlay .site-nav a[aria-current="page"] {
  color: var(--accent-text);
}

.site-header--overlay .icon-button,
.site-header--overlay .nav-toggle {
  border-color: rgb(255 255 255 / 20%);
  background: rgb(16 17 18 / 45%);
  color: rgb(255 255 255 / 82%);
}

.site-header--overlay .icon-button:hover,
.site-header--overlay .nav-toggle:hover {
  color: #fff;
  border-color: rgb(255 255 255 / 38%);
}

/* Pill CTA in the header: teal outline everywhere, solid teal in light mode,
   and dark glass when it floats over the hero photograph on the home page. */
.header-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.6rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: var(--step--1);
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.header-cta:hover {
  background: var(--surface-2);
}

.header-cta svg {
  width: 0.9em;
  height: 0.9em;
}

.site-header--overlay .header-cta {
  border-color: var(--accent);
  background: rgb(16 17 18 / 55%);
  backdrop-filter: blur(10px);
  color: #fff;
}

.site-header--overlay .header-cta:hover {
  background: rgb(16 17 18 / 82%);
  border-color: var(--accent);
}

.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  margin-right: auto;
  /* The artwork carries 10% of its height as transparent bleed on the left;
     pull it back so the emblem lines up with the text column below. */
  margin-left: calc(var(--logo-h) * -0.1);
  text-decoration: none;
}

.brand img {
  display: block;
  width: var(--logo-w);
  height: calc(var(--logo-w) / 3);
  max-width: 100%;
  object-fit: contain;
}

.brand img[data-site-logo="light"] {
  display: none;
}

:root[data-theme="light"] .brand img[data-site-logo="dark"] {
  display: none;
}

:root[data-theme="light"] .brand img[data-site-logo="light"] {
  display: block;
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: block;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  font-size: var(--step--1);
  font-weight: 500;
  text-decoration: none;
  color: var(--text-muted);
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.site-nav a:hover {
  color: var(--text);
  /* Teal wash at 10%: tinted, not solid, so it reads as a hover hint. */
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

/* The current page is marked by colour alone; the old grey pill fought with
   the teal hover state sitting next to it. */
.site-nav a[aria-current="page"] {
  color: var(--accent-text);
}

/* Contact is exposed by the mobile menu; wide screens already have the CTA. */
.nav-contact {
  display: none;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  margin-left: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease),
    transform 0.2s var(--ease);
}

.icon-button:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--text) 26%, var(--border));
  transform: translateY(-1px);
}

.icon-button svg {
  width: 1.05rem;
  height: 1.05rem;
}

.theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

.nav-toggle {
  display: none;
}

/* Dimmed page behind the open mobile menu, with no scrolling underneath it.
   The scrim fades on the same curve as the panel so the two arrive together
   rather than the page dimming in one frame. */
.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: block;
  background: rgb(8 8 8 / 55%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s var(--ease), visibility 0s linear 0.28s;
}

html.nav-open .nav-backdrop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.28s var(--ease), visibility 0s linear 0s;
}

html.nav-open,
html.nav-open body {
  overflow: hidden;
}

/* 6. Hero ----------------------------------------------------------------- */
/* Full-bleed photographic banner. The picture fills the section and the copy
   sits on the bottom left over it, close to the reference layout. Swap the
   photograph by changing --hero-bg; the radial underneath is only a stand-in
   so the section still reads as designed before an image is dropped in. The
   photo is its own layer, so each theme can use its own artwork without
   touching the copy, the scrim or the glow. */
.hero {
  --hero-bg: url("../img/hero-bg-dark-v2.webp");
  --hero-bg-light: url("../img/hero-bg-light-v2.webp");
  position: relative;
  display: flex;
  align-items: flex-end;
  /* The original 86svh banner, trimmed by exactly 100px. */
  min-height: clamp(34rem, calc(86svh - 6.25rem), 47.75rem);
  padding-block: calc(
      var(--header-h) + var(--header-pad-top) + var(--header-pad-bottom) + clamp(2rem, 5vw, 4rem)
    )
    clamp(2.5rem, 6vw, 4.5rem);
  overflow: clip;
  isolation: isolate;
  background-color: #0a0b0c;
}

/* Home banner only: the reference layout drops the copy lower than the
   standard hero clearance, so the top padding is fixed. */
.hero.hero--banner {
  padding-top: 350px;
}

.hero__bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: var(--hero-bg),
    radial-gradient(120% 90% at 78% 6%, #133138 0%, #0a0b0c 58%);
  background-size: cover;
  background-position: center;
  pointer-events: none;
}

/* Light theme: the banner uses its own pale abstract image, with dark copy and a
   white veil instead of the dark scrim. */
:root[data-theme="light"] .hero {
  background-color: #f6f4ef;
}

:root[data-theme="light"] .hero__bg {
  background-image: var(--hero-bg-light),
    radial-gradient(120% 90% at 78% 6%, #efeadd 0%, #f6f4ef 58%);
}

/* Legibility scrim: heavier at the top behind the floating header and at the
   bottom under the copy, with a left-to-right falloff so the photo stays open on
   the right. Painted above the photo, below the text. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(
      180deg,
      rgb(6 7 8 / 46%) 0%,
      rgb(6 7 8 / 8%) 30%,
      rgb(6 7 8 / 34%) 68%,
      rgb(7 8 9 / 86%) 100%
    ),
    linear-gradient(
      90deg,
      rgb(6 7 8 / 62%) 0%,
      rgb(6 7 8 / 24%) 46%,
      rgb(6 7 8 / 0%) 84%
    );
  pointer-events: none;
}

/* Soft teal bloom on the right of the photograph, above the scrim and below
   the copy. "screen" keeps it luminous instead of laying a flat tint over the
   image. Sits inside the hero's clipped box, so it never reaches the page
   edges or adds scroll width. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(
    clamp(14rem, 26vw, 30rem) clamp(14rem, 26vw, 30rem) at 86% 40%,
    color-mix(in srgb, var(--accent) 44%, transparent),
    transparent 70%
  );
  mix-blend-mode: screen;
  pointer-events: none;
}

.hero-inner {
  width: 100%;
  position: relative;
  z-index: 1;
}

/* Soft glass ribbons on the home banner. They span the hero, pass behind
   the copy and stay hidden on smaller screens. */
.hero-ribbons {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.4;
}

@media (min-width: 72rem) {
  .hero-ribbons {
    opacity: 0.55;
  }
}

.hero-ribbons svg {
  position: absolute;
  top: 0;
  left: -3%;
  width: 106%;
  max-width: none;
  height: 100%;
}

.ribbon-layer {
  transform-box: view-box;
  transform-origin: 800px 350px;
  will-change: transform;
}

.ribbon--a { fill: url("#ribbon-a"); }
.ribbon--b { fill: url("#ribbon-b"); }
.ribbon--c { fill: url("#ribbon-c"); }

.ribbon-edge {
  stroke: color-mix(in srgb, var(--accent) 78%, #ffffff);
  stroke-width: 1.2;
  stroke-linecap: round;
  opacity: 0.22;
}

.ribbon-edge--soft {
  stroke: color-mix(in srgb, var(--accent) 55%, transparent);
  opacity: 0.12;
}

.ribbon-line {
  stroke: color-mix(in srgb, var(--accent) 60%, transparent);
  stroke-width: 0.8;
  opacity: 0.1;
}

.ribbon-glow {
  fill: var(--accent);
  opacity: 0.05;
  filter: url("#ribbon-blur");
}

:root[data-theme="light"] .ribbon-edge {
  stroke: color-mix(in srgb, var(--accent) 60%, #0b3b44);
  opacity: 0.35;
}

:root[data-theme="light"] .ribbon-edge--soft,
:root[data-theme="light"] .ribbon-line {
  stroke: color-mix(in srgb, var(--accent) 50%, #0b3b44);
}

:root[data-theme="light"] .ribbon-glow {
  opacity: 0.035;
}

@media (prefers-reduced-motion: reduce) {
  .hero-ribbons [data-depth] {
    transform: none !important;
  }
}



.hero-copy {
  max-width: 46rem;
}

/* Desktop only: lift the hero copy 20px above its previous baseline. */
@media (min-width: 52rem) {
  .hero-copy {
    position: relative;
    top: -20px;
  }
}

.hero h1 {
  margin-bottom: var(--space-3);
  color: #fff;
  /* Sized so each sentence still sets on its own line; tops out at 80px. */
  font-size: calc(clamp(2.2rem, 4.6vw + 1.3rem, 5rem) * var(--type-h1));
  max-width: 20ch;
}

/* Teal phrase inside a heading, matching the hero lockup. */
/* Emphasis convention: <em> is the teal brand accent everywhere, while <i>
   stays italic. The CMS allows both tags in HTML fields, so an editor can
   accent a few words without touching CSS. .accent is the span equivalent. */
em,
.accent {
  font-style: normal;
  color: var(--accent-text);
}

i {
  font-style: italic;
  color: inherit;
}

.hero .eyebrow {
  color: rgb(255 255 255 / 66%);
}

.hero .lead {
  color: rgb(255 255 255 / 78%);
  /* Runs the full width of the copy block so it sets on two lines. */
  max-width: none;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: var(--space-4);
}

/* Over the photograph the outline button needs a light label. */
.hero .btn--ghost {
  --btn-fg: #fff;
}

/* Light theme banner: dark copy over a pale image, with a soft white veil so
   the artwork still reads while the text stays crisp. The teal bloom switches
   off "screen", which would wash out to white on a light background. */
:root[data-theme="light"] .hero::before {
  background:
    linear-gradient(
      180deg,
      rgb(246 244 239 / 38%) 0%,
      rgb(246 244 239 / 4%) 30%,
      rgb(246 244 239 / 14%) 68%,
      rgb(246 244 239 / 48%) 100%
    ),
    linear-gradient(
      90deg,
      rgb(246 244 239 / 34%) 0%,
      rgb(246 244 239 / 10%) 50%,
      rgb(246 244 239 / 0%) 88%
    );
}

:root[data-theme="light"] .hero::after {
  mix-blend-mode: normal;
  background: radial-gradient(
    clamp(14rem, 26vw, 30rem) clamp(14rem, 26vw, 30rem) at 86% 40%,
    color-mix(in srgb, var(--accent) 16%, transparent),
    transparent 70%
  );
}

:root[data-theme="light"] .hero h1 {
  color: var(--text);
}

:root[data-theme="light"] .hero .eyebrow {
  color: var(--accent-deep);
}

:root[data-theme="light"] .hero .lead {
  color: var(--lead);
}

:root[data-theme="light"] .hero .btn--ghost {
  --btn-bg: var(--paper);
  --btn-fg: var(--accent-deep);
  border-color: var(--accent-deep);
  background: var(--paper);
  color: var(--accent-deep);
}

:root[data-theme="light"] .hero .btn--ghost:hover {
  background: color-mix(in srgb, var(--accent-deep) 8%, var(--paper));
  color: var(--accent-deep);
  border-color: var(--accent-deep);
}

/* The floating header sits on the pale banner in light mode, so its controls
   flip from white-on-dark glass to dark-on-white glass. */
:root[data-theme="light"] .site-header--overlay .site-nav a {
  color: rgb(21 50 58 / 72%);
}

:root[data-theme="light"] .site-header--overlay .site-nav a:hover {
  color: var(--text);
}

:root[data-theme="light"] .site-header--overlay .site-nav a[aria-current="page"] {
  color: var(--accent-text);
}

:root[data-theme="light"] .site-header--overlay .icon-button,
:root[data-theme="light"] .site-header--overlay .nav-toggle {
  border-color: rgb(21 50 58 / 18%);
  background: rgb(255 255 255 / 62%);
  color: rgb(21 50 58 / 80%);
}

:root[data-theme="light"] .site-header--overlay .icon-button:hover,
:root[data-theme="light"] .site-header--overlay .nav-toggle:hover {
  color: var(--text);
  border-color: rgb(21 50 58 / 34%);
}

/* The teal lockup reads as a colour accent on the pale banner, so light mode
   redraws the header logo in the site's near-black text colour (#151515).
   brightness(0) strips the teal to pure black; invert() lifts that to --text.
   Dark mode keeps the teal logo. */
:root[data-theme="light"] .header-cta {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
}

:root[data-theme="light"] .header-cta:hover {
  border-color: color-mix(in srgb, var(--accent) 86%, #000);
  background: color-mix(in srgb, var(--accent) 86%, #000);
  color: var(--accent-contrast);
}

:root[data-theme="light"] .site-header--overlay.is-scrolled,
:root[data-theme="light"] .site-header--overlay[data-nav-open="true"] {
  background: var(--header-bg, rgb(255 255 255 / 88%));
  border-bottom-color: rgb(21 50 58 / 8%);
}

/* 7. Components ----------------------------------------------------------- */
.btn {
  --btn-bg: var(--accent);
  --btn-fg: var(--accent-contrast);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.72rem 1.3rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease),
    background-color 0.18s var(--ease), border-color 0.18s var(--ease);
}

/* Dark mode: primary buttons carry a white label. */
:root:not([data-theme="light"]) .btn {
  --btn-fg: #ffffff;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn:active {
  transform: translateY(0);
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--text);
  border-color: var(--accent);
}

.btn--ghost:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.btn svg {
  width: 0.95em;
  height: 0.95em;
}

/* Light mode buttons use the deep palette teal with white labels. */
:root[data-theme="light"] .header-cta,
:root[data-theme="light"] .btn {
  --btn-bg: var(--accent-deep);
  --btn-fg: #ffffff;
  border-color: var(--accent-deep);
  background: var(--accent-deep);
  color: #ffffff;
}

:root[data-theme="light"] .header-cta:hover,
:root[data-theme="light"] .btn:hover {
  border-color: color-mix(in srgb, var(--accent-deep) 84%, #000);
  background: color-mix(in srgb, var(--accent-deep) 84%, #000);
  color: #ffffff;
}

/* Cards use the accent as their outline in both themes. */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease),
    border-color 0.25s var(--ease);
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

/* Light mode cards use the white palette surface; their teal outline is kept. */

.card h3 {
  margin: 0;
}

.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--step--1);
  line-height: 1.6;
}

.card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.6rem;
}

.card-link {
  font-size: var(--step--1);
  font-weight: 600;
  text-decoration: none;
  color: var(--accent-text);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.card-link::after {
  content: "→";
  transition: transform 0.2s var(--ease);
}

.card-link:hover::after {
  transform: translateX(3px);
}

/* The link covers its whole card, so the tile responds anywhere it is tapped.
   Scoped to cards so standalone card links do not turn a whole section into
   one large click target. */
.card .card-link::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}

.grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tag {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Capability cards in the About sidebar: same surface, border and bullet list
   as the service cards, stacked in one column. */
.skill-list {
  display: grid;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Skill, client and service panels share the same teal outline as the cards,
   in both themes. */
.skill-card {
  padding: 2.25rem;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
}

.skill-card h3 {
  font-size: var(--step--1);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.skill-card .service-list {
  grid-template-columns: 1fr;
}

.steps {
  counter-reset: step;
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 1.75rem;
}

/* The "How a project runs" label sits 20px above the numbered steps. */
section[aria-labelledby="wordpress-heading"] h3 {
  padding-bottom: 20px;
  margin-bottom: 0;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 2.6rem;
  color: var(--text-muted);
  font-size: var(--step--1);
}

.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: -0.15rem;
  font-family: var(--font-display);
  font-size: var(--step-0);
  font-weight: 700;
  color: var(--accent-text);
}

.steps strong {
  display: block;
  color: var(--text);
  font-size: var(--step-0);
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.client-grid {
  display: grid;
  gap: 1.15rem 2rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Each client gets its own surface card, matching the service and skill cards,
   instead of a rule underneath. */
.client-grid li {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}

.client-grid strong {
  display: block;
  font-weight: 600;
  font-size: var(--step--1);
}

.client-grid span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.service {
  padding: clamp(1.75rem, 4vw, 2.75rem);
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
}

.service + .service {
  margin-top: 1.75rem;
}

.service > h2 {
  font-size: calc(var(--step-2) * var(--type-h2));
  margin-bottom: 0.35rem;
}

.service > .service-sub {
  color: var(--accent-text);
  font-weight: 500;
  margin-bottom: 1.5rem;
}

.service p {
  color: var(--text-muted);
  max-width: 62ch;
}

.service h3 {
  font-size: var(--step--1);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 1.75rem 0 0.9rem;
}

.service-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
}

.service-list li {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  font-size: var(--step--1);
}

.service-list li::before {
  content: "";
  flex: none;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-2px);
}

.info-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 1.5rem;
}

.info-list li {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.info-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.info-label {
  display: block;
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.info-list a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
}

.info-list a:hover {
  color: var(--accent-text);
}

.callout {
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  font-size: var(--step--1);
}

/* Light mode callouts use the dark ink recommendation card from the penguin
   palette, so the closing call to action reads as a deliberate feature. */
:root[data-theme="light"] .callout,
:root[data-theme="light"] .recommendation {
  background: var(--recommendation-bg);
  border-color: var(--recommendation-bg);
  color: var(--recommendation-text);
}

:root[data-theme="light"] .callout strong,
:root[data-theme="light"] .recommendation strong {
  color: #ffffff;
}

:root[data-theme="light"] .callout .text-muted,
:root[data-theme="light"] .recommendation .text-muted {
  color: var(--recommendation-muted);
}

.callout p {
  margin: 0;
}

.callout strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: var(--step-0);
}

.callout .btn {
  margin-top: 1rem;
}

/* 8. Portfolio ------------------------------------------------------------ */
.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 0 0 2.5rem;
  padding: 0;
  list-style: none;
}

.filter {
  padding: 0.45rem 0.95rem;
  /* Teal outline, matching the site accent rather than the neutral border. */
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease),
    border-color 0.2s var(--ease);
}

.filter:hover {
  color: var(--text);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.filter[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

:root[data-theme="light"] .filter[aria-pressed="true"] {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #ffffff;
}

.work-grid {
  display: grid;
  gap: 2.5rem 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18.5rem), 1fr));
}

.work-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-decoration: none;
  color: inherit;
  text-align: center;
}

.work-card__media {
  display: block;
  aspect-ratio: 5 / 4;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #ffffff;
}

.work-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1);
  transition: transform 0.5s var(--ease), filter 0.35s var(--ease);
}

.work-card:hover .work-card__media img,
.work-card:focus-visible .work-card__media img {
  transform: scale(1.035);
  filter: grayscale(0);
}

.work-card__title {
  display: block;
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--step-0);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.work-card__cat {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.work-card[hidden] {
  display: none;
}

.empty-note {
  margin-top: var(--space-4);
  color: var(--text-muted);
  font-size: var(--step--1);
}

/* Lightbox */
dialog.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(96vw, 76rem);
  max-height: 94vh;
  overflow: visible;
}

dialog.lightbox[open] {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
}

dialog.lightbox::backdrop {
  background: rgb(0 0 0 / 88%);
  backdrop-filter: blur(4px);
}

.lightbox-nav {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid rgb(255 255 255 / 30%);
  border-radius: 50%;
  background: rgb(18 18 18 / 68%);
  color: #ffffff;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease),
    transform 0.2s var(--ease);
}

.lightbox-nav:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.06);
}

.lightbox-nav svg {
  width: 1.1rem;
  height: 1.1rem;
}

.lightbox-nav--prev {
  grid-column: 1;
  grid-row: 1;
}

.lightbox-nav--next {
  grid-column: 3;
  grid-row: 1;
}

.lightbox img {
  grid-column: 2;
  grid-row: 1;
  max-height: 82vh;
  width: auto;
  margin-inline: auto;
  border-radius: var(--radius);
  background: #ffffff;
}

.lightbox-bar {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: 0.9rem;
  color: #ffffff;
  font-size: var(--step--1);
}

.lightbox-close {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid rgb(255 255 255 / 25%);
  border-radius: 999px;
  background: transparent;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.lightbox-close:hover {
  border-color: #ffffff;
}

/* 9. Forms ---------------------------------------------------------------- */
.form {
  display: grid;
  gap: 1.5rem;
}

.field {
  display: grid;
  gap: 0.5rem;
}

.field label {
  font-size: var(--step--1);
  font-weight: 600;
}

.field .hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

input,
textarea,
select {
  font: inherit;
  font-size: var(--step--1);
  color: var(--text);
  /* One step lighter than the page so the fields read as distinct boxes. */
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  width: 100%;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

input:hover,
textarea:hover {
  border-color: color-mix(in srgb, var(--text) 22%, var(--border));
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent);
}

input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: #e2705d;
}

textarea {
  resize: vertical;
  min-height: 9rem;
}

.form-row {
  display: grid;
  gap: 1.5rem;
}

.form-status {
  font-size: var(--step--1);
  margin: 0;
  min-height: 1.4em;
}

.form-status[data-state="error"] {
  color: #f0a08f;
}

:root[data-theme="light"] .form-status[data-state="error"] {
  color: #a5382a;
}

.form-status[data-state="success"] {
  color: var(--accent-text);
}

.form-status[data-state="pending"] {
  color: var(--text-muted);
}

/* Honeypot field: in the markup for bots, out of sight and out of the tab order
   for people. Not display:none, since some bots skip hidden fields. */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.btn:disabled {
  opacity: 0.65;
  cursor: progress;
}

/* 10. Footer -------------------------------------------------------------- */
.site-footer {
  position: relative;
  padding-block: 3rem;
  margin-top: 0;
  font-size: var(--step--1);
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem 3rem;
}

/* Left column: page sitelinks above the copyright, with a blank line between. */
.footer-left {
  display: grid;
  gap: 1.5rem;
}

.footer-copy {
  margin: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Right column: email, phone and site, one per line, flush right. */
.footer-contact {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.15rem;
  text-align: right;
}

.footer-links a {
  text-decoration: none;
  transition: color 0.18s var(--ease);
}

.footer-links a:hover {
  color: var(--text);
}

/* 11. Motion -------------------------------------------------------------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}

.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* Portfolio cards reveal by row as they enter the viewport. */
.js [data-reveal-card] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}

.js [data-reveal-card].is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

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

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

/* 12. Utilities / responsive ---------------------------------------------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

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

.mt-0 {
  margin-top: 0;
}

/* The nav is centred in the header on every page: the logo keeps the left
   edge and the CTA + theme toggle keep the right, so the links sit in the
   middle of the container rather than hugging the buttons. Centring only
   starts once the row is wide enough that the links clear the logo. */
@media (min-width: 60rem) {
  .site-nav {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* The 3:1 lockup only needs to step down when the header is narrow enough
   that the logo and the two round buttons would wrap. */
@media (min-width: 52rem) {
  .form-row {
    grid-template-columns: 1fr 1fr;
  }

  .two-col {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-5);
    align-items: start;
  }

  .two-col--wide {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  }

  .intro-split {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    column-gap: calc(var(--space-5) + 30px);
  }

  .intro-split__action {
    justify-self: end;
  }

  /* Why Emperor: each intro paragraph gets its own column, so the two sit side
     by side under the heading instead of stacking. */
  .section-head--split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: calc(var(--space-5) + 30px);
    align-items: start;
  }

  .section-head--split > div {
    grid-column: 1 / -1;
  }

  /* The left column opens with its eyebrow, then the heading, then the body
     copy. The numbered steps span both rows on the right, so the list starts
     level with the top of the column, beside the eyebrow. */
  .process {
    row-gap: 0;
  }

  .process-head {
    grid-column: 1;
    grid-row: 1;
  }

  .process-body {
    grid-column: 1;
    grid-row: 2;
  }

  /* The numbered steps sit beside the headline column and start level with its
     top, so the list and the eyebrow share a line. */
  .steps-panel {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  /* About story: heading on its own row, then the prose and the capability
     cards side by side with a wider gutter than the default. The cards start
     level with the first paragraph, not the heading. */
  .story {
    row-gap: 0;
    column-gap: var(--space-6);
  }

  .process-head,
  .story-head {
    /* Keeps the heading's bottom margin inside the row so the copy below
       keeps its original spacing. */
    display: flow-root;
  }

  .story-head {
    grid-column: 1;
    grid-row: 1;
  }

  .story-body {
    grid-column: 1;
    grid-row: 2;
  }

  .story-aside {
    grid-column: 2;
    /* Start level with the About Emperor heading instead of the first
       paragraph below it. */
    grid-row: 1 / span 2;
  }
}

@media (max-width: 51.99rem) {
  :root {
    --logo-w: 170px;
  }

  /* Comfortable tap targets for the header controls. */
  .icon-button {
    width: 2.75rem;
    height: 2.75rem;
  }

  .header-inner {
    flex-wrap: wrap;
  }

  .nav-toggle {
    display: inline-grid;
    place-items: center;
    position: relative;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    cursor: pointer;
    color: var(--text);
    order: 3;
  }

  .nav-toggle-bars {
    position: relative;
  }

  .nav-toggle-bars,
  .nav-toggle-bars::before,
  .nav-toggle-bars::after {
    display: block;
    width: 16px;
    height: 1.5px;
    border-radius: 2px;
    background: currentColor;
    transition: transform 0.22s var(--ease), opacity 0.22s var(--ease);
  }

  .nav-toggle-bars::before,
  .nav-toggle-bars::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
  }

  .nav-toggle-bars::before {
    transform: translateY(-5px);
  }

  .nav-toggle-bars::after {
    transform: translateY(5px);
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle-bars {
    background: transparent;
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle-bars::before {
    transform: rotate(45deg);
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle-bars::after {
    transform: rotate(-45deg);
  }

  .theme-toggle {
    order: 2;
  }

  .brand {
    order: 1;
  }

  /* The panel animates on max-height rather than a 0fr/1fr grid row: in an
     auto-height container a fr row resolves to its content, so the grid version
     either never collapsed or never opened depending on where it clipped. */
  .site-nav {
    order: 4;
    flex-basis: 100%;
    display: block;
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
    /* The panel takes the page's own reveal fade (opacity plus a short rise, on
       the same 0.6s curve) so it settles in instead of snapping open. */
    opacity: 0;
    transform: translateY(-8px);
    transition: max-height 0.28s var(--ease), opacity 0.28s var(--ease),
      transform 0.28s var(--ease), visibility 0s linear 0.28s;
  }

  .site-nav > ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
  }

  .site-nav a {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 2.75rem;
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    font-size: 16px;
    text-align: right;
    transition: background-color 0.18s var(--ease), color 0.18s var(--ease);
  }

  /* The global 10% hover wash disappears against the dark glass header. Use a
     clearer teal tint for the stacked menu, with the same state for keyboard
     focus and touch. */
  .site-nav a:hover,
  .site-nav a:focus-visible,
  .site-nav a:active {
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--text);
  }

  .nav-contact {
    display: list-item;
  }

  .site-header[data-nav-open="true"] .site-nav {
    /* Five 18px rows need slightly more than the old 15rem panel height. */
    max-height: min(16rem, calc(100vh - 9rem));
    max-height: min(16rem, calc(100svh - 9rem));
    overflow-y: auto;
    overscroll-behavior: contain;
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: max-height 0.28s var(--ease), opacity 0.28s var(--ease),
      transform 0.28s var(--ease), visibility 0s linear 0s;
  }

  .header-cta {
    display: none;
  }

  /* Phones keep the extra breathing room, one step tighter than desktop so the
     pages do not run long. */
  .section {
    padding-block: 5rem;
  }

  .section--tight {
    padding-block: 3.5rem;
  }

  /* Match the tighter H1-to-lead gap used on the other pages, and give the
     quote button more room below the standfirst. */
  .intro-split {
    margin-top: 0;
    gap: 1.75rem;
  }

  /* Stacked WordPress and process blocks: keep the link clear of the next
     heading instead of letting them touch. */
  section[aria-labelledby="wordpress-heading"] .two-col > div + div {
    margin-top: var(--space-4);
  }

  /* Stacked layout: give the list and the capability cards room beneath the
     copy instead of butting straight up against it. */
  .steps-panel,
  .story-aside {
    margin-top: var(--space-4);
  }

  /* Lead copy steps down to body size on phones. */
  .lead {
    font-size: calc(1rem * var(--type-lead));
  }

  /* Footer stacks: sitelinks (one per line), then contact, then copyright last.
     `display: contents` lifts the nav and copyright out of their wrapper so the
     whole footer can be ordered and centred as a single column. */
  .footer-inner {
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    text-align: center;
  }

  .footer-left {
    display: contents;
  }

  .footer-nav {
    order: 1;
  }

  .footer-contact {
    order: 2;
    align-items: center;
    text-align: center;
  }

  .footer-copy {
    order: 3;
  }

  /* Each sitelink used to carry a 2.5rem touch row plus a 0.5rem gap, which left
     48px between one word and the next. Zero gap and a 2rem row bring that down
     to 32px, so the list reads as one stack instead of a spread-out column. */
  .footer-links--pages {
    flex-direction: column;
    align-items: center;
    gap: 0;
  }


  /* The footer on phones is a column of text links, so each one gets a full
     touch target rather than just the height of its line box. */
  .footer-links a {
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;
  }

  /* The sitelinks stack immediately after this rule, so they drop the taller
     touch row: at 2rem with no gap the words sit 32px apart instead of 48px. */
  .footer-links--pages a {
    min-height: 2rem;
  }

  /* Phone-sized text floor for labels and secondary copy. */
  .info-label,
  .field .hint,
  .work-card__cat {
    font-size: 0.8rem;
  }

  /* 16px form text stops iOS Safari zooming the page on focus, and the filter
     chips get the same 44px target as the header buttons. */
  input,
  textarea,
  select {
    font-size: 1rem;
  }

  .filter {
    min-height: 2.75rem;
    font-size: 0.8rem;
  }

  /* Contact: the details block needs the same breathing room as every other
     stacked block instead of butting up under the submit button. */
  .contact-layout {
    display: grid;
    gap: var(--space-5);
  }

  /* The hero label drops its separator and breaks before the city on phones. */
  .eyebrow-sep {
    display: none;
  }

  .br-mobile {
    display: inline;
  }

  /* The banner keeps its photograph but gives the copy room on smaller screens. */
  .hero {
    min-height: min(84svh, 42rem);
    align-items: flex-start;
    padding-block: calc(
        var(--header-h) + var(--header-pad-top) + var(--header-pad-bottom) + 3rem
      )
      clamp(2.25rem, 8vw, 3rem);
  }

  /* Phones need less clearance than the desktop banner. */
  .hero.hero--banner {
    padding-top: 240px;
  }

  /* Lightbox: arrows above and below the image on phones. */
  dialog.lightbox[open] {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
  }

  .lightbox img {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    max-height: 72vh;
    object-fit: contain;
  }

  .lightbox-nav--prev {
    grid-column: 1;
    grid-row: 1;
    justify-self: center;
  }

  .lightbox-nav--next {
    grid-column: 1;
    grid-row: 3;
    justify-self: center;
  }

  .lightbox-bar {
    grid-column: 1;
    grid-row: 4;
    margin-top: 0.25rem;
  }
}

/* Narrowest phones: the 3:1 lockup plus two round buttons still has to fit
   on one row inside the header. */
@media (max-width: 23rem) {
  :root {
    --logo-w: 150px;
  }

  .header-inner {
    gap: var(--space-2);
  }
}

@media print {
  .site-header,
  .site-footer,
  .hero-actions,
  .theme-toggle,
  .nav-toggle,
  .filters,
  .lightbox {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

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

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