/* ═══════════════════════════════════════════════════════════════════════════
   LAYER 2: BASE — reset, document defaults, typography, accessibility
   Consumes tokens from 1-tokens.css. Authors no colour of its own.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Reset ───────────────────────────────────────────────────────────────── */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--space-6));
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--leading-relaxed);
  color: var(--color-text-secondary);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

img, svg, video, canvas {
  display: block;
  max-width: 100%;
}

img { height: auto; }

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button { background: none; border: none; cursor: pointer; }

ul, ol { padding: 0; list-style: none; }

table { border-collapse: collapse; border-spacing: 0; }

hr {
  border: 0;
  border-top: 1px solid var(--color-divider);
}

/* Components in this system set an explicit display (flex/grid), which would
   otherwise win over the UA's [hidden] rule. Make the attribute authoritative
   so JS can hide elements by toggling `hidden` rather than inline styles. */
[hidden] { display: none !important; }


/* ── Typography ──────────────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--color-text-primary);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

h1 { font-size: var(--text-h1); }
h2 { font-size: var(--text-h2); }
h3 {
  font-size: var(--text-h3);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-snug);
}
h4 {
  font-size: var(--text-h4);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-snug);
  font-weight: var(--weight-semibold);
}

p { text-wrap: pretty; }

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover { color: var(--color-primary-hover); }

strong, b { font-weight: var(--weight-semibold); color: var(--color-text-primary); }

small { font-size: var(--text-caption); }

::selection {
  background: var(--color-primary-a20);
  color: var(--color-text-primary);
}


/* ── Accessibility ───────────────────────────────────────────────────────── */

/* One focus treatment for the whole application. Mouse users never see it;
   keyboard users always do. */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

:focus:not(:focus-visible) { outline: none; }

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-4);
  z-index: var(--z-toast);
  padding: var(--space-3) var(--space-5);
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  font-weight: var(--weight-semibold);
  font-size: var(--text-body-sm);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  transform: translateY(-200%);
  transition: transform var(--duration-base) var(--ease-out);
}

.skip-link:focus {
  transform: translateY(0);
  color: var(--color-primary-contrast);
}

/* Visually hidden but available to screen readers. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ── Layout primitives ───────────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.container-narrow {
  width: 100%;
  max-width: 920px;
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.section { padding-block: var(--section-y); }
.section-tight { padding-block: var(--section-y-tight); }

.section-sunken {
  background: var(--color-surface-sunken);
  border-block: 1px solid var(--color-divider);
}

.section-inverse {
  background: var(--gradient-brand);
  color: var(--color-text-on-dark);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.section-inverse h1,
.section-inverse h2,
.section-inverse h3,
.section-inverse h4 { color: var(--color-text-inverse); }


/* ── Utilities ───────────────────────────────────────────────────────────── */

.text-center { text-align: center; }
.muted       { color: var(--color-text-muted); }
.prose-max   { max-width: var(--prose-max); }

/* Spacing utilities. Deliberately limited to the few steps the layouts need,
   so views never reach for an inline style to nudge a margin. */
.mt-3  { margin-top: var(--space-3); }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mt-8  { margin-top: var(--space-8); }
.mt-10 { margin-top: var(--space-10); }
.mt-12 { margin-top: var(--space-12); }
.mb-6  { margin-bottom: var(--space-6); }
.mb-8  { margin-bottom: var(--space-8); }
.mb-10 { margin-bottom: var(--space-10); }

/* Centred trailing action below a grid ("View More Services"). */
.section-foot {
  margin-top: var(--space-10);
  text-align: center;
}

.stack-center {
  max-width: 780px;
  margin-inline: auto;
  text-align: center;
}

/* Centred running paragraphs — same measure as .stack-center but left-aligned
   text, which stays readable across the several sentences the About page runs
   to. Centred text is fine for one line and hostile for four. */
.prose-center {
  max-width: var(--prose-max);
  margin-inline: auto;
}

/* ── Flow spacing ─────────────────────────────────────────────────────────
   Nothing in this stylesheet gives <p> a margin, so consecutive paragraphs
   and heading→paragraph pairs ran together with no gap wherever a text
   column was not inside .prose. That is most of the About, Contact and
   Compliance pages.

   This is opt-in rather than a global `p { margin-bottom }` because the card
   patterns (.card, .pillar, .quadrant, .info-list) are flex containers that
   already space their children with `gap` — a global margin would add to the
   gap and make every card taller.

   Uses the "owl" selector: margin between siblings only, never leading or
   trailing, so a .flow block still sits flush inside its section. */
.flow          { --flow-gap: var(--space-4); }
.flow > * + *  { margin-top: var(--flow-gap); }

/* A heading starting a new subsection needs more air above it than a
   paragraph following another paragraph. */
.flow > :is(h2, h3, h4) + *   { margin-top: var(--space-3); }
.flow > * + :is(h2, h3, h4)   { margin-top: var(--space-8); }

.prose-center { --flow-gap: var(--space-4); }
.prose-center > * + * { margin-top: var(--flow-gap); }

.icon-svg {
  flex-shrink: 0;
  vertical-align: middle;
}

/* Grid helpers. Auto-fit means these degrade gracefully with any item count. */
.grid { display: grid; gap: var(--space-6); }

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }

/* Deliberate two-up that must never collapse to one column above mobile. */
.grid-2-fixed { grid-template-columns: 1fr 1fr; }

@media (max-width: 620px) {
  .grid-2-fixed { grid-template-columns: 1fr; }
}
