/* ==========================================================================
   Pathway Analytics — Documentation Site Theme
   Conforms to the pwa-refactor application house style
   (packages/web/src/app.css): primary #1f4788, blue-600 accent, semantic
   surface/text/border tokens, light + dark via CSS-variable flip.
   ========================================================================== */

/* ==========================================================================
   1. CUSTOM PROPERTIES — house-style tokens (ported from pwa-refactor)
   ========================================================================== */

:root {
  color-scheme: light;
  /* Brand */
  --pa-primary: #1f4788;
  --pa-primary-hover: #163561;

  /* Semantic surfaces / text / borders (light) — pwa-refactor values */
  --pa-surface: #ffffff;          /* page background            */
  --pa-surface-raised: #ffffff;   /* cards / panels             */
  --pa-surface-sunken: #f3f4f6;   /* wells / inset areas / rows */
  --pa-surface-hover: #f9fafb;    /* row / control hover        */
  --pa-text: #111827;             /* gray-900 — primary body    */
  --pa-text-muted: #4b5563;       /* gray-600 — AA on white     */
  --pa-text-subtle: #6b7280;      /* gray-500 — hints/meta      */
  --pa-border: #e5e7eb;           /* gray-200                   */
  --pa-border-strong: #d1d5db;    /* gray-300                   */
  --pa-accent: #2563eb;           /* blue-600 — links / accent  */
  --pa-accent-hover: #1d4ed8;     /* blue-700                   */

  /* Status (brief §4) — ≥4.5:1 as text on surface-raised in light */
  --pa-success: #15803d;          /* green-700 */
  --pa-warning: #b45309;          /* amber-700 */
  --pa-danger:  #b91c1c;          /* red-700   */
  --pa-info:    #1d4ed8;          /* blue-700  */

  /* Docsify theme hook */
  --theme-color: var(--pa-primary);

  /* Spacing — 8px base scale */
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 32px;
  --space-xl: 48px;
  --space-2xl: 80px;

  /* Type */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  --font-size-base: 16px;
  --line-height: 1.7;

  /* Radius (pwa-refactor design1: controls 6px, cards 8px) */
  --pa-radius-control: 6px;
  --pa-radius-card: 8px;

  --content-max-width: 1100px;
  --article-max-width: 720px;   /* ~75 characters a line for long-form reading */
  --sidebar-width: 280px;
  --navbar-height: 64px;
}

/* Dark theme — pwa-refactor values, tuned for the near-black page bg */
html[data-theme="dark"] {
  color-scheme: dark;             /* native form controls, scrollbars, default colours */
  --pa-surface: #111827;          /* gray-900 */
  --pa-surface-raised: #1f2937;   /* gray-800 */
  --pa-surface-sunken: #0b1220;
  --pa-surface-hover: #374151;    /* gray-700 */
  --pa-text: #f3f4f6;             /* gray-100 */
  --pa-text-muted: #cbd5e1;       /* slate-300 */
  --pa-text-subtle: #94a3b8;      /* slate-400 */
  --pa-border: #374151;           /* gray-700 */
  --pa-border-strong: #4b5563;    /* gray-600 */
  --pa-primary: #6aa7f8;
  --pa-primary-hover: #9dc4fb;
  --pa-accent: #60a5fa;           /* blue-400 */
  --pa-accent-hover: #93c5fd;     /* blue-300 */

  --pa-success: #4ade80;
  --pa-warning: #fbbf24;
  --pa-danger:  #f87171;
  --pa-info:    #93c5fd;

  --theme-color: var(--pa-primary);
}

/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */

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

/* Offset anchor/hash navigation so targets clear the fixed navbar.
   scroll-padding-top on the scroll root covers native :target jumps and
   modern programmatic scrollIntoView; the per-heading scroll-margin-top
   below is the belt-and-braces for the heading elements themselves. */
html {
  scroll-padding-top: calc(var(--navbar-height) + var(--space-md));
}

body, h1, h2, h3, h4, h5, h6, p, ul, ol, figure, blockquote { margin: 0; }

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  font-weight: 400;
  line-height: var(--line-height);
  color: var(--pa-text);
  background-color: var(--pa-surface);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s, color 0.2s;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--pa-accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--pa-accent-hover); }

/* ==========================================================================
   3. NAVBAR
   ========================================================================== */

.app-nav,
nav.app-nav,
body.sticky .app-nav {
  position: fixed !important;
  top: 0 !important;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--navbar-height);
  width: 100%;
  display: flex !important;
  align-items: center;
  padding: 0 var(--space-lg);
  margin: 0 !important;
  background: var(--pa-surface) !important;
  border-bottom: 1px solid var(--pa-border);
  box-shadow: none;
}

.app-nav ul {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center;
  gap: 0;
  flex-grow: 1;
}

.app-nav li { list-style: none !important; margin: 0; }

.app-nav a {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  font-size: 0.85em;
  font-weight: 400;
  color: var(--pa-text-muted);
  letter-spacing: 0.02em;
  border-radius: var(--pa-radius-control);
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.app-nav a:hover { color: var(--pa-primary); background: var(--pa-surface-hover); }

/* Navbar — first item is the brand: stacked logo on wide screens, square mark on
   small ones. The link keeps its text ("Pathway Analytics") for screen readers
   and search engines; it is moved off-screen and the logo drawn as background.
   The logo image has a white background, so it is blended in: "multiply" drops
   the white on a light bar; in dark mode it is inverted (white to black, navy to
   a light tone, hue turned back) and "screen" drops the black. */
.app-nav li:first-child a {
  display: block;
  width: 129px;
  height: 44px;
  padding: 0;
  overflow: hidden;
  text-indent: -9999px;
  white-space: nowrap;
  background: url("/assets/images/brand/logo-mixed.png") no-repeat left center / contain;
  mix-blend-mode: multiply;
}

html[data-theme="dark"] .app-nav li:first-child a {
  filter: invert(1) hue-rotate(180deg);
  mix-blend-mode: screen;
}

@media (max-width: 768px) {
  .app-nav li:first-child a,
  html[data-theme="dark"] .app-nav li:first-child a {
    width: 36px;
    height: 36px;
    background-image: url("/assets/images/brand/pa-mark.svg");
    mix-blend-mode: normal;
    filter: none;
  }
}

.app-nav li:first-child a:hover { color: var(--pa-primary); background-color: transparent; }

/* Contact shows as a mail icon on small screens; the text stays for screen readers */
.nav-icon { display: none; }
.nav-icon svg { width: 20px; height: 20px; fill: currentColor; display: block; }

@media (max-width: 768px) {
  .nav-icon { display: inline-flex; }
  .nav-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* Very narrow screens: drop the brand mark, the bar needs the room */
@media (max-width: 480px) {
  .app-nav li:first-child { display: none; }
}

/* Desktop: leave room on the right for the fixed theme toggle */
@media (min-width: 769px) {
  .app-nav,
  nav.app-nav,
  body.sticky .app-nav { padding-right: calc(var(--space-lg) + 48px); }
}

/* Push nav links to the right */
.app-nav li:first-child { margin-right: auto; }

/* Dark mode toggle — fixed top-right */
.dark-mode-toggle {
  position: fixed;
  top: 14px;
  right: var(--space-lg);
  z-index: 1100;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--pa-surface-raised);
  color: var(--pa-text-muted);
  border: 1px solid var(--pa-border);
  border-radius: var(--pa-radius-control);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.dark-mode-toggle:hover {
  color: var(--pa-primary);
  border-color: var(--pa-border-strong);
  background: var(--pa-surface-hover);
}

/* ==========================================================================
   4. SIDEBAR  — now persistent across ALL sections
   ========================================================================== */

.sidebar {
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  overflow-y: auto;
  background-color: var(--pa-surface-sunken);
  border-right: 1px solid var(--pa-border);
  padding: var(--space-sm) 0;
  z-index: 900;
  display: block;
}

h1.app-name { display: none !important; }

/* Search — always mounted in the sidebar */
.search {
  padding: var(--space-xs) var(--space-sm) var(--space-sm);
  margin-bottom: var(--space-xs);
  border-bottom: 1px solid var(--pa-border);
}

.search .input-wrap { display: flex; align-items: center; }

.search input {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.85em;
  border: 1px solid var(--pa-border);
  border-radius: var(--pa-radius-control);
  background: var(--pa-surface-raised);
  color: var(--pa-text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search input:focus {
  border-color: var(--pa-accent) !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15) !important;
}

.search .clear-button { cursor: pointer; width: 28px; text-align: center; }
.search .results-panel { display: none; }
.search .results-panel.show { display: block; }
.search .matching-post { padding: 8px 0; border-bottom: 1px solid var(--pa-border); }
.search .matching-post:last-child { border-bottom: none; }
.search .matching-post a { color: var(--pa-accent); font-weight: 500; }
.search .matching-post p { font-size: 0.8em; color: var(--pa-text-muted); margin: 4px 0 0; }
.search p.empty { text-align: center; color: var(--pa-text-muted); font-size: 0.85em; }
.search h2 { font-size: 0.85em; margin: 10px 0 4px; color: var(--pa-text-muted); }

.search-highlight {
  background-color: rgba(37, 99, 235, 0.18);
  color: inherit;
  padding: 1px 3px;
  border-radius: 3px;
}

/* Sidebar nav */
.sidebar-nav { padding: var(--space-xs) var(--space-sm); }

.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }
.sidebar-nav ul ul { padding-left: var(--space-sm); margin-top: 2px; }

.sidebar-nav li > a,
.sidebar-nav li > p > a {
  display: block;
  padding: 7px 10px;
  font-size: 0.86em;
  font-weight: 400;
  color: var(--pa-text-muted);
  text-decoration: none;
  border-radius: var(--pa-radius-control);
  transition: color 0.15s, background 0.15s;
  line-height: 1.4;
}

.sidebar-nav li > a:hover,
.sidebar-nav li > p > a:hover {
  color: var(--pa-primary);
  background-color: var(--pa-surface-hover);
}

.sidebar-nav li.active > a,
.sidebar-nav li > p.active > a,
.sidebar-nav li > p.active a {
  color: var(--pa-primary);
  font-weight: 600;
  background-color: rgba(31, 71, 136, 0.08);
}

.sidebar-nav li > p { margin: 0; padding: 0; }

/* Top-level group headings (bold rows) */
.sidebar-nav li > p > strong,
.sidebar-nav li > strong {
  display: block;
  padding: 8px 10px;
  font-size: 0.72em;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pa-text-subtle);
  cursor: pointer;
  border-radius: var(--pa-radius-control);
  transition: color 0.15s, background 0.15s;
  line-height: 1.4;
}

.sidebar-nav li > p > strong:hover,
.sidebar-nav li > strong:hover {
  color: var(--pa-primary);
  background-color: var(--pa-surface-hover);
}

/* Sub-sidebar (page headings) */
.app-sub-sidebar {
  list-style: none;
  padding: 0 0 0 var(--space-sm);
  margin: 2px 0 0;
}

.app-sub-sidebar a {
  display: block;
  padding: 4px 10px;
  font-size: 0.78em;
  color: var(--pa-text-subtle);
  border-radius: var(--pa-radius-control);
  transition: color 0.15s;
}

.app-sub-sidebar a:hover { color: var(--pa-primary); }

/* Collapsible sections */
.sidebar-nav li.collapsible { position: relative; }
.sidebar-nav li.collapsible > p { padding-right: 28px; }

.sidebar-nav li.collapsible > .collapse-toggle,
.sidebar-nav li.collapsible > p::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 12px;
  width: 5px;
  height: 5px;
  border-right: 1.5px solid var(--pa-text-subtle);
  border-bottom: 1.5px solid var(--pa-text-subtle);
  transform: rotate(45deg);
  transition: transform 0.2s;
  pointer-events: none;
}

.sidebar-nav li.collapsible.collapsed > .collapse-toggle,
.sidebar-nav li.collapsible.collapsed > p::after {
  transform: rotate(-45deg);
}

.sidebar-nav li.collapsible > ul {
  overflow: hidden;
  max-height: 1200px;
  transition: max-height 0.25s ease;
}

.sidebar-nav li.collapsible.collapsed > ul { max-height: 0; }

/* Sidebar toggle button (mobile) */
.sidebar-toggle {
  position: fixed;
  top: calc((var(--navbar-height) - 40px) / 2);
  left: 8px;
  z-index: 1100;
  width: 40px;
  height: 40px;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--pa-surface-raised);
  border: 1px solid var(--pa-border-strong);
  border-radius: var(--pa-radius-control);
  cursor: pointer;
  color: var(--pa-text);
}

/* The three bars of the hamburger icon (Docsify's own stylesheet is not loaded) */
.sidebar-toggle .sidebar-toggle-button { display: flex; flex-direction: column; gap: 4px; }
.sidebar-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 1px;
  background: var(--pa-text);
}

/* ==========================================================================
   5. CONTENT AREA  — always offset for the persistent sidebar
   ========================================================================== */

section.content,
.content {
  padding-top: calc(var(--navbar-height) + var(--space-lg)) !important;
  padding-left: var(--space-xl);
  padding-right: var(--space-xl);
  padding-bottom: var(--space-2xl);
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  transition: margin-left 0.2s ease;
}

.markdown-section { max-width: var(--content-max-width); margin: 0 auto; }

/* Long-form articles (Insights): readable line length. Images, boxes and
   tables sit inside this column; on narrow screens it simply fills the width. */
body.page-article .markdown-section { max-width: min(100%, var(--article-max-width)); }
@media (min-width: 1600px) {
  body.page-article { --article-max-width: 760px; }
}

/* ==========================================================================
   6. TYPOGRAPHY
   ========================================================================== */

.markdown-section h1 {
  font-family: var(--font-body);
  font-size: 2em;
  font-weight: 700;
  color: var(--pa-primary);
  margin-top: 0;
  margin-bottom: var(--space-md);
  line-height: 1.2;
  letter-spacing: -0.01em;
  scroll-margin-top: calc(var(--navbar-height) + var(--space-md));
}

.markdown-section h2 {
  font-family: var(--font-body);
  font-size: 1.5em;
  font-weight: 700;
  color: var(--pa-primary);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--pa-border);
  line-height: 1.3;
  scroll-margin-top: calc(var(--navbar-height) + var(--space-md));
}

.markdown-section h3 {
  font-family: var(--font-body);
  font-size: 1.2em;
  font-weight: 600;
  color: var(--pa-text);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-xs);
  line-height: 1.4;
  scroll-margin-top: calc(var(--navbar-height) + var(--space-md));
}

.markdown-section h4 {
  font-family: var(--font-body);
  font-size: 1.05em;
  font-weight: 600;
  color: var(--pa-text);
  margin-top: var(--space-md);
  margin-bottom: var(--space-xs);
  scroll-margin-top: calc(var(--navbar-height) + var(--space-md));
}

.markdown-section h1 a,
.markdown-section h2 a,
.markdown-section h3 a,
.markdown-section h4 a { color: inherit !important; text-decoration: none; }

.markdown-section [id] { scroll-margin-top: calc(var(--navbar-height) + var(--space-md)); }

.markdown-section p { margin-bottom: var(--space-sm); color: var(--pa-text); }

.markdown-section ul,
.markdown-section ol { margin-bottom: var(--space-sm); padding-left: var(--space-md); }

.markdown-section li { margin-bottom: 6px; }

.markdown-section hr { border: none; border-top: 1px solid var(--pa-border); margin: var(--space-lg) 0; }

/* Code */
.markdown-section code {
  font-size: 0.85em;
  padding: 2px 6px;
  background: var(--pa-surface-sunken);
  border: 1px solid var(--pa-border);
  border-radius: var(--pa-radius-control);
  font-family: var(--font-mono);
  color: var(--pa-text);
}

.markdown-section pre {
  margin: var(--space-sm) 0;
  padding: var(--space-sm);
  background: #0b1220;
  border: 1px solid var(--pa-border);
  border-radius: var(--pa-radius-card);
  overflow-x: auto;
}

.markdown-section pre code {
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  font-size: 0.84em;
  line-height: 1.6;
  color: #e5e7eb;
}

/* Tables */
.markdown-section table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-sm) 0;
  font-size: 0.9em;
}

.markdown-section th {
  background: var(--pa-surface-sunken);
  color: var(--pa-text);
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--pa-border);
}

.markdown-section td { padding: 10px 12px; border: 1px solid var(--pa-border); }

.markdown-section tr:nth-child(even) { background: var(--pa-surface-hover); }

/* Blockquotes */
.markdown-section blockquote {
  border-left: 3px solid var(--pa-accent);
  background: var(--pa-surface-sunken);
  padding: var(--space-sm) var(--space-md);
  margin: var(--space-sm) 0;
  border-radius: 0 var(--pa-radius-control) var(--pa-radius-control) 0;
  font-style: normal;
  color: var(--pa-text);
}

.markdown-section blockquote p { margin-bottom: 0; }

/* Callouts (added by calloutPlugin based on label) */
.markdown-section blockquote.callout-note { border-left-color: var(--pa-warning); }
.markdown-section blockquote.callout-important { border-left-color: var(--pa-danger); }

/* ==========================================================================
   7. HOMEPAGE HERO & SECTIONS
   ========================================================================== */

.hero { padding: var(--space-2xl) 0 var(--space-xl); }

.hero .eyebrow {
  font-family: var(--font-body);
  font-size: 0.8em;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pa-accent);
  margin-bottom: var(--space-md);
  display: block;
}

.hero h1 {
  font-family: var(--font-body) !important;
  font-size: 2.6em !important;
  font-weight: 700 !important;
  color: var(--pa-primary) !important;
  line-height: 1.15 !important;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-md) !important;
}

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

.hero .lead {
  font-size: 1.1em;
  color: var(--pa-text-muted);
  max-width: 560px;
  line-height: 1.7;
  margin-bottom: var(--space-lg);
}

.hero .cta-row { display: flex; align-items: center; gap: var(--space-md); flex-wrap: wrap; }

.hero .cta-row .btn,
.section-contact .btn {
  display: inline-block;
  padding: 12px 24px;
  font-size: 0.9em;
  font-weight: 600;
  color: #ffffff;
  background: var(--pa-primary);
  border: none;
  border-radius: var(--pa-radius-control);
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
}

.hero .cta-row .btn:hover,
.section-contact .btn:hover { background: var(--pa-primary-hover); color: #ffffff; }

.hero .cta-row .meta {
  font-size: 0.85em;
  color: var(--pa-text-subtle);
  border-left: 1px solid var(--pa-border);
  padding-left: var(--space-md);
}

/* Full-width panel section */
.section-dark {
  background: var(--pa-surface-sunken);
  color: var(--pa-text);
  margin-left: calc(-1 * var(--space-xl));
  margin-right: calc(-1 * var(--space-xl));
  padding: var(--space-2xl) var(--space-xl);
  border-top: 1px solid var(--pa-border);
  border-bottom: 1px solid var(--pa-border);
}

.section-dark .section-inner { max-width: var(--content-max-width); margin: 0 auto; }

.section-dark .eyebrow {
  font-size: 0.75em;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pa-accent);
  margin-bottom: var(--space-sm);
}

.section-dark h2 {
  font-family: var(--font-body);
  font-size: 1.8em;
  font-weight: 700;
  color: var(--pa-primary);
  margin-bottom: var(--space-sm);
  line-height: 1.25;
}

.section-dark p { color: var(--pa-text-muted); max-width: 560px; }

/* Timeline */
.timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 2px solid var(--pa-border);
  position: relative;
}

.timeline-item { position: relative; padding-top: var(--space-sm); }

.timeline-item::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  width: 12px;
  height: 12px;
  background: var(--pa-surface-raised);
  border: 2px solid var(--pa-accent);
  border-radius: 50%;
}

.timeline-item .year {
  font-size: 0.8em;
  font-weight: 600;
  color: var(--pa-accent);
  margin-bottom: 4px;
}

.timeline-item h4 { font-size: 0.95em; font-weight: 600; color: var(--pa-text); margin-bottom: 4px; }
.timeline-item p { font-size: 0.82em; color: var(--pa-text-muted); line-height: 1.5; }

/* Services */
.section-services { padding: var(--space-2xl) 0; }
.section-services h2 { font-family: var(--font-body); font-size: 1.8em; font-weight: 700; color: var(--pa-primary); margin-bottom: var(--space-lg); }

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.service-card .number { font-size: 0.75em; font-weight: 600; color: var(--pa-accent); margin-bottom: var(--space-xs); }
.service-card h3 { font-family: var(--font-body); font-size: 1.1em; font-weight: 600; color: var(--pa-text); margin-bottom: var(--space-xs); }
.service-card p { font-size: 0.9em; color: var(--pa-text-muted); line-height: 1.6; }

/* Stats row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-lg);
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--pa-border);
  border-bottom: 1px solid var(--pa-border);
  margin: var(--space-lg) 0;
}

.stat { text-align: left; }
.stat .number { font-family: var(--font-body); font-size: 2.5em; font-weight: 700; color: var(--pa-primary); line-height: 1; margin-bottom: var(--space-xs); }
.stat p { font-size: 0.85em; color: var(--pa-text-muted); line-height: 1.5; }

/* Selected work */
.selected-work { padding: var(--space-2xl) 0; }
.selected-work h2 { font-family: var(--font-body); font-size: 1.8em; font-weight: 700; color: var(--pa-primary); margin-bottom: var(--space-lg); }

.work-item {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-top: 1px solid var(--pa-border);
  align-items: start;
}

.work-item:last-child { border-bottom: 1px solid var(--pa-border); }

.work-item .category {
  font-size: 0.72em;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pa-accent);
  padding-top: 4px;
}

.work-item h3 { font-family: var(--font-body); font-size: 1.05em; font-weight: 600; color: var(--pa-text); margin-bottom: 4px; }
.work-item p { font-size: 0.9em; color: var(--pa-text-muted); line-height: 1.6; margin: 0; }

/* Publications */
.publications { padding: var(--space-2xl) 0; }
.publications h2 { font-family: var(--font-body); font-size: 1.8em; font-weight: 700; color: var(--pa-primary); margin-bottom: var(--space-lg); }

.pub-list { list-style: none; padding: 0; margin: 0; max-width: 640px; }
.pub-list li { padding: var(--space-sm) 0; border-bottom: 1px solid var(--pa-border); font-size: 0.9em; line-height: 1.6; }
.pub-list li:first-child { border-top: 1px solid var(--pa-border); }
.pub-list li strong { color: var(--pa-text); }

/* Contact CTA section */
.section-contact {
  background: var(--pa-primary);
  color: #ffffff;
  margin-left: calc(-1 * var(--space-xl));
  margin-right: calc(-1 * var(--space-xl));
  padding: var(--space-2xl) var(--space-xl);
  margin-top: var(--space-2xl);
}

.section-contact .section-inner { max-width: var(--content-max-width); margin: 0 auto; }

.section-contact h2 {
  font-family: var(--font-body);
  font-size: 2em;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: var(--space-sm);
}

.section-contact p { color: rgba(255, 255, 255, 0.85); max-width: 480px; margin-bottom: var(--space-lg); }

.section-contact .btn { background: #ffffff; color: var(--pa-primary); }
.section-contact .btn:hover { background: var(--pa-surface-sunken); color: var(--pa-primary); }

/* ==========================================================================
   8. NAVIGATION CARDS (sub-pages)
   ========================================================================== */

.nav-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-sm);
  margin: var(--space-lg) 0;
}

.nav-card {
  border: 1px solid var(--pa-border);
  border-radius: var(--pa-radius-card);
  padding: var(--space-md);
  background: var(--pa-surface-raised);
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.nav-card:hover {
  border-color: var(--pa-accent);
  box-shadow: 0 4px 16px rgba(31, 71, 136, 0.1);
  transform: translateY(-1px);
}

.nav-card h3 { font-size: 1em; font-weight: 600; color: var(--pa-primary); margin-bottom: 6px; }
.nav-card p { font-size: 0.85em; color: var(--pa-text-muted); margin: 0; line-height: 1.5; }

/* ==========================================================================
   9. RESPONSIVE
   ========================================================================== */

@media (max-width: 1024px) {
  section.content, .content { padding-left: var(--space-md); padding-right: var(--space-md); }
  .section-dark,
  .section-contact {
    margin-left: calc(-1 * var(--space-md));
    margin-right: calc(-1 * var(--space-md));
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }
}

@media (max-width: 768px) {
  .app-nav { padding: 0 var(--space-sm); }
  /* Brand mark and hamburger share the left of the bar */
  .app-nav,
  nav.app-nav,
  body.sticky .app-nav { padding: 0 var(--space-xs) 0 56px; }
  .app-nav a { padding: 8px 6px; font-size: 0.8em; }
  .app-nav li:first-child a { margin-right: 4px; }
  .nav-long { display: none; }

  /* Theme toggle floats bottom-right so the bar has room for the links */
  .dark-mode-toggle {
    top: auto;
    bottom: var(--space-sm);
    right: var(--space-sm);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  }

  .sidebar-toggle { display: flex; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: none;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  }

  section.content, .content {
    margin-left: 0;
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
  }

  .hero h1 { font-size: 2em !important; }

  .section-dark,
  .section-contact {
    margin-left: calc(-1 * var(--space-sm));
    margin-right: calc(-1 * var(--space-sm));
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
  }

  .timeline { grid-template-columns: 1fr 1fr; }
  .services-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .work-item { grid-template-columns: 1fr; gap: var(--space-xs); }
  .nav-cards { grid-template-columns: 1fr; }
}

/* ==========================================================================
   10. ACCESSIBILITY
   ========================================================================== */

a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--pa-accent);
  outline-offset: 2px;
  border-radius: var(--pa-radius-control);
}

.skip-link {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: -1;
  font-size: 0.85em;
  font-weight: 500;
  color: #ffffff;
  background: var(--pa-primary);
  padding: 8px 16px;
  border-radius: 0 0 var(--pa-radius-control) var(--pa-radius-control);
}

.skip-link:focus {
  position: fixed;
  top: 0;
  left: var(--space-sm);
  width: auto;
  height: auto;
  overflow: visible;
  z-index: 9999;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   11. DOCSIFY PLUGIN OVERRIDES
   ========================================================================== */

.docsify-copy-code-button {
  background: var(--pa-primary) !important;
  color: #ffffff !important;
  border-radius: var(--pa-radius-control);
  font-size: 0.75em;
}

.progress { background: var(--pa-accent) !important; }

/* Edit link */
.edit-link {
  text-align: right;
  margin-top: var(--space-2xl);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--pa-border);
}

.edit-link a {
  font-size: 0.78em;
  color: var(--pa-text-subtle);
  opacity: 0.7;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.15s, color 0.15s;
}

.edit-link a:hover { opacity: 1; color: var(--pa-primary); }
.edit-link svg { width: 13px; height: 13px; }

/* Page-heading sub-sidebar: visually subordinate to page links */
.sidebar-nav .app-sub-sidebar {
  list-style: none;
  padding: 2px 0 4px var(--space-sm);
  margin: 0 0 0 10px;
  border-left: 1px solid var(--pa-border);
}

.sidebar-nav .app-sub-sidebar li { margin: 0; }

.sidebar-nav .app-sub-sidebar a {
  display: block;
  padding: 3px 10px;
  font-size: 0.78em;
  color: var(--pa-text-subtle);
  border-radius: 3px;
  transition: color 0.15s;
}

.sidebar-nav .app-sub-sidebar a:hover { color: var(--pa-primary); }
.sidebar-nav .app-sub-sidebar a.active { color: var(--pa-primary); font-weight: 600; }

/* ==========================================================================
   12. CMS SEGMENT (copyright notice, sourced from pwa-refactor CMS)
   ========================================================================== */

.cms-segment {
  margin-top: var(--space-xl);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--pa-border);
  font-size: 0.78em;
  line-height: 1.6;
  color: var(--pa-text-subtle);
}

.cms-segment a { color: var(--pa-accent); }
.cms-segment a:hover { color: var(--pa-accent-hover); }
.cms-segment-loading { color: var(--pa-text-subtle); opacity: 0.5; }

/* ==========================================================================
   13. HOMEPAGE SECTION GRID (flex-grid widget cards)
   ========================================================================== */

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-md);
  margin: var(--space-lg) 0 var(--space-xl);
}

.home-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-md);
  background: var(--pa-surface-raised);
  border: 1px solid var(--pa-border);
  border-radius: var(--pa-radius-card);
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

/* Accent bar on the leading edge, in the brand primary */
.home-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--pa-primary);
  opacity: 0.85;
  transition: width 0.2s;
}

.home-card:hover {
  border-color: var(--pa-accent);
  box-shadow: 0 6px 20px rgba(31, 71, 136, 0.12);
  transform: translateY(-2px);
}

.home-card:hover::before { width: 5px; }

.home-card-eyebrow {
  font-size: 0.7em;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pa-accent);
  margin-bottom: var(--space-xs);
}

.home-card h3 {
  font-size: 1.15em;
  font-weight: 600;
  color: var(--pa-primary);
  margin: 0 0 var(--space-xs);
  line-height: 1.3;
}

.home-card p {
  font-size: 0.9em;
  color: var(--pa-text-muted);
  line-height: 1.6;
  margin: 0 0 var(--space-md);
  flex-grow: 1;
}

.home-card-cta {
  font-size: 0.82em;
  font-weight: 600;
  color: var(--pa-accent);
  transition: color 0.15s;
}

.home-card:hover .home-card-cta { color: var(--pa-accent-hover); }

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

/* ==========================================================================
   14. MERMAID DIAGRAMS
   ========================================================================== */

.markdown-section .mermaid {
  margin: var(--space-md) 0;
  padding: var(--space-md);
  background: var(--pa-surface-raised);
  border: 1px solid var(--pa-border);
  border-radius: var(--pa-radius-card);
  text-align: center;
  overflow-x: auto;
}

.markdown-section .mermaid svg { max-width: 100%; height: auto; }

/* Figure caption that follows a diagram or widget */
.markdown-section .figure-caption {
  font-size: 0.82em;
  color: var(--pa-text-subtle);
  text-align: center;
  margin: calc(-1 * var(--space-xs)) 0 var(--space-md);
}

/* ==========================================================================
   15. IMAGE PLACEHOLDER (screenshots not yet added)
   ========================================================================== */

.markdown-section .image-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 160px;
  margin: var(--space-sm) 0;
  padding: var(--space-md);
  background: var(--pa-surface-sunken);
  border: 1px dashed var(--pa-border-strong);
  border-radius: var(--pa-radius-card);
  text-align: center;
}

.image-placeholder-title {
  font-size: 0.8em;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pa-text-muted);
}

.image-placeholder-alt {
  font-size: 0.82em;
  color: var(--pa-text-subtle);
  max-width: 60ch;
}

/* Worked-example box for articles:
   <div class="pa-example">
   <p class="pa-example-label">Example: topic</p>
   ...body...
   </div> */
.markdown-section .pa-example {
  background: var(--pa-surface-sunken);
  border: 1px solid var(--pa-border);
  border-left: 4px solid var(--pa-accent);
  border-radius: 0 var(--pa-radius-card) var(--pa-radius-card) 0;
  padding: var(--space-xs) 24px;
  margin: var(--space-lg) 0;
  color: var(--pa-text);
}

.markdown-section .pa-example-label {
  font-size: 0.8em;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pa-accent);
  margin-bottom: 0;
}

/* Small uppercase label used at the top of article components */
.markdown-section .pa-label {
  font-size: 0.8em;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pa-accent);
  margin: 0 0 8px;
}

/* Cause-and-effect chain:
   <div class="pa-chain"><p class="pa-label">Title</p>
   <div class="pa-chain-step">Step</div><div class="pa-chain-arrow">↓</div> ...
   <div class="pa-chain-step pa-chain-step-result">Outcome</div></div> */
.markdown-section .pa-chain { margin: var(--space-lg) auto; max-width: 640px; }

.markdown-section .pa-chain-step {
  background: var(--pa-surface-sunken);
  border: 1px solid var(--pa-border);
  border-radius: 6px;
  padding: 10px 16px;
  font-weight: 600;
  color: var(--pa-text);
}

.markdown-section .pa-chain-step-result {
  border-color: var(--pa-accent);
  border-left: 4px solid var(--pa-accent);
  color: var(--pa-accent);
}

.markdown-section .pa-chain-arrow {
  text-align: center;
  color: var(--pa-text-subtle);
  line-height: 1.8;
}

/* Statistics strip:
   <div class="pa-stats"><div class="pa-stat"><div class="pa-stat-value">10×</div>
   <div class="pa-stat-label">Description</div></div> ...</div>
   <p class="pa-stats-source">Sources: ...</p> */
.markdown-section .pa-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 24px 0 8px;
}

.markdown-section .pa-stat {
  flex: 1 1 180px;
  border-top: 3px solid var(--pa-accent);
  padding-top: 12px;
}

.markdown-section .pa-stat-value {
  font-size: 2em;
  font-weight: 700;
  line-height: 1.2;
  color: var(--pa-text);
}

.markdown-section .pa-stat-label {
  font-size: 0.85em;
  color: var(--pa-text-muted);
  line-height: 1.5;
  margin-top: 4px;
}

.markdown-section .pa-stats-source {
  font-size: 0.75em;
  color: var(--pa-text-subtle);
  margin: 0 0 var(--space-lg);
}

/* Author panel at the end of an article:
   <div class="pa-about"><p class="pa-label">About the author</p><p>...</p></div> */
.markdown-section .pa-about {
  border-top: 1px solid var(--pa-border);
  border-bottom: 1px solid var(--pa-border);
  padding: 20px 0;
  margin: 40px 0;
}

.markdown-section .pa-about p:last-child { margin: 0; }

/* ==========================================================================
   16. BAR CHART FIGURE (pure CSS, theme-aware)
   ========================================================================== */

.markdown-section .bar-chart {
  margin: var(--space-md) 0;
  padding: var(--space-md);
  background: var(--pa-surface-raised);
  border: 1px solid var(--pa-border);
  border-radius: var(--pa-radius-card);
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr 70px;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
}

.bar-label {
  font-size: 0.88em;
  font-weight: 600;
  color: var(--pa-text);
  line-height: 1.3;
}

.bar-label span {
  display: block;
  font-size: 0.85em;
  font-weight: 400;
  color: var(--pa-text-subtle);
}

.bar-track {
  height: 22px;
  background: var(--pa-surface-sunken);
  border-radius: var(--pa-radius-control);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--pa-primary);
  border-radius: var(--pa-radius-control);
}

.bar-value {
  font-size: 0.95em;
  font-weight: 700;
  color: var(--pa-text);
  text-align: right;
}

@media (max-width: 600px) {
  .bar-row { grid-template-columns: 1fr 70px; }
  .bar-label { grid-column: 1 / -1; }
}

/* Home page hero: logo with the LinkedIn strapline and tagline, then the
   headline, the question we work on and named clients. A small, light
   three-disciplines Venn diagram sits to the right. Stacks on narrow screens. */
.markdown-section .home-hero {
  max-width: 760px;
  margin: 16px 0 40px;
}
.markdown-section .home-brand { margin: 8px 0 28px; }
.markdown-section .home-brand img { width: 230px; max-width: 65%; height: auto; display: block; margin: 0 0 14px; }
.markdown-section .home-brand .home-logo-dark { display: none; }
html[data-theme="dark"] .markdown-section .home-brand .home-logo-light { display: none; }
html[data-theme="dark"] .markdown-section .home-brand .home-logo-dark { display: block; }
.markdown-section .home-strapline {
  margin: 0 0 4px;
  font-size: 1.02rem;
  white-space: nowrap;
  font-weight: 600;
  color: var(--pa-text);
}
.markdown-section .home-tagline {
  margin: 0;
  font-size: 0.95rem;
  white-space: nowrap;
  color: var(--pa-text-muted);
}
.markdown-section h1.home-headline {
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 3.1rem;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-wrap: balance;
  color: #14335a;
}
html[data-theme="dark"] .markdown-section h1.home-headline { color: #e8eef8; }
.markdown-section .home-subhead {
  margin: 0 0 24px;
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 1.4rem;
  line-height: 1.4;
  color: #518386;
}
.markdown-section .home-actions { margin: 28px 0 0; display: flex; gap: 12px; flex-wrap: wrap; }
.markdown-section .home-actions a { display: inline-block; padding: 10px 20px; border-radius: 6px; font-weight: 500; font-size: 0.95rem; text-decoration: none; }
.markdown-section .home-actions .btn-primary { background: #14335a; color: #ffffff; border: 1px solid #14335a; }
.markdown-section .home-actions .btn-secondary { background: transparent; color: #14335a; border: 1px solid #14335a; }
html[data-theme="dark"] .markdown-section .home-actions .btn-primary { background: #e8eef8; color: #111827; border-color: #e8eef8; }
html[data-theme="dark"] .markdown-section .home-actions .btn-secondary { color: #e8eef8; border-color: #e8eef8; }

/* Pathway graphic: three strands (navy strategy, teal health economics, gold
   digital solutions) converge on the patient and continue together. A wide
   labelled version for desktop; a compact version with an HTML legend on phones. */
.markdown-section .pathway-graphic { margin: 8px 0 64px; }
.markdown-section h2.pg-caption {
  padding: 0;
  border: 0;
  font-weight: 400;
  margin: 0 auto 36px;
  max-width: 760px;
  text-align: center;
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 1.7rem;
  line-height: 1.4;
  color: #14335a;
}
.markdown-section h2.pg-caption::after {
  content: '';
  display: block;
  width: 120px;
  height: 1px;
  margin: 18px auto 0;
  background: var(--pa-border);
}
html[data-theme="dark"] .markdown-section h2.pg-caption { color: #e8eef8; }
html[data-theme="dark"] .pg-hub-label, html[data-theme="dark"] .pg-values { fill: #8cc8c6; }
.markdown-section .pathway-graphic svg { width: 100%; height: auto; display: block; }
.markdown-section .pathway-graphic .pg-mobile, .markdown-section .pg-legend { display: none; }
.pg-strand { fill: none; stroke-width: 3.5; stroke-linecap: round; }
.pg-navy { stroke: #14335a; } .pg-teal { stroke: #518386; } .pg-gold { stroke: #c9a24a; }
.pg-navy-fill { fill: #14335a; } .pg-teal-fill { fill: #518386; } .pg-gold-fill { fill: #c9a24a; }
.pg-name { font-family: 'Playfair Display', Georgia, serif; font-size: 30px; fill: #14335a; }
.pg-end { font-family: 'Playfair Display', Georgia, serif; font-size: 32px; fill: #14335a; }
.pg-end-sm { font-family: 'Playfair Display', Georgia, serif; font-size: 20px; fill: #14335a; }
.pg-sub { font-family: Inter, sans-serif; font-size: 14.5px; fill: #4b5563; }
.pg-kicker { font-family: Inter, sans-serif; font-size: 11px; font-weight: 600; letter-spacing: 2.5px; fill: #518386; }
.pg-hub { fill: #f6f8fb; stroke: rgba(20, 51, 90, 0.18); stroke-width: 1.25; }
.pg-hub-ring { fill: none; stroke: #c9a24a; stroke-width: 2; }
.pg-person circle { fill: none; stroke: #14335a; stroke-width: 2.2; }
.pg-person path { fill: none; stroke: #14335a; stroke-width: 2.2; stroke-linecap: round; }
html[data-theme="dark"] .pg-navy { stroke: #9dc4fb; } html[data-theme="dark"] .pg-navy-fill { fill: #9dc4fb; }
html[data-theme="dark"] .pg-name, html[data-theme="dark"] .pg-end, html[data-theme="dark"] .pg-end-sm { fill: #e8eef8; }
html[data-theme="dark"] .pg-sub { fill: #cbd5e1; }

.pg-hub-label { font-family: 'Playfair Display', Georgia, serif; font-style: italic; font-size: 24px; fill: #518386; }
.pg-values { font-family: Inter, sans-serif; font-size: 14px; font-weight: 500; letter-spacing: 1.5px; fill: #518386; }
.pg-values-sm { font-family: Inter, sans-serif; font-size: 13px; font-weight: 500; letter-spacing: 1px; fill: #518386; }
.pg-hub-label-sm { font-family: 'Playfair Display', Georgia, serif; font-style: italic; font-size: 20px; fill: #518386; }
.pg-sub-sm { font-family: Inter, sans-serif; font-size: 13px; fill: #4b5563; }
.pg-sub-xs { font-family: Inter, sans-serif; font-size: 12px; fill: #4b5563; }
html[data-theme="dark"] .pg-hub-label, html[data-theme="dark"] .pg-hub-label-sm { fill: #e8eef8; }
html[data-theme="dark"] .pg-sub-sm, html[data-theme="dark"] .pg-sub-xs { fill: #cbd5e1; }
.markdown-section .pg-mobile-note { display: none; margin: 8px 0 0; text-align: right; font-size: 0.9rem; color: var(--pa-text-muted); }
@media (max-width: 700px) { .markdown-section .pg-mobile-note { display: block; } }
html[data-theme="dark"] .pg-hub { fill: #111827; stroke: rgba(232, 238, 248, 0.2); }
html[data-theme="dark"] .pg-person circle, html[data-theme="dark"] .pg-person path { stroke: #e8eef8; }
.markdown-section .pg-legend { list-style: none; margin: 0 0 8px; padding: 0; }
.markdown-section .pg-legend li { display: grid; grid-template-columns: 14px 1fr; column-gap: 10px; margin: 0 0 12px; }
.markdown-section .pg-dot-html { width: 9px; height: 9px; border-radius: 50%; margin-top: 9px; }
.pg-navy-bg { background: #14335a; } .pg-teal-bg { background: #518386; } .pg-gold-bg { background: #c9a24a; }
.markdown-section .pg-legend-name { font-family: 'Playfair Display', Georgia, serif; font-size: 1.25rem; color: #14335a; }
.markdown-section .pg-legend-sub { grid-column: 2; font-size: 0.9rem; color: var(--pa-text-muted); }
@media (max-width: 700px) {
  .markdown-section .pathway-graphic .pg-desktop { display: none; }
  .markdown-section .pathway-graphic .pg-mobile { display: block; }
  .markdown-section .pg-legend { display: block; }
  .markdown-section h1.home-headline { font-size: 2.3rem; }
  .markdown-section .home-subhead { font-size: 1.2rem; }
}
.markdown-section .home-lead {
  margin: 0 0 14px;
  font-size: 1.08rem;
  line-height: 1.65;
  color: var(--pa-text);
}
.markdown-section .home-lead-key {
  font-size: 1.22rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--pa-text);
}
.markdown-section .home-clients {
  margin: 0 0 8px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--pa-text-muted);
}
.markdown-section .home-hero-venn { text-align: center; }
.markdown-section .venn { width: 100%; max-width: 440px; height: auto; }
.venn circle { stroke-width: 1.5; }
.venn .venn-he { fill: rgba(31, 71, 136, 0.08); stroke: #1f4788; }
.venn .venn-fs { fill: rgba(81, 131, 134, 0.09); stroke: #518386; }
.venn .venn-hs { fill: rgba(217, 164, 65, 0.12); stroke: #d9a441; }
.venn .venn-label { font-family: Georgia, 'Times New Roman', serif; font-style: italic; font-size: 18px; }
.venn .venn-label-he { fill: #1f4788; }
.venn .venn-label-fs { fill: #3f6a6d; }
.venn .venn-label-hs { fill: #9a6f1f; }
.venn .venn-centre { fill: #ffffff; stroke: rgba(22, 53, 97, 0.18); stroke-width: 1; }
.venn .venn-logo-dark { display: none; }
html[data-theme="dark"] .venn .venn-he { fill: rgba(106, 167, 248, 0.08); stroke: #6aa7f8; }
html[data-theme="dark"] .venn .venn-fs { fill: rgba(140, 200, 198, 0.08); stroke: #8cc8c6; }
html[data-theme="dark"] .venn .venn-hs { fill: rgba(232, 190, 110, 0.08); stroke: #e8be6e; }
html[data-theme="dark"] .venn .venn-label-he { fill: #9dc4fb; }
html[data-theme="dark"] .venn .venn-label-fs { fill: #a9d6d4; }
html[data-theme="dark"] .venn .venn-label-hs { fill: #ecca8a; }
html[data-theme="dark"] .venn .venn-centre { fill: #111827; stroke: rgba(232, 238, 248, 0.25); }
html[data-theme="dark"] .venn .venn-logo-light { display: none; }
html[data-theme="dark"] .venn .venn-logo-dark { display: inline; }

/* Reach: a full-width tinted band listing who Pathway Analytics works with,
   by type. Verified figures and logos can be added here later. */
.markdown-section .reach {
  margin: 0 0 56px;
  padding: 36px 40px 40px;
  background: #f4f7fa;
  border-radius: 12px;
}
html[data-theme="dark"] .markdown-section .reach { background: #172033; }
.markdown-section h2.reach-title {
  margin: 0 0 24px;
  padding: 0;
  border: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 400;
  color: var(--pa-text);
}
.markdown-section .reach-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px 32px;
}
.markdown-section .reach-grid .reach-wide { grid-column: 1 / -1; }
.markdown-section .reach-wide .reach-names { max-width: 900px; }
.markdown-section .reach-note {
  margin: 28px 0 0;
  padding-top: 20px;
  border-top: 1px solid rgba(31, 71, 136, 0.15);
  font-size: 0.95rem;
  color: var(--pa-text-muted);
}
.markdown-section .reach-type {
  display: block;
  margin-bottom: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #518386;
}
.markdown-section .reach-names {
  display: block;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--pa-text);
}
@media (max-width: 900px) {
  .markdown-section .reach { padding: 28px 24px 30px; }
  .markdown-section .reach-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .markdown-section .reach-grid { grid-template-columns: 1fr; gap: 16px; }
}

/* Five questions: numbered columns divided by fine rules, no boxes. */
.markdown-section .five-questions {
  margin: 0 0 56px;
}
.markdown-section h2.five-questions-title {
  margin: 0 0 28px;
  padding: 0;
  border: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 400;
  color: var(--pa-text);
}
.markdown-section .five-questions-intro {
  margin: 0 0 28px;
  color: var(--pa-text-muted);
}
.markdown-section ol.how-we-work {
  list-style: none;
  counter-reset: hww;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
}
.markdown-section ol.how-we-work li {
  counter-increment: hww;
  margin: 0;
  padding: 0 20px;
  border-left: 1px solid var(--pa-border);
}
.markdown-section ol.how-we-work li:first-child { padding-left: 0; border-left: 0; }
.markdown-section ol.how-we-work li::before {
  content: counter(hww, decimal-leading-zero);
  font-variant-numeric: lining-nums;
  display: block;
  margin-bottom: 10px;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1;
  color: #518386;
}
.markdown-section .hww-q {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--pa-text);
}
.markdown-section .hww-a {
  display: block;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--pa-text-muted);
}

@media (max-width: 1100px) {
  .markdown-section ol.how-we-work { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 28px; }
  .markdown-section ol.how-we-work li:nth-child(4) { padding-left: 0; border-left: 0; }
}
@media (max-width: 900px) {
  .markdown-section .home-strapline { white-space: normal; }
  .markdown-section .home-hero { grid-template-columns: 1fr; gap: 32px; margin-bottom: 48px; }
  .markdown-section .venn { max-width: 340px; }
  .markdown-section h1.home-headline { font-size: 1.9rem; }
}
@media (max-width: 600px) {
  .markdown-section .home-strapline { font-size: 0.9rem; }
  .markdown-section ol.how-we-work { grid-template-columns: 1fr; row-gap: 24px; }
  .markdown-section ol.how-we-work li { padding: 0; border-left: 0; }
  .markdown-section ol.how-we-work li::before { font-size: 1.6rem; margin-bottom: 6px; }
}

/* ==========================================================================
   Site layout: no sidebar outside documentation (desktop)
   ========================================================================== */
@media (min-width: 769px) {
  body.no-sidebar .sidebar { display: none; }
  body.no-sidebar section.content, body.no-sidebar .content { margin-left: 0; }
}

/* Menu: Grouper login as a quiet link, Work with us as an outlined button.
   On phones only these two stay in the bar; the full menu is in the sidebar. */
.app-nav a[href^="https://production.pathwayanalytics.com"] { font-size: 0.8em; color: var(--pa-text-subtle); }
.app-nav a[href="/?id=work-with-us"] { margin-left: 8px; border: 1px solid #14335a; color: #14335a; padding: 6px 14px; }
.app-nav a[href="/?id=work-with-us"]:hover { background: #14335a; color: #ffffff; }
html[data-theme="dark"] .app-nav a[href="/?id=work-with-us"] { border-color: #e8eef8; color: #e8eef8; }
@media (max-width: 1100px) { .app-nav a { padding: 8px 10px; } }
@media (max-width: 900px) {
  .app-nav li:nth-child(n+2):nth-child(-n+6) { display: none; }
}

/* ==========================================================================
   Home page sections
   ========================================================================== */
.markdown-section section[id], .markdown-section div[id] { scroll-margin-top: calc(var(--navbar-height) + 16px); }
.markdown-section h2.section-title {
  margin: 0 0 28px;
  padding: 0;
  border: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 400;
  color: var(--pa-text);
}

/* Our expertise: three columns that continue the graphic's strands */
.markdown-section .expertise { margin: 0 0 64px; }
.markdown-section .expertise-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.markdown-section .expertise-col { padding-top: 18px; border-top: 4px solid; border-radius: 0; }
.markdown-section .ex-navy { border-top-color: #14335a; }
.markdown-section .ex-teal { border-top-color: #518386; }
.markdown-section .ex-gold { border-top-color: #c9a24a; }
.markdown-section h3.ex-name { margin: 0 0 4px; padding: 0; font-family: 'Playfair Display', Georgia, serif; font-size: 1.6rem; font-weight: 400; color: #14335a; }
html[data-theme="dark"] .markdown-section h3.ex-name { color: #e8eef8; }
.markdown-section .ex-tag { margin: 0 0 16px; font-family: 'Playfair Display', Georgia, serif; font-style: italic; font-size: 1.05rem; color: #518386; }
.markdown-section ul.ex-list { list-style: none; margin: 0 0 18px; padding: 0; }
.markdown-section ul.ex-list li { margin: 0; padding: 7px 0; border-bottom: 1px solid var(--pa-border); color: var(--pa-text); }
.markdown-section ul.ex-list li::before { content: none; }
.markdown-section a.ex-link { font-weight: 500; color: #14335a; text-decoration: none; }
.markdown-section a.ex-link::after { content: ' \2192'; }
html[data-theme="dark"] .markdown-section a.ex-link { color: #9dc4fb; }

/* Insights, tools and resources: three quiet cards */
.markdown-section .resources { margin: 0 0 64px; }
.markdown-section .resource-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.markdown-section a.resource-card { display: flex; flex-direction: column; gap: 6px; padding: 22px; border: 1px solid var(--pa-border); border-radius: 10px; text-decoration: none; color: inherit; transition: border-color 0.15s; }
.markdown-section a.resource-card:hover { border-color: #518386; }
.markdown-section .rc-type { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: #518386; }
.markdown-section .rc-title { font-family: 'Playfair Display', Georgia, serif; font-size: 1.3rem; color: var(--pa-text); }
.markdown-section .rc-text { font-size: 0.92rem; line-height: 1.5; color: var(--pa-text-muted); flex: 1; }
.markdown-section .rc-cta { font-size: 0.9rem; font-weight: 500; color: #14335a; }
.markdown-section .rc-cta::after { content: ' \2192'; }
html[data-theme="dark"] .markdown-section .rc-cta { color: #9dc4fb; }

/* Work with us: closing band */
.markdown-section .work-with-us { margin: 0 0 32px; padding: 44px 40px; background: #14335a; border-radius: 12px; color: #e8eef8; }
.markdown-section .work-with-us h2.section-title { color: #ffffff; margin-bottom: 10px; }
.markdown-section .wwu-text { margin: 0 0 22px; font-size: 1.05rem; color: #d6e0ee; }
.markdown-section .wwu-actions { margin: 0 0 28px; }
.markdown-section .wwu-actions a.btn-primary { display: inline-block; padding: 10px 20px; border-radius: 6px; background: #ffffff; color: #14335a; font-weight: 500; text-decoration: none; }
.markdown-section .wwu-gcloud { margin: 0; font-size: 0.88rem; color: #c3d0e2; }
.markdown-section .wwu-gcloud a { color: #ffffff; text-decoration: underline; }
.markdown-section .home-footer { text-align: center; padding: 16px 0; font-size: 0.85em; }

@media (max-width: 900px) {
  .markdown-section .expertise-grid, .markdown-section .resource-grid { grid-template-columns: 1fr; gap: 28px; }
  .markdown-section .work-with-us { padding: 32px 24px; }
}
/* The bar now has few items on phones, so the brand mark always shows */
@media (max-width: 480px) {
  .app-nav li:first-child { display: block; }
}

/* Wider, more confident layout on large screens (no-sidebar pages) */
body.no-sidebar .markdown-section { max-width: 1240px; }
.markdown-section .home-hero { max-width: 940px; }
@media (min-width: 1200px) {
  .markdown-section h1.home-headline { font-size: 3.7rem; }
  .markdown-section .home-subhead { font-size: 1.55rem; }
  .markdown-section .home-lead { font-size: 1.15rem; }
}
/* Menu: larger text and logo */
.app-nav a { font-size: 0.95em; }
@media (min-width: 769px) {
  .app-nav li:first-child a { width: 150px; height: 52px; }
}

/* Headline figures above the client categories */
.markdown-section .reach-stats { display: flex; flex-wrap: wrap; gap: 48px; margin: 0 0 32px; padding-bottom: 28px; border-bottom: 1px solid rgba(31, 71, 136, 0.15); }
.markdown-section .reach-stat { display: flex; flex-direction: column; max-width: 320px; }
.markdown-section .rs-num { font-family: 'Playfair Display', Georgia, serif; font-size: 2.6rem; line-height: 1.1; color: #14335a; font-variant-numeric: lining-nums; }
html[data-theme="dark"] .markdown-section .rs-num { color: #e8eef8; }
.markdown-section .rs-label { margin-top: 6px; font-size: 0.95rem; color: var(--pa-text-muted); }
