/* ==========================================================================
   plantbiomethods.com — design system
   Sibling of the-opinions.com: same editorial care, built for the bench.
   ========================================================================== */

:root {
  --paper: #F8F7F3;
  --card: #FFFFFF;
  --sage: #EAF0EB;
  --ink: #1F2A24;
  --ink-2: #4B5563;
  --muted: #6B7280;
  --rule: #DED9CE;
  --forest: #2D6A4F;
  --forest-dark: #1B4332;
  --moss: #52796F;
  --amber: #B45309;
  --amber-bg: #FEF3E2;
  --red: #B91C1C;
  --red-bg: #FDECEC;
  --blue: #1D4ED8;
  --blue-bg: #EAF0FD;

  --serif-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --serif: 'Source Serif 4', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --wrap: 1120px;
  --measure: 720px;
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.7;
}
img, svg { max-width: 100%; }
a { color: var(--forest); text-underline-offset: 2px; }
a:hover { color: var(--forest-dark); }
:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1.25rem; }
.measure { max-width: var(--measure); }

/* ---------- Draft banner ---------- */
.draft-banner {
  background: var(--amber-bg);
  color: #7C2D12;
  font-family: var(--sans);
  font-size: 0.8rem;
  text-align: center;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #F5D9B5;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(248, 247, 243, 0.94);
  backdrop-filter: saturate(140%) blur(6px);
  border-bottom: 1px solid var(--rule);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand {
  display: flex; align-items: center; gap: 0.55rem;
  font-family: var(--serif-display); font-weight: 700; font-size: 1.2rem;
  color: var(--ink); text-decoration: none; letter-spacing: -0.01em;
}
.brand img { width: 28px; height: 28px; }
.nav { display: flex; gap: 1.5rem; list-style: none; margin: 0; padding: 0; }
.nav a {
  font-family: var(--sans); font-size: 0.82rem; font-weight: 600; letter-spacing: 0.04em;
  color: var(--ink-2); text-decoration: none; padding: 0.3rem 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--forest); border-bottom-color: var(--forest); }
.nav-toggle { display: none; background: none; border: 1px solid var(--rule); border-radius: var(--radius); padding: 0.35rem 0.6rem; font-size: 1rem; color: var(--ink); }
@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; gap: 0; background: var(--paper); border-bottom: 1px solid var(--rule); padding: 0.5rem 1.25rem 1rem; }
  .nav.open { display: flex; }
  .nav a { display: block; padding: 0.7rem 0; border-bottom: 1px solid var(--rule); }
}

/* ---------- Type ---------- */
h1, h2, h3, h4 { font-family: var(--serif-display); color: var(--ink); line-height: 1.18; letter-spacing: -0.012em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; margin: 0 0 0.75rem; }
h2 { font-size: clamp(1.45rem, 3vw, 1.85rem); font-weight: 650; margin: 2.75rem 0 0.9rem; }
h3 { font-size: 1.2rem; font-weight: 650; margin: 1.8rem 0 0.6rem; }
p { margin: 0 0 1.1rem; }
.eyebrow {
  font-family: var(--sans); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--forest); margin: 0 0 0.75rem;
}
.lede { font-size: 1.2rem; line-height: 1.6; color: var(--ink-2); }
.small { font-family: var(--sans); font-size: 0.82rem; color: var(--muted); }
code, .mono { font-family: var(--mono); font-size: 0.9em; }

/* ---------- Area tags ---------- */
.tag {
  display: inline-block; font-family: var(--sans); font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; padding: 0.22rem 0.55rem; border-radius: 3px;
  color: #fff; background: var(--forest);
}
.tag-nucleic { background: #2D6A4F; }
.tag-transformation { background: #7C3AED; }
.tag-editing { background: #1D4ED8; }
.tag-mutagenesis { background: #B45309; }
.tag-imaging { background: #0F766E; }

/* ---------- Homepage ---------- */
.hero { padding: 4.5rem 0 3.5rem; border-bottom: 1px solid var(--rule); background:
  linear-gradient(var(--paper), var(--paper)) padding-box,
  repeating-linear-gradient(0deg, transparent 0 27px, rgba(45,106,79,0.05) 27px 28px); }
.hero .wrap { display: grid; grid-template-columns: 1.25fr 1fr; gap: 3rem; align-items: end; }
.hero h1 { font-size: clamp(2.3rem, 6vw, 3.6rem); }
.hero-facts { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.hero-facts li { display: flex; gap: 1rem; padding: 0.85rem 0; border-bottom: 1px solid var(--rule); font-family: var(--sans); font-size: 0.92rem; color: var(--ink-2); }
.hero-facts b { font-family: var(--serif-display); font-size: 1.5rem; color: var(--forest); min-width: 2.2rem; line-height: 1.1; }
@media (max-width: 860px) { .hero .wrap { grid-template-columns: 1fr; gap: 2rem; } .hero { padding: 3rem 0 2.5rem; } }

.section { padding: 3.5rem 0; }
.section + .section { border-top: 1px solid var(--rule); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.section-head a { font-family: var(--sans); font-size: 0.88rem; font-weight: 600; }

.areas { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; }
.area {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 1.15rem 1.1rem 1.25rem; border-top: 4px solid var(--area, var(--forest));
  text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 0.4rem;
  transition: transform .15s ease, box-shadow .15s ease;
}
.area:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(31,42,36,.07); color: inherit; }
.area h3 { margin: 0; font-size: 1.05rem; }
.area p { margin: 0; font-family: var(--sans); font-size: 0.85rem; line-height: 1.5; color: var(--ink-2); }
.area .count { margin-top: auto; padding-top: 0.6rem; font-family: var(--sans); font-size: 0.75rem; font-weight: 700; color: var(--area, var(--forest)); }
@media (max-width: 1000px) { .areas { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .areas { grid-template-columns: 1fr; } }

.principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem 2rem; }
.principles div h3 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.principles div p { margin: 0; font-size: 0.98rem; color: var(--ink-2); }
@media (max-width: 860px) { .principles { grid-template-columns: 1fr; } }

/* ---------- Protocol cards / index ---------- */
.protocol-list { display: grid; gap: 1rem; }
.protocol-card {
  display: grid; grid-template-columns: 1fr auto; gap: 0.4rem 1.5rem; align-items: start;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 1.25rem 1.35rem; text-decoration: none; color: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.protocol-card:hover { border-color: var(--forest); box-shadow: 0 6px 18px rgba(31,42,36,.06); color: inherit; }
.protocol-card h3 { margin: 0.45rem 0 0.25rem; font-size: 1.25rem; }
.protocol-card p { margin: 0; font-size: 0.98rem; color: var(--ink-2); }
.protocol-card .facts { font-family: var(--sans); font-size: 0.8rem; color: var(--muted); text-align: right; white-space: nowrap; line-height: 1.7; }
.protocol-card.is-hidden { display: none; }
@media (max-width: 640px) { .protocol-card { grid-template-columns: 1fr; } .protocol-card .facts { text-align: left; } }

.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1.5rem; }
.filters button {
  font-family: var(--sans); font-size: 0.8rem; font-weight: 600; padding: 0.42rem 0.8rem;
  border: 1px solid var(--rule); background: var(--card); color: var(--ink-2); border-radius: 999px; cursor: pointer;
}
.filters button[aria-pressed="true"] { background: var(--forest); border-color: var(--forest); color: #fff; }
.empty-area { font-family: var(--sans); font-size: 0.9rem; color: var(--muted); padding: 1rem 0; }

/* ---------- Page header ---------- */
.page-head { padding: 3rem 0 2rem; border-bottom: 2px solid var(--ink); }
.page-head p.lede { margin: 0; max-width: 46rem; }

/* ---------- Protocol page ---------- */
.protocol-head { padding: 2.75rem 0 2rem; border-bottom: 1px solid var(--rule); }
.protocol-head h1 { max-width: 52rem; margin-top: 0.8rem; }
.protocol-head .lede { max-width: 46rem; margin-bottom: 1.25rem; }
.meta-strip { font-family: var(--sans); font-size: 0.82rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; }
.tools { display: flex; gap: 0.6rem; margin-top: 1.25rem; flex-wrap: wrap; }
.btn {
  font-family: var(--sans); font-size: 0.82rem; font-weight: 600; padding: 0.5rem 0.85rem;
  border: 1px solid var(--rule); background: var(--card); color: var(--ink); border-radius: var(--radius);
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn:hover { border-color: var(--forest); color: var(--forest); }

.glance { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 2rem 0 0; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.glance div { padding: 0.9rem 1rem; border-right: 1px solid var(--rule); }
.glance div:last-child { border-right: none; }
.glance dt { font-family: var(--sans); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.25rem; }
.glance dd { margin: 0; font-family: var(--sans); font-size: 0.95rem; font-weight: 600; color: var(--ink); line-height: 1.35; }
@media (max-width: 760px) { .glance { grid-template-columns: repeat(2, 1fr); } .glance div:nth-child(2) { border-right: none; } .glance div:nth-child(-n+2) { border-bottom: 1px solid var(--rule); } }

.protocol-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 3rem; padding: 2.5rem 0 4rem; }
.toc { position: sticky; top: 84px; align-self: start; font-family: var(--sans); font-size: 0.85rem; }
.toc p { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.6rem; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--rule); }
.toc a { display: block; padding: 0.3rem 0 0.3rem 0.85rem; margin-left: -2px; border-left: 2px solid transparent; color: var(--ink-2); text-decoration: none; line-height: 1.4; }
.toc a:hover, .toc a.is-current { color: var(--forest); border-left-color: var(--forest); }
@media (max-width: 900px) { .protocol-layout { grid-template-columns: 1fr; gap: 0; } .toc { display: none; } }

.protocol-body { max-width: var(--measure); }
.protocol-body > h2:first-child { margin-top: 0; }

/* Callouts */
.callout { border-radius: var(--radius); padding: 0.9rem 1.1rem; margin: 1.25rem 0; font-size: 0.98rem; border-left: 4px solid; }
.callout > :last-child { margin-bottom: 0; }
.callout .label { display: block; font-family: var(--sans); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 0.3rem; }
.callout.safety { background: var(--red-bg); border-color: var(--red); }
.callout.safety .label { color: var(--red); }
.callout.critical { background: var(--amber-bg); border-color: var(--amber); }
.callout.critical .label { color: var(--amber); }
.callout.note { background: var(--blue-bg); border-color: var(--blue); }
.callout.note .label { color: var(--blue); }
.callout.principle { background: var(--sage); border-color: var(--forest); }
.callout.principle .label { color: var(--forest); }

/* Tables (materials, recipes, troubleshooting) */
.table-wrap { overflow-x: auto; margin: 1rem 0 1.5rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 0.88rem; line-height: 1.5; }
th { text-align: left; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); background: #FBFAF7; padding: 0.7rem 0.85rem; border-bottom: 1px solid var(--rule); }
td { padding: 0.65rem 0.85rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
tr:last-child td { border-bottom: none; }
td.num, .q { font-family: var(--mono); font-size: 0.85rem; white-space: nowrap; }

/* Steps */
ol.steps { list-style: none; counter-reset: step; margin: 1rem 0 1.5rem; padding: 0; }
ol.steps > li {
  counter-increment: step; position: relative; padding: 0.15rem 0 1.1rem 3.1rem; margin: 0;
  border-left: 1px dashed var(--rule); margin-left: 0.95rem;
}
ol.steps > li:last-child { border-left-color: transparent; }
ol.steps > li::before {
  content: counter(step); position: absolute; left: -0.95rem; top: 0;
  width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--card); border: 2px solid var(--forest);
  color: var(--forest); font-family: var(--sans); font-size: 0.82rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
ol.steps > li.is-done::before { content: '\2713'; background: var(--forest); color: #fff; }
ol.steps > li.is-done > .step-text { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(45,106,79,.45); }
.step-check {
  position: absolute; left: 1.5rem; top: 0.2rem; width: 1.15rem; height: 1.15rem; margin: 0; cursor: pointer; accent-color: var(--forest);
}
.step-text { display: block; }
.step-tag { display: inline-block; font-family: var(--sans); font-size: 0.66rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 0.1rem 0.4rem; border-radius: 3px; margin-right: 0.35rem; vertical-align: 0.1em; }
.step-tag.critical { background: var(--amber-bg); color: var(--amber); }
.step-tag.pause { background: var(--blue-bg); color: var(--blue); }
.step-tag.timing { background: var(--sage); color: var(--forest); }
.step-sub { display: block; margin-top: 0.35rem; font-family: var(--sans); font-size: 0.86rem; line-height: 1.55; color: var(--ink-2); }
.steps-reset { font-family: var(--sans); font-size: 0.8rem; }

/* Glossary */
.term { border-bottom: 1px dashed var(--forest); cursor: help; }
.tip {
  position: fixed; z-index: 100; max-width: 300px; background: var(--forest-dark); color: #F0F5F1;
  font-family: var(--sans); font-size: 0.82rem; line-height: 1.5; padding: 0.6rem 0.8rem; border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.18); pointer-events: none; opacity: 0; transition: opacity .12s ease;
}
.tip.is-visible { opacity: 1; }

/* References */
ol.refs { padding-left: 1.2rem; font-family: var(--sans); font-size: 0.88rem; line-height: 1.6; color: var(--ink-2); }
ol.refs li { margin-bottom: 0.55rem; }
.cite-box { font-family: var(--sans); font-size: 0.85rem; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 0.9rem 1rem; color: var(--ink-2); }
.changelog { font-family: var(--sans); font-size: 0.85rem; color: var(--ink-2); }

/* ---------- Footer ---------- */
.site-footer { background: var(--forest-dark); color: #C9D8CE; padding: 2.5rem 0 2rem; font-family: var(--sans); font-size: 0.85rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 1.5rem 2rem; flex-wrap: wrap; }
.site-footer .name { font-family: var(--serif-display); font-weight: 700; font-size: 1.1rem; color: #fff; }
.site-footer p { margin: 0.4rem 0 0; max-width: 380px; line-height: 1.55; }
.site-footer nav { display: flex; gap: 0.5rem 1.4rem; flex-wrap: wrap; }
.site-footer a { color: #C9D8CE; text-decoration: none; }
.site-footer a:hover { color: #fff; }
.site-footer .copy { flex-basis: 100%; border-top: 1px solid rgba(255,255,255,.1); padding-top: 1.1rem; margin-top: 0.5rem; font-size: 0.78rem; }

/* ---------- Print: bench copy ---------- */
@media print {
  body { background: #fff; font-size: 10.5pt; line-height: 1.45; }
  .topbar, .draft-banner, .tools, .toc, .site-footer, .step-check, .steps-reset, .no-print { display: none !important; }
  .protocol-layout { display: block; padding: 0; }
  .protocol-head { padding: 0 0 0.6rem; }
  h1 { font-size: 20pt; } h2 { font-size: 13pt; margin-top: 1.1rem; page-break-after: avoid; }
  .glance { margin-top: 0.6rem; }
  ol.steps > li { page-break-inside: avoid; padding-bottom: 0.55rem; }
  ol.steps > li::before { border-color: #000; color: #000; }
  .callout, .table-wrap { page-break-inside: avoid; }
  a { color: #000; text-decoration: none; }
  .term { border-bottom: none; }
}
