/* ==========================================================================
   R3 — the dark body field
   Work order §6, gate §13.5
   --------------------------------------------------------------------------
   The homepage now spends a full dark field on "Three steps to get started",
   which is the key change the reference makes and R2 never did.

   The first render put dark text on it, because the section's children carry
   their own colour rules from earlier layers. This file gives the dark field an
   explicit foreground vocabulary instead of relying on inheritance, and it is
   measured — see evidence/measurements/r3/dark-field-contrast.json.

   Contrast is computed, not eyeballed: every pairing below is checked against
   WCAG AA (4.5:1 for body, 3:1 for large display) by tests/contrast-gate.mjs.
   ========================================================================== */

.r3-dark-field {
  background: var(--r3-surface-dark);
  color: var(--r3-on-dark);
}

/* Headings on the field take the palette's on-dark colour. */
.r3-dark-field h1,
.r3-dark-field h2,
.r3-dark-field h3,
.r3-dark-field h4,
.r3-dark-field .b-section-title,
.r3-dark-field .b-process__title {
  color: var(--r3-on-dark);
}

/* Body copy and leads take the muted on-dark tone. */
.r3-dark-field p,
.r3-dark-field li,
.r3-dark-field .b-lead,
.r3-dark-field .b-section-lede,
.r3-dark-field .b-process__number,
.r3-dark-field .b-caption {
  color: var(--r3-on-dark-muted);
}

/* The eyebrow is the smallest text on the field, so it gets the brightest
   muted tone rather than the general one. */
.r3-dark-field .b-eyebrow,
.r3-dark-field .b-kicker {
  color: var(--r3-on-dark);
  opacity: 0.82;
}

/* Rules and separators inside the field. */
.r3-dark-field .b-process__item,
.r3-dark-field .b-principle,
.r3-dark-field hr {
  border-color: color-mix(in srgb, var(--r3-on-dark) 26%, transparent);
}

/*
 * The dark field is a full-width colour field, not a card: generous vertical
 * rhythm from the extraction's own spacing tokens (--spacing-large: 120px
 * desktop, 90px at 1024, 70px at 670).
 */
.r3-dark-field {
  padding-block: clamp(70px, 8vw, 120px);
}

/* Links on the field keep a visible affordance without a second colour. */
.r3-dark-field a:not(.btn) {
  color: var(--r3-on-dark);
  text-decoration-color: color-mix(in srgb, var(--r3-on-dark) 55%, transparent);
}

.r3-dark-field a:not(.btn):hover {
  color: var(--r3-on-dark);
  text-decoration-color: currentColor;
}

/* Focus colour must survive the dark surface (§4.7, §13.6 accessibility). */
.r3-dark-field :focus-visible {
  outline-color: var(--r3-on-dark);
}

/* The secondary button on a dark field becomes the light variant: a dark pill
   on a dark surface would disappear. */
.r3-dark-field .btn--light,
.b-section--dark .btn--light {
  --btn-bg: var(--p-pale);
  --btn-fg: var(--p-ink);
  --btn-focus: var(--p-pale);
}

/* Design C dark field inherits --p-dark (#0F1014) and --p-on-dark (#FFFFFF). */
body.palette-c .r3-dark-field {
  background: var(--p-dark);
  color: var(--p-on-dark);
}
