/* ==========================================================================
   Agilex+ — Design System
   EU regulatory technology company. Navy authority, amber signal.
   Sections: 1. Fonts  2. Tokens  3. Reset  4. Base typography
             5. Layout primitives  6. Utilities  7. Components
             8. Reveal / motion  9. Media queries
   ========================================================================== */

/* -----------------------------------------------------------------------
   1. Fonts
   ----------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* -----------------------------------------------------------------------
   2. Tokens
   ----------------------------------------------------------------------- */
:root {
  /* Brand colour */
  --navy: #0D1F3C;
  --navy-90: #142a4d;
  --blue: #1A5FB4;
  --blue-dark: #144a8c;
  --amber: #E8A020;
  --bg: #FAFAFA;
  --ink: #141414;

  /* Neutral scale (derived, for borders / muted text — kept cool to match navy) */
  --gray-100: #ECEEF2;
  --gray-200: #DCE0E7;
  --gray-400: #8891A0;
  --gray-500: #5B6472;
  --gray-600: #3D4552;

  --surface: #FFFFFF;
  --surface-sunken: #F2F4F7;

  /* Type */
  --font-display: 'DM Sans', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --fs-hero: clamp(2.75rem, 3.2vw + 2rem, 5rem);
  --fs-h2: clamp(2rem, 1.6vw + 1.5rem, 3rem);
  --fs-h3: clamp(1.25rem, 0.4vw + 1.1rem, 1.5rem);
  --fs-lead: clamp(1.125rem, 0.5vw + 1rem, 1.375rem);
  --fs-body: 1.0625rem;
  --fs-small: 0.9rem;
  --fs-eyebrow: 0.8rem;

  --lh-tight: 1.08;
  --lh-heading: 1.2;
  --lh-body: 1.65;

  /* 8px spacing grid */
  --sp-1: 8px;
  --sp-2: 16px;
  --sp-3: 24px;
  --sp-4: 32px;
  --sp-5: 40px;
  --sp-6: 48px;
  --sp-8: 64px;
  --sp-10: 80px;
  --sp-12: 96px;
  --sp-16: 128px;

  --container-max: 1280px;
  --container-pad: clamp(20px, 4vw, 56px);
  --section-pad-y: clamp(64px, 9vw, 128px);

  /* Sticky header height — drives the mobile nav panel top offset */
  --header-h: 65px;

  --radius: 4px;
  --radius-lg: 8px;

  --border: 1px solid var(--gray-200);
  --border-dark: 1px solid rgba(255, 255, 255, 0.16);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 480ms;

  --focus-ring: 3px solid var(--navy);
}

/* -----------------------------------------------------------------------
   3. Reset
   ----------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Offset anchor scrolls by the sticky header height + breathing room so the
     section's eyebrow + heading land fully visible below the header, not
     tucked under it. */
  scroll-padding-top: var(--header-h);
}

/* Defensive: also give every section an explicit scroll margin in case a
   non-html anchor mechanism is used. */
section[id] {
  scroll-margin-top: var(--header-h);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

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

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

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

a {
  color: inherit;
  text-decoration: none;
}

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

/* -----------------------------------------------------------------------
   4. Base typography
   ----------------------------------------------------------------------- */
body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--bg);
  font-weight: 400;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--navy);
  line-height: var(--lh-heading);
  font-weight: 600;
  text-wrap: balance;
}

h1 { font-weight: 700; }

p {
  max-width: 68ch;
}

.lead {
  font-size: var(--fs-lead);
  line-height: 1.55;
  color: var(--gray-600);
}

strong, b {
  font-weight: 600;
}

code, .mono {
  font-family: var(--font-mono);
}

a:not([class]) {
  color: var(--blue);
  text-underline-offset: 3px;
  text-decoration: underline;
  text-decoration-color: rgba(26, 95, 180, 0.4);
}

a:not([class]):hover {
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 3px;
}

.section--navy :focus-visible,
.site-footer :focus-visible {
  outline-color: var(--amber);
}

/* -----------------------------------------------------------------------
   5. Layout primitives
   ----------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

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

.section--tight {
  padding-block: calc(var(--section-pad-y) * 0.6);
}

.section--navy {
  background: var(--navy);
  color: rgba(255, 255, 255, 0.86);
}

.section--navy h2,
.section--navy h3 {
  color: #fff;
}

.section--sunken {
  background: var(--surface-sunken);
}

.section-header {
  max-width: 46rem;
  margin-bottom: var(--sp-8);
}

.section-header--wide {
  max-width: 60rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-family: var(--font-mono);
  font-size: var(--fs-eyebrow);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: var(--sp-2);
}

.section--navy .eyebrow {
  color: rgba(255, 255, 255, 0.85);
}

.eyebrow::before {
  content: '';
  width: 20px;
  height: 2px;
  background: currentColor;
  display: inline-block;
}

.grid {
  display: grid;
  gap: var(--sp-4);
}

.grid--services {
  grid-template-columns: repeat(3, 1fr);
}

.grid--three {
  grid-template-columns: repeat(3, 1fr);
}

.grid--two {
  grid-template-columns: repeat(2, 1fr);
}

/* -----------------------------------------------------------------------
   6. Utilities
   ----------------------------------------------------------------------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--sp-2);
  z-index: 100;
  background: var(--navy);
  color: #fff;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  font-weight: 600;
  transition: top 200ms var(--ease);
}

.skip-link:focus {
  top: var(--sp-2);
}

.text-blue { color: var(--blue); }
.text-muted { color: var(--gray-500); }

/* -----------------------------------------------------------------------
   7. Components
   ----------------------------------------------------------------------- */

/* Logo -------------------------------------------------------------- */
.logo {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--navy);
}

.logo__mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

/* Pull the "+" tight against the preceding "x" — the parent .logo is inline-flex
   with an 8px gap between the SVG mark and the wordmark; without this the gap
   also opens up between "Agilex" and "+". Negative margin cancels it. */
.logo__plus {
  color: var(--amber);
  margin-left: calc(var(--sp-1) * -1);
}

.site-footer .logo__plus,
.section--navy .logo__plus {
  /* Keep the accent "+" amber even on dark backgrounds */
  color: var(--amber);
}

.section--navy .logo,
.site-footer .logo {
  color: #fff;
}

/* Site header --------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 250, 250, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--sp-2);
  /* Rendered height (content + 1px border) matches --header-h (65px) so the
     mobile nav panel sits flush under the sticky header. */
  min-height: calc(var(--header-h) - 1px);
  /* Keep logo + nav on one row; never wrap the CTA below the links */
  flex-wrap: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: nowrap;
  flex-shrink: 0;
}

/* Desktop: place the nav links and CTA on the same horizontal row.
   (On mobile the 760px query re-declares .site-nav as a fixed column panel.) */
@media (min-width: 761px) {
  .site-nav {
    display: flex;
    align-items: center;
  }
}

.nav__list {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: nowrap;
}

.nav__list li {
  flex-shrink: 0;
}

.nav__list a {
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--navy-90);
  padding: var(--sp-1) 0;
  position: relative;
  white-space: nowrap;
}

.nav__list a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--blue);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 220ms var(--ease);
}

.nav__list a:hover::after,
.nav__list a:focus-visible::after {
  transform: scaleX(1);
}

/* Active-page state */
.nav__list a[aria-current="page"] {
  color: var(--blue);
  font-weight: 600;
}

.nav__list a[aria-current="page"]::after {
  transform: scaleX(1);
}

.nav__cta {
  flex-shrink: 0;
  /* Divider so the CTA reads as a distinct action, not a 5th nav link */
  margin-left: var(--sp-3);
  padding-left: var(--sp-3);
  border-left: 1px solid var(--gray-200);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
}

.nav-toggle__bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--navy);
  transition: transform 220ms var(--ease), opacity 220ms var(--ease);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-small);
  padding: 0.85em 1.5em;
  border-radius: var(--radius);
  border: 2px solid transparent;
  transition: transform 180ms var(--ease), background 180ms var(--ease), border-color 180ms var(--ease), color 180ms var(--ease);
  white-space: nowrap;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
}

.btn-primary:hover {
  background: var(--blue-dark);
  transform: translateY(-2px);
}

.btn-secondary {
  background: transparent;
  border-color: var(--navy);
  color: var(--navy);
}

.btn-secondary:hover {
  background: var(--navy);
  color: #fff;
  transform: translateY(-2px);
}

.section--navy .btn-secondary {
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
}

.section--navy .btn-secondary:hover {
  background: #fff;
  color: var(--navy);
}

/* Hero ------------------------------------------------------------------ */
.hero {
  position: relative;
  padding-block: clamp(56px, 9vw, 140px) var(--sp-10);
  overflow: hidden;
}

.hero__grid {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: var(--sp-8);
  align-items: end;
}

.hero__kicker {
  font-family: var(--font-mono);
  font-size: var(--fs-eyebrow);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.hero__kicker::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
}

.hero h1 {
  font-size: var(--fs-hero);
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
  max-width: 16ch;
}

.hero h1 em {
  font-style: normal;
  color: var(--blue);
}

.hero__aside {
  border-left: 3px solid var(--amber);
  padding-left: var(--sp-4);
}

.hero__lead {
  font-size: var(--fs-lead);
  color: var(--gray-600);
  margin-bottom: var(--sp-4);
  max-width: 42ch;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
}

.trust-bar {
  margin-top: var(--sp-10);
  padding-top: var(--sp-4);
  border-top: var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-1) var(--sp-3);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--gray-500);
}

.trust-bar strong {
  font-family: var(--font-body);
  color: var(--navy);
  font-weight: 600;
}

/* Cards ------------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
}

/* Service cards ------------------------------------------------------------------ */
.service-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--gray-200);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.service-card {
  background: var(--surface);
  padding: var(--sp-5) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  transition: background 220ms var(--ease);
}

.service-card:hover,
.service-card:focus-within {
  background: var(--surface-sunken);
}

.service-card__index {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--blue);
  font-weight: 500;
}

.service-card h3 {
  font-size: var(--fs-h3);
}

.service-card h3 a {
  color: var(--navy);
}

.service-card h3 a::after {
  content: '';
  position: absolute;
  inset: 0;
}

.service-card {
  position: relative;
}

.service-card p {
  color: var(--gray-500);
  font-size: var(--fs-small);
  max-width: 34ch;
}

.service-card__tag {
  margin-top: auto;
  padding-top: var(--sp-2);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--blue);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.service-card__arrow {
  font-family: var(--font-display);
  color: var(--blue);
}

/* Approach steps ------------------------------------------------------------------ */
.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
  counter-reset: step;
}

.step {
  position: relative;
  padding-top: var(--sp-5);
  border-top: 2px solid var(--gray-200);
}

.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  display: block;
  font-family: var(--font-mono);
  color: var(--blue);
  font-size: 0.85rem;
  margin-bottom: var(--sp-2);
}

.step h3 {
  font-size: 1.05rem;
  margin-bottom: var(--sp-1);
}

.step p {
  color: var(--gray-500);
  font-size: var(--fs-small);
}

/* Differentiator columns ------------------------------------------------------------------ */
.diff-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-6);
}

.diff-grid h3 {
  font-size: 1.15rem;
  margin-bottom: var(--sp-2);
}

.diff-grid p {
  color: rgba(255, 255, 255, 0.72);
  font-size: var(--fs-small);
}

/* CTA strip ------------------------------------------------------------------ */
.cta-strip {
  background: var(--navy);
  border-radius: var(--radius-lg);
  padding: var(--sp-8) var(--sp-6);
}

.cta-strip h2 {
  color: #fff;
  font-size: var(--fs-h2);
  margin-bottom: var(--sp-3);
}

.cta-strip p {
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: var(--sp-5);
}

.cta-strip__actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: center;
}

/* The CTA strip has a navy background but isn't .section--navy, so the
   default .btn-secondary (navy text/border) would be invisible. Override. */
.cta-strip .btn-secondary {
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
}

.cta-strip .btn-secondary:hover {
  background: #fff;
  color: var(--navy);
}

/* Footer ------------------------------------------------------------------ */
.site-footer {
  background: var(--navy);
  color: rgba(255, 255, 255, 0.72);
  padding-block: var(--sp-8) var(--sp-6);
}

.site-footer a {
  color: rgba(255, 255, 255, 0.72);
}

.site-footer a:hover {
  color: #fff;
}

.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--sp-6);
  padding-bottom: var(--sp-6);
  border-bottom: var(--border-dark);
}

.footer__tagline {
  margin-top: var(--sp-2);
  font-size: var(--fs-small);
  max-width: 30ch;
}

.footer__heading {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: var(--sp-2);
}

.footer__list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.footer__list a {
  font-size: var(--fs-small);
}

.footer__list a[aria-current="page"] {
  color: #fff;
  font-weight: 600;
}

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--sp-2);
  padding-top: var(--sp-4);
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.6);
}

.footer__legal {
  max-width: 60ch;
}

/* -----------------------------------------------------------------------
   7b. Service detail page additions (Phase 2)
   ----------------------------------------------------------------------- */

/* Breadcrumb back-link above service hero kickers */
.breadcrumb {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--gray-500);
  margin-bottom: var(--sp-3);
}

.breadcrumb a {
  color: var(--blue);
}

/* Audience bullet list ("who it's for" sections) */
.audience-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.audience-list li {
  position: relative;
  padding-left: var(--sp-3);
  color: var(--gray-600);
}

.audience-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
}

/* Informational-context note box (e.g. "not legal advice" disclaimers) */
.note-box {
  border-left: 3px solid var(--blue);
  background: var(--surface-sunken);
  padding: var(--sp-3) var(--sp-4);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: var(--fs-small);
  color: var(--gray-600);
}

.note-box strong {
  color: var(--navy);
}

/* -----------------------------------------------------------------------
   7c. About / contact / legal page additions (Phase 3)
   ----------------------------------------------------------------------- */

/* Four-column variant of the service-card grid, used for the pillars on about.html */
.service-list--four {
  grid-template-columns: repeat(4, 1fr);
}

/* Three-column variant of the numbered steps grid, used on contact.html */
.steps--three {
  grid-template-columns: repeat(3, 1fr);
}

/* Long-form legal/prose content: narrower measure, spaced headings */
.legal-content {
  max-width: 68ch;
}

.legal-content h2 {
  font-size: var(--fs-h3);
  margin-top: var(--sp-8);
  margin-bottom: var(--sp-2);
}

.legal-content h2:first-child {
  margin-top: 0;
}

.legal-content p + h2,
.legal-content ul + h2 {
  margin-top: var(--sp-8);
}

.legal-content p {
  margin-bottom: var(--sp-3);
  max-width: 68ch;
}

.legal-content .audience-list {
  margin-bottom: var(--sp-3);
}

.legal-content__updated {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--gray-500);
}

/* 404 page */
.error-page {
  text-align: left;
}

.error-page__code {
  font-family: var(--font-mono);
  font-size: clamp(4rem, 8vw, 7rem);
  font-weight: 500;
  color: var(--blue);
  line-height: 1;
  margin-bottom: var(--sp-3);
}

/* -----------------------------------------------------------------------
   7d. Contact modal
   Reusable "Schedule a call" dialog, injected into #contact-modal-root.
   ----------------------------------------------------------------------- */
.cm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  background: rgba(13, 31, 60, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  overflow-y: auto;
  animation: cm-fade 200ms var(--ease);
}

.cm-backdrop[hidden] {
  display: none;
}

.cm-dialog {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: 0 20px 60px rgba(13, 31, 60, 0.25);
  animation: cm-slide 260ms var(--ease);
}

@keyframes cm-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cm-slide {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.cm-close {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--gray-500);
  cursor: pointer;
  transition: background 160ms var(--ease), color 160ms var(--ease);
}

.cm-close:hover {
  background: var(--surface-sunken);
  color: var(--navy);
}

.cm-close svg {
  width: 22px;
  height: 22px;
}

.cm-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-family: var(--font-mono);
  font-size: var(--fs-eyebrow);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: var(--sp-2);
}

/* Amber accent — the single focal point in the composition */
.cm-eyebrow::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
}

.cm-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.5rem, 1vw + 1.25rem, 1.875rem);
  line-height: var(--lh-heading);
  letter-spacing: -0.01em;
  color: var(--navy);
}

.cm-title:focus-visible {
  outline: none;
}

.cm-lead {
  color: var(--gray-600);
  margin-top: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.cm-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
}

.cm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.cm-field--full {
  grid-column: 1 / -1;
}

.cm-field label {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-small);
  color: var(--navy);
}

.cm-hint {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--gray-500);
}

.cm-field input,
.cm-field select,
.cm-field textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.6em 0.75em;
  font-size: var(--fs-body);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

.cm-field textarea {
  min-height: 88px;
  resize: vertical;
}

.cm-field input:focus,
.cm-field select:focus,
.cm-field textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26, 95, 180, 0.18);
}

.cm-privacy {
  font-size: var(--fs-small);
  color: var(--gray-500);
  margin-top: var(--sp-3);
}

.cm-submit {
  margin-top: var(--sp-4);
  width: 100%;
  justify-content: center;
}

/* Success state */
.cm-success {
  text-align: center;
  padding: var(--sp-3) 0;
}

.cm-success[hidden] {
  display: none;
}

.cm-success__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--sp-3);
}

.cm-success .cm-lead {
  margin-left: auto;
  margin-right: auto;
  max-width: 40ch;
}

.cm-success__fallback {
  font-size: var(--fs-small);
  color: var(--gray-500);
  margin-bottom: var(--sp-4);
}

@media (prefers-reduced-motion: reduce) {
  .cm-backdrop,
  .cm-dialog {
    animation: none;
  }
}

@media (max-width: 560px) {
  .cm-backdrop {
    padding: 0;
  }

  .cm-dialog {
    max-width: none;
    min-height: 100%;
    border-radius: 0;
    padding: var(--sp-5) var(--sp-4);
  }

  .cm-grid {
    grid-template-columns: 1fr;
  }
}

/* -----------------------------------------------------------------------
   Contact page — general-enquiry form
   Always-visible form on contact.html. Distinct from the Schedule-a-call
   modal: general enquiry (name / email / org / topic / message), builds a
   mailto: and shows an inline success message. On-brand tokens only.
   ----------------------------------------------------------------------- */
.contact-form {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2, 0 8px 30px rgba(13, 31, 60, 0.08));
}

.contact-form__intro {
  margin-bottom: var(--sp-5);
}

.contact-form__intro h2 {
  margin: var(--sp-1) 0 var(--sp-2);
}

.contact-form__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
}

.contact-form__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.contact-form__field--full {
  grid-column: 1 / -1;
}

.contact-form__field label {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-small);
  color: var(--navy);
}

.contact-form__hint {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--gray-500);
}

.contact-form__field input,
.contact-form__field select,
.contact-form__field textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.6em 0.75em;
  font-size: var(--fs-body);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

.contact-form__field textarea {
  min-height: 120px;
  resize: vertical;
}

.contact-form__field input:focus,
.contact-form__field select:focus,
.contact-form__field textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26, 95, 180, 0.18);
}

.contact-form__cross-link {
  font-size: var(--fs-small);
  color: var(--gray-600);
  margin-top: var(--sp-2);
}

.contact-form__cross-link a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.contact-form__privacy {
  font-size: var(--fs-small);
  color: var(--gray-500);
  margin-top: var(--sp-3);
}

.contact-form__submit {
  margin-top: var(--sp-4);
}

/* Inline success state (shown after mailto is triggered) */
.contact-form__success {
  text-align: center;
  padding: var(--sp-4) 0;
}

.contact-form__success[hidden] {
  display: none;
}

.contact-form__success-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--sp-3);
}

.contact-form__success-title {
  margin-bottom: var(--sp-2);
}

.contact-form__success-title:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 4px;
}

/* -----------------------------------------------------------------------
   Form error box — used on service-request form (and any future form)
   ----------------------------------------------------------------------- */
.form-error-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-left: 3px solid #DC2626;
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 16px;
  color: var(--ink);
}

.form-error-box[hidden] {
  display: none;
}

.form-error-box__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #DC2626;
  margin-top: 1px;
}

.form-error-box__body {
  flex: 1;
  min-width: 0;
}

.form-error-box__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-body);
  color: #991B1B;
  margin: 0 0 4px;
}

.form-error-box__msg {
  font-size: var(--fs-small);
  color: var(--gray-600);
  margin: 0;
  line-height: var(--lh-body);
}

.form-error-box__msg a {
  color: #991B1B;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.contact-form__turnstile {
  margin: var(--sp-3) 0 var(--sp-2);
}

@media (max-width: 560px) {
  .contact-form {
    padding: var(--sp-4);
  }

  .contact-form__grid {
    grid-template-columns: 1fr;
  }
}

/* -----------------------------------------------------------------------
   8. Reveal / motion
   ----------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* -----------------------------------------------------------------------
   9. Media queries
   ----------------------------------------------------------------------- */
@media (max-width: 1100px) {
  /* Tighten the nav row so links + CTA don't wrap before the mobile breakpoint */
  .nav__list {
    gap: var(--sp-3);
  }

  .grid--services,
  .service-list,
  .service-list--four {
    grid-template-columns: repeat(2, 1fr);
  }

  .steps,
  .steps--three {
    grid-template-columns: repeat(2, 1fr);
  }

  .diff-grid {
    grid-template-columns: 1fr;
    gap: var(--sp-5);
  }

  .footer__grid {
    grid-template-columns: 1.5fr 1fr 1fr;
  }
}

@media (max-width: 900px) {
  .hero__grid {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .hero__aside {
    border-left: none;
    border-top: 3px solid var(--amber);
    padding-left: 0;
    padding-top: var(--sp-3);
  }

  }

@media (max-width: 760px) {
  .nav__list,
  .nav__cta {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  /* backdrop-filter on .site-header makes the header a containing block for
       fixed descendants, which traps this full-height panel inside the ~77px
       header and clips the nav links. Disable it on mobile so position:fixed
       resolves against the viewport and the panel spans full height. */
  .site-header {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--bg);
  }

  .site-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: 0;
    /* Below the sticky header (z-index:50) but above page content */
    z-index: 49;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg);
    /* Bottom padding keeps the CTA clear of the iPhone home indicator AND the
       Safari bottom toolbar. env(safe-area-inset-bottom) only resolves once
       the page declares viewport-fit=cover (added to the meta viewport). The
       extra fixed 2rem covers the Safari toolbar height where the safe-area
       inset alone is not enough (e.g. non-notched devices with the browser
       bar visible). */
    padding: var(--sp-5) var(--container-pad)
             calc(2rem + var(--sp-6) + env(safe-area-inset-bottom));
    overflow-y: auto;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms var(--ease), transform 220ms var(--ease);
  }

  .site-nav.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .site-nav.is-open .nav__list {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-3);
  }

  .site-nav.is-open .nav__list a {
    font-size: 1.1rem;
  }

  .site-nav.is-open .nav__cta {
    display: inline-flex;
    justify-content: center;
    width: 100%;
    /* Pin the CTA to the bottom of the panel so it's always reachable */
    margin-top: auto;
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    align-self: stretch;
  }

  .grid--services,
  .service-list,
  .service-list--four {
    grid-template-columns: 1fr;
  }

  .steps,
  .steps--three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .footer__grid {
    grid-template-columns: 1fr 1fr;
  }

  .hero__actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* -----------------------------------------------------------------------
   Custom dropdown component
   Native <select> kept (form submission + accessibility) but styled to
   match text-input height/outline/focus-ring, with an animated chevron
   that rotates down->up and turns blue when the select is focused/open.
   Used by: modal selects (#cm-time, #cm-service via contact-modal.js) and
   the contact-page select (#cf-topic). Works for any future select too.
   ----------------------------------------------------------------------- */
.select-wrap {
  position: relative;
  width: 100%;
}

.cm-field .select-wrap select,
.contact-form__field .select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  min-height: 44px;
  padding: 0.6em 2.25em 0.6em 0.75em; /* right padding leaves room for arrow */
  font-size: var(--fs-body);
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

.cm-field .select-wrap select:hover,
.contact-form__field .select-wrap select:hover {
  border-color: var(--gray-400);
}

.cm-field .select-wrap select:focus,
.contact-form__field .select-wrap select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26, 95, 180, 0.18);
}

.select-arrow {
  position: absolute;
  right: 0.9em;
  top: 50%;
  width: 0.55em;
  height: 0.55em;
  border-right: 2px solid var(--navy);
  border-bottom: 2px solid var(--navy);
  transform: translateY(-65%) rotate(45deg); /* down chevron */
  transition: transform 220ms var(--ease), border-color 160ms var(--ease);
  pointer-events: none;
}

.select-wrap select:focus ~ .select-arrow,
.select-wrap select.is-open ~ .select-arrow {
  transform: translateY(-35%) rotate(-135deg); /* up chevron */
  border-color: var(--blue);
}


/* ── UX improvements: spinner, inline errors, redesigned success/error ──── */

/* Button spinner */
.btn-spinner {
  width: 18px;
  height: 18px;
  vertical-align: -3px;
  margin-right: 8px;
  animation: btn-spin 0.6s linear infinite;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}
.btn--loading {
  pointer-events: none;
  opacity: 0.85;
}
.btn--loading .btn-text {
  opacity: 0.9;
}

/* Inline field errors */
.field-error {
  border-color: #DC2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important;
}
.field-error-msg {
  display: block;
  font-size: var(--fs-small, 13px);
  color: #DC2626;
  margin-top: 6px;
  font-family: var(--font-body, inherit);
  line-height: 1.4;
}
.field-error-msg[hidden] {
  display: none;
}

/* Redesigned success card */
.contact-form__success--card {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: 12px;
  padding: 32px 28px;
  margin-top: 20px;
}
.contact-form__success--card .contact-form__success-icon-wrap {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
}
.contact-form__success--card .contact-form__success-icon {
  width: 56px;
  height: 56px;
  margin: 0;
}
.contact-form__success--card .success-circle {
  animation: success-circle-draw 0.5s ease-out forwards;
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
}
@keyframes success-circle-draw {
  to { stroke-dashoffset: 0; }
}
.contact-form__success--card .success-check {
  animation: success-check-draw 0.3s ease-out 0.3s forwards;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
}
@keyframes success-check-draw {
  to { stroke-dashoffset: 0; }
}
.contact-form__success--card .contact-form__success-title {
  color: #14532D;
  font-size: 1.4rem;
}
.contact-form__success--card #sr-success-msg {
  color: #166534;
  font-size: var(--fs-body, 15px);
  margin-bottom: 6px;
}
.contact-form__success-sub {
  font-size: var(--fs-small, 13px);
  color: #4B7C5E;
  margin: 0;
}

/* Redesigned error card */
.form-error-box--card {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-left: 4px solid #DC2626;
  border-radius: 10px;
  padding: 16px 18px;
  margin-top: 20px;
  animation: error-shake 0.4s ease-out;
}
@keyframes error-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.form-error-box--card .form-error-box__icon {
  width: 22px;
  height: 22px;
  color: #DC2626;
}
.form-error-box--card .form-error-box__title {
  color: #991B1B;
  font-size: var(--fs-body, 15px);
}

@media (prefers-reduced-motion: reduce) {
  .btn-spinner, .success-circle, .success-check, .form-error-box--card {
    animation: none !important;
  }
  .contact-form__success--card .success-circle,
  .contact-form__success--card .success-check {
    stroke-dashoffset: 0 !important;
  }
}
