:root {
  --fg: #111;
  --bg: #fff;
  --muted: #555;
  --accent: #0a58ca;
  --border: #e3e3e3;
  --code-bg: #f6f6f6;
  --max: 102ch;
}

/* Dark palette - applied via OS preference OR explicit [data-theme="dark"]. */
:root[data-theme="dark"] {
  --fg: #e8e8e8;
  --bg: #111;
  --muted: #a0a0a0;
  --accent: #6ea8fe;
  --border: #2a2a2a;
  --code-bg: #1a1a1a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fg: #e8e8e8;
    --bg: #111;
    --muted: #a0a0a0;
    --accent: #6ea8fe;
    --border: #2a2a2a;
    --code-bg: #1a1a1a;
  }
}
:root[data-theme="dark"] .skip:focus,
:root:not([data-theme="light"]) .skip:focus { background: #332; color: var(--fg); }

* { box-sizing: border-box; }

html { font-size: 17px; }

body {
  margin: 0;
  font-family: "Albert Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.55;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Albert Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

.skip {
  position: absolute; left: -9999px;
}
.skip:focus { left: 1rem; top: 1rem; background: #ffd; padding: .5rem; }

.site-header, .site-footer, main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
}
.site-header {
  border-bottom: 1px solid var(--border);
}
.site-header-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  margin-bottom: .5rem;
}
.site-header-tools { display: flex; gap: .5rem; align-items: center; }
.site-header nav ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: nowrap; gap: .25rem .95rem;
  font-size: .94rem;
}
.site-header nav a {
  position: relative;
  display: inline-block;
  padding: .35rem 0 .5rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--fg);
  white-space: nowrap;
  transition: color .15s ease;
}
.site-header nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .18s ease;
}
.site-header nav a:hover { color: var(--accent); }
.site-header nav a:hover::after,
.site-header nav a:focus-visible::after { transform: scaleX(1); }
.site-header nav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}
.site-header nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

/* Theme toggle button. */
.theme-toggle {
  width: 36px; height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg { display: block; }
/* Click-to-enable-dark icon (sun): shown in light mode. */
.theme-toggle .light-icon { display: none; }
.theme-toggle .dark-icon  { display: inline-flex; }
/* When dark mode is active (explicit OR OS preference with no override),
   swap to the click-to-enable-light icon (moon). */
:root[data-theme="dark"] .theme-toggle .dark-icon { display: none; }
:root[data-theme="dark"] .theme-toggle .light-icon { display: inline-flex; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .dark-icon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .light-icon { display: inline-flex; }
}

/* Hamburger nav toggle - hidden on desktop. */
.nav-toggle {
  display: none;
  width: 40px; height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  border-radius: 6px;
  cursor: pointer;
  align-items: center; justify-content: center;
}
.nav-toggle:hover { color: var(--accent); border-color: var(--accent); }
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  display: block;
  width: 20px; height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform .18s ease, opacity .12s ease;
}
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before,
.nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after  { top:  6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after  { transform: translateY(-6px) rotate(-45deg); }

main { padding-top: 2rem; padding-bottom: 3rem; }
main h1 { line-height: 1.15; margin-top: 0; }
main h2 { margin-top: 2rem; }

/* Consistent page hero on every page. The hero owns the page H1 (and on most
   pages, the lede paragraph) so the visual rhythm is identical from page to
   page. */
.page-hero {
  /* Negative side margins + matching padding extend the border-bottom out
     to the same horizontal extent as the site-header and site-footer
     borders (which live on the full-width container). */
  margin: 0 -1.25rem 2rem;
  padding: 0 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.page-hero h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--fg);
}
.page-hero .lede {
  margin: .9rem 0 0;
  max-width: 62ch;
  font-size: 1.15rem;
  line-height: 1.55;
}

/* Home hero: name + post-nominals subtitle. */
.home-hero h1 {
  font-size: clamp(2.4rem, 6vw, 3.4rem);
}
.home-hero .post-noms {
  margin: .35rem 0 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--accent);
  text-transform: uppercase;
}

/* Collapse the gap between hero and the first heading that follows it. */
.page-hero + h2,
.page-hero + .portrait + .lede + h2,
.page-hero + figure + h2 { margin-top: 1rem; }

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .9rem;
}
.site-footer .affiliations {
  margin: 0 0 .5rem;
  font-size: .85rem;
  color: var(--muted);
}
.site-footer .affiliations a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--border);
}
.site-footer .affiliations a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

article + article { border-top: 1px solid var(--border); padding-top: 1.5rem; margin-top: 1.5rem; }

.biblio { padding-left: 1.4rem; }
.biblio li { margin-bottom: .75rem; line-height: 1.5; }
.biblio li:last-child { margin-bottom: 0; }
.biblio .date {
  color: var(--muted);
  font-size: .85rem;
  margin-left: .35rem;
  white-space: nowrap;
}

code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
pre { background: var(--code-bg); padding: 1rem; overflow-x: auto; border-radius: 4px; }

.lede { font-size: 1.15rem; color: var(--fg); }

.proof-anchors {
  list-style: none; padding: 0; margin: 1.5rem 0;
  display: grid; gap: 1rem;
}
.proof-anchors li {
  border-left: 3px solid var(--accent);
  padding: .65rem 0 .65rem 1.1rem;
  line-height: 1.5;
}
.proof-anchors strong a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
.proof-anchors strong a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.partner {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
}
.partner:first-of-type { border-top: 0; padding-top: 1rem; }
.partner h2 {
  margin: 0 0 .25rem;
  display: flex; align-items: baseline; flex-wrap: wrap; gap: .5rem 1rem;
}
.role-tag {
  font-size: .85rem;
  font-style: italic;
  color: var(--muted);
  font-weight: 400;
}
.partner p { margin: .5rem 0; }

.disclosures, .inquiries {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
}
.disclosures ul { list-style: none; padding: 0; }
.disclosures li { padding: .25rem 0; }

.footnote {
  color: var(--muted);
  font-size: .9rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 2rem;
}

.see-also {
  margin: 2rem 0 .5rem;
  padding: .75rem 1rem;
  border-left: 3px solid var(--border);
  background: var(--code-bg);
  font-size: .95rem;
  color: var(--muted);
  border-radius: 0 4px 4px 0;
}
.see-also a { color: var(--accent); text-decoration: none; }
.see-also a:hover { text-decoration: underline; }

.portrait {
  float: right;
  margin: 0 0 1rem 1.25rem;
  width: 220px;
}
.portrait img {
  width: 220px;
  height: auto;
  display: block;
  border-radius: 8px;
}
@media (max-width: 560px) {
  .portrait { float: none; margin: 0 auto 1.25rem; }
  .portrait img { margin: 0 auto; }
}

.venn {
  margin: 1.5rem auto 2.5rem;
  text-align: center;
  max-width: 480px;
  clear: both;
}
.venn .venn-svg { width: 100%; height: auto; display: block; }
.venn figcaption {
  font-style: italic;
  color: var(--muted);
  font-size: .95rem;
  margin-top: .5rem;
}

/* Venn diagram - inlined so it respects the document theme override. */
.venn-svg .venn-label {
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 18px;
  font-weight: 700;
  fill: #111;
}
.venn-svg .venn-icon-healthcare    { fill: #5b0e0e; }
.venn-svg .venn-icon-technology    { fill: #0f254f; }
.venn-svg .venn-icon-leadership    { fill: #5b1e08; }
.venn-svg .venn-icon-chip-inset    { fill: #ffffff; }
.venn-svg .venn-circles            { mix-blend-mode: multiply; }

/* Dark variant - explicit theme override (works regardless of OS pref). */
:root[data-theme="dark"] .venn-svg .venn-label              { fill: #e8e8e8; }
:root[data-theme="dark"] .venn-svg .venn-icon-healthcare    { fill: #f4a8a8; }
:root[data-theme="dark"] .venn-svg .venn-icon-technology    { fill: #a8c2f4; }
:root[data-theme="dark"] .venn-svg .venn-icon-leadership    { fill: #f4c0a0; }
:root[data-theme="dark"] .venn-svg .venn-icon-chip-inset    { fill: #111111; }
:root[data-theme="dark"] .venn-svg .venn-circles            { mix-blend-mode: screen; }

/* Dark via OS preference, unless overridden to light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .venn-svg .venn-label           { fill: #e8e8e8; }
  :root:not([data-theme="light"]) .venn-svg .venn-icon-healthcare { fill: #f4a8a8; }
  :root:not([data-theme="light"]) .venn-svg .venn-icon-technology { fill: #a8c2f4; }
  :root:not([data-theme="light"]) .venn-svg .venn-icon-leadership { fill: #f4c0a0; }
  :root:not([data-theme="light"]) .venn-svg .venn-icon-chip-inset { fill: #111111; }
  :root:not([data-theme="light"]) .venn-svg .venn-circles         { mix-blend-mode: screen; }
}

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

.site-footer .social {
  margin-top: .5rem;
  display: flex;
  gap: .85rem;
  align-items: center;
}
.site-footer .social a {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  transition: color .15s ease;
}
.site-footer .social a:hover { color: var(--accent); }
.site-footer .social svg { display: block; }

/* In-page table of contents on long biblio pages. */
.toc {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .75rem 1rem;
  margin: 1.25rem 0 2rem;
  font-size: .95rem;
  background: var(--code-bg);
}
.toc strong { display: block; margin-bottom: .35rem; color: var(--muted); font-weight: 600; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.toc ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* Back-to-top affordance after long content blocks. */
.back-to-top {
  display: inline-block;
  margin-top: 1.5rem;
  font-size: .9rem;
  color: var(--muted);
  text-decoration: none;
  border-top: 1px solid var(--border);
  padding-top: .75rem;
}
.back-to-top:hover { color: var(--accent); }

/* Home Lab - project card grid. */
.project-grid {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 32ch), 1fr));
}
.project-card {
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  transition: border-color .15s ease, transform .15s ease;
}
.project-card:hover {
  border-color: var(--accent);
}
.project-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
  margin: 0 0 .5rem;
  flex-wrap: wrap;
}
.project-card-head h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.25;
}
.project-alias {
  font-weight: 500;
  color: var(--muted);
  font-size: .95rem;
}
.project-card p { margin: 0 0 .65rem; line-height: 1.5; }
.project-card p:last-child { margin-bottom: 0; }
.project-card-link a {
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
.project-card-meta {
  margin-top: auto;
  padding-top: .65rem;
  font-size: .85rem;
  color: var(--muted);
  font-style: italic;
}

/* Status chip - public (accent) / private (muted). */
.chip {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .15rem .55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.chip-public {
  color: var(--accent);
  background: rgba(10, 88, 202, .1);
  border: 1px solid rgba(10, 88, 202, .25);
}
.chip-private {
  color: var(--muted);
  background: var(--code-bg);
  border: 1px solid var(--border);
}

/* Keep the older .status tag rule for back-compat (if anything still uses it). */
h2 .status {
  font-size: .8rem;
  font-weight: 400;
  font-style: italic;
  color: var(--muted);
  vertical-align: middle;
  margin-left: .5rem;
}

/* Contact form. */
.contact-form {
  margin: 1.5rem 0 1rem;
  max-width: 60ch;
  padding: 1.5rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.contact-form p { margin: 0 0 1rem; }
.contact-form label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: .25rem; }
.contact-form label small { color: var(--muted); font-weight: 400; }
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
  width: 100%;
  padding: .55rem .7rem;
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.contact-form input:focus,
.contact-form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.contact-form textarea { resize: vertical; min-height: 8rem; }
.contact-form button {
  padding: .55rem 1.2rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  cursor: pointer;
}
.contact-form button:hover { filter: brightness(1.07); }
.contact-form .hp { position: absolute; left: -9999px; }

/* Profile links list on /about/. */
.profiles { list-style: none; padding: 0; margin: 1rem 0; }
.profiles li { padding: .35rem 0; border-bottom: 1px dotted var(--border); }
.profiles li:last-child { border-bottom: 0; }
.profiles .muted { color: var(--muted); font-size: .85rem; margin-left: .5rem; }

/* Press kit: bio cards and downloadable images. */
.press-bio {
  margin: 1.25rem 0;
  padding: 1.25rem 1.25rem .85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}
.press-bio-head h3 {
  margin: 0 0 .75rem;
  font-size: 1.05rem;
  display: flex;
  align-items: baseline;
  gap: .5rem;
}
.press-meta {
  font-weight: 400;
  font-size: .85rem;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, monospace;
}
.press-bio p { margin: .5rem 0; }
.press-bio p:last-child { margin-bottom: 0; }

.press-images {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0;
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 28ch), 1fr));
}
.press-images li {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.press-images img {
  border-radius: 4px;
  width: 160px;
  height: auto;
  flex-shrink: 0;
}
.press-images p { margin: 0; font-size: .9rem; line-height: 1.5; }
.press-images strong { font-weight: 600; }

.key-facts {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}
.key-facts li {
  padding: .55rem 0;
  border-bottom: 1px dotted var(--border);
  line-height: 1.5;
}
.key-facts li:last-child { border-bottom: 0; }
.key-facts strong { color: var(--fg); }

/* Case study images. */
.case-wordmark {
  max-width: 180px;
  height: auto;
  display: block;
}
.case-figure {
  margin: 1.5rem 0 2rem;
  text-align: center;
}
.case-figure img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}
.case-figure figcaption {
  margin-top: .65rem;
  font-size: .9rem;
  color: var(--muted);
  font-style: italic;
  max-width: 60ch;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

/* Print stylesheet - clean layout, hide chrome, force light, expose URLs.
   Optimized for journalists/recruiters who print /about/ or /press/. */
@media print {
  :root {
    --fg: #000;
    --bg: #fff;
    --muted: #555;
    --accent: #000;
    --border: #bbb;
    --code-bg: #f5f5f5;
  }

  /* Hide site chrome that doesn't carry meaning on paper. */
  .site-header,
  .site-footer,
  .nav-toggle,
  .theme-toggle,
  .skip,
  .back-to-top,
  .toc,
  .see-also { display: none !important; }

  /* Open up the container - margins come from the printer, not us. */
  html { font-size: 11pt; }
  main { max-width: none; padding: 0; }

  /* Page-hero loses its negative-margin trick on print. */
  .page-hero {
    margin: 0 0 1rem !important;
    padding: 0 0 .5rem;
    border-bottom: 1px solid #000;
  }
  .page-hero h1 { font-size: 22pt; }
  .home-hero .post-noms { color: #000; }

  body { line-height: 1.45; }
  h1, h2, h3 { page-break-after: avoid; }
  p, li, blockquote { orphans: 3; widows: 3; }

  /* Expose link targets so printed pages remain usable. */
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #555;
    word-break: break-all;
  }
  a[href^="#"]::after,
  a[href^="/"]::after { content: ""; }

  /* Don't split cards/list items across pages. */
  .biblio li,
  .project-card,
  .press-bio,
  .partner,
  .now ol.biblio li { page-break-inside: avoid; }

  /* The Venn is decorative; suppress on print to save ink. */
  .venn { display: none; }
}

/* /now/ - editorial-style feed. Each item is card-like with a leading type
   chip; the date floats to the right as a small caption. */
.now h2 { margin-top: 2.25rem; }
.now ol.biblio {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0;
  display: grid;
  gap: .75rem;
}
.now ol.biblio li {
  margin-bottom: 0;
  padding: .9rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  line-height: 1.5;
  position: relative;
}
.now ol.biblio li:hover { border-color: var(--accent); }
.now ol.biblio .date {
  display: inline-block;
  margin-left: 0;
  margin-top: .35rem;
  font-size: .8rem;
  color: var(--muted);
  white-space: nowrap;
}
.now-type {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(10, 88, 202, .08);
  text-transform: uppercase;
  letter-spacing: .07em;
  border: 1px solid rgba(10, 88, 202, .2);
  padding: .12rem .5rem;
  border-radius: 999px;
  margin-right: .55rem;
  vertical-align: middle;
}

/* Narrow viewports: hamburger nav, tighter padding.
   Breakpoint set high enough that the 11-item nav never wraps - if it would
   need to wrap, we drop to the hamburger instead. */
@media (max-width: 960px) {
  html { font-size: 16px; }
  .site-header, .site-footer, main { padding-left: 1rem; padding-right: 1rem; }
  .page-hero { margin-left: -1rem; margin-right: -1rem; padding-left: 1rem; padding-right: 1rem; }
  .nav-toggle { display: inline-flex; }
  .site-header nav {
    max-height: 0;
    overflow: hidden;
    transition: max-height .25s ease;
  }
  .site-header nav.is-open { max-height: 80vh; }
  .site-header nav ul {
    flex-direction: column;
    gap: 0;
    padding-top: .5rem;
    border-top: 1px solid var(--border);
    margin-top: .5rem;
  }
  .site-header nav li { border-bottom: 1px solid var(--border); }
  .site-header nav li:last-child { border-bottom: 0; }
  .site-header nav a {
    display: flex;
    align-items: center;
    padding: .85rem .25rem;
    font-size: 1rem;
    border-radius: 4px;
  }
  /* Remove the animated underline in the stacked mobile menu - use a left
     accent bar on hover/active instead, since the underline pattern reads
     awkwardly in a vertical list. */
  .site-header nav a::after { display: none; }
  .site-header nav a:hover { background: var(--code-bg); padding-left: .75rem; }
  .site-header nav a[aria-current="page"] {
    background: var(--code-bg);
    padding-left: .75rem;
    border-left: 3px solid var(--accent);
  }
  .toc ul { gap: .25rem .75rem; }
}
