/* The site's one type system: headings, prose, lists, quotes, code, links
   and small print. Every page that loads home.css loads this right after it.
   A page's own stylesheet styles components (cards, chips, badges, nav,
   footer) and never sets these again.

   Prose rules live inside the flowing columns: .tech-copy, .tech-detail,
   .feature-copy, .tech-note, .dl-cli, the columns of .detail-cols, and
   .prose for any other. They are wrapped in :where(), so they weigh
   nothing: any component's class beats them without a fight. */

:root {
  --text-lede: clamp(1.08rem, 2vw, 1.35rem);
  --text-body: clamp(1rem, 1.6vw, 1.15rem);
  --text-small: 0.86rem;
  --leading-body: 1.62;

  --flow: var(--space-md);
  --gap-before-h2: 3rem;
  --gap-before-h3: var(--space-roomy);
  --gap-before-h4: var(--space-xl);
  --list-indent: var(--space-xl);
  --list-item-gap: var(--space-xs);

  --color-prose: var(--color-ink-muted);
  --color-prose-strong: var(--color-ink);
  /* The coral itself is too light to read as a numeral on paper (2.6:1). */
  --color-marker: oklch(55% 0.15 40);
}

/* Dark bands: the same prose, in light ink. */
.tech-section-dark,
.feature-actions {
  --color-prose: color-mix(in oklch, var(--color-on-dark) 76%, transparent);
  --color-prose-strong: var(--color-on-dark);
  --color-marker: var(--color-coral);
}

h1,
h2,
h3,
h4,
p {
  overflow-wrap: anywhere;
}

/* Weightless, so the flowing-column rhythm below can set a heading's gap. */
:where(h1, h2, h3, h4) {
  margin: 0;
  font-family: var(--font-display);
}

h1 {
  max-width: 13ch;
  font-size: clamp(3.2rem, 7vw, 6.5rem);
  font-weight: 710;
  letter-spacing: -0.065em;
  line-height: 0.96;
}

h2 {
  max-width: 16ch;
  font-size: clamp(2.35rem, 5vw, 4.7rem);
  font-weight: 680;
  letter-spacing: -0.055em;
  line-height: 1;
}

h3 {
  font-size: clamp(1.25rem, 2.2vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

h4 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

/* Prose: one paragraph, one list of each kind. */
:where(.tech-copy, .tech-detail, .feature-copy, .tech-note, .dl-cli, .detail-cols > div, .prose) > :where(p, ul:not([class]), ol:not([class])) {
  max-width: var(--measure);
  margin: var(--flow) 0 0;
  color: var(--color-prose);
  font-family: var(--font-reading);
  font-size: var(--text-body);
  font-weight: 400;
  line-height: var(--leading-body);
}

:where(.tech-copy, .tech-detail, .feature-copy, .tech-note, .dl-cli, .detail-cols > div, .prose) > :where(ul:not([class]), ol:not([class])) {
  padding-left: var(--list-indent);
}

:where(.tech-copy, .tech-detail, .feature-copy, .tech-note, .dl-cli, .detail-cols > div, .prose) > :where(ul:not([class]), ol:not([class])) > :where(li + li) {
  margin-top: var(--list-item-gap);
}

:where(.tech-copy, .tech-detail, .feature-copy, .tech-note, .dl-cli, .detail-cols > div, .prose) > :where(ul:not([class]), ol:not([class])) > :where(li)::marker {
  color: var(--color-marker);
}


:where(.tech-copy, .tech-detail, .feature-copy, .tech-note, .dl-cli, .detail-cols > div, .prose) :where(strong, b) {
  color: var(--color-prose-strong);
  font-weight: 700;
}

/* Vertical rhythm. Later rules win at equal weight, so the order matters:
   blocks first, then the gap above a heading, then the gap below one. */
:where(.tech-copy, .tech-detail, .feature-copy, .tech-note, .dl-cli, .detail-cols > div, .prose) > :where(* + *) {
  margin-top: var(--flow);
}

:where(.tech-copy, .tech-detail, .feature-copy, .tech-note, .dl-cli, .detail-cols > div, .prose) > :where(:first-child) {
  margin-top: 0;
}

/* A badged heading row (.title-row) in a browser without :has() takes the
   h2 gaps; the :has() rules below refine the h3 case where they are understood. */
:where(.tech-copy, .tech-detail, .feature-copy, .tech-note, .dl-cli, .detail-cols > div, .prose) > :where(* + .title-row) {
  margin-top: var(--gap-before-h2);
}

:where(.tech-copy, .tech-detail, .feature-copy, .tech-note, .dl-cli, .detail-cols > div, .prose) > :where(.title-row + *) {
  margin-top: var(--space-lg);
}

:where(.tech-copy, .tech-detail, .feature-copy, .tech-note, .dl-cli, .detail-cols > div, .prose) > :where(* + :is(h2, .title-row:has(> h2))) {
  margin-top: var(--gap-before-h2);
}

:where(.tech-copy, .tech-detail, .feature-copy, .tech-note, .dl-cli, .detail-cols > div, .prose) > :where(* + :is(h3, .title-row:has(> h3))) {
  margin-top: var(--gap-before-h3);
}

:where(.tech-copy, .tech-detail, .feature-copy, .tech-note, .dl-cli, .detail-cols > div, .prose) > :where(* + h4) {
  margin-top: var(--gap-before-h4);
}

:where(.tech-copy, .tech-detail, .feature-copy, .tech-note, .dl-cli, .detail-cols > div, .prose) > :where(:is(h2, .title-row:has(> h2)) + *) {
  margin-top: var(--space-lg);
}

:where(.tech-copy, .tech-detail, .feature-copy, .tech-note, .dl-cli, .detail-cols > div, .prose) > :where(:is(h3, .title-row:has(> h3)) + *) {
  margin-top: var(--space-sm);
}

:where(.tech-copy, .tech-detail, .feature-copy, .tech-note, .dl-cli, .detail-cols > div, .prose) > :where(h4 + *) {
  margin-top: var(--space-xs);
}

/* The opening paragraph under a page's or the home hero's title. */
.hero-lede,
:where(.tech-hero-inner) > p {
  color: var(--color-ink-muted);
  font-family: var(--font-reading);
  font-size: var(--text-lede);
}

/* An ask on an errand card, or any other quoted line. */
:where(blockquote) {
  margin: var(--space-xs) 0;
  padding: var(--space-sm) var(--space-md);
  border-left: 3px solid var(--color-coral);
  border-radius: var(--radius-sm);
  background: var(--color-paper-quiet);
  font-family: var(--font-reading);
}

:where(blockquote) > :where(p) {
  margin: 0;
}

:where(:not(pre) > code) {
  padding: 1px 6px;
  border-radius: 6px;
  background: color-mix(in srgb, currentColor 9%, transparent);
  font-family: var(--kai-mono);
  font-size: 0.86em;
  overflow-wrap: anywhere;
}

:where(small, figcaption, .small-print) {
  color: var(--color-prose);
  font-size: var(--text-small);
}

a {
  color: var(--color-ocean);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.14em;
}

a:hover {
  color: var(--color-ocean-dark);
}

a:visited {
  color: var(--color-visited);
}

a:focus-visible {
  border-radius: 0.25rem;
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}

/* Ocean links vanish on the dark bands; coral reads there. */
.tech-section-dark a,
.tech-section-dark a:visited {
  color: var(--color-coral);
}
