/* ==========================================================================
   Base / reset / typography primitives
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden; /* guard against any accidental horizontal scroll */
}

/* Media defaults */
img, picture, video, canvas, svg { display: block; max-width: 100%; }
img { height: auto; }

/* Forms inherit type */
button, input, select, textarea { font: inherit; color: inherit; }

/* Links */
a { color: var(--color-link); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; transition: color var(--dur-micro) var(--ease-out); }
a:hover { color: var(--color-link-hover); }

/* ---- Headings ------------------------------------------------------------ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-heading);
  margin: 0 0 0.5em;
}
.h1, h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); letter-spacing: var(--ls-h1); }
.h2, h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); letter-spacing: var(--ls-h2); }
.h3, h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); letter-spacing: var(--ls-h3); }
.h4, h4 { font-size: var(--fs-h4); line-height: var(--lh-h4); letter-spacing: var(--ls-h4); }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

/* ---- Type utilities ------------------------------------------------------ */
.display-stat { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-stat); line-height: var(--lh-stat); letter-spacing: var(--ls-stat); color: var(--color-heading); }
.body-lg { font-size: var(--fs-body-lg); line-height: var(--lh-body-lg); }
.body-sm { font-size: var(--fs-body-sm); line-height: var(--lh-body-sm); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted { color: var(--color-text-muted); }
.measure { max-width: 68ch; } /* ~65-70ch line length, brief §3 */

/* ---- Eyebrow (label + 28x2 green rule) — brief §3 ------------------------ */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-eyebrow);
  line-height: var(--lh-eyebrow);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--secondary);
  margin: 0 0 16px;
}
.eyebrow--primary { color: var(--blue-700); }
.eyebrow--green::before { background: var(--green-500); }
/* Plain eyebrow — no leading rule */
.eyebrow--plain::before { display: none; }
.eyebrow--plain { gap: 0; }
.eyebrow::before {
  content: "";
  width: 28px;
  height: 2px;
  background: var(--green-500);
  flex: 0 0 auto;
}
/* Eyebrow on dark bands */
.is-dark .eyebrow { color: rgba(255,255,255,.86); }

/* ---- Layout container ---------------------------------------------------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + (var(--gutter) * 2));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
/* On large screens the content column is exactly 1200; gutters are the artboard 120 */
@media (min-width: 1441px) {
  .container { max-width: calc(var(--container) + 240px); padding-inline: 120px; }
}

.section { padding-block: var(--section-py); }
.section--surface { background: var(--surface); }
.section--tight { padding-block: calc(var(--section-py) * 0.7); }

/* ---- Dark band context --------------------------------------------------- */
.is-dark { background: var(--blue-700); color: rgba(255,255,255,.9); }
.is-dark h1, .is-dark h2, .is-dark h3, .is-dark h4 { color: #fff; }
.is-dark .text-secondary { color: rgba(255,255,255,.75); }
.is-dark--deep { background: var(--blue-900); }

/* ---- Skip link (accessibility gate, brief §10) --------------------------- */
.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: var(--z-skiplink);
  background: var(--blue-700);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--r-input);
  text-decoration: none;
  font-weight: 600;
  transition: top var(--dur-micro) var(--ease-out);
}
.skip-link:focus { top: 16px; color: #fff; outline: 3px solid var(--green-500); outline-offset: 2px; }

/* ---- Visible focus states (accessibility) -------------------------------- */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--blue-500);
  outline-offset: 2px;
  border-radius: 4px;
}
.is-dark :where(a, button):focus-visible { outline-color: var(--green-500); }

/* ---- Image placeholder (design uses tinted blue-100 blocks) -------------- */
.img-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 160px;
  background: linear-gradient(135deg, var(--blue-100), #d6e6ec);
  position: relative;
}
.img-placeholder::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24' fill='none' stroke='%230e536e' stroke-opacity='0.35' stroke-width='1.5'%3E%3Crect width='18' height='18' x='3' y='3' rx='2'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Cpath d='m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

/* ---- Screen-reader only -------------------------------------------------- */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ---- Section header (eyebrow + heading + intro) -------------------------- */
.section-head { max-width: 720px; margin-bottom: 48px; }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head--center .eyebrow { justify-content: center; }
.section-head p { color: var(--color-text-secondary); font-size: var(--fs-body-lg); line-height: var(--lh-body-lg); }

/* ---- Utility grid helpers ------------------------------------------------ */
.grid { display: grid; gap: var(--grid-gap); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1023px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 639px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---- Phones: tighter vertical rhythm -------------------------------------
   Page stylesheets use the desktop spacing from the design; on phones every
   band steps down so content isn't separated by screen-high gaps. */
@media (max-width: 760px) {
  .page-hero, .page-hero--noimg, .section.hero, .search-hero, .legal-header,
  .service-header, .report-header { padding-top: 32px !important; padding-bottom: 36px !important; }
  .section, .inner-section, .home-section, .quick-actions, .impact-section, .impact-stats-band,
  .dash-viz, .dash-about, .signpost, .talk, .gi-partners, .partner-accred, .vacancies-list,
  .vacancies-why, .vacancies-life, .news-featured, .news-grid, .news-projects, .annual-featured,
  .annual-archive, .service-overview, .service-reviews, .service-visit, .key-findings, .report-body,
  .report-related, .help-body, .help-related, .legal, .search-results, .urgent-help,
  .feedback-form, .testimonial, .two-ways, .directory { padding-top: 48px !important; padding-bottom: 48px !important; }
  .closing-cta { padding-top: 56px !important; padding-bottom: 56px !important; }
  .contact-body { padding-top: 32px !important; padding-bottom: 48px !important; }
  .annual-featured { padding-bottom: 16px !important; }
  .news-featured { padding-bottom: 24px !important; }
}
