/* ---------- Fonts (self-hosted, OFL) ---------- */

@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-opsz-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-opsz-italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Sans";
  src: url("../fonts/instrument-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */

:root {
  color-scheme: light dark;

  --paper: #F5F3EC;
  --ink: #14171A;
  --muted: #5E6468;
  --rule: #D9D5C8;
  --accent: #1F3FD6;
  --on-accent: #FFFFFF;
  --classic: #B9B4A6;

  --invert-bg: #14171A;
  --invert-ink: #F5F3EC;
  --invert-muted: #A9ADAF;
  --invert-rule: #2E3338;

  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --wrap: 75rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --section: clamp(4rem, 10vw, 8rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #111315;
    --ink: #ECE9E0;
    --muted: #9BA0A3;
    --rule: #2B2F33;
    --accent: #7C93FF;
    --on-accent: #0B0D10;
    --classic: #5A574F;

    --invert-bg: #ECE9E0;
    --invert-ink: #14171A;
    --invert-muted: #5E6468;
    --invert-rule: #CFCBBE;
  }
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 5.5rem;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

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

h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

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

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

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

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.75rem, 7.4vw, 5.75rem);
  line-height: 0.98;
  letter-spacing: -0.025em;
  max-width: 11em;
}

h1 em {
  color: var(--accent);
  font-weight: 300;
}

h2 {
  font-size: clamp(1.9rem, 4.2vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  max-width: 18em;
}

h3 {
  font-size: clamp(1.4rem, 2.3vw, 1.8rem);
  line-height: 1.15;
  letter-spacing: -0.005em;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.label {
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.lede {
  font-size: clamp(1.15rem, 1.6vw, 1.375rem);
  line-height: 1.5;
  max-width: 34em;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 20;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.9375rem;
  text-decoration: none;
}

.skip-link:focus {
  top: 0.75rem;
}

/* ---------- Buttons and links ---------- */

.btn {
  display: inline-block;
  padding: 0.85rem 1.4rem;
  border-radius: 2px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
  background: var(--ink);
  color: var(--paper);
}

.btn-small {
  padding: 0.6rem 1rem;
  font-size: 0.9375rem;
}

.btn-invert {
  background: var(--invert-ink);
  color: var(--invert-bg);
}

.btn-invert:hover {
  background: var(--accent);
  color: var(--on-accent);
}

.link-arrow {
  font-weight: 500;
  font-size: 1rem;
}

.link-arrow::after {
  content: " \2192";
}

.link-arrow:hover {
  color: var(--accent);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.75rem;
  margin-top: 2.25rem;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--paper);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.site-header.is-scrolled {
  border-bottom-color: var(--rule);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 0.5rem;
}

.logo {
  --logo-h: 3.5rem;
  display: block;
  flex: none;
}

/* The logo files carry transparent padding (51px of 548px); pull the artwork back to the gutter. */
.logo img {
  display: block;
  width: auto;
  height: var(--logo-h);
  margin-left: calc(var(--logo-h) * -0.093);
}

@media (max-width: 47.99rem) {
  .logo {
    --logo-h: 3rem;
  }
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 2rem;
}

.site-nav a:not(.btn) {
  font-size: 0.9375rem;
  text-decoration: none;
}

.site-nav a:not(.btn):hover {
  color: var(--accent);
}

.nav-toggle {
  display: none;
  padding: 0.5rem 0;
  border: 0;
  background: none;
  color: inherit;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

@media (max-width: 47.99rem) {
  .js .nav-toggle {
    display: block;
  }

  .js .site-nav {
    display: none;
    width: 100%;
  }

  .js .site-nav.is-open {
    display: block;
  }

  .site-nav ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding-bottom: 0.5rem;
  }

  .site-nav li {
    width: 100%;
    border-top: 1px solid var(--rule);
  }

  .site-nav a:not(.btn) {
    display: block;
    padding: 0.85rem 0;
    font-size: 1.0625rem;
  }

  .site-nav .btn {
    margin: 1rem 0 0.5rem;
  }
}

/* ---------- Hero ---------- */

.hero {
  padding-block: clamp(3rem, 8vw, 6.5rem) var(--section);
}

.hero .label {
  margin-bottom: 1.75rem;
}

.hero .lede {
  margin-top: 2rem;
}

.hero-top {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 3rem;
  align-items: center;
}

@media (max-width: 61.99rem) {
  .hero-top {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-art {
    max-width: 28rem;
  }
}

/* ---------- Illustrations ---------- */

/* Two-colour print palette. Plates keep their colours in both themes; only the tint plate follows the page. */
.art {
  --pi: #14171A;
  --pp: #F5F3EC;
  --pb: #1F3FD6;
  --pw: #F2A93B;
  --ps: #B9B4A6;
  display: block;
  width: 100%;
  height: auto;
}

.plate {
  border-radius: 2px;
}

.plate--blue {
  background: var(--pb);
}

.plate--warm {
  background: var(--pw);
}

.plate--tint {
  background: #E9E5D8;
}

@media (prefers-color-scheme: dark) {
  .plate--tint {
    --pi: #ECE9E0;
    --pp: #111315;
    --pb: #6C86FF;
    --ps: #55524A;
    background: #1C2024;
  }
}

.art .f-none { fill: none; }
.art .f-ink { fill: var(--pi); }
.art .f-paper { fill: var(--pp); }
.art .f-blue { fill: var(--pb); }
.art .f-warm { fill: var(--pw); }
.art .f-soft { fill: var(--ps); }
.art .s-ink { stroke: var(--pi); }
.art .s-paper { stroke: var(--pp); }
.art .s-warm { stroke: var(--pw); }

/* Stopwatch: the wedge and the hand both stop at one tenth of the dial. */
.dial-tenth {
  stroke-dasharray: 38.327 383.274;
}

.dial-hand {
  transform: rotate(36deg);
  transform-origin: 232px 250px;
}

.js .art-dial .dial-tenth {
  stroke-dasharray: 0 383.274;
  transition: stroke-dasharray 0.9s cubic-bezier(0.3, 0.7, 0.2, 1) 0.4s;
}

.js .art-dial .dial-hand {
  transform: rotate(0deg);
  transition: transform 0.9s cubic-bezier(0.3, 0.7, 0.2, 1) 0.4s;
}

.js .art-dial.is-in .dial-tenth {
  stroke-dasharray: 38.327 383.274;
}

.js .art-dial.is-in .dial-hand {
  transform: rotate(36deg);
}

.band {
  margin-top: clamp(2rem, 4vw, 3.25rem);
}

.band-cap {
  display: grid;
  grid-template-columns: 35fr 30fr 35fr;
  gap: 0.75rem;
  margin-top: 0.85rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.band-cap span:nth-child(2) {
  text-align: center;
  color: var(--accent);
}

.band-cap span:nth-child(3) {
  text-align: right;
}

.band-cap--two {
  grid-template-columns: 1fr 1fr;
}

.band-cap--two span:nth-child(2) {
  text-align: left;
}

.band + .compare {
  margin-top: clamp(2rem, 4vw, 3rem);
}

.art-talk .talk-gap {
  stroke: var(--invert-bg);
}

/* Scale timeline: both bars share one axis, Timesoft is one tenth of the classic bar. */

.scale {
  margin-top: clamp(3.5rem, 8vw, 6rem);
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}

.scale-rows {
  display: grid;
  gap: 1.5rem;
}

.scale-row {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.scale-label {
  padding-top: 0.55rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.scale-label--us {
  color: var(--accent);
}

.scale-bar {
  display: flex;
  gap: 3px;
  font-family: var(--mono);
  font-size: 0.6875rem;
  line-height: 1.35;
  color: var(--muted);
}

.scale-bar > * {
  flex: var(--w) 1 0;
  min-width: 0;
}

.scale-bar > *::before {
  content: "";
  display: block;
  height: 2rem;
  margin-bottom: 0.5rem;
  background: var(--classic);
}

.scale-seg {
  color: var(--accent);
  white-space: nowrap;
}

.scale-seg::before {
  background: var(--accent);
}

.scale-rest {
  padding-left: 0.75rem;
  text-align: right;
}

.scale-rest::before {
  margin-left: -0.75rem;
  background: repeating-linear-gradient(90deg, var(--classic) 0 4px, transparent 4px 10px) center / 100% 1px no-repeat;
}

.scale-axis {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--muted);
}

.scale-axis span {
  padding: 0.4rem 0.35rem 0 0;
  border-right: 1px solid var(--rule);
  text-align: right;
}

.scale-axis span:first-child {
  color: var(--accent);
}

.scale figcaption {
  margin-top: 1.5rem;
  max-width: 44em;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--muted);
}

.js .scale-bar {
  clip-path: inset(0 100% 0 0);
}

.js .scale.is-in .scale-bar {
  clip-path: inset(0 0 0 0);
  transition: clip-path 3s linear 0.4s;
}

@media (max-width: 61.99rem) {
  .scale-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.6rem;
  }

  .scale-label {
    padding-top: 0;
  }

  .scale-row--axis > span {
    display: none;
  }
}

/* Narrow screens: turn the chart on its side so the phase labels have room. */
@media (max-width: 44.99rem) {
  .scale-rows {
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
  }

  .scale-row {
    display: block;
  }

  .scale-label {
    margin-bottom: 0.9rem;
  }

  .scale-row--axis {
    display: none;
  }

  .scale-bar {
    flex-direction: column;
    height: 24rem;
  }

  .scale-bar > * {
    display: flex;
    gap: 0.625rem;
  }

  .scale-bar > *::before {
    flex: none;
    width: 1.75rem;
    height: auto;
    margin: 0;
  }

  .scale-seg {
    white-space: normal;
  }

  .scale-rest {
    padding-left: 0;
    text-align: left;
  }

  .scale-rest::before {
    margin-left: 0;
    background: repeating-linear-gradient(180deg, var(--classic) 0 4px, transparent 4px 10px) center / 1px 100% no-repeat;
  }

  .js .scale-bar {
    clip-path: inset(0 0 100% 0);
  }
}

/* ---------- Sections ---------- */

.section {
  padding-block: var(--section);
  border-top: 1px solid var(--rule);
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 10fr);
  gap: 1.5rem 2rem;
}

.section-grid > .label {
  padding-top: 0.9rem;
}

@media (max-width: 61.99rem) {
  .section-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .section-grid > .label {
    padding-top: 0;
  }
}

.prose {
  margin-top: 2.25rem;
  max-width: 62ch;
}

.prose p + p {
  margin-top: 1.1em;
}

.pull {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  padding-block: clamp(1.75rem, 3vw, 2.5rem);
  border-block: 1px solid var(--rule);
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.5rem, 3.2vw, 2.5rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

/* ---------- Approach ---------- */

.steps {
  margin-top: clamp(2rem, 4vw, 3.25rem);
}

.step {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr) minmax(0, 16rem);
  gap: 1.25rem 2rem;
  padding-block: 2.25rem;
  border-top: 1px solid var(--rule);
}

.step:last-child {
  border-bottom: 1px solid var(--rule);
}

.step-n {
  display: block;
  margin-bottom: 0.5rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent);
}

.step-main p {
  margin-top: 0.85rem;
  max-width: 52ch;
}

.step-meta {
  display: grid;
  gap: 1.1rem;
  align-content: start;
  padding-top: 0.45rem;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.step-meta dt {
  margin-bottom: 0.25rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

@media (max-width: 61.99rem) {
  .step {
    grid-template-columns: 6.5rem minmax(0, 1fr);
  }

  .step-meta {
    grid-column: 2;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem 2rem;
  }
}

@media (max-width: 35.99rem) {
  .step {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  .step-art {
    width: 6.5rem;
  }

  .step-meta {
    grid-column: 1;
    grid-template-columns: minmax(0, 1fr);
    margin-top: 0.5rem;
  }
}

/* ---------- Comparison ---------- */

.compare {
  width: 100%;
  margin-top: clamp(2rem, 4vw, 3.25rem);
  border-collapse: collapse;
  font-size: 1rem;
  line-height: 1.5;
}

.compare th,
.compare td {
  padding: 1.15rem 1.5rem 1.15rem 0;
  border-top: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

.compare thead th,
.compare thead td {
  padding-block: 0 0.9rem;
  border-top: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.compare thead .is-us {
  color: var(--accent);
}

.compare tbody th {
  width: 26%;
  font-weight: 500;
}

.compare tbody td {
  width: 37%;
}

.compare tbody td:nth-child(2) {
  color: var(--muted);
}

.compare tbody tr:last-child > * {
  border-bottom: 1px solid var(--rule);
}

@media (max-width: 47.99rem) {
  .compare,
  .compare tbody,
  .compare tr,
  .compare th,
  .compare td {
    display: block;
    width: auto;
  }

  .compare thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .compare tbody tr {
    padding-block: 1.25rem;
    border-top: 1px solid var(--rule);
  }

  .compare tbody tr:last-child {
    border-bottom: 1px solid var(--rule);
  }

  .compare tbody th,
  .compare tbody td,
  .compare tbody tr:last-child > * {
    width: auto;
    padding: 0;
    border: 0;
  }

  .compare tbody th {
    font-family: var(--serif);
    font-size: 1.3rem;
    font-weight: 400;
    line-height: 1.2;
  }

  .compare tbody td {
    margin-top: 0.85rem;
  }

  .compare tbody td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.15rem;
    font-family: var(--mono);
    font-size: 0.6875rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .compare tbody td:last-child::before {
    color: var(--accent);
  }
}

/* ---------- Typical work ---------- */

.work {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 2.5rem;
  margin-top: clamp(2rem, 4vw, 3.25rem);
  border-bottom: 1px solid var(--rule);
}

.work li {
  display: flex;
  gap: 0.9rem;
  padding-block: 1.1rem;
  border-top: 1px solid var(--rule);
  line-height: 1.45;
}

.work li::before {
  content: "\00D7";
  flex: none;
  font-family: var(--mono);
  font-weight: 500;
  color: var(--accent);
}

@media (max-width: 47.99rem) {
  .work {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Questions ---------- */

.faq {
  margin-top: clamp(2rem, 4vw, 3.25rem);
  border-bottom: 1px solid var(--rule);
}

.faq details {
  border-top: 1px solid var(--rule);
}

.faq summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1.25rem;
  font-family: var(--serif);
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  line-height: 1.25;
  cursor: pointer;
  list-style: none;
}

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

.faq summary:hover {
  color: var(--accent);
}

.plus {
  flex: none;
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1;
  color: var(--accent);
  transition: transform 0.2s ease;
}

/* The plus turns into the times sign when the answer is open. */
.faq details[open] .plus {
  transform: rotate(45deg);
}

.answer {
  max-width: 62ch;
  padding-bottom: 1.6rem;
}

/* ---------- Contact ---------- */

.contact {
  background: var(--invert-bg);
  color: var(--invert-ink);
  border-top: 0;
}

.contact .label,
.contact-mail {
  color: var(--invert-muted);
}

.contact .lede {
  margin-top: 1.75rem;
}

.contact-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 14rem);
  gap: 2.5rem 3rem;
  align-items: center;
}

@media (max-width: 61.99rem) {
  .contact-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .art-talk {
    order: -1;
    width: 10rem;
  }
}

.contact-mail {
  font-family: var(--mono);
  font-size: 0.875rem;
}

.contact :focus-visible {
  outline-color: var(--invert-ink);
}

/* ---------- Footer ---------- */

.site-footer {
  padding-block: 2.5rem;
  font-size: 0.9375rem;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 2rem;
}

.site-footer .logo {
  --logo-h: 3rem;
}

.footer-legal {
  font-family: var(--mono);
  font-size: 0.75rem;
}

/* ---------- Motion ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

@media print, (prefers-reduced-motion: reduce) {
  .js .reveal,
  .js .reveal.is-in {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .js .scale-bar,
  .js .scale.is-in .scale-bar {
    clip-path: none;
    transition: none;
  }

  .js .art-dial .dial-tenth {
    stroke-dasharray: 38.327 383.274;
    transition: none;
  }

  .js .art-dial .dial-hand {
    transform: rotate(36deg);
    transition: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .plus,
  .btn,
  .site-header {
    transition: none;
  }
}
