/* Base + typography + layout */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--kg-offwhite);
  color: var(--kg-charcoal);
  font-family: var(--kg-body);
  font-size: var(--kg-body-size);
  line-height: 1.65;
  font-feature-settings: "kern" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--kg-display);
  color: var(--kg-deep-green);
  letter-spacing: -0.005em;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 var(--kg-3);
}

.section h1 { font-size: var(--kg-h1); margin: var(--kg-8) 0 var(--kg-5); }
.section h2 { font-size: var(--kg-h2); margin: var(--kg-7) 0 var(--kg-4); }
.section h3 {
  font-size: var(--kg-h3);
  margin: var(--kg-6) 0 var(--kg-3);
  font-family: var(--kg-body);
  font-weight: 600;
}
.section h4 {
  font-size: var(--kg-h4);
  margin: var(--kg-5) 0 var(--kg-3);
  font-family: var(--kg-body);
  font-weight: 600;
}

p { margin: 0 0 var(--kg-4); max-width: 75ch; }
ul, ol { margin: 0 0 var(--kg-4) 0; padding-left: var(--kg-5); max-width: 75ch; }
ul li, ol li { margin: 0 0 var(--kg-2); }
/* Editorial lead paragraphs (e.g. opening paragraph of a section): slightly
   larger and tighter line height than regular body, but ordinary weight. */
p.lead-bold {
  font-weight: 400;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--kg-charcoal);
  margin-bottom: var(--kg-4);
}
/* Only the FIRST lead paragraph in an article gets the subtle deep-green accent
   so we don't end up with a stack of boxed blocks. */
article.section > p.lead-bold:first-of-type,
article.section > .lead-bold:first-child {
  font-size: 1.125rem;
  color: var(--kg-deep-green);
  font-style: normal;
}

strong { font-weight: 600; color: var(--kg-charcoal); }
em { font-style: italic; }

/* === Bold reduction (per Update Brief, May 2026) ===
   Pandoc converts source DOCX bold runs into <strong>. Where the source author
   wrapped an entire paragraph/list-item in bold, we demote it to regular weight
   for readability while preserving the source verbatim text (Gate 1).
   Inline <strong> within a paragraph (used for true emphasis) is preserved.
   Bold remains in headings, tables, callouts, and labels.
   See EVALUATION-vs-DOCX.md, "Editorial deviations". */
article.section p > strong:only-child,
article.section li > p > strong:only-child {
  font-weight: 400;
  color: inherit;
}
/* Keep table cells bolded when used as row/column labels */
article.section table th strong,
article.section table th { font-weight: 600; }
/* Keep bold on key-figure callouts */
article.section .callout p > strong:only-child,
article.section figure figcaption p > strong:only-child { font-weight: 600; color: var(--kg-charcoal); }

a {
  color: var(--kg-ai);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color var(--kg-d-sm) var(--kg-ease);
}
a:hover { color: var(--kg-deep-green); text-decoration-thickness: 2px; }
a:focus-visible {
  outline: 2px solid var(--kg-ai);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection { background: rgba(46,111,79,0.18); color: var(--kg-charcoal); }

/* Numeric */
.tnum, table.report-table td, .kpi-value, .data { font-variant-numeric: tabular-nums lining-nums; font-feature-settings: "tnum" 1, "lnum" 1; }

/* Container */
.container { max-width: var(--kg-container); margin: 0 auto; padding: 0 var(--kg-5); }
.narrow    { max-width: var(--kg-narrow); margin: 0 auto; padding: 0 var(--kg-5); }

/* Skip link — hidden until keyboard-focused.
   Use transform so we don't depend on the element's height. */
.skip {
  position: absolute; top: 8px; left: 16px;
  background: var(--kg-deep-green); color: var(--kg-offwhite);
  padding: 10px 16px; border-radius: var(--kg-r);
  z-index: 1000;
  transform: translateY(-200%);
  transition: transform 160ms ease;
}
.skip:focus { transform: translateY(0); }
