/* Organicity site-wide standard (Part 1).
   Loaded after the shared stylesheet on every main page. */

:root {
  --std-section-pad: clamp(4.5rem, 10vh, 7.5rem);
  --std-gap-tight: 1.25rem; /* label -> headline, headline -> body */
  --std-gap-block: clamp(2.25rem, 5vh, 3.25rem); /* -> content, -> link/button */
  --std-grid-gap: clamp(1.5rem, 3vw, 3rem);
  --std-offwhite: color-mix(in srgb, var(--color-soft) 24%, var(--color-paper));
  --std-dark: #141414;
}

/* ---------- Sections and backgrounds ---------- */
.std-page > .std-section {
  background: var(--color-paper);
}
.std-page > .std-section:nth-child(2n) {
  background: var(--std-offwhite);
}
.std-page > .std-section.std-section--dark {
  background: var(--std-dark);
  color: var(--color-paper);
}
.std-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: min(calc(100% - (2 * var(--page-pad))), var(--content-max));
  margin-inline: auto;
  padding-block: var(--std-section-pad);
}
.std-flow {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

/* One rhythm everywhere: label -> headline -> body -> content -> link */
.std-inner > * + *,
.std-flow > * + * {
  margin-top: var(--std-gap-block);
}
.std-inner > .std-label + *,
.std-flow > .std-label + * {
  margin-top: var(--std-gap-tight);
}
.std-inner > :is(.std-h1, .std-h2) + .std-body,
.std-flow > :is(.std-h1, .std-h2) + .std-body {
  margin-top: var(--std-gap-tight);
}
.std-inner > .std-source,
.std-flow > .std-source {
  margin-top: var(--std-gap-tight);
}

/* ---------- The five text styles ---------- */
:where(.std-label, .std-h1, .std-h2, .std-h3, .std-body, .std-source, .std-rows) {
  margin-top: 0;
}
/* 1. Section label */
.std-label {
  margin-bottom: 0;
  color: var(--color-red);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.015em;
  line-height: 1.45;
  text-transform: uppercase;
}
/* 2. Page headline (H1) */
.std-h1 {
  max-width: 72rem;
  margin-bottom: 0;
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 6vw, 6rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.98;
  text-wrap: balance;
}
/* 3. Section headline (H2) */
.std-h2 {
  max-width: 64rem;
  margin-bottom: 0;
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 3.9vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.02;
  text-wrap: balance;
}
.std-h2 a {
  color: inherit;
  text-decoration: none;
}
.std-h2 a:hover,
.std-h2 a:focus-visible {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.12em;
}
/* 4. Card / item title (H3) */
.std-h3 {
  margin-bottom: 0;
  color: var(--color-ink);
  font-size: clamp(1.2rem, 1.6vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-transform: none;
}
/* 5. Body text (also hero intro text) */
.std-body {
  max-width: 46rem;
  margin-bottom: 0;
  color: var(--color-grey);
  font-size: clamp(1.05rem, 1.3vw, 1.25rem);
  font-weight: 400;
  line-height: 1.45;
}

/* Headline colour rule: one red full stop per page */
.red-stop {
  color: var(--color-red);
}
.std-section--dark :is(.std-h1, .std-h2, .std-h3) {
  color: var(--color-paper);
}

/* Supporting data styles (stat numbers and source notes) */
.std-source {
  margin-bottom: 0;
  color: var(--color-grey);
  font-size: 0.73rem;
}
.std-source a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}
.std-source a:hover,
.std-source a:focus-visible {
  color: var(--color-red);
}

/* ---------- Links and buttons ---------- */
.std-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.std-actions .button-primary,
.std-actions .button-secondary {
  justify-content: flex-start;
  gap: 0.6rem;
}
.std-link {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  color: var(--color-red);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
}
.std-link span[aria-hidden] {
  font-size: 0.9em;
}
.std-link:hover,
.std-link:focus-visible {
  color: var(--color-ink);
}
.std-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2.25rem;
}
.std-section--dark .button-primary:hover,
.std-section--dark .button-primary:focus-visible {
  background: var(--color-paper);
  border-color: var(--color-paper);
  color: var(--color-red);
}

/* ---------- Card grids ---------- */
.std-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  gap: var(--std-grid-gap);
  width: 100%;
  border-top: 1px solid var(--color-rule);
  padding-top: clamp(1.5rem, 3vh, 2.25rem);
}
.std-grid--2 { --cols: 2; }
.std-grid--3 { --cols: 3; }
.std-grid--4 { --cols: 4; }
.std-grid--5 { --cols: 5; }
.std-item {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
}
@media (max-width: 64rem) {
  .std-grid--4,
  .std-grid--5 { --cols: 2; }
  .std-grid--3 { --cols: 1; }
}
@media (max-width: 40rem) {
  .std-grid--2,
  .std-grid--4,
  .std-grid--5 { --cols: 1; }
}

/* Two-stat row (Home) */
.std-stat-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(2rem, 6vw, 6rem);
  width: 100%;
  max-width: 56rem;
}
.std-stat-pair .stat-red {
  color: var(--color-red);
}
@media (max-width: 40rem) {
  .std-stat-pair { grid-template-columns: 1fr; }
}
.std-inner > .stats-grid,
.std-flow > .stats-grid {
  width: 100%;
  margin-top: var(--std-gap-block);
}

/* ---------- Heroes ---------- */
.std-hero-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, min(34vw, 30rem));
  align-items: center;
  gap: clamp(1.5rem, 4vw, 4rem);
  width: 100%;
}
@media (max-width: 64rem) {
  .std-hero-split { grid-template-columns: 1fr; }
}

/* ---------- Thinking series list ---------- */
.std-rows {
  width: 100%;
  margin-bottom: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--color-rule);
}
.std-row {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: var(--std-grid-gap);
  border-bottom: 1px solid var(--color-rule);
  padding-block: clamp(1.1rem, 2.4vh, 1.6rem);
}
.std-row .std-status {
  color: var(--color-grey);
  font-size: 0.92rem;
  font-weight: 700;
}
@media (max-width: 40rem) {
  .std-row { grid-template-columns: 2.5rem minmax(0, 1fr); }
  .std-row > :last-child { grid-column: 2; }
}

/* Kept components stretch to the content width */
.std-inner > :is(.contributor-grid, .contribution-timeline, form, .form-container) {
  width: 100%;
}

/* Let's Talk: once the form is sent, the thank-you message replaces the
   section label, headline and form so the visitor sees one clear message. */
.std-inner:has(.form-success-panel) > :is(.std-label, .std-h2) {
  display: none;
}
.std-inner > .form-success-panel {
  width: 100%;
  margin-top: 0;
  outline: none;
}
.form-success-panel.std-flow > .std-grid {
  margin-top: var(--std-gap-block);
}
.form-success-panel .std-h2 {
  max-width: 64rem;
  font-size: clamp(2.2rem, 3.9vw, 4rem);
  letter-spacing: -0.04em;
  line-height: 1.02;
}
.form-success-panel > p.std-label {
  margin-top: 0;
  color: var(--color-red);
  font-size: 0.76rem;
}
.form-success-panel > p.std-body {
  font-size: clamp(1.05rem, 1.3vw, 1.25rem);
}

/* Lab hero: headline always reads as two lines,
   "Redesign one workflow" / "that matters." */
.lab-hero-title .lab-title-line {
  display: block;
}
@media (min-width: 64.01rem) {
  .lab-hero-title .lab-title-line {
    white-space: nowrap;
  }
}

/* Let's Talk form: "Send inquiry" matches every other primary button */
.form-actions .form-button {
  width: auto;
  min-width: 0;
  min-height: 3rem;
  justify-content: flex-start;
  gap: 0.6rem;
  padding: 0.8rem 1.15rem;
  font-size: 0.86rem;
  font-weight: 700;
}
.form-actions .form-button:hover:not(:disabled),
.form-actions .form-button:focus-visible {
  border-color: var(--color-ink);
  background: var(--color-ink);
  color: var(--color-paper);
}
@media (max-width: 47.5rem) {
  .form-actions .form-button {
    align-self: flex-start;
  }
}
/* Give the two-line Lab headline room: narrow the step strip's column from
   the left; the strip keeps its vertical position and right edge. */
.std-hero-split.lab-hero-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, min(26vw, 22rem));
}

/* ===== Refinement: spacing and section headlines (site-wide) ===== */
/* 1. Section padding: mobile ~88px, tablet ~120px, desktop ~160px.
      (The full-screen Home hero keeps its own padding on desktop.) */
:root {
  --std-section-pad: 5.5rem;
  --std-h2-size: clamp(2.2rem, 3.9vw, 4rem);
}
@media (min-width: 48rem) {
  :root { --std-section-pad: 7.5rem; }
}
@media (min-width: 64rem) {
  :root {
    --std-section-pad: 10rem;
    /* 2. Section headlines 12% larger on desktop; same weight, tight leading */
    --std-h2-size: clamp(2.464rem, 4.368vw, 4.48rem);
  }
}
.std-h2,
.form-success-panel .std-h2 {
  font-size: var(--std-h2-size);
}

/* 3. Headline group -> content: 25% more room. Label/headline/body stay
      tight, and content -> link/button keeps the existing spacing. */
.std-inner > :is(.std-label, .std-h1, .std-h2, .std-body) + :not(.std-label, .std-h1, .std-h2, .std-body, .std-actions, .std-link, .std-links, .std-source, style),
.std-flow > :is(.std-label, .std-h1, .std-h2, .std-body) + :not(.std-label, .std-h1, .std-h2, .std-body, .std-actions, .std-link, .std-links, .std-source, style) {
  margin-top: calc(var(--std-gap-block) * 1.25);
}

/* 4. Desktop line breaks at natural points (max two lines) */
.h2-line { display: inline; }
@media (min-width: 64rem) {
  .h2-line { display: block; }
  /* width grows with the headline so it wraps at most once */
  .std-h2 { max-width: 20em; }
}
