/* CHONK BIO — Formation Bio inspired theme.
   Cream paper, editorial typography, soft shadows, restrained accents.
   Chonk cutouts are the brand element, juxtaposed against slick clinical UI. */

:root {
  /* paper */
  --bg:        oklch(0.97 0.012 78);     /* cream */
  --bg-2:      oklch(0.93 0.014 78);     /* warmer cream */
  --bg-3:      oklch(0.99 0.006 78);     /* near-white */
  --paper:     #ffffff;                   /* pure white cards */

  /* ink */
  --ink:       oklch(0.18 0.015 230);    /* near-black, cool */
  --ink-2:     oklch(0.32 0.012 230);
  --ink-soft:  oklch(0.50 0.010 230);
  --ink-mute:  oklch(0.65 0.008 230);

  /* hairlines */
  --line:      oklch(0.88 0.012 78);
  --line-2:    oklch(0.82 0.014 78);
  --line-dark: oklch(0.30 0.015 230);

  /* signal — restrained, pharma-credible */
  --signal:       oklch(0.55 0.16 145);     /* vet-green */
  --signal-deep:  oklch(0.40 0.14 145);
  --signal-soft:  oklch(0.88 0.10 145);

  /* secondary accents — used sparingly */
  --plasma:    oklch(0.55 0.14 235);     /* pharma-blue */
  --warm:      oklch(0.70 0.14 55);      /* clinical orange */
  --hazard:    oklch(0.58 0.20 28);      /* red */

  /* shadows */
  --shadow-sm: 0 1px 2px oklch(0.20 0.015 230 / 0.06), 0 1px 1px oklch(0.20 0.015 230 / 0.04);
  --shadow:    0 6px 16px oklch(0.20 0.015 230 / 0.06), 0 2px 4px oklch(0.20 0.015 230 / 0.04);
  --shadow-lg: 0 24px 60px oklch(0.20 0.015 230 / 0.08), 0 8px 20px oklch(0.20 0.015 230 / 0.05);

  /* fonts */
  --font-sans:    "Inter", "Geist", system-ui, -apple-system, sans-serif;
  --font-mono:    "Geist Mono", ui-monospace, monospace;
  --font-serif:   "Newsreader", "Tiempos", Georgia, serif;
  --font-display: "Newsreader", "Tiempos", Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-feature-settings: "ss01" 1, "cv11" 1, "cv05" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  width: 100%;
}
::selection { background: var(--signal-soft); color: var(--ink); }

h1, h2, h3, h4, h5, h6 { font-weight: 500; letter-spacing: -0.02em; line-height: 1.05; }
p { line-height: 1.6; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }
.uc { text-transform: uppercase; letter-spacing: 0.08em; }
.serif { font-family: var(--font-serif); }
.italic { font-style: italic; }

/* page wrappers */
.wrap        { max-width: 1320px; margin: 0 auto; padding: 0 40px; }
.wrap-tight  { max-width: 1080px; margin: 0 auto; padding: 0 40px; }
.wrap-narrow { max-width:  760px; margin: 0 auto; padding: 0 40px; }

/* eyebrow */
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}
.eyebrow::before {
  content: ""; width: 28px; height: 1px; background: var(--ink-soft);
}

/* eyebrow on dark surface */
.eyebrow-light { color: oklch(0.85 0.01 78); }
.eyebrow-light::before { background: oklch(0.85 0.01 78); }

/* editorial display headline (serif) */
.display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 0.96;
  color: var(--ink);
}

/* big sans hero (alt) */
.sans-display {
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 0.95;
}

/* italic editorial accent */
.italic-accent {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--signal-deep);
}

/* card */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.card-lg {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.card-flat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
}

/* pill / chip */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
}
.pill .dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--signal);
}
.pill-signal { background: var(--signal-soft); border-color: var(--signal-soft); color: var(--signal-deep); }

/* button */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: transform 200ms ease, box-shadow 200ms ease, background 200ms ease;
  cursor: pointer;
}
.btn-primary {
  background: var(--ink);
  color: var(--bg);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-secondary {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--line-2);
}
.btn-secondary:hover { background: var(--bg-3); }
.btn-signal {
  background: var(--signal);
  color: var(--paper);
}

/* hairlines */
.hr  { height: 1px; background: var(--line); border: none; }
.hr-2{ height: 1px; background: var(--line-2); border: none; }

/* sticky nav */
.nav-glass {
  position: sticky; top: 0; z-index: 50;
  background: oklch(0.97 0.012 78 / 0.84);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

/* sections */
section { position: relative; }
.panel        { background: var(--bg); }
.panel-warm   { background: var(--bg-2); }
.panel-paper  { background: var(--paper); }
.panel-ink    { background: var(--ink); color: oklch(0.92 0.01 78); }

/* link arrow */
.link-arrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
}

/* chonk cutout — transparent PNG, sits inline */
.chonk-cutout {
  display: block;
  filter: drop-shadow(0 14px 30px oklch(0.20 0.015 230 / 0.18))
          drop-shadow(0 4px 8px oklch(0.20 0.015 230 / 0.10));
  pointer-events: none;
  user-select: none;
}

/* tiny circular chonk avatar (head crop via object-position) */
.chonk-avatar {
  display: inline-block;
  border-radius: 999px;
  background: var(--bg-2);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  border: 1px solid var(--line);
}
.chonk-avatar img {
  position: absolute;
  width: 180%;
  height: 180%;
  object-fit: cover;
  object-position: 50% 10%;
  top: -8%;
  left: -40%;
}

/* dot grid background utility */
.dot-grid {
  background-image: radial-gradient(circle at 1px 1px, oklch(0.20 0.015 230 / 0.10) 1px, transparent 0);
  background-size: 28px 28px;
}

/* faint horizontal rule between major sections */
.section-rule {
  border-top: 1px solid var(--line);
}

/* slick UI surfaces — these are the "interface" half of the juxtaposition */

.surface {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.surface-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-3);
}
.surface-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.surface-body { padding: 18px; }

/* status dot */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}
.status::before {
  content: ""; width: 6px; height: 6px; border-radius: 999px;
}
.status-on::before  { background: var(--signal); box-shadow: 0 0 0 2px oklch(0.55 0.16 145 / 0.18); }
.status-warn::before{ background: var(--warm); }
.status-off::before { background: var(--ink-mute); }

/* sparkline + bar utilities */
.bar-track {
  height: 6px;
  background: var(--bg-2);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--signal);
  border-radius: 999px;
}

/* table */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tbl th, .tbl td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.tbl th {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 500;
  background: var(--bg-3);
}
.tbl tr:hover td { background: var(--bg-3); }

/* ============================================================
   Responsive — mobile + tablet
   ============================================================ */

/* Nav: hamburger pattern */
.nav-wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 40px; gap: 16px;
}
.nav-desktop { display: flex; gap: 32px; font-size: 14px; }
.nav-cta { padding: 8px 16px; font-size: 13px; }
.nav-hamburger {
  display: none;
  background: transparent; border: none; cursor: pointer;
  width: 40px; height: 40px; padding: 0;
  align-items: center; justify-content: center;
  border-radius: 999px;
}
.nav-hamburger:hover { background: var(--bg-2); }
.nav-hamburger-icon {
  display: flex; flex-direction: column; gap: 4px;
  width: 20px;
}
.nav-hamburger-icon span {
  display: block; height: 2px; width: 100%;
  background: var(--ink); border-radius: 2px;
  transition: transform 200ms ease;
}

/* Drawer */
.nav-drawer {
  position: fixed; top: 0; left: 0;
  width: 100vw; height: 100vh; height: 100dvh;
  z-index: 100;
  pointer-events: none;
}
.nav-drawer-bg {
  position: absolute; inset: 0;
  background: oklch(0.18 0.015 230 / 0);
  transition: background 220ms ease;
}
.nav-drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(380px, 90vw);
  background: var(--paper);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 320ms cubic-bezier(0.32, 0.72, 0, 1);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.nav-drawer.open { pointer-events: auto; }
.nav-drawer.open .nav-drawer-bg { background: oklch(0.18 0.015 230 / 0.40); backdrop-filter: blur(4px); }
.nav-drawer.open .nav-drawer-panel { transform: translateX(0); }
.nav-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}
.nav-drawer-close {
  background: transparent; border: none; cursor: pointer;
  width: 36px; height: 36px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); font-size: 20px;
}
.nav-drawer-close:hover { background: var(--bg-2); }
.nav-drawer-links {
  display: flex; flex-direction: column;
  padding: 16px 0;
}
.nav-drawer-links a {
  padding: 16px 24px;
  font-size: 18px;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--line);
}
.nav-drawer-links a:hover { background: var(--bg-2); }
.nav-drawer-links a.active { color: var(--signal-deep); }
.nav-drawer-cta {
  margin-top: auto;
  padding: 24px;
  display: flex; flex-direction: column; gap: 10px;
  border-top: 1px solid var(--line);
}
.nav-drawer-cta .btn { width: 100%; justify-content: center; padding: 14px 18px; }
.nav-drawer-cta-mail {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
  padding-top: 6px;
}

/* lock body scroll when drawer is open */
body.nav-locked { overflow: hidden; }

/* horizontal-scroll container for wide tables/dashboards on mobile */
.h-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.h-scroll > * { min-width: 880px; }

/* ===== Tablet (≤ 1100px) ===== */
@media (max-width: 1100px) {
  .wrap, .wrap-tight, .wrap-narrow { padding: 0 32px; }
}

/* ===== Mobile (≤ 800px) — main breakpoint ===== */
@media (max-width: 800px) {
  .wrap, .wrap-tight, .wrap-narrow { padding: 0 20px; }

  /* Nav swap */
  .nav-wrap { padding: 14px 20px; }
  .nav-desktop, .nav-cta { display: none; }
  .nav-hamburger { display: inline-flex; }

  /* Display type — pull the floor down */
  .display { letter-spacing: -0.025em; }
  h1.display, h2.display, h3.display { line-height: 1.02; }

  /* Force all multi-col inline grids back to stacks/sensibly few cols.
     React renders style={{gridTemplateColumns}} as kebab-case in the HTML
     attribute, so [style*="grid-template-columns"] works. */
  [style*="grid-template-columns: 1.2fr"],
  [style*="grid-template-columns: 1.3fr"],
  [style*="grid-template-columns: 1.4fr"],
  [style*="grid-template-columns: 1.5fr"],
  [style*="grid-template-columns: 1.6fr"],
  [style*="grid-template-columns: 1.05fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1.1fr"],
  [style*="grid-template-columns: 1fr 1.2fr"],
  [style*="grid-template-columns: auto 1fr"],
  [style*="grid-template-columns: 1.1fr"],
  [style*="grid-template-columns: repeat(2,"],
  [style*="grid-template-columns: repeat(3,"] {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
    align-items: start !important;
  }
  [style*="grid-template-columns: repeat(4,"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1px !important;
  }
  [style*="grid-template-columns: repeat(5,"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  [style*="grid-template-columns: repeat(6,"],
  [style*="grid-template-columns: repeat(7,"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  [style*="grid-template-columns: 120px 1fr 200px"],
  [style*="grid-template-columns: 120px 1fr 280px"],
  [style*="grid-template-columns: 60px 1fr 280px"] {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    text-align: left !important;
  }
  [style*="grid-template-columns: 84px 1.4fr"] {
    /* old pipeline; covered by h-scroll wrap */
  }

  /* Section padding — pull in */
  section[class*="panel"][style*="padding: 140px"] { padding: 80px 0 !important; }
  section[class*="panel"][style*="padding: 120px"] { padding: 72px 0 !important; }
  section[class*="panel"][style*="padding: 96px"]  { padding: 60px 0 !important; }

  /* Cards & surface bodies on mobile — make sure inner grids don't overflow */
  .card, .card-lg, .card-flat, .surface { max-width: 100%; }
  .surface-body { padding: 14px; }
  .surface-header { padding: 12px 14px; }

  /* Buttons — make hero CTA pair stack/full-width when squished */
  [style*="justify-content: flex-end"][style*="display: flex"] { justify-content: flex-start !important; flex-wrap: wrap !important; }
  .btn { padding: 12px 18px; font-size: 13px; }

  /* Hero wordmarks & stat numbers — tighten line-height to prevent walls of type */
  h1.display, h2.display { word-break: break-word; hyphens: auto; }
  .display-num { letter-spacing: -0.04em !important; }

  /* Sticky filter bar gets in the way on mobile — un-stick it */
  .card[style*="position: sticky"][style*="top: 76"] { position: static !important; }

  /* Pipeline / dashboard tables: wrap in .h-scroll where needed */
  .tbl { font-size: 12px; }
  .tbl th, .tbl td { padding: 10px 12px; }

  /* Tables inside surfaces (e.g. ClinicalDashboard) scroll horizontally
     without forcing the whole surface to scroll. */
  .surface-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .surface-body .tbl { min-width: 560px; }

  /* SVG charts (LineChart, SparkECG, MoleculeViz) — width 100%, viewBox handles scaling */
  .surface-body > svg,
  .card-flat > svg,
  .card > svg,
  .surface-body .card-flat > svg { max-width: 100%; height: auto; }

  /* Absolutely-positioned dashboard/surface overlays inside hero images:
     unstack them below the image on mobile so labels don't overflow. */
  [style*="position: absolute"][style*="width: 380"],
  [style*="position: absolute"][style*="width: 460"],
  [style*="position: absolute"][style*="width: 480"],
  [style*="position: absolute"][style*="width: 520"] {
    position: static !important;
    width: auto !important;
    max-width: 100% !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    top: auto !important;
    margin-top: 14px !important;
  }

  /* Hero image blocks with an aspect-ratio constraint — relax so chonk + funnel + headline don't collide */
  [style*="aspect-ratio: 16 / 8"],
  [style*="aspect-ratio: 16/8"] { aspect-ratio: auto !important; }

  /* Chonk cutouts: anchor tighter, cap height so they don't overpower content.
     The natural sizes (260–460px) are designed for desktop hero blocks. */
  .chonk-cutout[style*="position: absolute"] { max-height: 220px !important; }
  .chonk-cutout[style*="position: absolute"][style*="right: -"] { right: -8px !important; }
  .chonk-cutout[style*="position: absolute"][style*="left: -"]  { left:  -8px !important; }
  .chonk-cutout[style*="position: absolute"][style*="bottom: -"] { bottom: -8px !important; }

  /* Footer columns collapse */
  footer .wrap > div[style*="grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 32px !important;
  }

  /* Roster grid: force a 2-col layout no matter the inline value */
  section#roster div[style*="grid-template-columns: repeat("] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Hero pipeline preview card — let it stack under the headline */
  .lcard, .card { box-shadow: var(--shadow-sm); }
}

/* ===== Small phone (≤ 480px) — final compress ===== */
@media (max-width: 480px) {
  .wrap, .wrap-tight, .wrap-narrow { padding: 0 16px; }
  .nav-wrap { padding: 12px 16px; }
  h1.display { font-size: 48px !important; }
  /* still allow .display h2 to scale via clamp() naturally */

  /* Pipeline table — too tight even with horizontal scroll. Hide stage bar column. */
  .h-scroll > * { min-width: 760px; }
}
