/* ==========================================================================
   Civil Digital Solutions — Design System (Option C)
   Clean, modern, professional, lightweight, accessible, fast.
   No external fonts or frameworks: system font stack for performance.
   ONE strong accent colour: purple (--accent) — from CivilDigital brand mark.
   ========================================================================== */

/* ---- Design tokens ------------------------------------------------------ */
:root {
  /* Accent (the single strong brand colour) */
  --accent:        #8b5cf6;   /* purple 500 — AA on white for large/bold + button bg */
  --accent-dark:   #6d28d9;   /* hover / active */
  --accent-light:  #ede9fe;   /* tints, backgrounds */
  --accent-tint:   #f5f3ff;   /* very light section wash */

  /* Ink & neutrals */
  --ink:           #2a3038;   /* headings / primary text — matches CivilDigital logotype */
  --body:          #3d4655;   /* body text (AA on white) */
  --muted:         #64748b;   /* secondary text */
  --line:          #e2e8f0;   /* borders / dividers */
  --surface:       #ffffff;
  --surface-alt:   #f8fafc;   /* alternating section bg */
  --surface-deep:  #1a1f28;   /* dark footer / hero accents */

  /* Feedback */
  --focus:         #7c3aed;
  --success:       #047857;
  --error:         #b91c1c;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
               Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  --fs-300: 0.875rem;
  --fs-400: 1rem;
  --fs-500: 1.125rem;
  --fs-600: 1.375rem;
  --fs-700: clamp(1.5rem, 3.5vw, 2rem);
  --fs-800: clamp(2rem, 5vw, 3rem);
  --fs-900: clamp(2.4rem, 6vw, 3.6rem);

  /* Spacing scale */
  --sp-1: 0.25rem; --sp-2: 0.5rem; --sp-3: 0.75rem; --sp-4: 1rem;
  --sp-5: 1.5rem;  --sp-6: 2rem;   --sp-7: 3rem;    --sp-8: 4rem;
  --sp-9: 6rem;

  /* Other */
  --radius:   12px;
  --radius-sm: 8px;
  --shadow:   0 1px 2px rgba(15,23,42,.06), 0 8px 24px rgba(15,23,42,.06);
  --shadow-lg:0 12px 40px rgba(15,23,42,.12);
  --maxw:     1120px;
  --maxw-prose: 70ch;
}

/* ---- Reset / base ------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-400);
  line-height: 1.65;
  color: var(--body);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--ink); line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-900); }
h2 { font-size: var(--fs-800); }
h3 { font-size: var(--fs-600); }
h4 { font-size: var(--fs-500); }
p { max-width: var(--maxw-prose); }

/* ---- Accessibility helpers --------------------------------------------- */
.skip-link {
  position: absolute; left: var(--sp-2); top: -3rem;
  background: var(--accent); color: #fff; padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-sm); z-index: 200; transition: top .15s ease;
}
.skip-link:focus { top: var(--sp-2); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- Layout ------------------------------------------------------------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--sp-5); }
.section { padding-block: var(--sp-9); }
.section--alt { background: var(--surface-alt); }
.section--tint { background: var(--accent-tint); }
.section__head { max-width: 60ch; margin-bottom: var(--sp-7); }
.section__head p { color: var(--muted); font-size: var(--fs-500); }
.eyebrow {
  text-transform: uppercase; letter-spacing: .08em; font-size: var(--fs-300);
  font-weight: 700; color: var(--accent); margin-bottom: var(--sp-2);
}

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-weight: 600; font-size: var(--fs-400); line-height: 1;
  padding: var(--sp-3) var(--sp-5); border-radius: var(--radius-sm);
  border: 2px solid transparent; cursor: pointer; transition: background .15s ease, color .15s ease, border-color .15s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-dark); }
.btn--secondary { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn--secondary:hover { background: var(--accent-light); }
.btn--ghost-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.btn--ghost-light:hover { background: rgba(255,255,255,.12); }
.btn--lg { font-size: var(--fs-500); padding: var(--sp-4) var(--sp-6); }

/* ---- Header / nav ------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: var(--sp-5); }
.brand { display: inline-flex; align-items: center; gap: var(--sp-3); font-weight: 700; color: var(--ink); font-size: var(--fs-500); }
.brand:hover { text-decoration: none; }
.brand__mark { width: 36px; height: 36px; flex: none; object-fit: contain; }
.brand__text small { display: block; font-size: .68rem; font-weight: 600; color: var(--muted); letter-spacing: .02em; }

.nav__links { list-style: none; display: flex; align-items: center; gap: var(--sp-2); padding: 0; }
.nav__links a {
  color: var(--body); font-weight: 600; padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm); font-size: var(--fs-400);
}
.nav__links a:hover { color: var(--accent); background: var(--accent-tint); text-decoration: none; }
.nav__links a[aria-current="page"] { color: var(--accent); }
.nav__cta { margin-left: var(--sp-2); }

.nav__toggle {
  display: none; background: none; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: var(--sp-2); cursor: pointer; color: var(--ink);
}

@media (max-width: 860px) {
  .nav__toggle { display: inline-flex; }
  .nav__links {
    position: absolute; inset: 64px 0 auto 0; flex-direction: column; align-items: stretch;
    background: #fff; border-bottom: 1px solid var(--line); padding: var(--sp-3) var(--sp-5) var(--sp-5);
    gap: var(--sp-1); box-shadow: var(--shadow); display: none;
  }
  .nav__links.is-open { display: flex; }
  .nav__links a { padding: var(--sp-3); }
  .nav__cta { margin-left: 0; margin-top: var(--sp-2); }
  .nav__cta .btn { width: 100%; justify-content: center; }
}

/* ---- Hero --------------------------------------------------------------- */
.hero {
  background:
    radial-gradient(60% 120% at 85% 0%, rgba(139,92,246,.10), transparent 60%),
    var(--surface);
  border-bottom: 1px solid var(--line);
  padding-block: var(--sp-9);
}
.hero__inner { max-width: 52rem; }
.hero h1 { margin-bottom: var(--sp-5); }
.hero__lede { font-size: var(--fs-600); color: var(--body); margin-bottom: var(--sp-6); max-width: 46rem; }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); }

/* ---- Grids & cards ------------------------------------------------------ */
.grid { display: grid; gap: var(--sp-5); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-3);
  transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
.card--link:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--accent-light); }
.card h3 { font-size: var(--fs-600); }
.card p { color: var(--body); }
.card__more { margin-top: auto; font-weight: 600; color: var(--accent); display: inline-flex; align-items: center; gap: var(--sp-2); }
.card a.stretched::after { content: ""; position: absolute; inset: 0; }
.card { position: relative; }

.icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-light); color: var(--accent-dark); flex: none;
}
.icon svg { width: 24px; height: 24px; }

/* ---- Feature / steps lists --------------------------------------------- */
.feature { display: flex; gap: var(--sp-4); align-items: flex-start; }
.feature h3 { font-size: var(--fs-500); margin-bottom: var(--sp-1); }
.feature p { color: var(--muted); }

.steps { counter-reset: step; display: grid; gap: var(--sp-5); }
.step { display: flex; gap: var(--sp-4); align-items: flex-start; }
.step__num {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.step h3 { font-size: var(--fs-500); margin-bottom: var(--sp-1); }
.step p { color: var(--muted); }

/* ---- Pills / tags ------------------------------------------------------- */
.pill-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.pill {
  font-size: var(--fs-300); font-weight: 600; color: var(--accent-dark);
  background: var(--accent-light); border-radius: 999px; padding: var(--sp-2) var(--sp-4);
}

/* ---- Page header (interior pages) -------------------------------------- */
.page-head { background: var(--accent-tint); border-bottom: 1px solid var(--line); padding-block: var(--sp-8); }
.page-head p { font-size: var(--fs-500); color: var(--body); }
.breadcrumb { font-size: var(--fs-300); color: var(--muted); margin-bottom: var(--sp-3); }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }

/* ---- Prose (about, privacy, article) ----------------------------------- */
.prose { max-width: var(--maxw-prose); }
.prose > * + * { margin-top: var(--sp-4); }
.prose h2 { margin-top: var(--sp-7); font-size: var(--fs-700); }
.prose h3 { margin-top: var(--sp-5); }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li + li { margin-top: var(--sp-2); }

/* ---- Insights list ------------------------------------------------------ */
.article-card { position: relative; }
.article-card .meta { font-size: var(--fs-300); color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.article-card h3 { font-size: var(--fs-500); }
.badge {
  display: inline-block; font-size: var(--fs-300); font-weight: 600; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px var(--sp-3);
}

/* ---- Contact / forms ---------------------------------------------------- */
.form-grid { display: grid; gap: var(--sp-4); }
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field label { font-weight: 600; color: var(--ink); }
.field .req { color: var(--error); }
.field input, .field select, .field textarea {
  font: inherit; color: var(--ink); padding: var(--sp-3); border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: #fff; width: 100%;
}
.field textarea { min-height: 160px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline-offset: 0; }
.form-note { font-size: var(--fs-300); color: var(--muted); }
.form-status { padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-sm); display: none; }
.form-status.is-error { display: block; background: #fef2f2; color: var(--error); border: 1px solid #fecaca; }

.contact-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--sp-8); align-items: start; }
@media (max-width: 820px) { .contact-cols { grid-template-columns: 1fr; } }
.contact-card { background: var(--surface-alt); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-6); }
.contact-card a { font-weight: 600; }

/* ---- Call-to-action band ----------------------------------------------- */
.cta-band { background: var(--surface-deep); color: #e2e8f0; border-radius: var(--radius); padding: var(--sp-8); text-align: center; }
.cta-band h2 { color: #fff; }
.cta-band p { color: #cbd5e1; margin-inline: auto; margin-block: var(--sp-3) var(--sp-6); }
.cta-band .btn--primary { background: #fff; color: var(--accent-dark); }
.cta-band .btn--primary:hover { background: var(--accent-light); }

/* ---- Footer ------------------------------------------------------------- */
.site-footer { background: var(--surface-deep); color: #94a3b8; padding-block: var(--sp-8) var(--sp-6); margin-top: var(--sp-9); }
.site-footer a { color: #cbd5e1; }
.site-footer a:hover { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: var(--sp-6); }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 460px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h2 { color: #fff; font-size: var(--fs-400); text-transform: uppercase; letter-spacing: .06em; margin-bottom: var(--sp-3); }
.footer-brand .brand { color: #fff; }
.footer-brand p { color: #94a3b8; font-size: var(--fs-300); margin-top: var(--sp-3); }
.footer-links { list-style: none; padding: 0; display: grid; gap: var(--sp-2); }
.footer-bottom { border-top: 1px solid rgba(148,163,184,.2); margin-top: var(--sp-6); padding-top: var(--sp-5); display: flex; flex-wrap: wrap; gap: var(--sp-3); justify-content: space-between; font-size: var(--fs-300); }

/* ---- Utilities ---------------------------------------------------------- */
.text-center { text-align: center; }
.mt-6 { margin-top: var(--sp-6); }
.lead { font-size: var(--fs-500); color: var(--body); }

/* ==========================================================================
   HOMEPAGE v2 — Apple / Medium inspired (additive; homepage only)
   Spacious, visual, minimal text. Reuses the same tokens above so it stays
   consistent with the design system and does not affect other pages.
   ========================================================================== */

/* Big centered hero */
.hero-xl {
  padding-block: clamp(4.5rem, 13vh, 9.5rem);
  text-align: center;
  background:
    radial-gradient(70% 120% at 50% -10%, rgba(139,92,246,.10), transparent 60%),
    var(--surface);
  border-bottom: 1px solid var(--line);
}
.hero-xl .container { max-width: 60rem; }
.hero-logo {
  width: min(340px, 78%); height: auto; margin: 0 auto var(--sp-7);
}
.hero-xl h1 {
  font-size: clamp(2.5rem, 6.2vw, 4.25rem);
  letter-spacing: -0.035em; line-height: 1.05; margin-bottom: var(--sp-5);
}
.hero-xl .hero-sub {
  font-size: clamp(1.15rem, 2.6vw, 1.6rem); line-height: 1.45;
  color: var(--muted); max-width: 40rem; margin: 0 auto var(--sp-7);
}
.hero-xl .hero__actions { justify-content: center; }

/* Generic spacious "stage" section — one idea, room to breathe */
.stage { padding-block: clamp(3.5rem, 9vh, 7rem); }
.stage--tint { background: var(--accent-tint); }
.stage--alt { background: var(--surface-alt); }
.stage__title { text-align: center; max-width: 46rem; margin: 0 auto clamp(2.25rem, 6vh, 3.75rem); }
.stage__title h2 { font-size: clamp(1.9rem, 4.2vw, 2.7rem); letter-spacing: -0.025em; }
.stage__title p { color: var(--muted); font-size: var(--fs-500); margin-top: var(--sp-3); }

/* Service tiles — icon-led, no paragraphs */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-5); }
@media (max-width: 900px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .tiles { grid-template-columns: 1fr; } }
.tile {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-3);
  text-align: center; text-decoration: none; color: inherit;
  padding: var(--sp-6) var(--sp-4); border-radius: var(--radius);
  transition: background .15s ease, transform .15s ease;
}
.tile:hover { background: var(--accent-tint); text-decoration: none; transform: translateY(-3px); }
.ico-xl {
  width: 76px; height: 76px; border-radius: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-tint); color: var(--accent-dark);
}
.tile:hover .ico-xl { background: #fff; }
.ico-xl svg { width: 38px; height: 38px; }
.tile h3 { font-size: var(--fs-500); }
.tile .tag { color: var(--muted); font-size: var(--fs-300); }

/* Value row (Why CDS) — scannable, short */
.values { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-6); }
@media (max-width: 900px) { .values { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .values { grid-template-columns: 1fr; } }
.value { text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); }
.value h3 { font-size: var(--fs-500); }
.value p { color: var(--muted); font-size: var(--fs-300); max-width: 22ch; margin: 0 auto; }

/* Approach — big numerals, minimal words */
.steps-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-6); }
@media (max-width: 900px) { .steps-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .steps-row { grid-template-columns: 1fr; } }
.stepc { text-align: center; }
.stepc .n {
  font-size: clamp(2.4rem, 5vw, 3.25rem); font-weight: 800; color: var(--accent);
  line-height: 1; letter-spacing: -0.03em; display: block; margin-bottom: var(--sp-3);
}
.stepc h3 { font-size: var(--fs-500); }
.stepc p { color: var(--muted); font-size: var(--fs-300); max-width: 22ch; margin: var(--sp-1) auto 0; }

/* Insights — editorial, Medium-like */
.posts { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-7); }
@media (max-width: 820px) { .posts { grid-template-columns: 1fr; gap: var(--sp-5); } }
.post { display: block; text-decoration: none; color: inherit; padding-top: var(--sp-4); border-top: 2px solid var(--accent); }
.post .cat { color: var(--accent-dark); font-size: var(--fs-300); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.post h3 { font-size: var(--fs-600); margin-top: var(--sp-3); letter-spacing: -0.015em; line-height: 1.25; }
.post:hover h3 { color: var(--accent-dark); }

/* Closing CTA — big, calm, centered */
.closing { text-align: center; padding-block: clamp(4.5rem, 11vh, 8.5rem); }
.closing h2 { font-size: clamp(2.1rem, 5.2vw, 3.1rem); letter-spacing: -0.03em; }
.closing p { color: var(--muted); font-size: var(--fs-500); max-width: 34rem; margin: var(--sp-4) auto var(--sp-7); }
.closing .hero__actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); justify-content: center; }
