/* =========================================================
   WRENCHVERSE BESPOKE · STYLES

    1. Design tokens (colours, type, spacing)
    2. Basics
    3. Layout helpers & shared text styles
    4. Buttons & links
    5. Header & navigation
    6. Story (scrollytelling network)
    7. Paper sections & the cost calculator
    8. Symptom vs cause table
    9. Method
   10. Capabilities & scenarios
   11. Pricing
   12. Contact & enquiry form
   13. Footer
   14. Interactive pieces: ticker, path finder, fitting
   15. Reduced motion
   ========================================================= */

/* =========================================================
   1. DESIGN TOKENS
   Change these values to restyle the whole site.
   ========================================================= */
:root {
  /* Royal plum & brass. Each accent has one job:
     brass = craft and action (buttons, labels, focus, stitching, seal)
     purple = voice and emphasis (highlighted words, links, quotes)
     green = flowing / fixed (diagrams, correct answers, done)
     friction = garnet (congestion, problems) */

  /* Dark surfaces */
  --ink: #17111d; /* page background, deep aubergine */
  --ink-2: #21182a; /* plum, for alternating sections */
  --ink-3: #2a2034;
  --line: rgba(245, 239, 227, 0.12); /* fine borders on dark */

  /* Light ("paper") surfaces, used for the practical sections */
  --paper: #f5efe3; /* ivory */
  --paper-2: #ebe3d3;
  --paper-line: rgba(29, 22, 34, 0.14);
  --paper-text: #1d1622;
  --paper-muted: #5a5163;

  /* Text on dark */
  --text: #f5efe3; /* ivory */
  --muted: #b2a8ba;

  /* Accents (all pass WCAG AA on the surfaces they're used on) */
  --brass: #c9a45c;
  --brass-deep: #7d5f22; /* brass that's readable on paper */
  --purple: #b49ad8;
  --purple-deep: #5c3f86; /* purple that's readable on paper */
  --green: #5fbf8f;
  --green-deep: #24664a; /* green that's readable on paper */
  --friction: #d0645b; /* garnet */

  /* Type */
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
  /* Headings and quotes: a warm serif already installed on most devices (no download) */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Noto Serif", serif;

  /* Spacing and shape */
  --gutter: 20px;
  --max-width: 1160px;
  --header-h: 64px;
  --radius: 6px;
  --section-pad: clamp(72px, 10vw, 128px);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px); /* keeps headings clear of the header */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
  font-weight: 650;
}

h1 {
  font-size: clamp(2.1rem, 5vw, 3.6rem);
}

h2 {
  font-size: clamp(1.7rem, 3.6vw, 2.6rem);
}

h3 {
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}

/* Website headings use the serif; the client portal keeps the plain sans for its app screens */
body:not(.portal) h1,
body:not(.portal) h2 {
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: -0.012em;
}

/* Highlighted words in headings */
h1 em,
h2 em {
  font-style: normal;
  color: var(--purple);
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--purple);
  text-underline-offset: 3px;
}

img,
svg {
  max-width: 100%;
}

/* Visible keyboard focus everywhere */
:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--brass);
  color: var(--ink);
  font-weight: 600;
}

.skip-link:focus {
  top: 12px;
}

/* =========================================================
   3. LAYOUT HELPERS & SHARED TEXT STYLES
   ========================================================= */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section {
  padding: var(--section-pad) 0;
}

.section--alt {
  background: var(--ink-2);
}

.section__lead {
  max-width: 620px;
  color: var(--muted);
  font-size: 1.1rem;
}

/* Small technical label above headings */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 1em;
}

/* The brand line above the hero headline: a sentence, so not uppercased */
.eyebrow--brand {
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: 0.95rem;
}

/* On narrow screens, break between the two sentences, never inside one */
.eyebrow--brand span {
  display: inline-block;
}

.lead {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 34em;
}

.fine {
  font-size: 0.9rem;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 28px 0 20px;
}

/* List with small green ticks */
.tick-list {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
}

.tick-list li {
  position: relative;
  padding: 10px 0 10px 28px;
  border-top: 1px solid var(--paper-line);
}

.tick-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 19px;
  width: 10px;
  height: 6px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  color: var(--brass-deep);
}

.tick-list--compact li {
  padding-top: 6px;
  padding-bottom: 6px;
  font-size: 0.95rem;
}

.tick-list--compact li::before {
  top: 14px;
}

/* =========================================================
   4. BUTTONS & LINKS
   ========================================================= */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 24px;
  border: 1px solid var(--brass);
  border-radius: var(--radius);
  background: var(--brass);
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.button:hover {
  background: #d8b878;
  border-color: #d8b878;
}

.button--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.button--ghost:hover {
  background: rgba(245, 239, 227, 0.06);
  border-color: rgba(245, 239, 227, 0.35);
}

.button--small {
  min-height: 40px;
  padding: 8px 16px;
  font-size: 0.95rem;
}

/* Link with an arrow that nudges on hover */
.arrow-link {
  font-weight: 600;
  text-decoration: none;
}

.arrow-link::after {
  content: "→";
  display: inline-block;
  margin-left: 0.35em;
  transition: transform 0.2s var(--ease);
}

.arrow-link:hover::after {
  transform: translateX(4px);
}

/* =========================================================
   5. HEADER & NAVIGATION
   ========================================================= */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  /* Solid, and on its own layer, so scrolling content never shows through */
  background: var(--ink);
  border-bottom: 1px solid var(--line);
  transform: translateZ(0);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-h);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
}

.logo__name span {
  color: var(--muted);
  font-weight: 500;
}

.logo--small {
  font-size: 0.98rem;
}

.nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav__link {
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  font-weight: 500;
  font-size: 0.98rem;
}

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

/* The menu button only exists on small screens, and only with JavaScript */
.nav-toggle {
  display: none;
}

@media (max-width: 760px) {
  :root {
    --header-h: 56px;
    --gutter: 16px;
  }
}

/* Below 960px the five header items no longer fit on one line,
   so they move into the ☰ menu */
@media (max-width: 960px) {
  .js .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-right: -8px;
    background: none;
    border: 0;
    color: var(--text);
    cursor: pointer;
  }

  /* Three-line icon, which becomes a cross when open */
  .nav-toggle__bars,
  .nav-toggle__bars::before,
  .nav-toggle__bars::after {
    display: block;
    width: 20px;
    height: 2px;
    background: currentColor;
    transition: transform 0.2s var(--ease), background 0.2s;
  }

  .nav-toggle__bars {
    position: relative;
  }

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

  .nav-toggle__bars::before {
    top: -6px;
  }

  .nav-toggle__bars::after {
    top: 6px;
  }

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

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

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

  /* With JavaScript: the links drop down from the header */
  .js .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px var(--gutter) 20px;
    background: var(--ink);
    border-bottom: 1px solid var(--line);
  }

  .js .nav.is-open {
    display: flex;
  }

  .js .nav__link {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
    font-size: 1.05rem;
    color: var(--text);
  }

  .js .nav .button {
    margin-top: 16px;
    min-height: 48px;
  }

  /* Without JavaScript: the links simply wrap below the logo */
  html:not(.js) .header__inner {
    flex-wrap: wrap;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  html:not(.js) .nav {
    flex-wrap: wrap;
    gap: 16px;
  }
}

/* =========================================================
   6. STORY (scrollytelling network)
   The text steps scroll normally. The figure is sticky.
   main.js sets data-scene="0".."4" on .story and the rules
   below restyle the network for each scene.
   ========================================================= */
.story {
  position: relative;
  background:
    radial-gradient(ellipse at 75% 30%, rgba(180, 154, 216, 0.08), transparent 60%),
    var(--ink);
}

.story__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 96px);
}

.story__steps {
  grid-column: 1;
  grid-row: 1;
}

.story__visual {
  grid-column: 2;
  grid-row: 1;
}

.story__figure {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  height: calc(100svh - var(--header-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

.story__step {
  min-height: 62vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 0;
  max-width: 520px;
}

.story__step--hero {
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100svh - var(--header-h));
}

.story__step:last-child {
  min-height: 60vh;
}

/* Inactive steps are dimmed so the reader's eye follows the active one.
   0.75 is the lowest opacity that keeps the dimmed text above WCAG AA
   contrast (4.5:1) on the dark background; don't go lower. */
.js .story__step {
  opacity: 0.75;
  transition: opacity 0.4s var(--ease);
}

.js .story__step.is-active {
  opacity: 1;
}

/* Figure caption row and legend */
.figure-label,
.figure-legend {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.figure-label {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.figure-status span {
  display: none;
  color: var(--green);
}

.story[data-scene="1"] .figure-status span,
.story[data-scene="2"] .figure-status span,
.story[data-scene="3"] .figure-status span {
  color: var(--friction);
}

.story[data-scene="0"] .figure-status [data-for="0"],
.story[data-scene="1"] .figure-status [data-for="1"],
.story[data-scene="2"] .figure-status [data-for="2"],
.story[data-scene="3"] .figure-status [data-for="3"],
.story[data-scene="4"] .figure-status [data-for="4"] {
  display: inline;
}

.figure-legend {
  justify-content: flex-start;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.legend::before {
  content: "";
  display: inline-block;
  vertical-align: middle;
  width: 18px;
  height: 0;
  margin-right: 8px;
  border-top: 2px solid var(--green);
}

.legend--jam::before {
  border-top: 2px dotted var(--friction);
}

.legend--warn::before {
  content: "!";
  width: auto;
  height: auto;
  vertical-align: baseline;
  margin-right: 6px;
  border: 0;
  color: var(--friction);
  font-weight: 700;
}

/* --- The network drawing --- */
.network {
  display: block;
  width: 100%;
  height: auto;
  max-height: 62vh;
  overflow: visible;
}

.edge__line {
  fill: none;
  stroke: var(--line);
  stroke-width: 2;
}

/* Moving dashes show information flowing along a connection */
.edge__flow {
  fill: none;
  stroke: var(--green);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 2 10;
  animation: flow 1.6s linear infinite;
  transition: stroke 0.5s var(--ease), opacity 0.5s var(--ease);
}

@keyframes flow {
  to {
    stroke-dashoffset: -24;
  }
}

/* Don't animate while the figure is off screen (main.js adds this class) */
.network.is-offscreen .edge__flow {
  animation-play-state: paused;
}

/* Congested connections: amber, dense and slow.
   Scene 1: only around the source. Scenes 2–3: everywhere. */
.story[data-scene="1"] :is([data-role="queue"], [data-role="source"]) .edge__flow,
.story:is([data-scene="2"], [data-scene="3"]) .edge__flow {
  stroke: var(--friction);
  stroke-dasharray: 2 4;
  animation-duration: 5s;
}

/* Side effects only exist while the problem is there */
[data-role="spread"],
[data-role="workaround"],
.node--spread,
.node--workaround {
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}

.story:is([data-scene="2"], [data-scene="3"]) :is([data-role="spread"], [data-role="workaround"], .node--spread, .node--workaround) {
  opacity: 1;
}

/* Workaround connections are drawn dashed, like something improvised */
[data-role="workaround"] .edge__line {
  stroke-dasharray: 6 6;
}

/* Fixed: faster, calmer flow */
.story[data-scene="4"] .edge__flow {
  animation-duration: 1s;
}

/* Nodes */
.node circle {
  fill: var(--ink);
  stroke: var(--green);
  stroke-width: 2.5;
  transition: stroke 0.5s var(--ease), fill 0.5s var(--ease);
}

.node text {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  fill: var(--text);
  text-anchor: middle;
  /* a dark outline behind the text keeps it readable over lines */
  paint-order: stroke;
  stroke: var(--ink);
  stroke-width: 6px;
  stroke-linejoin: round;
}

.node__flag {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}

.node .node__flag--warn {
  fill: var(--friction);
}

.node .node__flag--ok {
  fill: none;
  stroke: var(--green);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The source of the trouble */
.story:is([data-scene="1"], [data-scene="2"], [data-scene="3"]) .node--source circle {
  stroke: var(--friction);
  fill: rgba(208, 100, 91, 0.25);
}

.story:is([data-scene="1"], [data-scene="2"], [data-scene="3"]) .node--source .node__flag--warn {
  opacity: 1;
}

.story[data-scene="4"] .node--source circle {
  fill: var(--green);
}

.story[data-scene="4"] .node--source .node__flag--ok {
  opacity: 1;
}

/* Everything the problem touches */
.story[data-scene="2"] .node--affected circle {
  stroke: var(--friction);
}

.story[data-scene="2"] .node--affected .node__flag--warn {
  opacity: 1;
}

/* Scene 3: dim everything except the source, and show the lens */
.edges,
.nodes .node:not(.node--source) {
  transition: opacity 0.5s var(--ease);
}

.story[data-scene="3"] .edges,
.story[data-scene="3"] .nodes .node:not(.node--source) {
  opacity: 0.25;
}

.lens {
  fill: none;
  stroke: var(--text);
  stroke-width: 1.5;
  stroke-dasharray: 4 5;
  opacity: 0;
  transform-origin: 200px 70px;
  transform: scale(1.6);
  transition: opacity 0.5s var(--ease), transform 0.6s var(--ease);
}

.story[data-scene="3"] .lens {
  opacity: 1;
  transform: scale(1);
}

/* Callouts: short notes shown in one scene each */
.callout {
  font-family: var(--mono);
  font-size: 13px;
  fill: var(--friction);
  text-anchor: middle;
  paint-order: stroke;
  stroke: var(--ink);
  stroke-width: 6px;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}

.callout--start {
  text-anchor: start;
}

.callout--ok {
  fill: var(--green);
}

.story[data-scene="1"] .callout[data-for="1"],
.story[data-scene="2"] .callout[data-for="2"],
.story[data-scene="3"] .callout[data-for="3"],
.story[data-scene="4"] .callout[data-for="4"] {
  opacity: 1;
}

/* --- The fitting: meter, tape rail, queue, pulse, chalk, "your turn" --- */

/* Hours lost this week (modules/story.js) */
.story-meter {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  margin: 0;
  font-family: var(--mono);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}

.story:not([data-scene="0"]) .story-meter {
  opacity: 1;
  transform: none;
}

.story-meter__value {
  font-size: 1.35rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--friction);
}

.story[data-scene="4"] .story-meter__value {
  color: var(--text);
}

.story-meter__label {
  font-size: 0.82rem;
  color: var(--muted);
}

.story-meter__basis {
  flex-basis: 100%;
  font-size: 0.72rem;
  color: var(--muted);
}

/* Tape-measure progress rail */
.story-rail {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.story-rail li {
  position: relative;
  padding-top: 12px;
  color: var(--muted);
  transition: color 0.4s var(--ease);
}

/* each segment of tape, with its end tick */
.story-rail li::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--line);
  border-left: 1px solid rgba(23, 17, 29, 0.6);
  transition: background 0.4s var(--ease);
}

.story[data-scene="0"] .story-rail li:nth-child(-n + 1),
.story[data-scene="1"] .story-rail li:nth-child(-n + 2),
.story[data-scene="2"] .story-rail li:nth-child(-n + 3),
.story[data-scene="3"] .story-rail li:nth-child(-n + 4),
.story[data-scene="4"] .story-rail li:nth-child(-n + 5) {
  color: var(--brass);
}

.story[data-scene="0"] .story-rail li:nth-child(-n + 1)::before,
.story[data-scene="1"] .story-rail li:nth-child(-n + 2)::before,
.story[data-scene="2"] .story-rail li:nth-child(-n + 3)::before,
.story[data-scene="3"] .story-rail li:nth-child(-n + 4)::before,
.story[data-scene="4"] .story-rail li:nth-child(-n + 5)::before {
  background: var(--brass);
}

/* Work queueing in front of the bottleneck */
.queue circle {
  fill: var(--friction);
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0.3);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}

.queue circle:nth-child(2) { transition-delay: 0.08s; }
.queue circle:nth-child(3) { transition-delay: 0.16s; }
.queue circle:nth-child(4) { transition-delay: 0.24s; }
.queue circle:nth-child(5) { transition-delay: 0.32s; }
.queue circle:nth-child(6) { transition-delay: 0.4s; }
.queue circle:nth-child(7) { transition-delay: 0.48s; }

/* Scene 1: a short queue; scenes 2-3: a long one */
.story[data-scene="1"] .queue circle:nth-child(-n + 3),
.story:is([data-scene="2"], [data-scene="3"]) .queue circle {
  opacity: 1;
  transform: scale(1);
}

/* Scene 4: the queue is released in a rush, through the fixed step */
.story[data-scene="4"] .queue circle {
  opacity: 0;
  transform: translateX(150px) scale(0.6);
  transition: opacity 0.7s ease-in, transform 0.7s ease-in;
}

/* The bottleneck pulses while it pinches */
.pulse {
  fill: none;
  stroke: var(--friction);
  stroke-width: 2;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}

.story:is([data-scene="1"], [data-scene="2"]) .pulse {
  animation: pinch 1.6s ease-out infinite;
}

@keyframes pinch {
  0% {
    opacity: 0.8;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.8);
  }
}

.network.is-offscreen .pulse {
  animation-play-state: paused;
}

/* Tailor's chalk marking the source (scene 3) */
.lens {
  stroke: var(--text);
  stroke-width: 2;
  stroke-dasharray: 7 4 2 4;
}

.chalk path {
  stroke: var(--text);
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0;
  transition: opacity 0.4s var(--ease) 0.2s;
}

.story[data-scene="3"] .chalk path {
  opacity: 0.9;
}

.story .callout[data-for="3"] {
  fill: var(--text);
}

/* Callouts slide in as well as fade */
.callout {
  transform: translateY(4px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}

.story[data-scene="1"] .callout[data-for="1"],
.story[data-scene="2"] .callout[data-for="2"],
.story[data-scene="3"] .callout[data-for="3"],
.story[data-scene="4"] .callout[data-for="4"] {
  transform: none;
}

/* "Your turn" */
.guess {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.guess .chip-button[aria-pressed="true"] {
  border-color: var(--brass);
  background: rgba(201, 164, 92, 0.14);
}

.guess .chip-button[aria-pressed="true"]::before {
  content: none;
}

.guess__feedback {
  margin: 16px 0 0;
  padding-left: 14px;
  border-left: 3px solid var(--brass);
}

.guess__feedback:empty {
  display: none;
}

.guess__feedback.is-right {
  border-color: var(--green);
}

/* The visitor's pick is shown only while they're guessing */
.story[data-scene="2"] .node.is-guess circle {
  stroke: var(--brass);
  stroke-width: 4;
}

/* --- Story on tablets and phones: the headline first, then the figure
   sticks at the top while the rest of the story scrolls beneath it --- */
@media (max-width: 860px) {
  .story__inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  /* The steps join the grid directly, so the hero can sit above the figure */
  .story__steps {
    display: contents;
  }

  .story__visual,
  .story__step {
    grid-column: 1;
  }

  .story__step--hero {
    grid-row: 1;
  }

  .story__visual {
    grid-row: 2;
    position: sticky;
    top: var(--header-h);
    z-index: 2;
    background: var(--ink);
    border-bottom: 1px solid var(--line);
    padding: 12px 0;
    margin-bottom: 8px;
  }

  .story__figure {
    position: static;
    height: auto;
    gap: 8px;
  }

  .network {
    max-height: 23vh;
    max-height: 23svh;
    margin: 0 auto;
  }

  /* Keep the sticky figure compact: no caption (the status stays), meter on
     one line, rail as ticks only */
  .figure-label > [data-fit="figure"] {
    display: none;
  }

  .figure-label {
    padding-bottom: 6px;
  }

  .story-meter__value,
  .story-meter__label {
    white-space: nowrap;
  }

  .story-meter__basis {
    flex-basis: 100%;
  }

  /* Tabbing to a "Your turn" button scrolls it clear of the sticky figure */
  .guess .chip-button {
    scroll-margin-top: 62vh;
  }

  .story-rail li {
    padding-top: 8px;
    font-size: 0;
  }

  .story-meter__value {
    font-size: 1.05rem;
  }

  .story-meter__basis {
    font-size: 0.68rem;
  }

  /* The diagram is drawn smaller here, so its text is set larger */
  .node text {
    font-size: 21px;
  }

  .callout {
    font-size: 17px;
  }

  .figure-legend {
    display: none; /* flags and dashes stay visible, the legend is less important here */
  }

  .story__step,
  .story__step--hero {
    min-height: 55vh;
    padding: 24px 0 48px;
  }

  .story__step--hero {
    min-height: 0;
    padding: 32px 0 40px;
  }
}

/* =========================================================
   7. PAPER SECTIONS & THE COST CALCULATOR
   ========================================================= */
.section--paper {
  background: var(--paper);
  color: var(--paper-text);
}

.section--paper .eyebrow {
  color: var(--brass-deep);
}

.section--paper a {
  color: var(--purple-deep);
}

.section--paper .section__lead {
  color: var(--paper-muted);
}

.section--paper :focus-visible {
  outline-color: var(--brass-deep);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: start;
}

.split__intro > p:not(.eyebrow) {
  color: var(--paper-muted);
  font-size: 1.1rem;
}

.calc {
  background: #fbf8f2;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  padding: clamp(20px, 4vw, 36px);
}

.calc h3 {
  margin-bottom: 0.3em;
}

.calc__note {
  font-size: 0.95rem;
  color: var(--paper-muted);
}

.calc__fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 20px;
  margin: 24px 0;
}

/* Form fields, shared by the calculator and the enquiry form */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field label,
.field legend {
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0;
}

.field input,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  font: inherit;
  font-size: 1.05rem; /* 16px+ stops iOS zooming in on focus */
  color: inherit;
  background: transparent;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
}

.field textarea {
  resize: vertical;
}

.field__hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--paper-muted);
}

.field__error,
.calc__error {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #b4231a;
}

.field__error::before,
.calc__error::before {
  content: "⚠ ";
}

.calc input[type="number"] {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  background: #fff;
}

.calc input:focus-visible {
  outline: 2px solid var(--brass-deep);
  outline-offset: 1px;
}

.calc__result {
  padding: 20px 0;
  border-top: 1px solid var(--paper-line);
  border-bottom: 1px solid var(--paper-line);
}

.calc__label {
  margin: 0;
  font-size: 0.9rem;
  color: var(--paper-muted);
}

.calc__total {
  margin: 4px 0;
  font-family: var(--mono);
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.calc__working {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--paper-muted);
  overflow-wrap: anywhere;
}

.calc__scenario {
  padding: 20px 0 8px;
}

.calc__scenario label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 10px;
}

.calc__scenario input[type="range"] {
  width: 100%;
  height: 32px;
  accent-color: var(--brass-deep);
}

.calc__scenario-result {
  margin: 4px 0 0;
  color: var(--paper-muted);
}

.calc__scenario-result output {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--paper-text);
}

.calc__disclaimer {
  margin: 12px 0 0;
  font-size: 0.85rem;
  color: var(--paper-muted);
}

@media (max-width: 860px) {
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 420px) {
  .calc__fields {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* =========================================================
   8. SYMPTOM VS CAUSE TABLE
   ========================================================= */
.cause-table {
  margin-top: 48px;
  border-top: 1px solid var(--line);
}

.cause-table__row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.cause-table__head {
  padding: 14px 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Colour plus position tell the three columns apart */
.cause-table__row:not(.cause-table__head) [role="cell"]:nth-child(1) {
  color: var(--muted);
}

.cause-table__row:not(.cause-table__head) [role="cell"]:nth-child(2) {
  color: var(--friction);
}

.cause-table__row:not(.cause-table__head) [role="cell"]:nth-child(3) {
  color: var(--text);
  font-weight: 600;
}

@media (max-width: 760px) {
  .cause-table__head {
    display: none;
  }

  .cause-table__row {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  /* On phones, each cell shows its column name above it */
  .cause-table [role="cell"]::before {
    content: attr(data-label);
    display: block;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 400;
  }
}

/* =========================================================
   9. METHOD
   ========================================================= */
.method {
  list-style: none;
  padding: 0;
  margin: 48px 0 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.method li {
  padding: 24px 20px 8px 0;
  position: relative;
}

/* A small green tick on the shared top line marks each step */
.method li::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brass);
}

.method__num {
  display: block;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--brass);
  margin-bottom: 10px;
}

.method p {
  color: var(--muted);
  font-size: 0.98rem;
}

@media (max-width: 960px) {
  .method {
    grid-template-columns: minmax(0, 1fr);
    border-top: 0;
    border-left: 1px solid var(--line);
    margin-left: 4px;
  }

  .method li {
    padding: 0 0 28px 28px;
  }

  .method li::before {
    top: 4px;
    left: -4px;
  }
}

/* =========================================================
   10. CAPABILITIES & SCENARIOS
   ========================================================= */
.capabilities {
  list-style: none;
  padding: 0;
  margin: 40px 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 48px;
  border-top: 1px solid var(--line);
}

.capabilities li {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

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

.scenarios {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 56px;
}

.scenario {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink-2);
}

.scenario__tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px dashed var(--line);
  padding: 3px 8px;
  border-radius: 3px;
}

.scenario p:not(.scenario__tag) {
  color: var(--muted);
}

.scenario strong {
  color: var(--text);
}

@media (max-width: 760px) {
  .capabilities,
  .scenarios {
    grid-template-columns: minmax(0, 1fr);
  }

  .scenario {
    padding: 22px;
  }
}

/* =========================================================
   11. PRICING
   ========================================================= */
.stages {
  list-style: none;
  padding: 0;
  margin: 40px 0 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr);
  border-top: 2px solid var(--paper-text);
}

.stage {
  padding: 24px 24px 24px 0;
}

.stage + .stage {
  padding-left: 24px;
  border-left: 1px solid var(--paper-line);
}

/* The two "Step 3" options (sprint, implementation) share the third column */
.stage:nth-child(1),
.stage:nth-child(2) {
  grid-row: 1 / span 2;
}

.stage:nth-child(4) {
  grid-area: 2 / 3;
  border-top: 1px solid var(--paper-line);
}

.stage:nth-child(5) {
  grid-area: 1 / 4 / span 2;
}

.stage__step {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper-muted);
}

.stage__price {
  font-family: var(--mono);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.8em;
}

.stage__price span {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--paper-muted);
}

.stage p {
  font-size: 0.97rem;
}

.stage--featured {
  background: #fbf8f2;
  box-shadow: inset 0 3px 0 var(--brass-deep);
  padding-right: 24px;
}

.stage__subhead {
  margin: 1.2em 0 0;
  font-weight: 600;
}

.credit {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px;
  margin-top: 40px;
  padding: 20px 0;
  border-top: 1px solid var(--paper-line);
  border-bottom: 1px solid var(--paper-line);
}

.credit p {
  margin: 0;
}

.credit__title {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass-deep);
  padding-top: 3px;
}

.faq {
  margin-top: 32px;
  max-width: 760px;
}

.faq details {
  border-bottom: 1px solid var(--paper-line);
}

.faq summary {
  cursor: pointer;
  padding: 16px 32px 16px 0;
  font-weight: 600;
  list-style: none;
  position: relative;
}

.faq summary::-webkit-details-marker {
  display: none;
}

/* + / − indicator */
.faq summary::after {
  content: "+";
  position: absolute;
  right: 4px;
  top: 14px;
  font-family: var(--mono);
  font-size: 1.2rem;
  color: var(--brass-deep);
}

.faq details[open] summary::after {
  content: "−";
}

.faq details p {
  color: var(--paper-muted);
  padding-bottom: 8px;
}

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

  .stage:nth-child(n) {
    grid-area: auto;
  }

  .stage:nth-child(5) {
    grid-column: 1 / -1;
  }

  .stage:nth-child(3),
  .stage:nth-child(5) {
    padding-left: 0;
    border-left: 0;
  }

  .stage:nth-child(n + 3) {
    border-top: 1px solid var(--paper-line);
  }
}

@media (max-width: 640px) {
  .stages {
    grid-template-columns: minmax(0, 1fr);
  }

  .stage,
  .stage + .stage {
    padding: 22px 0;
    border-left: 0;
  }

  .stage + .stage {
    border-top: 1px solid var(--paper-line);
  }

  .stage--featured {
    padding: 22px 18px;
  }

  .credit {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }
}

/* =========================================================
   12. CONTACT & ENQUIRY FORM
   ========================================================= */
.contact {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(180, 154, 216, 0.1), transparent 55%),
    var(--ink);
}

.contact__title {
  max-width: 900px;
  margin-bottom: 56px;
}

.contact__title em {
  display: block;
}

.contact__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 80px);
  align-items: start;
}

.enquiry {
  padding: clamp(20px, 4vw, 36px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink-2);
}

.enquiry__intro {
  color: var(--muted);
  font-size: 0.97rem;
}

.enquiry .field {
  margin-top: 20px;
}

.enquiry .field input,
.enquiry .field textarea {
  border-color: var(--line);
  background: var(--ink);
}

.enquiry .field input:focus-visible,
.enquiry .field textarea:focus-visible {
  outline-offset: 1px;
}

.enquiry .field__hint,
.optional {
  color: var(--muted);
  font-weight: 400;
}

.enquiry .field__error {
  color: #ff9b8f;
}

.enquiry [aria-invalid="true"] {
  border-color: #ff9b8f;
}

.enquiry__row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 20px;
}

/* Bottleneck chips: real radio buttons, styled as pills */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.chip {
  position: relative;
}

.chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.chip span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.93rem;
  color: var(--muted);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.chip:hover span {
  border-color: rgba(245, 239, 227, 0.35);
}

.chip input:checked + span {
  border-color: var(--purple);
  color: var(--text);
  background: rgba(180, 154, 216, 0.12);
}

/* A tick, so the selected state doesn't rely on colour alone */
.chip input:checked + span::before {
  content: "";
  width: 9px;
  height: 5px;
  margin: -3px 8px 0 0;
  border-left: 2px solid var(--purple);
  border-bottom: 2px solid var(--purple);
  transform: rotate(-45deg);
}

.chip input:focus-visible + span {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

.chip-hint {
  margin: 10px 0 0;
  font-size: 0.93rem;
  color: var(--muted);
}

.chip-hint:empty {
  display: none;
}

.checkbox {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 20px;
  font-size: 0.95rem;
  color: var(--muted);
  cursor: pointer;
}

.checkbox input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--brass);
}

.checkbox strong {
  color: var(--text);
  font-family: var(--mono);
}

.enquiry__status {
  margin: 0;
  font-size: 0.93rem;
  color: var(--muted);
}

.enquiry__privacy {
  margin: 16px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.enquiry__status:empty {
  display: none;
}

.enquiry__status.is-success::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 5px;
  margin: 0 8px 3px 1px;
  border-left: 2px solid var(--green);
  border-bottom: 2px solid var(--green);
  transform: rotate(-45deg);
}

.enquiry__status.is-error::before {
  content: "⚠ ";
  color: #ff9b8f;
}

.contact__aside h3 {
  margin-bottom: 16px;
}

.aside-links {
  list-style: none;
  padding: 0;
  margin: 0 0 32px;
  border-top: 1px solid var(--line);
}

.aside-links li {
  border-bottom: 1px solid var(--line);
}

.aside-links a {
  display: block;
  padding: 14px 0;
}

.contact__direct,
.contact__who {
  color: var(--muted);
}

.contact__who strong {
  color: var(--text);
}

.contact__who {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.contact__direct a {
  font-family: var(--mono);
  font-size: 1rem;
  overflow-wrap: anywhere;
}

@media (max-width: 860px) {
  .contact__grid,
  .enquiry__row {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* =========================================================
   13. FOOTER
   ========================================================= */
.footer {
  padding: 40px 0;
  border-top: 1px solid var(--line);
  font-size: 0.93rem;
  color: var(--muted);
}

.footer__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px 32px;
  align-items: center;
}

.footer p {
  margin: 0;
}

.footer__line {
  font-family: var(--mono);
  font-size: 0.8rem;
}

.footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}

.footer__nav a {
  color: var(--text);
  text-decoration: none;
}

.footer__nav a:hover {
  color: var(--purple);
}

.footer__copy {
  grid-column: 1 / -1;
  font-size: 0.85rem;
}

@media (max-width: 760px) {
  .footer__inner {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* =========================================================
   14. INTERACTIVE PIECES
   Built by the modules in /static/js/modules. They need
   JavaScript, so their sections are hidden without it.
   ========================================================= */
html:not(.js) .js-only {
  display: none;
}

.section--alt .scenario {
  background: var(--ink);
}

/* Legend entries that use a character instead of a line */
.legend--glyph::before {
  content: attr(data-glyph);
  width: auto;
  height: auto;
  vertical-align: baseline;
  margin-right: 6px;
  border: 0;
  color: var(--friction);
  font-weight: 700;
}

/* Pill-shaped toggle buttons (fitting, enquiry) */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-button {
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.chip-button:hover {
  border-color: rgba(245, 239, 227, 0.35);
}

.chip-button[aria-pressed="true"] {
  border-color: var(--friction);
  background: rgba(208, 100, 91, 0.14);
}

.chip-button[aria-pressed="true"]::before {
  content: "✕ ";
  color: var(--friction);
}

/* --- Live cost ticker (inside the calculator) --- */
.ticker {
  padding: 18px 0;
  border-bottom: 1px solid var(--paper-line);
}

.ticker__label {
  margin: 0 0 4px;
  font-size: 0.9rem;
  color: var(--paper-muted);
}

.ticker__value {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #9b3a33; /* amber, darkened to stay readable on paper */
}

.ticker.is-empty .ticker__value {
  color: var(--paper-muted);
}

/* --- "Where do I start?" path finder (on paper) --- */
.pathfinder {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  margin: 40px 0 56px;
  align-items: start;
}

.pathfinder__form h3 {
  margin-bottom: 20px;
}

.pathfinder fieldset {
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}

.pathfinder legend {
  font-weight: 650;
  margin-bottom: 8px;
  padding: 0;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--paper-line);
  border-top-width: 0;
  cursor: pointer;
  font-size: 0.97rem;
  transition: background 0.2s;
}

.option:first-of-type {
  border-top-width: 1px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.option:last-of-type {
  border-radius: 0 0 var(--radius) var(--radius);
}

.option:hover {
  background: #fbf8f2;
}

.option:has(input:checked) {
  background: #fbf8f2;
  box-shadow: inset 3px 0 0 var(--brass-deep);
  font-weight: 600;
}

.option input {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: none;
  accent-color: var(--brass-deep);
}

.pathfinder__result {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  padding: 24px;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  background: #fbf8f2;
}

.pathfinder__waiting {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--paper-muted);
}

.pathfinder__label {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass-deep);
}

.pathfinder__price {
  display: block;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--paper-muted);
}

.pathfinder__note {
  margin: 16px 0;
  font-size: 0.88rem;
  color: var(--paper-muted);
}

.section--paper .pathfinder .button {
  color: var(--ink);
}

@media (max-width: 860px) {
  .pathfinder {
    grid-template-columns: minmax(0, 1fr);
  }

  .pathfinder__result {
    position: static;
  }
}

/* --- Enquiry form extras ("Add to my email") --- */
.extras {
  margin: 20px 0 0;
  padding: 0;
  border: 0;
}

.extras legend {
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0;
}

.extras .checkbox {
  margin-top: 10px;
}

/* =========================================================
   BESPOKE DETAILS
   Made to measure (fitting), the founder's notes, the tape
   measure and stitched edges: small tailoring touches.
   ========================================================= */

/* --- "Fit this page to your business" --- */
.fitting {
  margin-top: 28px;
  padding: 0 0 4px;
}

/* A tailor's swing tag, with its punched hole */
.fitting__tag {
  position: relative;
  display: inline-block;
  margin: 0 0 12px;
  padding: 4px 12px 4px 24px;
  border-radius: 3px;
  background: var(--paper);
  color: var(--paper-text);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fitting__tag::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: var(--ink);
}

.fitting__options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-button--fit[aria-pressed="true"] {
  border-color: var(--purple);
  background: rgba(180, 154, 216, 0.12);
}

/* A drawn tick on the chosen fitting */
.chip-button--fit[aria-pressed="true"]::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 5px;
  margin: 0 8px 3px 0;
  border-left: 2px solid var(--purple);
  border-bottom: 2px solid var(--purple);
  transform: rotate(-45deg);
}

.fitting__status {
  margin: 10px 0 0;
  font-size: 0.9rem;
  color: var(--purple);
}

.fitting__status:empty {
  display: none;
}

/* --- Maker's seal (static/img/seal.svg) --- */
.brand-line {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 1em;
}

.brand-line .eyebrow {
  margin: 0;
}

.seal {
  display: block;
  flex: none;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35));
}

.seal--small {
  width: 52px;
  height: 52px;
}

/* --- Fitting: intro line and business name --- */
.fitting__intro {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: var(--muted);
}

.fitting__name {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 360px;
  margin-top: 16px;
}

.fitting__name label {
  font-size: 0.9rem;
  font-weight: 600;
}

.fitting__name .optional {
  color: var(--muted);
  font-weight: 400;
}

.fitting__name input {
  min-height: 44px;
  padding: 9px 12px;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.fitting__name input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

/* --- The invitation (the enquiry form, as an ivory card) --- */
.enquiry {
  position: relative;
  background: var(--paper);
  color: var(--paper-text);
  border: 2px solid var(--brass);
  /* a second, finer brass rule just inside: an engraved card */
  box-shadow: inset 0 0 0 6px var(--paper), inset 0 0 0 7px rgba(201, 164, 92, 0.55);
}

.invitation__head {
  text-align: center;
  padding: 4px 0 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--paper-line);
}

.invitation__head .seal {
  width: 76px;
  height: 76px;
  margin: 0 auto 10px;
}

.invitation__title {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 3vw, 1.7rem);
  font-weight: 700;
  color: var(--paper-text);
  margin: 0;
}

.invitation__kicker {
  display: block;
  margin-bottom: 4px;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass-deep);
}

.invitation__for {
  margin: 8px 0 0;
  font-family: var(--serif);
  font-style: italic;
  color: var(--paper-muted);
}

.invitation__for span {
  color: var(--purple-deep);
  font-style: normal;
  font-weight: 700;
}

.invitation__sign {
  margin: 20px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--paper-line);
  font-family: var(--serif);
  font-style: italic;
  color: var(--paper-muted);
}

.invitation__sign span {
  display: block;
  font-size: 1.25rem;
  color: var(--paper-text);
}

/* Everything inside the card in its ivory colours */
.enquiry .enquiry__intro,
.enquiry .field__hint,
.enquiry .optional,
.enquiry .checkbox,
.enquiry .chip-hint,
.enquiry .enquiry__status,
.enquiry .enquiry__privacy {
  color: var(--paper-muted);
}

.enquiry .field input,
.enquiry .field textarea {
  background: #fff;
  border-color: var(--paper-line);
  color: var(--paper-text);
}

.enquiry .field__error {
  color: #b4231a;
}

.enquiry [aria-invalid="true"] {
  border-color: #b4231a;
}

.enquiry :focus-visible,
.enquiry .chip input:focus-visible + span {
  outline-color: var(--brass-deep);
}

.enquiry .chip span {
  border-color: var(--paper-line);
  color: var(--paper-muted);
}

.enquiry .chip:hover span {
  border-color: rgba(29, 22, 34, 0.35);
}

.enquiry .chip input:checked + span {
  border-color: var(--purple-deep);
  background: rgba(92, 63, 134, 0.1);
  color: var(--paper-text);
}

.enquiry .chip input:checked + span::before {
  border-color: var(--purple-deep);
}

.enquiry .checkbox strong {
  color: var(--paper-text);
}

.enquiry .checkbox input {
  accent-color: var(--purple-deep);
}

.enquiry .button--ghost {
  color: var(--paper-text);
  border-color: var(--paper-line);
}

.enquiry .button--ghost:hover {
  background: rgba(29, 22, 34, 0.05);
  border-color: rgba(29, 22, 34, 0.35);
}

.enquiry .enquiry__privacy a {
  color: var(--purple-deep);
}

.enquiry .enquiry__status.is-success::before {
  border-color: var(--green-deep);
}

.enquiry .enquiry__status.is-error::before {
  color: #b4231a;
}

.contact__service {
  margin-bottom: 10px;
}

.enquiry .field select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  font: inherit;
  font-size: 1rem;
  color: var(--paper-text);
  background: #fff;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
}

/* --- What happens next (inside the invitation) --- */
.next-steps {
  list-style: none;
  margin: 18px 0 4px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  font-size: 0.88rem;
  color: var(--paper-muted);
}

.next-steps li {
  padding-top: 10px;
  border-top: 2px solid var(--brass);
}

.next-steps span {
  display: block;
  margin-bottom: 2px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--brass-deep);
}

@media (max-width: 560px) {
  .next-steps {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* --- A peek at the diagnostic: a sample document --- */
.sample {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: start;
  margin-top: 64px;
}

.sample__intro {
  position: sticky;
  top: calc(var(--header-h) + 32px);
}

.sample__intro p {
  color: var(--paper-muted);
}

/* A sheet of paper, slightly lifted off the page */
.sheet {
  position: relative;
  padding: clamp(22px, 4vw, 40px);
  background: #fffdf8;
  color: var(--paper-text);
  border: 1px solid var(--paper-line);
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(29, 22, 34, 0.04), 0 18px 40px -18px rgba(29, 22, 34, 0.35);
  font-size: 0.95rem;
  overflow: hidden;
}

/* "SAMPLE" stamped in the corner */
.sheet__stamp {
  position: absolute;
  top: 22px;
  right: -38px;
  width: 160px;
  margin: 0;
  padding: 4px 0;
  transform: rotate(35deg);
  background: var(--purple-deep);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
}

.sheet__head {
  padding-bottom: 14px;
  margin-bottom: 6px;
  border-bottom: 2px solid var(--paper-text);
}

.sheet__kind {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass-deep);
}

.sheet h4 {
  margin: 4px 0 10px;
  font-family: var(--serif);
  font-size: 1.5rem;
}

.sheet__meta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 14px;
  margin: 0;
  font-size: 0.85rem;
}

.sheet__meta dt {
  color: var(--paper-muted);
}

.sheet__meta dd {
  margin: 0;
}

.sheet__part {
  padding: 14px 0;
  border-bottom: 1px solid var(--paper-line);
}

.sheet__part:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.sheet h5 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.sheet__part p {
  margin: 0 0 6px;
  color: var(--paper-muted);
}

.sheet__part strong {
  color: var(--paper-text);
}

/* The workflow as a little chain, with the source marked */
.sheet__flow {
  list-style: none;
  margin: 8px 0 10px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 4px;
  font-size: 0.85rem;
}

.sheet__flow li {
  padding: 4px 10px;
  border: 1px solid var(--paper-line);
  border-radius: 999px;
}

.sheet__flow li + li::before {
  content: "→ ";
  color: var(--paper-muted);
}

.sheet__flow li span {
  display: block;
  font-size: 0.75rem;
  color: var(--paper-muted);
}

.sheet__flow .is-source {
  border-color: var(--friction);
  border-style: dashed;
}

.sheet__options {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.sheet__options th,
.sheet__options td {
  padding: 8px 8px 8px 0;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--paper-line);
}

.sheet__options th {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--paper-muted);
}

.sheet__options .is-chosen td {
  font-weight: 600;
  background: rgba(201, 164, 92, 0.12);
}

.sheet__options .is-chosen td:first-child {
  box-shadow: inset 3px 0 0 var(--brass-deep);
  padding-left: 8px;
}

.sheet__sign {
  margin-top: 10px !important;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--paper-text) !important;
}

@media (max-width: 860px) {
  .sample {
    grid-template-columns: minmax(0, 1fr);
  }

  .sample__intro {
    position: static;
  }
}

/* --- Closing: the label sewn into the finished suit --- */
.finale {
  padding: clamp(56px, 8vw, 96px) 0;
  border-top: 1px solid var(--line);
}

.finale__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.finale__strip {
  width: 100%;
  max-width: 420px;
  height: auto;
  overflow: visible;
}

.finale__nodes circle {
  fill: var(--ink);
  stroke: var(--green);
  stroke-width: 2.5;
}

.finale__strip.is-offscreen .edge__flow {
  animation-play-state: paused;
}

.woven-label {
  position: relative;
  max-width: 420px;
  padding: 28px 32px 24px;
  text-align: center;
  background: var(--paper);
  color: var(--paper-text);
  border-radius: 4px;
}

.woven-label::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1.5px dashed rgba(29, 22, 34, 0.3);
  border-radius: 2px;
  pointer-events: none;
}

.woven-label .seal {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
}

.woven-label__line {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
}

.woven-label__line em {
  font-style: normal;
  color: var(--purple-deep);
}

.woven-label__by span {
  white-space: nowrap;
}

.woven-label__by {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--paper-muted);
}

/* --- Tape measure in the calculator --- */
.tape {
  position: relative;
  height: 22px;
  margin: 16px 0 6px;
  border: 1px solid var(--paper-line);
  border-radius: 3px;
  overflow: hidden;
  /* tick marks: small every 5%, tall every 25% */
  background:
    linear-gradient(to right, rgba(29, 22, 34, 0.35) 1px, transparent 1px) 0 100% / 25% 100% repeat-x,
    linear-gradient(to right, rgba(29, 22, 34, 0.25) 1px, transparent 1px) 0 100% / 5% 40% repeat-x,
    #fff;
}

.tape__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 10%;
  background: rgba(208, 100, 91, 0.4);
  border-right: 2px solid #9b3a33;
  transition: width 0.4s var(--ease);
}

.calc__time-share {
  margin: 0;
  font-size: 0.88rem;
  color: var(--paper-muted);
}

/* --- Notes from Henrico --- */
.note {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 20px;
  align-items: start;
  max-width: 760px;
  margin: 48px 0;
  padding: 24px 26px;
  border-radius: var(--radius);
  background: #fbf8f2;
  color: var(--paper-text);
}

/* Stitching just inside the edge */
.note::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1.5px dashed var(--paper-line);
  border-radius: 3px;
  pointer-events: none;
}

.note__face {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--brass-deep);
  grid-row: span 2;
}

.note__quote {
  margin: 0;
}

.note__quote p {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.1rem, 2.2vw, 1.3rem);
  line-height: 1.45;
}

.note__by {
  font-size: 0.88rem;
  color: var(--paper-muted);
}

.note__by a {
  color: var(--purple-deep);
}

.note--dark {
  background: var(--ink-2);
  color: var(--text);
}

.note--dark::before {
  border-color: var(--line);
}

.note--dark .note__face {
  border-color: var(--brass);
}

.note--dark .note__by {
  color: var(--muted);
}

.note--dark .note__by a {
  color: var(--purple);
}

.contact__who .note__face {
  width: 56px;
  height: 56px;
  border-color: var(--brass);
}

@media (max-width: 560px) {
  .note {
    gap: 6px 14px;
    padding: 20px;
  }

  .note__face {
    width: 48px;
    height: 48px;
  }
}

/* --- Stitched edges on the light sections --- */
.section--paper {
  position: relative;
}

.section--paper::before,
.section--paper::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  border-top: 1.5px dashed rgba(29, 22, 34, 0.16);
  pointer-events: none;
}

.section--paper::before {
  top: 10px;
}

.section--paper::after {
  bottom: 10px;
}

/* The founder's facts card gets the same stitching */
.founder__facts::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1.5px dashed var(--line);
  border-radius: 3px;
  pointer-events: none;
}

/* =========================================================
   ABOUT THE FOUNDER (about.html)
   ========================================================= */
.founder-intro {
  padding-bottom: clamp(40px, 6vw, 72px);
  background:
    radial-gradient(ellipse at 80% 0%, rgba(180, 154, 216, 0.1), transparent 55%),
    var(--ink);
}

.founder-intro__inner {
  display: flex;
  align-items: flex-end;
  gap: clamp(24px, 5vw, 56px);
}

/* Shown once a photo is added (see the comment in about.html) */
.founder-photo {
  width: clamp(220px, 26vw, 340px);
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  flex: none;
}

.founder-tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  font-weight: 600;
  color: var(--purple);
  margin: 0;
  max-width: 34em;
}

/* The story follows straight on from the intro, without a second full gap */
.founder {
  padding-top: clamp(40px, 6vw, 72px);
}

.founder__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: clamp(32px, 6vw, 88px);
  align-items: start;
}

.founder__story {
  max-width: 680px;
  font-size: 1.1rem;
  line-height: 1.75;
}

.founder__story p {
  color: var(--text);
  margin-bottom: 1.2em;
}

/* The opening sentence leads in a little larger */
.founder__first {
  font-size: 1.25rem;
  line-height: 1.6;
}

/* "But good software doesn't begin with code." — a turning point */
.founder__turn {
  margin: 2em 0 1em !important;
  padding-top: 1.2em;
  border-top: 1px solid var(--line);
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.founder__quote {
  margin: 1.8em 0;
  padding: 4px 0 4px 22px;
  border-left: 3px solid var(--purple);
}

.founder__quote p {
  font-family: var(--serif);
  margin: 0 !important;
  font-size: 1.2rem;
  line-height: 1.5;
}

.founder__quote--big p {
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.founder__quote--big strong {
  color: var(--purple);
}

.founder__signoff {
  margin-top: 2em;
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--muted) !important;
}

.founder__facts {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink);
}

.founder__facts-title {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass);
}

.founder__facts dl {
  margin: 0;
}

.founder__facts dt {
  margin-top: 14px;
  font-size: 0.8rem;
  color: var(--muted);
}

.founder__facts dd {
  margin: 2px 0 0;
  font-size: 0.97rem;
}

@media (max-width: 860px) {
  .founder__inner {
    grid-template-columns: minmax(0, 1fr);
  }

  /* On phones the facts come first, as a quick summary before the story */
  .founder__facts {
    position: relative; /* not sticky here, but still anchors its stitching */
    top: auto; /* the sticky offset would otherwise push it down over the story */
    order: -1;
  }

  .founder__story {
    font-size: 1.03rem;
  }

  .founder-intro__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Big enough on phones to actually see the person */
  .founder-photo {
    width: 100%;
    max-width: 360px;
  }
}

/* =========================================================
   PAGE NOT FOUND (404.html)
   ========================================================= */
.not-found .container {
  max-width: 720px;
}

.not-found__diagram {
  display: block;
  width: 100%;
  max-width: 320px;
  margin-bottom: 40px;
}

.not-found__line {
  stroke: var(--green);
  stroke-width: 2.5;
  stroke-dasharray: 2 10;
  stroke-linecap: round;
  fill: none;
}

/* The part of the path that leads nowhere */
.not-found__line--missing {
  stroke: var(--line);
  stroke-dasharray: 4 6;
}

.not-found__node {
  fill: var(--ink);
  stroke: var(--green);
  stroke-width: 2.5;
}

.not-found__node--here {
  fill: var(--friction);
  stroke: var(--friction);
}

.not-found__node--missing {
  stroke: var(--line);
  stroke-dasharray: 3 4;
}

/* =========================================================
   LEGAL PAGES (privacy notice)
   ========================================================= */
.legal {
  max-width: 760px;
}

.legal h1 {
  font-size: clamp(1.9rem, 4.5vw, 2.8rem);
}

.legal h2 {
  font-size: 1.4rem;
  margin-top: 2.4em;
  padding-top: 1.2em;
  border-top: 1px solid var(--line);
}

.legal h3 {
  font-size: 1.05rem;
  margin-top: 1.6em;
}

.legal p,
.legal li,
.legal dd {
  color: var(--muted);
}

.legal strong {
  color: var(--text);
}

.legal code {
  font-family: var(--mono);
  font-size: 0.9em;
  color: var(--text);
}

.legal__updated {
  font-family: var(--mono);
  font-size: 0.85rem;
}

.legal__lead {
  font-size: 1.15rem;
  color: var(--text) !important;
}

.legal__toc {
  margin: 32px 0;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink-2);
}

.legal__toc ol {
  margin: 0;
  padding-left: 1.2em;
  columns: 2;
  column-gap: 32px;
}

.legal__toc li {
  padding: 3px 0;
  break-inside: avoid;
}

.legal__contact {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 20px;
}

.legal__contact dt {
  font-family: var(--mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding-top: 3px;
}

.legal__contact dd {
  margin: 0;
}

/* Tick list for dark backgrounds */
.tick-list--plain {
  margin: 12px 0 20px;
}

.tick-list--plain li {
  border-top-color: var(--line);
}

.tick-list--plain li::before {
  color: var(--brass);
}

@media (max-width: 560px) {
  .legal__toc ol {
    columns: 1;
  }
}

/* =========================================================
   15. REDUCED MOTION
   The story still changes scene; it just doesn't animate.
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }

  .edge__flow {
    animation: none;
    stroke-dasharray: none;
  }

  .pulse {
    animation: none !important;
  }

  .story:is([data-scene="1"], [data-scene="2"], [data-scene="3"]) .edge__flow {
    stroke-dasharray: 2 4;
  }
}

/* The enquiry form's bot trap: out of sight, out of the tab order */
.enquiry__trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
