/* Medtech 2026 - editorial primer, book-like */
:root{
  --ink: #0a0a0a;
  --ink-2: #2a2a2a;
  --muted: #6b6b6b;
  --rule: #d9d9d9;
  --rule-soft: #ececec;
  --paper: #fdfdfb;
  --paper-2: #f6f4ef;
  --accent: #144e8c; /* muted clinical blue */
  --accent-2: #7a2226; /* clinical crimson */
  --serif: "Source Serif 4", "Crimson Pro", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --measure: 68ch;
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin:0;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a{ color: var(--ink); text-decoration: none; border-bottom: 1px solid rgba(10,10,10,0.25); transition: border-color .15s ease; }
a:hover{ border-bottom-color: var(--ink); }

sup a{ border: none; color: var(--accent); font-family: var(--sans); font-size: 10px; font-weight: 500; padding-left: 2px; }

/* Layout: sticky left rail + prose column */
.wrap{
  display: grid;
  grid-template-columns: 240px minmax(0,1fr);
  gap: 40px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 32px;
}

aside.rail{
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  padding: 40px 0 40px;
  font-family: var(--sans);
  font-size: 13px;
  border-right: 1px solid var(--rule-soft);
}

.brand{
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.brand small{ display:block; font-family: var(--sans); font-size: 11px; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; margin-top: 2px; }

.rail h6{
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 28px 0 10px;
  font-weight: 600;
}

.rail ol{ list-style: none; padding: 0; margin: 0; counter-reset: idx; }
.rail ol li{ margin: 6px 0; counter-increment: idx; display: flex; gap: 10px; }
.rail ol li::before{
  content: counter(idx, decimal-leading-zero);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  flex: 0 0 24px;
  padding-top: 2px;
}
.rail ol li a{ border: none; color: var(--ink-2); line-height: 1.35; }
.rail ol li a:hover{ color: var(--ink); }
.rail ol li a.active{ color: var(--ink); font-weight: 600; }

main{
  padding: 60px 0 120px;
  max-width: var(--measure);
}

h1.title{
  font-size: 68px;
  line-height: 1.02;
  letter-spacing: -0.02em;
  font-weight: 400;
  margin: 20px 0 8px;
}
.byline{
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-bottom: 40px;
}
.byline a{ border: none; color: var(--accent); }

h2{
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: -0.015em;
  font-weight: 400;
  margin: 80px 0 8px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}
h2 .num{ display:block; font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; margin-bottom: 12px; }
h3{
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.005em;
  font-weight: 600;
  margin: 44px 0 10px;
}
h4{
  font-size: 17px;
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 28px 0 8px;
  color: var(--ink);
}
p{ margin: 0 0 18px; }
p.lede{ font-size: 22px; line-height: 1.5; color: var(--ink-2); margin-bottom: 32px; }
.dropcap::first-letter{
  font-size: 74px;
  float: left;
  line-height: 0.85;
  padding: 6px 10px 0 0;
  font-weight: 400;
}

ul, ol{ padding-left: 20px; margin: 0 0 20px; }
ul li, ol li{ margin: 4px 0; }

blockquote{
  border-left: 2px solid var(--ink);
  margin: 24px 0;
  padding: 4px 18px;
  font-style: italic;
  color: var(--ink-2);
}

/* Callouts */
.callout{
  border: 1px solid var(--rule);
  background: var(--paper-2);
  padding: 20px 22px;
  margin: 28px 0;
  border-radius: 2px;
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.55;
}
.callout .label{ font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin-bottom: 6px; }
.callout h5{ font-family: var(--serif); font-size: 18px; margin: 0 0 8px; font-weight: 600; }

/* Frameworks / stat blocks */
.stat-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0;
  margin: 32px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.stat{
  padding: 20px 16px;
  border-right: 1px solid var(--rule-soft);
  font-family: var(--sans);
}
.stat:last-child{ border-right: none; }
.stat .num{ font-family: var(--serif); font-size: 34px; font-weight: 400; line-height: 1; letter-spacing: -0.01em; color: var(--ink); }
.stat .lbl{ font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }

/* Tables */
table{ width: 100%; border-collapse: collapse; margin: 24px 0; font-family: var(--sans); font-size: 14px; }
th, td{ text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
th{ font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--rule); }
tbody tr:hover{ background: var(--paper-2); }
td.num, th.num{ text-align: right; font-variant-numeric: tabular-nums; }

/* Charts */
.chart-block{
  margin: 36px 0;
  padding: 24px;
  background: var(--paper-2);
  border: 1px solid var(--rule-soft);
  border-radius: 2px;
}
.chart-block .caption{ font-family: var(--sans); font-size: 12px; color: var(--muted); margin-top: 10px; letter-spacing: 0.02em; }
.chart-block .title{ font-family: var(--sans); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink); margin-bottom: 14px; font-weight: 600; }
.chart-holder{ position: relative; height: 320px; }
.chart-holder.tall{ height: 420px; }

/* Equations */
.eq{
  font-family: var(--mono);
  font-size: 15px;
  background: var(--paper-2);
  padding: 16px 18px;
  border-left: 3px solid var(--accent);
  margin: 20px 0;
  overflow-x: auto;
}

/* Small caps section header */
.section-lead{
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 60px 0 -6px;
}

/* In this chapter box */
.in-chapter{
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  padding: 22px 0 24px;
  margin: 28px 0 36px;
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.55;
}
.in-chapter h6{ font-family: var(--sans); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; margin: 0 0 12px; color: var(--muted); font-weight: 600; }
.in-chapter ul{ list-style: none; padding: 0; margin: 0; }
.in-chapter ul li{ padding-left: 16px; position: relative; margin: 5px 0; }
.in-chapter ul li::before{ content: "→"; position: absolute; left: 0; color: var(--accent); }

/* Footnotes */
.footnotes{
  border-top: 1px solid var(--rule);
  margin-top: 100px;
  padding-top: 32px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-2);
}
.footnotes h3{ font-family: var(--sans); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 20px; }
.footnotes ol{ padding-left: 28px; }
.footnotes ol li{ margin: 8px 0; line-height: 1.5; }
.footnotes a{ border: none; color: var(--accent); word-break: break-word; }

footer.colophon{
  margin-top: 80px;
  padding-top: 32px;
  border-top: 1px solid var(--rule-soft);
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* Cover-ish header */
.cover{
  padding: 60px 0 20px;
}
.cover .kicker{
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
  font-weight: 600;
}

/* Diagram */
.diagram{
  margin: 32px 0;
  padding: 28px;
  border: 1px solid var(--rule);
  background: white;
  font-family: var(--sans);
  font-size: 13px;
}

/* Responsive */
html, body{ overflow-x: hidden; }
h1.title{ word-break: break-word; overflow-wrap: anywhere; hyphens: auto; }

@media (max-width: 900px){
  .wrap{ grid-template-columns: 1fr; padding: 0 20px; gap: 24px; }
  aside.rail{ position: relative; height: auto; border-right: none; border-bottom: 1px solid var(--rule-soft); padding: 24px 0; }
  aside.rail ol{ padding-right: 8px; }
  aside.rail ol li a{ white-space: normal; }
  main{ padding: 20px 0 80px; }
  h1.title{ font-size: 44px; line-height: 1.02; }
  h2{ font-size: 28px; }
  h3{ font-size: 20px; }
  body{ font-size: 17px; }
  .drop-cap::first-letter{ font-size: 56px; }
  .stat-grid{ grid-template-columns: repeat(2,1fr); }
  .chart-block{ padding: 16px 12px; }
  table{ font-size: 13px; }
  th, td{ padding: 6px 6px; }
}

@media (max-width: 480px){
  .wrap{ padding: 0 16px; }
  h1.title{ font-size: 34px; }
  h2{ font-size: 24px; }
  body{ font-size: 16.5px; }
  p.lede{ font-size: 19px; }
  .stat .num{ font-size: 28px; }
  .drop-cap::first-letter{ font-size: 46px; }
}
