/* Cambridge Cheminformatics Consulting — site styles */

/* Self-hosted fonts (SIL Open Font License), Latin subset */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("../fonts/inter.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 500 600; font-display: swap; src: url("../fonts/space-grotesk.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-mono-400.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #fbfaf7;
  --bg-alt: #f2f0ea;
  --surface: #ffffff;
  --ink: #0f1b2d;
  --ink-soft: #3c4a5e;
  --muted: #5f6b7e;
  --line: #e2ded4;
  --accent: #0d7c6e;
  --accent-strong: #0a5f55;
  --accent-soft: #dff1ec;
  --warm: #d9663b;
  --mol-c: #2f3d52;
  --mol-bond: #8794a6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .04), 0 8px 24px rgba(15, 27, 45, .06);
  --max: 1120px;
  --font-head: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1420;
    --bg-alt: #111b2a;
    --surface: #152133;
    --ink: #eef2f6;
    --ink-soft: #c2cbd6;
    --muted: #8d9aab;
    --line: #233247;
    --accent: #3cc5b0;
    --accent-strong: #6ad8c6;
    --accent-soft: #123a37;
    --warm: #f08a5d;
    --mol-c: #c3cedb;
    --mol-bond: #5d6b80;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

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

h1, h2, h3 {
  font-family: var(--font-head);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 .5em;
  font-weight: 600;
}
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); }
h3 { font-size: 1.2rem; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

.skip-link {
  position: absolute; left: -999px; top: 8px;
  background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 100;
}
.skip-link:focus { left: 8px; }

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

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 68px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none;
  font-family: var(--font-head); font-weight: 600; font-size: 1.02rem; line-height: 1.1;
}
.brand:hover { color: var(--ink); }
.brand svg { width: 32px; height: 32px; flex: none; }
.brand small { display: block; font-family: var(--font-mono); font-weight: 400; font-size: .68rem; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; margin-top: 2px; }

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  color: var(--ink-soft); text-decoration: none; font-size: .95rem; font-weight: 500;
  padding: 8px 12px; border-radius: 999px;
}
.nav a:hover { color: var(--ink); background: var(--bg-alt); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav .nav-cta, .nav .nav-cta[aria-current] { background: var(--ink); color: var(--bg); }
.nav .nav-cta:hover { background: var(--accent); color: #fff; }
.nav .ext::after { content: "↗"; font-size: .8em; margin-left: 3px; opacity: .6; }

@media (max-width: 560px) {
  .brand-text { display: none; }
  .nav a { padding: 8px 10px; font-size: .9rem; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px;
  font-weight: 600; font-size: .98rem; text-decoration: none;
  border: 1px solid transparent; transition: transform .15s, background .15s, color .15s, border-color .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); color: #fff; }
@media (prefers-color-scheme: dark) {
  .btn-primary, .btn-primary:hover { color: #06201c; }
}
.btn-ghost { border-color: var(--line); color: var(--ink); background: var(--surface); }
.btn-ghost:hover { border-color: var(--ink-soft); color: var(--ink); }
.btn svg { width: 18px; height: 18px; }

/* ---------- Hero ---------- */
.hero { padding: 56px 0 72px; overflow: hidden; }
.hero .wrap { display: grid; gap: 40px; align-items: center; }
@media (min-width: 900px) {
  .hero { padding: 88px 0 104px; }
  .hero .wrap { grid-template-columns: 1.05fr .95fr; }
}
.eyebrow {
  font-family: var(--font-mono); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 18px; display: inline-flex; align-items: center; gap: 10px;
}
.eyebrow::before { content: ""; width: 24px; height: 1px; background: currentColor; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lede { font-size: 1.18rem; color: var(--ink-soft); max-width: 36em; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero .byline {
  margin-top: 36px; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .95rem;
}
.hero .byline img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.hero .byline strong { color: var(--ink); font-weight: 600; display: block; }

.hero-art { width: 100%; max-width: 580px; justify-self: center; }
.hero-art svg { width: 100%; height: auto; overflow: visible; }
.hero-art .bond { stroke: var(--mol-bond); stroke-width: 8; stroke-linecap: round; }
.hero-art .bond.dbl { stroke-width: 5; }
.hero-art .atom { stroke: var(--bg); stroke-width: 3.5; }
.hero-art .a-C { fill: var(--mol-c); }
.hero-art .a-N { fill: var(--accent); }
.hero-art .a-O { fill: var(--warm); }
.hero-art .bit { fill: var(--accent); animation: twinkle 6s ease-in-out var(--d) infinite; }
.hero-art .bit.hi { fill: var(--warm); }
@keyframes twinkle {
  0%, 100% { fill-opacity: 1; }
  50% { fill-opacity: .35; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-art .bit { animation: none; }
  html { scroll-behavior: auto; }
}
@media (max-width: 899px) { .hero-art { max-width: 340px; order: -1; } }

/* ---------- Sections ---------- */
section { padding: 80px 0; }
.section-alt { background: var(--bg-alt); }
.section-head { max-width: 46em; margin-bottom: 44px; }
.section-head p { color: var(--ink-soft); font-size: 1.08rem; }
.kicker {
  font-family: var(--font-mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 10px; display: block;
}

/* Services */
.services { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .services { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .services { grid-template-columns: repeat(3, 1fr); } }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow);
  transition: transform .2s, border-color .2s;
}
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.card p { color: var(--ink-soft); margin: 0; font-size: 1rem; }
.icon {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); margin-bottom: 18px;
}
.icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.card-cta {
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  background: var(--ink); color: var(--bg); border-color: var(--ink);
}
.card-cta h3 { color: var(--bg); }
.card-cta p { color: color-mix(in srgb, var(--bg) 75%, transparent); margin-bottom: 20px; }

/* Intro / about teaser */
.intro { display: grid; gap: 40px; align-items: center; }
@media (min-width: 860px) { .intro { grid-template-columns: 340px 1fr; gap: 64px; } }
.portrait { position: relative; max-width: 340px; }
.portrait img { border-radius: 20px; aspect-ratio: 1; object-fit: cover; width: 100%; position: relative; z-index: 1; }
.intro p { color: var(--ink-soft); }
.stats { display: flex; flex-wrap: wrap; gap: 28px 40px; margin: 28px 0 32px; padding: 0; list-style: none; }
.stats li { font-size: .9rem; color: var(--muted); }
.stats strong { display: block; font-family: var(--font-head); font-size: 1.6rem; color: var(--ink); font-weight: 600; letter-spacing: -0.02em; }

/* Posts */
.posts { display: grid; gap: 18px; grid-template-columns: 1fr; list-style: none; padding: 0; margin: 0; }
@media (min-width: 860px) { .posts { grid-template-columns: repeat(3, 1fr); } }
.post a {
  display: flex; flex-direction: column; height: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; text-decoration: none; color: inherit; transition: transform .2s, border-color .2s;
}
.post a:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.post time { font-family: var(--font-mono); font-size: .75rem; color: var(--muted); letter-spacing: .04em; }
.post h3 { margin: 10px 0 10px; font-size: 1.12rem; color: var(--ink); }
.post p { color: var(--ink-soft); font-size: .96rem; margin: 0 0 16px; }
.post .more { margin-top: auto; color: var(--accent); font-weight: 600; font-size: .92rem; }
.section-foot { margin-top: 32px; }

/* CTA band */
.cta-band { padding: 0 0 88px; }
.cta-band .box {
  background: var(--ink); color: var(--bg); border-radius: 24px; padding: 48px 28px;
  display: grid; gap: 24px; align-items: center; position: relative; overflow: hidden;
}
@media (min-width: 760px) { .cta-band .box { grid-template-columns: 1fr auto; padding: 56px 56px; } }
.cta-band h2 { color: var(--bg); margin-bottom: .3em; }
.cta-band p { color: color-mix(in srgb, var(--bg) 75%, transparent); margin: 0; max-width: 36em; }
.cta-band .box::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 45%, transparent) 0 2px, transparent 3px) 0 0 / 22px 22px;
  opacity: .5; pointer-events: none;
}

/* ---------- Page header (inner pages) ---------- */
.page-head { padding-top: 64px; padding-bottom: 24px; }
.page-head p { font-size: 1.15rem; color: var(--ink-soft); max-width: 40em; }

/* About */
.about-grid { display: grid; gap: 40px; }
@media (min-width: 900px) { .about-grid { grid-template-columns: 1fr 300px; gap: 72px; align-items: start; } }
.about-grid aside { order: -1; }
@media (min-width: 900px) { .about-grid aside { order: 0; position: sticky; top: 100px; } }
.about-grid aside img { border-radius: 18px; max-width: 300px; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.about-grid aside ul { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 8px; }
.about-grid aside a { font-weight: 500; }
.prose p { color: var(--ink-soft); }
.prose h2 { font-size: 1.5rem; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); }

.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 22px; }
.timeline li { display: grid; gap: 2px 24px; }
@media (min-width: 640px) { .timeline li { grid-template-columns: 170px 1fr; } }
.timeline .when { font-family: var(--font-mono); font-size: .82rem; color: var(--muted); padding-top: 3px; }
.timeline .what strong { display: block; color: var(--ink); font-weight: 600; }
.timeline .what span { color: var(--ink-soft); font-size: .98rem; }
.timeline .what p { margin: 6px 0 0; font-size: .95rem; color: var(--ink-soft); }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { font-family: var(--font-mono); font-size: .8rem; padding: 5px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-soft); }
.prose .stats { margin: 32px 0 0; }

.prose h3 { font-size: 1.05rem; margin: 28px 0 12px; }
.pubs.talks { list-style: none; padding-left: 0; }
.pubs.talks li { padding-left: 0; }
.pubs { padding-left: 1.2em; margin: 0; display: grid; gap: 14px; }
.pubs li { color: var(--ink-soft); font-size: .97rem; padding-left: 4px; }
.pubs li::marker { color: var(--muted); font-family: var(--font-mono); font-size: .85rem; }
.pubs em { color: var(--ink); font-style: normal; font-weight: 500; }

/* Contact */
.contact-grid { display: grid; gap: 18px; grid-template-columns: 1fr; padding-bottom: 96px; }
@media (min-width: 760px) { .contact-grid { grid-template-columns: 1.7fr 1fr 1fr; } }
.contact-card { display: flex; flex-direction: column; gap: 6px; }
.contact-card .label { font-family: var(--font-mono); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.contact-card a.big { font-family: var(--font-head); font-size: 1.25rem; font-weight: 600; text-decoration: none; overflow-wrap: normal; word-break: normal; }
.contact-card.primary { background: var(--ink); border-color: var(--ink); }
.contact-card.primary .label { color: color-mix(in srgb, var(--bg) 60%, transparent); }
.contact-card.primary a.big { color: var(--accent); font-size: 1.15rem; }
@media (max-width: 420px) { .contact-card.primary a.big { font-size: 1.02rem; } }
.contact-card.primary p { color: color-mix(in srgb, var(--bg) 75%, transparent); }
.contact-card p { font-size: .95rem; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 40px 0; color: var(--muted); font-size: .92rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px; align-items: center; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.site-footer a { color: var(--ink-soft); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.site-footer .legal { margin: 0; line-height: 1.6; }

/* 404 */
.notfound { min-height: 60vh; display: grid; place-items: center; text-align: center; padding-top: 80px; padding-bottom: 80px; }
.notfound code { font-family: var(--font-mono); color: var(--accent); }

/* Screen-reader-only text (e.g. "opens in a new tab") */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
