/* ConductBiology design tokens — lifted from conductscience-headless / conductcolony pattern */

:root {
  /* Brand — teal slots between cognition (rose), colony (amber), signal (green), speech (violet) */
  --brand-50:  #f0fdfa;
  --brand-100: #ccfbf1;
  --brand-200: #99f6e4;
  --brand-300: #5eead4;
  --brand-400: #2dd4bf;
  --brand-500: #14b8a6;
  --brand-600: #0d9488;
  --brand-700: #0f766e;
  --brand-800: #115e59;
  --brand-900: #134e4a;

  /* Neutral — slightly warm, scientific */
  --ink-900: #0f172a;
  --ink-800: #1e293b;
  --ink-700: #334155;
  --ink-600: #475569;
  --ink-500: #64748b;
  --ink-400: #94a3b8;
  --ink-300: #cbd5e1;
  --ink-200: #e2e8f0;
  --ink-100: #f1f5f9;
  --ink-50:  #f8fafc;
  --ink-white: #ffffff;

  /* Status / data-source coding (per spec) */
  --ok:      #059669;  /* complete metadata (green) */
  --ok-bg:   #ecfdf5;
  --warn:    #d97706;  /* warnings (amber) */
  --warn-bg: #fffbeb;
  --block:   #dc2626;  /* blocking issues (red) */
  --block-bg:#fef2f2;
  --info:    #2563eb;  /* account/system actions (restrained blue) */
  --info-bg: #eff6ff;
  --src-vision: #7c3aed; /* future ConductVision source */
  --src-vision-bg: #f5f3ff;
  --src-signal: #0891b2; /* future ConductSignal source */
  --src-signal-bg: #ecfeff;
  --src-bench: var(--brand-600);
  --src-bench-bg: var(--brand-50);

  /* Type */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Layout */
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.04), 0 1px 1px rgba(15,23,42,.02);
  --shadow-md: 0 4px 12px -2px rgba(15,23,42,.06), 0 2px 4px -2px rgba(15,23,42,.04);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--ink-white);
  color: var(--ink-900);
  font-family: var(--font-sans);
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.mono { font-family: var(--font-mono); }

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

/* Reusable primitives ---------------------------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border-radius: 999px;
  border: 1px solid var(--ink-200);
  background: var(--ink-50);
  color: var(--ink-700);
  font-family: var(--font-mono);
  white-space: nowrap;
}
.chip-ok      { background: var(--ok-bg);     color: var(--ok);     border-color: #a7f3d0; }
.chip-warn    { background: var(--warn-bg);   color: var(--warn);   border-color: #fde68a; }
.chip-block   { background: var(--block-bg);  color: var(--block);  border-color: #fecaca; }
.chip-info    { background: var(--info-bg);   color: var(--info);   border-color: #bfdbfe; }
.chip-bench   { background: var(--src-bench-bg);  color: var(--src-bench);  border-color: var(--brand-200); }
.chip-vision  { background: var(--src-vision-bg); color: var(--src-vision); border-color: #ddd6fe; }
.chip-signal  { background: var(--src-signal-bg); color: var(--src-signal); border-color: #a5f3fc; }

.dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease;
  white-space: nowrap;
  user-select: none;
}
.btn-primary { background: var(--brand-600); color: white; }
.btn-primary:hover { background: var(--brand-700); }
.btn-ghost  { background: transparent; color: var(--ink-800); border-color: var(--ink-200); }
.btn-ghost:hover { background: var(--ink-50); }
.btn-link { background: none; color: var(--brand-700); padding: 0; }
.btn-link:hover { color: var(--brand-800); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }

.card {
  background: white;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.panel {
  background: white;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--ink-200);
}
.panel-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-700);
}
.panel-body { padding: 16px; }

/* scrollbar polish */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--ink-200); border-radius: 999px; border: 2px solid white; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-300); }

/* Hero animations */
@keyframes cb-rise {
  0%   { opacity: 0; transform: translateY(14px) scale(.98); }
  100% { opacity: 1; transform: translateY(0)    scale(1);   }
}
@keyframes cb-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
@keyframes cb-pulse {
  0%   { box-shadow: 0 0 0 0    rgba(45,212,191,.55); }
  70%  { box-shadow: 0 0 0 7px  rgba(45,212,191,0);   }
  100% { box-shadow: 0 0 0 0    rgba(45,212,191,0);   }
}
@keyframes cb-grow {
  0%   { width: 0%; }
  100% { width: 83%; }
}
@keyframes cb-marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-33.333%); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Hero responsive grid */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 36px;
  align-items: center;
}
.hero-grid > :first-child { padding-right: 12px; }

@media (max-width: 1080px) {
  .hero-grid { grid-template-columns: 1fr; gap: 56px; }
  .hero-visual { height: 520px; max-width: 560px; margin: 0 auto; width: 100%; }
}
/* Phones show only the decision pack: the file cards, flow lines, and pill are hidden,
   and the card drops its absolute position (inline styles need the !important). */
@media (max-width: 640px) {
  .hero-pad { padding: 48px 16px 40px !important; }
  .hero-grid { gap: 32px; }
  .hero-grid > :first-child { padding-right: 0; }
  .hero-visual { height: auto !important; }
  .hero-file, .hero-lines, .hero-pill, .hero-glow { display: none !important; }
  .hero-record { position: relative !important; top: auto !important; right: auto !important; width: 100% !important; }
}

/* Buttons on new controls meet the 44 px touch target */
.btn-tap { min-height: 44px; }

/* Navigation: links on wide screens, a menu below 860 px */
.nav-inner {
  max-width: 1240px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-link { font-size: 13.5px; font-weight: 500; color: var(--ink-700); }
.nav-link:hover, .nav-link[aria-current="page"] { color: var(--brand-700); }
.nav-menu { display: none; position: relative; }
.nav-menu > summary {
  list-style: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px;
  border: 1px solid var(--ink-200); border-radius: var(--radius-sm); background: white;
  font-size: 14px; font-weight: 500; color: var(--ink-800);
}
.nav-menu > summary::-webkit-details-marker { display: none; }
.nav-menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  min-width: 240px; padding: 6px; display: grid; gap: 2px;
  background: white; border: 1px solid var(--ink-200); border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.nav-menu-panel a {
  display: flex; align-items: center; min-height: 44px; padding: 0 12px;
  border-radius: var(--radius-sm); font-size: 15px; color: var(--ink-800);
}
.nav-menu-panel a:hover { background: var(--ink-50); }
.nav-menu-panel a[aria-current="page"] { color: var(--brand-700); }
.nav-menu-panel a.btn-primary { margin-top: 6px; justify-content: center; color: white; }
.nav-menu-panel a.btn-primary:hover { background: var(--brand-700); }
@media (max-width: 860px) {
  .nav-inner { padding: 10px 16px; }
  .nav-links { display: none; }
  .nav-menu { display: block; }
}

/* Page sections */
.page-wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.section { padding: 88px 0; }
@media (max-width: 760px) {
  .page-wrap { padding: 0 16px; }
  .section { padding: 56px 0; }
}

/* Responsive grids */
.grid-2, .grid-3, .grid-4 { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split-2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; }
.stats-5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat-cell { background: white; padding: 26px 22px; }
.inst-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); gap: 32px; }
@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .grid-3, .split-2 { grid-template-columns: 1fr; }
  .stat-cell { padding: 18px 14px; }
  .inst-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .stats-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-5 > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .inst-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-links { gap: 0 !important; }
  .footer-links a { display: inline-flex; align-items: center; min-height: 44px; }
}

/* Sign-up layout */
.signup-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(340px, 520px); grid-template-rows: auto 1fr;
  grid-template-areas: "head side" "steps side"; column-gap: 44px; row-gap: 34px; align-items: start; }
.signup-head { grid-area: head; min-width: 0; }
.signup-side { grid-area: side; min-width: 0; display: grid; gap: 16px; align-content: start; }
.signup-steps { grid-area: steps; min-width: 0; }
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) {
  .signup-grid { grid-template-columns: 1fr; grid-template-rows: none; grid-template-areas: "head" "side" "steps"; gap: 32px; }
}
@media (max-width: 520px) {
  .form-2col { grid-template-columns: 1fr; }
}

/* Wide tables scroll sideways inside their panel instead of widening the page */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Text for screen readers only */
.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;
}

/* Browser tools (Molecular and Population genetics) ------------------------ */

.tool-head { padding: 28px 0 8px; }
.tool-head h1 {
  margin: 6px 0 0; font-size: clamp(26px, 3.4vw, 36px); font-weight: 700; letter-spacing: -0.025em;
  line-height: 1.1; text-wrap: balance;
}
.tool-head p { margin: 8px 0 0; max-width: 720px; font-size: 15px; line-height: 1.55; color: var(--ink-600); }
.tool-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }

.tool-steps {
  display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 2px; margin: 18px 0 0;
  border-bottom: 1px solid var(--ink-200); scrollbar-width: none;
}
.tool-steps::-webkit-scrollbar { display: none; }
.tool-step {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border: none; border-bottom: 2px solid transparent; background: none; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 500; color: var(--ink-600); white-space: nowrap;
}
.tool-step:hover:not(:disabled) { color: var(--ink-900); }
.tool-step[aria-current="step"] { color: var(--brand-700); border-bottom-color: var(--brand-600); }
.tool-step:disabled { color: var(--ink-300); cursor: default; }
.tool-step-num {
  width: 22px; height: 22px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 600; background: var(--ink-100); color: var(--ink-600);
}
.tool-step[aria-current="step"] .tool-step-num { background: var(--brand-600); color: white; }
.tool-step.is-done .tool-step-num { background: var(--brand-100); color: var(--brand-800); }

.tool-body { padding-top: 24px; padding-bottom: 72px; }
.tool-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 20px; align-items: start; }
.tool-stack { display: grid; gap: 16px; }
@media (max-width: 1000px) { .tool-grid { grid-template-columns: 1fr; } }

.tool-drop {
  display: block; position: relative; padding: 18px; border: 1.5px dashed var(--ink-300);
  border-radius: var(--radius); background: var(--ink-50); cursor: pointer; transition: border-color .12s, background .12s;
}
.tool-drop:hover, .tool-drop.is-over { border-color: var(--brand-500); background: var(--brand-50); }
.tool-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.tool-drop:focus-within { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.tool-drop-title { font-size: 14.5px; font-weight: 600; color: var(--ink-900); }
.tool-drop-hint { margin-top: 3px; font-size: 13px; color: var(--ink-500); line-height: 1.45; }

.tool-file {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-top: 8px;
  border: 1px solid var(--ink-200); border-radius: var(--radius-sm); background: white; font-size: 13px;
}
.tool-file-name { font-weight: 500; color: var(--ink-900); overflow-wrap: anywhere; }
.tool-file-meta { color: var(--ink-500); font-size: 12px; }

.tool-notice {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: var(--radius-sm);
  font-size: 13.5px; line-height: 1.5; border: 1px solid var(--ink-200); background: var(--ink-50); color: var(--ink-700);
}
.tool-notice.tone-ok { background: var(--ok-bg); border-color: #a7f3d0; color: #065f46; }
.tool-notice.tone-warn { background: var(--warn-bg); border-color: #fde68a; color: #92400e; }
.tool-notice.tone-block { background: var(--block-bg); border-color: #fecaca; color: #991b1b; }
.tool-notice.tone-info { background: var(--info-bg); border-color: #bfdbfe; color: #1e40af; }
.tool-notice ul { margin: 4px 0 0; padding-left: 18px; }

.tool-table { width: 100%; border-collapse: collapse; font-size: 13px; background: white; }
.tool-table th {
  text-align: left; padding: 9px 10px; font-size: 10.5px; font-weight: 600; color: var(--ink-500);
  letter-spacing: .05em; text-transform: uppercase; background: var(--ink-50); border-bottom: 1px solid var(--ink-200);
  white-space: nowrap;
}
.tool-table td { padding: 9px 10px; border-top: 1px solid var(--ink-100); color: var(--ink-800); vertical-align: top; }
.tool-table tbody tr:first-child td { border-top: none; }
.tool-table td.num, .tool-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tool-table tr.is-selected td { background: var(--brand-50); }
.tool-table tr.is-clickable { cursor: pointer; }
.tool-table tr.is-clickable:hover td { background: var(--ink-50); }
.tool-table input, .tool-table select { min-height: 36px; }

.tool-field { display: grid; gap: 5px; }
.tool-field > span { font-size: 13px; font-weight: 500; color: var(--ink-800); }
.tool-field small { font-size: 12px; color: var(--ink-500); line-height: 1.4; }
.tool-input {
  min-height: 44px; width: 100%; padding: 0 11px; font: inherit; font-size: 14px; color: var(--ink-900);
  background: white; border: 1px solid var(--ink-300); border-radius: var(--radius-sm);
}
.tool-input:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(20,184,166,.15); }
.tool-input:disabled { background: var(--ink-50); color: var(--ink-600); }
textarea.tool-input { padding: 10px 11px; min-height: 88px; resize: vertical; line-height: 1.5; }
.tool-check { display: flex; gap: 10px; align-items: center; min-height: 44px; font-size: 14px; color: var(--ink-800); cursor: pointer; }
.tool-check input { width: 18px; height: 18px; accent-color: var(--brand-600); }
.tool-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
@media (max-width: 640px) { .tool-form-grid { grid-template-columns: 1fr; } }

.tool-stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.tool-stat { padding: 12px 14px; border: 1px solid var(--ink-200); border-radius: var(--radius); background: white; }
.tool-stat-label { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-500); }
.tool-stat-value { margin-top: 4px; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink-900); font-variant-numeric: tabular-nums; }
.tool-stat-sub { margin-top: 2px; font-size: 12px; color: var(--ink-500); }

.tool-progress { height: 6px; border-radius: 999px; background: var(--ink-100); overflow: hidden; }
.tool-progress > span { display: block; height: 100%; background: var(--brand-600); transition: width .2s ease; }

.tool-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.tool-tab {
  min-height: 40px; padding: 0 12px; border: 1px solid var(--ink-200); border-radius: 999px; background: white;
  font: inherit; font-size: 13px; font-weight: 500; color: var(--ink-700); cursor: pointer;
}
.tool-tab[aria-selected="true"] { background: var(--ink-900); border-color: var(--ink-900); color: white; }
@media (max-width: 640px) { .tool-tab { min-height: 44px; } }

.tool-mono { font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; }
.tool-muted { color: var(--ink-500); }
.tool-bad { color: var(--block); font-weight: 600; }
.tool-warn { color: var(--warn); font-weight: 600; }
.tool-good { color: var(--ok); font-weight: 600; }

/* Print: only the report prints */
@media print {
  body { background: white !important; }
  body * { visibility: hidden !important; }
  .print-root, .print-root * { visibility: visible !important; }
  .print-root { position: absolute; left: 0; top: 0; width: 100%; padding: 0 !important; border: none !important; box-shadow: none !important; }
  .no-print { display: none !important; }
  .print-break { break-before: page; }
}

/* Phones and tablets: every control in the tools meets the 44 px touch target. */
@media (max-width: 1000px) {
  .tool-body .btn, .tool-head .btn, .tool-body .tool-input, .tool-table input, .tool-table select { min-height: 44px !important; }
  .tool-body .btn-link { min-height: 44px; display: inline-flex; align-items: center; }
  .tool-tab { min-height: 44px; }
}
.tool-table th.keep-case { text-transform: none; letter-spacing: 0; font-size: 11.5px; }
/* The nav button also meets the 44 px target: tablets in landscape get the desktop nav. */
.nav-links .btn { min-height: 44px; padding-left: 14px; padding-right: 14px; }
@media (min-width: 861px) { .nav-inner { padding-top: 8px; padding-bottom: 8px; } }
/* Status colors win over the table's default text color. */
.tool-table td.tool-bad, .tool-table td .tool-bad { color: var(--block); }
.tool-table td.tool-warn, .tool-table td .tool-warn { color: var(--warn); }
.tool-table td.tool-good, .tool-table td .tool-good { color: var(--ok); }
.tool-table td.tool-muted, .tool-table td .tool-muted { color: var(--ink-500); }
/* Grid children may shrink below their content, so a wide table scrolls inside its panel
   instead of widening the page. */
.tool-stack > *, .tool-grid > * { min-width: 0; }
/* Every tool control meets the 44 px target at every width (tablets in landscape use the
   desktop layout). */
.tool-body .btn, .tool-head .btn, .tool-body .tool-input, .tool-table input, .tool-table select { min-height: 44px !important; }

/* Account (sign-in with a ConductScience account) ------------------------- */
.nav-account { position: relative; }
.nav-account > summary {
  list-style: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 6px;
  border-radius: 999px; cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--ink-800);
}
.nav-account > summary::-webkit-details-marker { display: none; }
.nav-account > summary:hover { background: var(--ink-50); }
.nav-avatar {
  width: 30px; height: 30px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-100); color: var(--brand-800); font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
.nav-account-panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: 260px; display: grid; gap: 4px; padding: 14px;
  background: white; border: 1px solid var(--ink-200); border-radius: var(--radius); box-shadow: var(--shadow-md); z-index: 60;
}
.nav-account-panel .btn { width: 100%; }
.nav-menu-account { padding: 8px 12px; font-size: 13.5px; color: var(--ink-700); }
.nav-menu-account span { display: block; font-size: 12.5px; color: var(--ink-500); overflow-wrap: anywhere; }
.nav-menu-signout {
  min-height: 44px; padding: 0 12px; text-align: left; background: none; border: none; border-radius: 8px;
  font: inherit; font-size: 14.5px; color: var(--ink-800); cursor: pointer;
}
.nav-menu-signout:hover { background: var(--ink-50); }
