/* Palette loosely based on H&E histology stains */
:root {
  --bg: #f6f8fb;
  --paper: #ffffff;
  --ink: #16213a;
  --muted: #5e6a82;
  --line: #dde3ee;
  --grid: rgba(64, 120, 200, 0.07);
  --haem: #5b3d9e;      /* haematoxylin purple */
  --eosin: #e0508f;     /* eosin pink */
  --cyan: #0fa3b1;
  --green: #1f9d6b;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Lab-notebook graph paper */
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--bg);
}

.molecules {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  color: var(--haem);
  opacity: 0.06;
  pointer-events: none;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.logo {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: var(--haem);
}
.logo sub { font-family: var(--mono); font-size: 0.65rem; color: var(--eosin); font-weight: 600; }
.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.led {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(31, 157, 107, 0.6);
  animation: led 2s infinite;
}
@keyframes led {
  70%  { box-shadow: 0 0 0 8px rgba(31, 157, 107, 0); }
  100% { box-shadow: 0 0 0 0 rgba(31, 157, 107, 0); }
}

/* ---------- Layout ---------- */
.wrap {
  flex: 1;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 64px 24px 56px;
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 48px;
  align-items: center;
}
.eyebrow {
  font-family: var(--mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--cyan);
  font-weight: 600;
}
.name {
  font-size: clamp(2.6rem, 6.5vw, 4.4rem);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-top: 0.6rem;
  background: linear-gradient(120deg, var(--haem) 0%, var(--eosin) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stamp {
  display: inline-block;
  margin-top: 1.1rem;
  padding: 0.3rem 0.9rem;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--eosin);
  border: 2px solid var(--eosin);
  border-radius: 4px;
  transform: rotate(-2.5deg);
  background: rgba(224, 80, 143, 0.06);
}
.intro {
  margin-top: 1.4rem;
  font-size: 1.1rem;
  color: #34405a;
  max-width: 52ch;
}
.intro strong { color: var(--ink); font-weight: 600; }

/* ---------- 96-well plate ---------- */
.plate-wrap { margin: 0; }
.plate {
  position: relative;
  display: grid;
  grid-template-columns: 18px 1fr;
  grid-template-rows: 18px 1fr;
  gap: 6px;
  padding: 18px 20px 20px 14px;
  background: linear-gradient(160deg, #ffffff, #eef2f8);
  border: 1px solid #cfd7e6;
  border-radius: 14px 14px 14px 30px; /* clipped corner like a real plate */
  box-shadow: 0 18px 40px -18px rgba(22, 33, 58, 0.35), inset 0 1px 0 #fff;
}
.plate-cols, .plate-rows {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: #8a96ad;
  display: grid;
  text-align: center;
  align-items: center;
}
.plate-cols { grid-column: 2; grid-template-columns: repeat(12, 1fr); }
.plate-rows { grid-row: 2; grid-template-rows: repeat(8, 1fr); }
.wells {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 6px;
}
.wells i {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid #c3cbdb;
  box-shadow: inset 0 2px 3px rgba(22, 33, 58, 0.18);
  background: #f3f5f9;
  animation: fill 0.6s ease-out both;
  transition: transform 0.2s;
}
.wells i.w1 { background: #f6d3e3; }
.wells i.w2 { background: #ec9fc2; }
.wells i.w3 { background: #d77bb4; }
.wells i.w4 { background: #9c64b8; }
.wells i.w5 { background: #5b3d9e; }
.wells i.ping {
  transform: scale(1.18);
  box-shadow: 0 0 0 3px rgba(15, 163, 177, 0.55), inset 0 2px 3px rgba(22, 33, 58, 0.18);
}
@keyframes fill { from { background: #f3f5f9; transform: scale(0.6); opacity: 0; } }
.plate-wrap figcaption {
  margin-top: 0.8rem;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

/* ---------- Cards ---------- */
.card {
  margin-top: 28px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.5rem 1.6rem;
  box-shadow: 0 10px 30px -20px rgba(22, 33, 58, 0.3);
}
.hero + .card { margin-top: 64px; }
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.card-head h2 { font-size: 1.1rem; font-weight: 700; }
.card-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* Sample log table */
.table-scroll { overflow-x: auto; }
.log { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.log th {
  text-align: left;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 0 12px 10px 0;
}
.log td { padding: 12px 12px 12px 0; border-top: 1px dashed var(--line); white-space: nowrap; }
.log td.id { font-family: var(--mono); color: var(--haem); font-weight: 600; }
.pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}
.pill.done { color: var(--green); background: rgba(31, 157, 107, 0.12); }
.pill.pub  { color: var(--haem);  background: rgba(91, 61, 158, 0.12); }
.pill.live { color: #b26a00; background: rgba(255, 170, 0, 0.16); position: relative; padding-left: 1.4rem; }
.pill.live::before {
  content: "";
  position: absolute;
  left: 0.55rem; top: 50%;
  width: 6px; height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: #e08a00;
  animation: blink 1.2s ease-in-out infinite;
}
@keyframes blink { 50% { opacity: 0.2; } }
.footnote { margin-top: 0.9rem; font-size: 0.82rem; color: var(--muted); font-style: italic; }

/* Two-up */
.duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}
.methods { list-style: none; display: grid; gap: 0.65rem; }
.methods li { display: flex; align-items: center; gap: 0.75rem; }
.ico {
  display: inline-grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 8px;
  background: rgba(15, 163, 177, 0.1);
  color: var(--cyan);
  font-size: 1rem;
}

.boxing {
  background:
    radial-gradient(circle at 100% 0%, rgba(224, 80, 143, 0.12), transparent 55%),
    var(--paper);
  border-color: rgba(224, 80, 143, 0.35);
}
.boxing .card-head h2 { color: var(--eosin); }
.hypothesis { color: #34405a; }
.hypothesis span {
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--eosin);
  font-weight: 700;
  margin-right: 0.3rem;
}
.rounds { display: flex; gap: 8px; margin-top: 1.2rem; }
.rounds span {
  flex: 1;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.35rem 0;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.rounds span.on {
  background: var(--eosin);
  border-color: var(--eosin);
  color: #fff;
  animation: blink 2s ease-in-out infinite;
}

/* ---------- Progress / test tube ---------- */
.progress {
  margin-top: 40px;
  display: flex;
  align-items: center;
  gap: 22px;
  justify-content: center;
  text-align: left;
}
.tube {
  position: relative;
  width: 26px;
  height: 84px;
  border: 2px solid #9aa6bd;
  border-top: none;
  border-radius: 0 0 14px 14px;
  background: rgba(255, 255, 255, 0.6);
  overflow: hidden;
}
.tube::before {
  content: "";
  position: absolute;
  top: 0; left: -6px; right: -6px;
  height: 2px;
  background: #9aa6bd;
}
.liquid {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 58%;
  background: linear-gradient(to top, var(--haem), var(--eosin));
  animation: level 4s ease-in-out infinite alternate;
}
@keyframes level { from { height: 45%; } to { height: 68%; } }
.liquid i {
  position: absolute;
  bottom: 0;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
  animation: bubble 2.4s linear infinite;
}
.liquid i:nth-child(1) { left: 5px; }
.liquid i:nth-child(2) { left: 13px; animation-delay: 0.8s; width: 4px; height: 4px; }
.liquid i:nth-child(3) { left: 9px;  animation-delay: 1.6s; }
@keyframes bubble {
  0%   { transform: translateY(0); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translateY(-48px); opacity: 0; }
}
.progress-title { font-weight: 700; font-size: 1.05rem; }
.progress-sub { color: var(--muted); font-size: 0.92rem; }

/* ---------- Footer ---------- */
.foot {
  text-align: center;
  padding: 22px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 36px; }
  .duo { grid-template-columns: 1fr; gap: 0; }
  .wrap { padding-top: 40px; }
}
@media (max-width: 480px) {
  .wells, .plate { gap: 4px; }
  .wells { gap: 3px; }
  .topbar { padding: 14px 18px; }
  .log td:nth-child(3), .log th:nth-child(3) { display: none; }
  .log td:nth-child(2) { white-space: normal; }
  .log { font-size: 0.9rem; }
}

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

/* ---------- Hero links / buttons ---------- */
.hero-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 1.6rem; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.55rem 1.05rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  color: var(--haem);
  background: var(--paper);
  border: 1.5px solid rgba(91, 61, 158, 0.35);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: var(--haem); background: rgba(91, 61, 158, 0.06); }
.btn.primary { background: var(--haem); color: #fff; border-color: var(--haem); }
.btn.primary:hover { background: #4a3086; }
.foot a { color: var(--haem); }

/* ---------- Featured publication ---------- */
.paper {
  border-color: rgba(91, 61, 158, 0.3);
  background:
    radial-gradient(circle at 0% 0%, rgba(91, 61, 158, 0.07), transparent 45%),
    var(--paper);
  scroll-margin-top: 80px;
}
.paper .card-head h2 { color: var(--haem); }
.paper-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 32px;
  align-items: start;
}
.journal {
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cyan);
  font-weight: 600;
}
.paper-title {
  font-size: 1.2rem;
  line-height: 1.35;
  color: var(--ink);
  margin: 0.45rem 0 0.55rem;
}
.authors { font-size: 0.88rem; color: var(--muted); }
.authors b { color: var(--eosin); }
.summary { margin-top: 1rem; color: #34405a; }
.summary.small { font-size: 0.92rem; margin-top: 0.6rem; }
.summary strong { color: var(--ink); }
.findings {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 1.1rem;
}
.findings li {
  border: 1px solid var(--line);
  border-top: 3px solid var(--eosin);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
  background: #fff;
}
.findings b {
  display: block;
  font-size: 1.25rem;
  color: var(--haem);
  line-height: 1.15;
}
.findings span { font-size: 0.8rem; color: var(--muted); line-height: 1.3; display: block; margin-top: 2px; }
.paper-links { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 1.3rem; }
.doi { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); word-break: break-all; }

.chromatogram {
  margin: 0;
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 12px 8px;
}
.chromatogram svg { width: 100%; height: auto; display: block; }
.chromatogram .axis line { stroke: #9aa6bd; stroke-width: 1.2; }
.chromatogram .ticks line { stroke: #9aa6bd; stroke-width: 1; }
.chromatogram .trace {
  fill: none;
  stroke: var(--haem);
  stroke-width: 2.2;
  stroke-linejoin: round;
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  animation: trace 3.2s ease-out 0.4s forwards;
}
@keyframes trace { to { stroke-dashoffset: 0; } }
.chromatogram .lbl { font-family: var(--mono); font-size: 9px; fill: var(--eosin); text-anchor: middle; font-weight: 700; }
.chromatogram .ax { font-family: var(--mono); font-size: 8px; fill: var(--muted); text-anchor: middle; }
.chromatogram figcaption {
  text-align: center;
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-top: 4px;
}
.contrib {
  margin-top: 1.3rem;
  padding-top: 0.9rem;
  border-top: 1px dashed var(--line);
  font-size: 0.9rem;
  color: #34405a;
}
.contrib span {
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--eosin);
  font-weight: 700;
  margin-right: 0.3rem;
}

@media (max-width: 820px) {
  .paper-grid { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 480px) {
  .findings { grid-template-columns: 1fr; }
  .findings li { display: flex; align-items: baseline; gap: 10px; }
  .findings span { margin-top: 0; }
  .findings b { white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  .chromatogram .trace { stroke-dashoffset: 0; }
}

/* Methods card, full width */
.bench .methods { grid-template-columns: repeat(2, 1fr); gap: 0.65rem 2rem; }
@media (max-width: 820px) { .bench .methods { grid-template-columns: 1fr; } }
