/* Design tokens */

:root {
  /* Colour: warm monochrome */
  --paper: #fbfaf8;
  --ink: #1b1a18;
  --ink-soft: #34322e;
  --grey: #57534e;
  --rule: #e7e4df;

  /* Type */
  --sans: "Helvetica Neue", Helvetica, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --text-xs: 0.8125rem;   /* eyebrows, numbering, footer */
  --text-sm: 0.9375rem;   /* nav, pillar body, CTA */
  --text-base: 1.0625rem; /* body */
  --text-md: 1.1875rem;   /* lede, h3 */
  --text-h1: clamp(1.75rem, 4.5vw, 2.625rem);

  /* Spacing scale */
  --space-2xs: 0.5rem;
  --space-xs: 0.875rem;
  --space-s: 1.5rem;
  --space-m: 2.5rem;
  --space-l: 3.5rem;
  --space-xl: 5rem;
  --space-2xl: 7rem;

  /* Layout */
  --container: 66rem;
  --measure: 65ch;
  --gutter: 1.5rem;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--sans);
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

a:focus-visible,
.cta:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* Layout */

.hero,
.section,
.site-footer {
  padding-left: var(--gutter);
  padding-right: var(--gutter);
  max-width: var(--container);
  margin-left: auto;
  margin-right: auto;
}

/* Prose keeps a readable measure inside the wider container */
h1,
.section > p,
.service p {
  max-width: var(--measure);
}

.section {
  scroll-margin-top: 5rem;
}

/* Header: sticky, full-width hairline, content aligned to container */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  padding: 1.25rem max(var(--gutter), calc((100% - var(--container)) / 2 + var(--gutter)));
}

.wordmark,
.wordmark-small {
  font-weight: 700;
  font-size: var(--text-base);
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}

.header-nav {
  display: flex;
  gap: var(--space-s);
  align-items: baseline;
}

.nav-link {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 0.1rem;
  font-size: var(--text-sm);
}

.nav-link:hover {
  color: var(--grey);
  border-bottom-color: var(--grey);
}

.nav-services {
  display: none;
}

@media (min-width: 30rem) {
  .nav-services {
    display: inline;
  }
}

/* Hero */

.hero {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-2xl);
}

.eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--grey);
  margin-bottom: var(--space-s);
}

h1 {
  font-weight: 700;
  font-size: var(--text-h1);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-s);
}

.lede {
  font-size: var(--text-md);
  color: var(--grey);
  margin-bottom: var(--space-m);
  max-width: 34rem;
}

.cta {
  display: inline-block;
  color: var(--paper);
  background: var(--ink);
  text-decoration: none;
  padding: 0.8125rem 1.75rem;
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
}

.cta:hover {
  background: var(--ink-soft);
}

/* Sections */

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

h2 {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--grey);
  margin-bottom: var(--space-m);
}

h3 {
  font-weight: 700;
  font-size: var(--text-md);
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-2xs);
}

.section p + p {
  margin-top: 1.25rem;
}

/* Editorial numbering, rendered in CSS so markup stays untouched */

.services {
  counter-reset: service;
}

.service {
  counter-increment: service;
  padding: var(--space-m) 0;
  border-top: 1px solid var(--rule);
}

.service:first-child {
  border-top: 0;
  padding-top: 0;
}

.service:last-child {
  padding-bottom: 0;
}

.service::before,
.pillar::before {
  display: block;
  font-size: var(--text-xs);
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--grey);
  font-variant-numeric: tabular-nums;
  margin-bottom: var(--space-2xs);
}

.service::before {
  content: counter(service, decimal-leading-zero);
}

/* How we work pillars */

.pillars {
  counter-reset: pillar;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-m);
}

.pillar {
  counter-increment: pillar;
  border-top: 1px solid var(--ink);
  padding-top: var(--space-s);
}

.pillar::before {
  content: counter(pillar, decimal-leading-zero);
}

.pillar h3 {
  font-size: var(--text-base);
}

.pillar p {
  font-size: var(--text-sm);
  line-height: 1.6;
}

@media (min-width: 40rem) {
  .pillars {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 64rem) {
  .pillars {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Contact form */

.contact-form {
  max-width: 34rem;
  margin-top: var(--space-m);
  display: grid;
  gap: var(--space-s);
}

.field {
  display: grid;
  gap: var(--space-2xs);
}

.field label {
  font-size: var(--text-sm);
  font-weight: 600;
}

.field-optional {
  font-weight: 400;
  color: var(--grey);
}

.field input,
.field textarea {
  font: inherit;
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--grey);
  border-radius: 0;
  padding: 0.625rem 0.75rem;
  width: 100%;
}

.field textarea {
  resize: vertical;
}

.field input:focus-visible,
.field textarea:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Keep browser autofill highlight within the monochrome palette */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--paper) inset;
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
}

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: var(--ink);
  border-width: 2px;
}

.field-error {
  font-size: var(--text-sm);
  color: var(--grey);
}

.botcheck {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

button.cta {
  border: 0;
  font-family: inherit;
  cursor: pointer;
  justify-self: start;
}

button.cta:disabled {
  background: var(--grey);
  cursor: default;
}

.form-status {
  font-size: var(--text-base);
}

.form-status a {
  color: var(--ink);
  text-underline-offset: 0.2em;
}

/* Footer */

.site-footer {
  padding-top: var(--space-l);
  padding-bottom: var(--space-l);
  border-top: 1px solid var(--rule);
  font-size: var(--text-xs);
  color: var(--grey);
}

.site-footer p + p {
  margin-top: var(--space-2xs);
}

.wordmark-small {
  font-size: var(--text-sm);
}

/* Fade on scroll */

.fade {
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade.visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .fade {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Wider screens */

@media (min-width: 48rem) {
  :root {
    --gutter: 2rem;
  }

  .hero {
    padding-top: var(--space-2xl);
    padding-bottom: var(--space-2xl);
  }

  .section {
    padding-top: var(--space-xl);
    padding-bottom: var(--space-xl);
  }
}
