/* ==========================================================================
   Collaborative Brain Trust — Design System
   ========================================================================== */

:root {
  /* Color */
  --ink:        oklch(0.22 0.04 215);   /* deep teal-navy — primary text + dark sections */
  --ink-2:      oklch(0.32 0.045 215);  /* secondary dark */
  --ink-soft:   oklch(0.45 0.035 215);  /* tertiary dark */
  --teal:       oklch(0.50 0.075 200);  /* accent teal */
  --teal-deep:  oklch(0.38 0.07 205);   /* deeper teal for buttons */
  --teal-soft:  oklch(0.92 0.025 200);  /* soft teal panel */
  --teal-mist:  oklch(0.96 0.015 200);  /* lightest teal panel */
  --paper:      oklch(0.985 0.005 85);  /* warm white */
  --paper-2:    oklch(0.965 0.008 85);  /* section paper */
  --paper-3:    oklch(0.94 0.01 85);    /* deeper warm paper */
  --rule:       oklch(0.88 0.01 220);   /* default border */
  --rule-soft:  oklch(0.93 0.008 220);  /* hairline border */
  --mute:       oklch(0.50 0.015 220);  /* muted body */
  --gold:       oklch(0.72 0.09 75);    /* warm accent for AI/highlights */

  /* Type */
  --font-serif: "Newsreader", "Source Serif Pro", Georgia, serif;
  --font-sans:  "DM Sans", -apple-system, "Segoe UI", system-ui, sans-serif;
  --font-mono:  "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Rhythm */
  --r-1: 4px;
  --r-2: 8px;
  --r-3: 12px;
  --r-4: 16px;
  --r-5: 24px;
  --r-6: 32px;
  --r-7: 48px;
  --r-8: 64px;
  --r-9: 96px;
  --r-10: 128px;

  /* Layout */
  --container: 1240px;
  --container-wide: 1400px;
  --container-read: 720px;
  --radius: 4px;
  --radius-lg: 12px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

/* ----- Typography ----- */

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 400;
  margin: 0;
  letter-spacing: -0.012em;
  font-variation-settings: "opsz" 36;
  text-wrap: balance;
}

h1 { font-size: clamp(44px, 5.6vw, 80px); line-height: 1.02; letter-spacing: -0.02em; font-variation-settings: "opsz" 60; }
h2 { font-size: clamp(34px, 3.6vw, 52px); line-height: 1.06; letter-spacing: -0.018em; font-variation-settings: "opsz" 44; }
h3 { font-size: clamp(22px, 2vw, 28px); line-height: 1.18; letter-spacing: -0.01em; }
h4 { font-size: 19px; line-height: 1.3; }

p { margin: 0 0 1em; text-wrap: pretty; }

.eyebrow {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--teal-deep);
  margin: 0 0 var(--r-5);
  display: inline-flex;
  align-items: center;
  gap: var(--r-3);
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: currentColor;
  display: inline-block;
}

.eyebrow.no-rule::before { display: none; }

.lede {
  font-size: clamp(18px, 1.4vw, 22px);
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 60ch;
}

.serif-italic { font-style: italic; font-feature-settings: "ss01"; }

.muted { color: var(--mute); }

/* ----- Layout ----- */

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--r-5);
}
.container.wide { max-width: var(--container-wide); }
.container.read { max-width: var(--container-read); }

section { padding: var(--r-9) 0; }

@media (max-width: 720px) {
  section { padding: var(--r-8) 0; }
}

.section-head {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: var(--r-7);
  margin-bottom: var(--r-7);
  align-items: end;
}
@media (max-width: 860px) {
  .section-head { grid-template-columns: 1fr; gap: var(--r-4); }
}

/* ----- Buttons ----- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}
.btn .arrow {
  display: inline-block;
  transition: transform 0.25s var(--ease);
}
.btn:hover .arrow { transform: translateX(3px); }

.btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary:hover { background: var(--teal-deep); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn-ghost:hover { background: var(--ink); color: var(--paper); }

.btn-link {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
  padding-bottom: 4px;
}
.btn-link:hover { color: var(--teal-deep); border-color: var(--teal-deep); }

.btn-light {
  background: var(--paper);
  color: var(--ink);
}
.btn-light:hover { background: var(--teal-mist); }

/* ----- Header ----- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklch, var(--paper) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--rule-soft);
}
.site-header .inner {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 14px var(--r-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--r-5);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.brand img.brand-logo {
  height: 112px;
  width: auto;
  display: block;
}
.site-footer .brand { font-size: 22px; }
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}
.nav-primary {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-primary a {
  padding: 8px 14px;
  font-size: 14.5px;
  color: var(--ink-2);
  border-radius: 999px;
  transition: all 0.2s var(--ease);
}
.nav-primary a:hover { color: var(--ink); background: var(--teal-mist); }
.nav-primary a.active { color: var(--ink); }
.nav-primary a.active::after {
  content: "";
  display: block;
  height: 0;
}

.header-cta { display: flex; align-items: center; gap: var(--r-3); }
.header-cta .btn { padding: 10px 18px; font-size: 14px; }

.nav-toggle { display: none; }

@media (max-width: 920px) {
  .nav-primary { display: none; }
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--rule);
    border-radius: 999px;
    background: var(--paper);
    cursor: pointer;
  }
  body.nav-open .nav-primary {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    padding: var(--r-4);
    gap: 4px;
  }
  body.nav-open .nav-primary a { padding: 12px 16px; font-size: 16px; }
  .header-cta .btn-ghost { display: none; }
}

/* ----- Footer ----- */

.site-footer {
  background: var(--ink);
  color: oklch(0.85 0.01 215);
  padding: var(--r-9) 0 var(--r-6);
  font-size: 14.5px;
}
.site-footer .grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: var(--r-7);
  padding-bottom: var(--r-7);
  border-bottom: 1px solid color-mix(in oklch, var(--paper) 12%, transparent);
}
.site-footer .brand { color: var(--paper); font-size: 22px; }
.site-footer .brand-mark { background: var(--paper); color: var(--ink); }
.site-footer h5 {
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: oklch(0.65 0.02 200);
  margin: 0 0 var(--r-4);
  font-weight: 500;
}
.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.site-footer a { color: oklch(0.85 0.01 215); transition: color 0.2s; }
.site-footer a:hover { color: var(--paper); }
.site-footer .legal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--r-3);
  padding-top: var(--r-5);
  font-size: 13px;
  color: oklch(0.65 0.02 200);
}
.site-footer .legal-links { display: flex; gap: var(--r-5); }
.site-footer .blurb { max-width: 38ch; color: oklch(0.78 0.01 200); margin-top: var(--r-4); }
.mbe-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid color-mix(in oklch, var(--paper) 24%, transparent);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: oklch(0.78 0.01 200);
  margin-top: var(--r-5);
}
.mbe-badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold);
}
@media (max-width: 720px) {
  .site-footer .grid { grid-template-columns: 1fr 1fr; }
  .site-footer .col-brand { grid-column: 1 / -1; }
}

/* ----- Cards ----- */

.card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: var(--r-6);
  transition: all 0.25s var(--ease);
}
.card.bare { background: transparent; border: 0; padding: 0; }

.service-card {
  display: block;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: var(--r-6);
  transition: all 0.25s var(--ease);
  position: relative;
  overflow: hidden;
}
.service-card:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
}
.service-card .tag {
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal-deep);
  margin-bottom: var(--r-4);
  display: block;
}
.service-card h3 { margin-bottom: 12px; }
.service-card .credentials {
  margin-top: var(--r-4);
  padding-top: var(--r-4);
  border-top: 1px solid var(--rule-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--mute);
  letter-spacing: 0.02em;
}

/* ----- Stat ----- */

.stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--r-5) 0;
}
.stat .num {
  font-family: var(--font-serif);
  font-size: clamp(48px, 5vw, 72px);
  line-height: 1;
  font-variation-settings: "opsz" 60;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.stat .label {
  font-size: 13.5px;
  color: var(--mute);
  max-width: 22ch;
  line-height: 1.4;
}

/* ----- Image placeholder ----- */

.placeholder {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background:
    repeating-linear-gradient(
      135deg,
      color-mix(in oklch, var(--teal-soft) 70%, transparent) 0 1px,
      transparent 1px 14px
    ),
    var(--teal-mist);
  border: 1px solid var(--rule-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  padding: var(--r-4);
  aspect-ratio: 4 / 3;
}
.placeholder.tall { aspect-ratio: 3 / 4; }
.placeholder.square { aspect-ratio: 1; }
.placeholder.wide { aspect-ratio: 16 / 9; }
.placeholder.banner { aspect-ratio: 21 / 9; }
.placeholder .label {
  background: color-mix(in oklch, var(--paper) 80%, transparent);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  backdrop-filter: blur(4px);
}

/* portrait photos for consultants */
.portrait {
  aspect-ratio: 3 / 4;
  background:
    radial-gradient(ellipse at 50% 38%, color-mix(in oklch, var(--paper) 95%, transparent) 0 28%, transparent 50%),
    repeating-linear-gradient(135deg, color-mix(in oklch, var(--teal-soft) 60%, transparent) 0 1px, transparent 1px 12px),
    var(--teal-mist);
  border-radius: var(--radius-lg);
  border: 1px solid var(--rule-soft);
  position: relative;
  overflow: hidden;
}
.portrait::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 40%;
  background: linear-gradient(to top, color-mix(in oklch, var(--ink) 8%, transparent), transparent);
}

/* ----- Page header ----- */

.page-header {
  padding: var(--r-9) 0 var(--r-7);
  border-bottom: 1px solid var(--rule-soft);
  background: var(--paper);
}
.page-header .lede { margin-top: var(--r-5); }

/* dark variant */
.dark {
  background: var(--ink);
  color: var(--paper);
}
.dark h1, .dark h2, .dark h3, .dark h4 { color: var(--paper); }
.dark .eyebrow { color: oklch(0.78 0.04 200); }
.dark .muted, .dark .lede { color: oklch(0.82 0.01 215); }
.dark a { color: var(--paper); }
.dark .btn-ghost { color: var(--paper); border-color: color-mix(in oklch, var(--paper) 32%, transparent); }
.dark .btn-ghost:hover { background: var(--paper); color: var(--ink); }
.dark .placeholder {
  background:
    repeating-linear-gradient(135deg, color-mix(in oklch, var(--teal) 28%, transparent) 0 1px, transparent 1px 14px),
    color-mix(in oklch, var(--ink) 92%, var(--teal));
  border-color: color-mix(in oklch, var(--paper) 12%, transparent);
  color: oklch(0.78 0.04 200);
}
.dark .placeholder .label { background: color-mix(in oklch, var(--ink) 75%, transparent); border-color: color-mix(in oklch, var(--paper) 14%, transparent); color: oklch(0.85 0.02 215); }
.dark .stat .num { color: var(--paper); }
.dark .stat .label { color: oklch(0.78 0.01 215); }
.dark .card, .dark .service-card { background: color-mix(in oklch, var(--ink) 92%, var(--paper)); border-color: color-mix(in oklch, var(--paper) 12%, transparent); }
.dark .service-card:hover { border-color: var(--paper); }
.dark hr { border-color: color-mix(in oklch, var(--paper) 12%, transparent); }

/* ----- Utilities ----- */

.hr { border: 0; border-top: 1px solid var(--rule); margin: var(--r-7) 0; }
.hr-soft { border: 0; border-top: 1px solid var(--rule-soft); margin: var(--r-7) 0; }

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: var(--teal-mist);
  border: 1px solid var(--rule-soft);
  padding: 5px 10px;
  border-radius: 999px;
}

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--r-5); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--r-5); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--r-5); }
@media (max-width: 920px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-3, .grid-4, .grid-2 { grid-template-columns: 1fr; } }

/* In-page tag list separator */
.dot-sep > * + *::before { content: "·"; padding: 0 8px; color: var(--ink-soft); }

/* Skip animations on prefers reduced */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   MOBILE FIX-UP — global responsive tightening for ≤720px
   Header logo shrinks, hero/section padding tightens, type
   reins in for handheld widths.
   ============================================================ */
@media (max-width: 720px) {
  /* Header */
  .site-header .inner { padding: 10px var(--r-4); gap: var(--r-3); }
  .brand img.brand-logo { height: 56px; }
  .site-footer .brand { font-size: 18px; }
  .header-cta .btn { padding: 8px 14px; font-size: 12.5px; }
  .header-cta .btn .arrow { display: none; }

  /* Containers — tighter side padding */
  .container { padding: 0 var(--r-4); }

  /* Section rhythm — bring sections closer together */
  section { padding: var(--r-7) 0; }

  /* Section heads stack and bottom-align text reads */
  .section-head { gap: var(--r-3); }
  .section-head h2 { font-size: clamp(32px, 8vw, 44px); line-height: 1.05; }
  .lede { font-size: 17px; line-height: 1.45; }

  /* Stats — wrap nicely */
  .stat .num { font-size: clamp(40px, 10vw, 56px); }
  .stat { padding: var(--r-3) 0; }

  /* Footer — single column, looser */
  .site-footer { padding: var(--r-7) 0 var(--r-5); }
  .site-footer .grid { grid-template-columns: 1fr; gap: var(--r-5); padding-bottom: var(--r-5); }
  .site-footer .col-brand { grid-column: auto; }
  .site-footer .legal { gap: var(--r-3); font-size: 12px; }
  .site-footer .legal-links { gap: var(--r-4); }
  .site-footer h5 { margin-bottom: var(--r-2); }

  /* Page header / hero shared blocks */
  .page-header { padding: var(--r-7) 0 var(--r-5); }
  .page-header .lede { margin-top: var(--r-4); }

  /* Cards — tighter padding so 16px container gap doesn't suffocate them */
  .card, .service-card { padding: var(--r-5); }
  .service-card h3 { font-size: 22px; }

  /* Big serif headlines — ensure they never overflow */
  h1 { word-break: normal; overflow-wrap: anywhere; }
  h2, h3 { overflow-wrap: anywhere; }
}

/* Extra-small ≤480px — phone in portrait */
@media (max-width: 480px) {
  .site-header .inner { padding: 8px var(--r-3); }
  .brand img.brand-logo { height: 48px; }
  .container { padding: 0 var(--r-3); }
  section { padding: var(--r-6) 0; }

  /* Buttons full-width-ish in CTA stacks */
  .cta-imaged .ctas .btn,
  .p60-hero .ctas .btn,
  .p60-cta .ctas .btn {
    width: 100%;
    justify-content: center;
  }

  /* Don't let big serif numbers blow the layout */
  .stat .num { font-size: clamp(36px, 11vw, 48px); }

  /* Marquee — slow it down + smaller text */
  .marquee-track { font-size: 14px !important; }

  /* Tag chips */
  .tag-chip { font-size: 10px; padding: 4px 8px; }
}

/* ============================================================
   Catch-all for inline-styled responsive grids (≤640px).
   Many sections use `style="display:grid; grid-template-columns:
   ... 1fr ..."` inline — at small screens we want them in one
   column. The selector deliberately scopes to inline styles only
   so component-level grids in stylesheets remain authoritative.
   ============================================================ */
@media (max-width: 640px) {
  [style*="grid-template-columns"][style*="1fr"] {
    grid-template-columns: 1fr !important;
    gap: var(--r-4) !important;
  }
}
