/* Consilium Digitalis — Design System v2 "The Counsel's Ledger"
   Voice: measured deliberation. A senior advisory chamber, worked in the margins.
   Type: Newsreader (editorial serif, display) + Inter (body) + IBM Plex Mono (apparatus).
   Palette: cool near-navy ink on cool off-white; deep pine "counsel green"; one terracotta note. */

:root {
  /* Colour — cool, deliberately not cream */
  --ink:      #16202b;   /* near-navy ink — text & dark bands */
  --slate:    #4a5661;   /* secondary text (darkened for AA contrast ≈ 6:1 on paper) */
  --paper:    #f4f5f3;   /* cool off-white (green-grey, not cream) */
  --paper-2:  #e9ebe7;   /* alt band */
  --rule:     #cfd4cd;   /* hairline */
  --rule-soft:#dfe2dc;
  --accent:   #1f6f5c;   /* deep pine — counsel green */
  --accent-d: #185446;   /* darker pine for text-on-paper contrast */
  --warm:     #b24a2c;   /* single muted terracotta — used once */
  --white:    #ffffff;

  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --sp-section: clamp(4rem, 9vw, 7.5rem);
  --container: 1160px;
  --margin-w: 168px;      /* left ledger-margin width (desktop) */
  --col-max: 68ch;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  color-scheme: light;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.65;
  font-size: 1.02rem;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Reduce font-swap reflow (CLS): keep fallback metrics close to the web fonts */
h1, h2, h3, .lead { font-size-adjust: 0.47; }

/* Skip link */
.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 100;
  background: var(--ink); color: var(--paper);
  padding: 0.6rem 1rem; border-radius: 2px; text-decoration: none;
  font-family: var(--font-mono); font-size: 0.8rem; font-weight: 500;
  transition: top 0.18s ease;
}
.skip-link:focus { top: 1rem; }

/* Visible keyboard focus */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent-d);
  outline-offset: 3px;
  border-radius: 2px;
}

.container {
  width: 100%; max-width: var(--container);
  margin: 0 auto; padding: 0 clamp(1.25rem, 4vw, 2.5rem);
}
.center { text-align: center; }

/* ---------- Typography ---------- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 480;
  letter-spacing: -0.012em;
  color: var(--ink);
  text-wrap: balance;
}
h1 { font-size: clamp(2.35rem, 5.4vw, 4rem); line-height: 1.04; margin: 0 0 1.4rem; font-weight: 440; }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.55rem); line-height: 1.12; margin: 0 0 1rem; }
h3 { font-size: 1.18rem; margin: 0 0 0.5rem; font-weight: 520; letter-spacing: -0.005em; }

.lead {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 1.9vw, 1.42rem);
  font-weight: 380;
  line-height: 1.5;
  color: var(--slate);
  max-width: var(--col-max);
}
.muted { color: var(--slate); }

/* Mono apparatus: eyebrows, numbers, annotations */
.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--accent-d);
  margin: 0 0 1rem;
}
.section-title { margin-bottom: 1.75rem; }
.section-title.big { font-size: clamp(2.1rem, 5.2vw, 3.4rem); }

p { max-width: var(--col-max); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono);
  font-weight: 500; font-size: 0.85rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  padding: 0.85rem 1.4rem;
  border-radius: 2px;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
  touch-action: manipulation;
}
.btn-primary { background: var(--accent); color: var(--white); }
.btn-primary:hover { background: var(--accent-d); }
.btn-ghost { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.btn-text { color: var(--accent-d); background: transparent; padding-left: 0; padding-right: 0; }
.btn-text:hover { color: var(--ink); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(130%) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 76px; }
.brand { display: flex; align-items: center; gap: 0.65rem; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 38px; height: 38px;
  display: block;
  object-fit: contain;
}
.brand-name { font-family: var(--font-display); font-weight: 480; font-size: 1.18rem; letter-spacing: -0.01em; }
.nav { display: flex; align-items: center; gap: 1.6rem; }
.nav a { text-decoration: none; color: var(--slate); font-size: 0.82rem; font-family: var(--font-mono); letter-spacing: 0.01em; transition: color 0.18s ease; }
.nav a:hover { color: var(--ink); }
.nav a.btn { color: var(--white); font-size: 0.8rem; }
.nav a.btn.btn-ghost { color: var(--ink); }

/* Mobile nav toggle */
.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 44px; height: 44px; padding: 0;
  background: transparent; border: 1px solid var(--rule); border-radius: 2px;
  cursor: pointer; touch-action: manipulation;
}
.nav-toggle-bar { display: block; width: 20px; height: 2px; margin: 0 auto; background: var(--ink); }

/* ---------- Ledger layout: margin rule + column ---------- */
.ledger {
  display: grid;
  grid-template-columns: var(--margin-w) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 3.75rem);
  position: relative;
}
/* No full-height container rule (it left an empty vertical void in short sections).
   Instead the margin block carries a short accent tick beside its marker — a contained,
   intentional mark rather than a rule running past empty space. */
.margin {
  position: relative;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--slate);
  text-transform: uppercase;
  padding-top: 0.55rem;
  padding-right: 1.25rem;   /* gutter */
  line-height: 1.35;
}
.margin::before { /* short brass tick, only as tall as the marker */
  content: "";
  position: absolute;
  left: 0; top: 0.7rem;
  width: 22px; height: 2px;
  background: var(--accent);
}
.margin .marker { display: block; color: var(--accent-d); font-weight: 500; padding-top: 0.9rem; }
.margin .annot { display: block; margin-top: 0.6rem; text-transform: none; letter-spacing: 0.005em; line-height: 1.45; color: var(--slate); font-size: 0.72rem; }

/* ---------- Sections ---------- */
.section { padding: var(--sp-section) 0; border-top: 1px solid var(--rule); }
.section.alt { background: var(--paper-2); }

/* Hero — two-column with a mono index counterweight on the right */
.hero { padding: clamp(2.75rem, 6vw, 4.5rem) 0 clamp(3rem, 7vw, 6rem); }
.hero .container { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.hero-index { margin-top: 0.75rem; }
.hero-copy { min-width: 0; }
.hero .eyebrow { color: var(--warm); }   /* the single terracotta note */
.hero h1 { max-width: 15ch; }
.hero .lead { margin-bottom: 2.25rem; max-width: 44ch; }
.hero-actions { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.hero-index {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.04em;
  color: var(--slate); border-top: 1px solid var(--rule); padding-top: 0.9rem;
}
.hero-index li { list-style: none; padding: 0.5rem 0; border-bottom: 1px solid var(--rule-soft); display: flex; justify-content: space-between; gap: 1rem; }
.hero-index ul { margin: 0; padding: 0; }
.hero-index .n { color: var(--accent-d); }
.hero-index .label { text-transform: uppercase; letter-spacing: 0.06em; }

/* Problem */
.problem-list { list-style: none; padding: 0; margin: 1.5rem 0; display: grid; gap: 0.85rem; max-width: var(--col-max); }
.problem-list li { padding-left: 1.6rem; position: relative; font-size: 1.06rem; }
.problem-list li::before {
  content: ""; position: absolute; left: 0; top: 0.72em;
  width: 0.7rem; height: 2px; background: var(--warm);
}

/* Journey — the signature counsel timeline (owns the only vertical axis here) */
.journey { display: grid; gap: 0; margin: 1.25rem 0 0; }
.step {
  position: relative;
  padding: 1.5rem 0 1.5rem 2.75rem;
  border-left: 2px solid var(--rule);
}
.step:first-child { padding-top: 0.5rem; }
.step::before { /* node on the timeline, centred on the 2px spine */
  content: ""; position: absolute; left: -6px; top: 1.85rem;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--paper);
}
.step:first-child::before { top: 0.85rem; }
.alt .step::before { border-color: var(--paper-2); }
.step-num { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.09em; color: var(--ink); display: block; margin-bottom: 0.35rem; }
.step h3 { margin-bottom: 0.35rem; }
.step p { color: var(--slate); font-size: 1rem; margin: 0; max-width: 52ch; }
/* the hand-off: the spine opens and the node becomes a hollow ring — "we step back" */
.step.handoff { border-left: 2px dashed var(--rule); }
.step.handoff::before {
  background: var(--paper); border: 2px solid var(--accent);
  width: 13px; height: 13px; left: -7px;
  box-shadow: 0 0 0 3px var(--paper);
  z-index: 1;
}
.step.handoff .step-num { color: var(--accent-d); }
/* Hand-off: the spine STOPS at the last node; only a short taper trails off. */
.step.handoff {
  border-left: none;
  padding-bottom: 0.5rem;
}
.step.handoff::after { /* redraw the spine from the top only down to the node, then fade */
  content: ""; position: absolute; left: -1px; top: 0; height: 2.35rem; width: 2px;
  background: linear-gradient(var(--rule) 60%, transparent);
}

/* Services */
.services { margin-top: 2.75rem; padding-top: 1.75rem; border-top: 1px solid var(--rule); }
.services-label { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--slate); margin: 0 0 1rem; }
.services-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem 2.5rem; max-width: var(--col-max); }
.services-list li { padding-left: 1.25rem; position: relative; color: var(--ink); }
.services-list li::before { content: "\2014"; position: absolute; left: 0; color: var(--accent); }

/* On AI — split statement + candid ledger (distinct from the 3-column pillars) */
.ai-split { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: clamp(2rem, 5vw, 4rem); align-items: start; margin-top: 0.5rem; }
.ai-statement .section-title { margin-bottom: 1.1rem; }
.ai-statement .lead { max-width: 40ch; }
.ai-ledger {
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--paper-2);
  padding: 1.4rem 1.5rem;
}
.ai-ledger-head {
  font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--slate); margin: 0 0 1rem; max-width: none;
}
.ai-ledger ul { list-style: none; margin: 0; padding: 0; }
.ai-ledger .ai-yes { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--rule); }
.ai-ledger li {
  position: relative; padding-left: 1.6rem; margin: 0.55rem 0;
  font-size: 0.96rem; line-height: 1.4; color: var(--ink); max-width: none;
}
.ai-ledger .ai-yes li::before {
  content: "\2713";  /* check */
  position: absolute; left: 0; top: 0; color: var(--accent-d); font-weight: 600;
}
.ai-ledger .ai-no li { color: var(--slate); }
.ai-ledger .ai-no li::before {
  content: "\2014";  /* em dash — muted slate, not a red warning */
  position: absolute; left: 0; top: 0; color: var(--slate);
}

/* Pillars (why a team) */
.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; margin-top: 1rem; }
.pillar { border-top: 2px solid var(--ink); padding-top: 0.9rem; }
.pillar h3 { color: var(--ink); }
.pillar p { color: var(--slate); margin: 0; font-size: 0.98rem; }

/* Promise (dark band) */
.promise { background: var(--ink); border-top: none; }
.promise .eyebrow { color: #d9765a; } /* lighter terracotta for AA contrast on the dark ink band */
.promise h2, .promise .lead { color: var(--paper); }
.promise .lead { max-width: 40ch; }

/* About */
.about .lead { max-width: var(--col-max); }

/* Contact */
.contact-cta { margin: 1.75rem 0 0; }
.contact-cta .btn { font-size: 0.9rem; }
.contact-note { font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.02em; color: var(--slate); margin: 1rem 0 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); padding: 2.5rem 0; background: var(--paper-2); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.02em; color: var(--slate); }
.footer-brand { display: flex; align-items: center; gap: 0.85rem; }
.footer-emblem { width: 84px; height: 84px; display: block; object-fit: contain; }
.footer-inner .brand-name { font-family: var(--font-display); font-size: 1.05rem; letter-spacing: -0.01em; color: var(--ink); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  :root { --margin-w: 0px; }
  .ledger { grid-template-columns: 1fr; gap: 0.75rem; }
  .ledger::before { display: none; }
  .margin { padding-top: 0; padding-right: 0; padding-bottom: 0.5rem; border-bottom: 1px solid var(--rule-soft); margin-bottom: 1.25rem; display: flex; gap: 0.9rem; align-items: baseline; }
  .margin::before { display: none; }
  .margin .marker { display: inline; padding-top: 0; }
  .margin .annot { display: inline; margin-top: 0; color: var(--slate); }
  .hero .container { grid-template-columns: 1fr; align-items: start; }
  .hero-index { display: none; }
  .pillars { grid-template-columns: 1fr; gap: 1.5rem; }
  .ai-split { grid-template-columns: 1fr; gap: 1.75rem; }
  .ai-statement .lead { max-width: none; }
  .services-list { grid-template-columns: 1fr; }

  .nav-toggle { display: flex; }
  .nav {
    position: absolute; top: 76px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--rule);
    padding: 0.5rem clamp(1.25rem, 4vw, 2.5rem) 1rem;
    box-shadow: 0 8px 24px rgba(22,32,43,0.10);
    display: none;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 0.9rem 0; border-bottom: 1px solid var(--rule-soft); font-size: 0.95rem; }
  .nav a.btn { margin-top: 0.75rem; border-bottom: none; text-align: center; justify-content: center; }
}
@media (max-width: 520px) {
  .field-row { grid-template-columns: 1fr; }
}

/* Reduced motion */
@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;
  }
}
