/* ============================================================
   PatientFlow content pages (case studies, guides).
   Same tokens as the lander (index.html :root). If a token changes
   there, change it here too. The lander keeps its own inline CSS;
   this file only serves the content pages.
   ============================================================ */

:root {
  --bg:            #F6F3F5;
  --surface:       #FCFAFB;
  --surface-sunk:  #EFE9EE;
  --edge:          rgba(91, 42, 69, 0.14);
  --edge-strong:   rgba(91, 42, 69, 0.22);
  --ink:           #1A1318;
  --ink-soft:      #463B44;
  --ink-mute:      #5E5560;
  --plum:          #5B2A45;
  --plum-deep:     #3D1A2E;
  --plum-darker:   #2C1220;
  --plum-tint:     rgba(91, 42, 69, 0.07);
  --plum-tint-2:   rgba(91, 42, 69, 0.12);
  --on-plum:       #FBF6F9;
  --on-plum-mute:  rgba(251, 246, 249, 0.74);
  --shadow:        0 1px 2px rgba(44, 18, 32, 0.04), 0 6px 8px rgba(44, 18, 32, 0.04);
  --display: "Cabinet Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --body:    "Switzer", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --wrap:    1080px;
  --measure: 68ch;
  --gutter:  clamp(16px, 5vw, 40px);
  --radius:  12px;
  --ease:    cubic-bezier(0.22, 1, 0.36, 1);
  --z-sticky: 50;
  --z-toast:  80;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
h1, h2, h3 {
  font-family: var(--display);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.025em;
  margin: 0;
  text-wrap: balance;
}
p { margin: 0; text-wrap: pretty; }
a { color: inherit; }
::selection { background: var(--plum); color: var(--on-plum); }
:focus-visible { outline: 2px solid var(--plum); outline-offset: 3px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding-inline: var(--gutter); }

/* ---- Signature mark ---- */
.mark { display: inline-flex; align-items: flex-end; gap: 3px; height: 18px; }
.mark span { width: 3px; background: var(--plum); border-radius: 2px; display: block; }
.mark span:nth-child(1) { height: 40%; }
.mark span:nth-child(2) { height: 72%; }
.mark span:nth-child(3) { height: 100%; }
.mark span:nth-child(4) { height: 60%; }
.mark span:nth-child(5) { height: 86%; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-family: var(--body); font-weight: 600; font-size: 1rem; line-height: 1;
  padding: 0.95rem 1.5rem; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform 200ms var(--ease), background 200ms var(--ease), border-color 200ms var(--ease);
}
.btn-primary { background: var(--plum); color: var(--on-plum); }
.btn-primary:hover { background: var(--plum-deep); transform: translateY(-2px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--edge-strong); }
.btn-ghost:hover { background: var(--plum-tint); border-color: var(--plum); transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .btn, .btn:hover { transition: none; transform: none; } }

/* ---- Nav ---- */
.nav {
  position: sticky; top: 0; z-index: var(--z-sticky);
  height: 64px; display: flex; align-items: center;
  background: rgba(246, 243, 245, 0.9);
  border-bottom: 1px solid var(--edge);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-family: var(--display); font-weight: 800; font-size: 1.2rem; letter-spacing: -0.02em;
  text-decoration: none; color: var(--ink);
}
.nav-links { display: flex; align-items: center; gap: 1.75rem; }
.nav-links a { font-size: 0.95rem; font-weight: 500; color: var(--ink-soft); text-decoration: none; }
.nav-links a:hover, .nav-links a[aria-current] { color: var(--plum); }
.nav .btn { padding: 0.62rem 1.05rem; font-size: 0.9rem; }
@media (max-width: 760px) { .nav-links { display: none; } }

/* ---- Article ---- */
.article { padding-block: clamp(36px, 6vw, 72px) clamp(48px, 7vw, 88px); }
.crumbs { font-size: 0.88rem; color: var(--ink-mute); margin-bottom: 1.6rem; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.crumbs li + li::before { content: "/"; margin-right: 0.4rem; opacity: 0.5; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--plum); }

.article h1 {
  font-size: clamp(2.1rem, 4.6vw, 3.4rem);
  max-width: 22ch;
  margin-bottom: 1.4rem;
}
.answer {
  font-size: clamp(1.14rem, 1.9vw, 1.32rem);
  line-height: 1.55;
  max-width: 62ch;
  color: var(--ink);
}
.answer strong { color: var(--plum); font-weight: 700; }
.byline {
  display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem;
  margin-top: 1.4rem; padding-bottom: 2rem;
  border-bottom: 1px solid var(--edge);
  font-size: 0.88rem; color: var(--ink-mute);
}

.prose { max-width: var(--measure); }
.prose > * + * { margin-top: 1.05rem; }
.prose h2 {
  font-size: clamp(1.5rem, 2.6vw, 1.95rem);
  margin-top: clamp(2.6rem, 5vw, 3.4rem);
  scroll-margin-top: 84px;
}
.prose h3 { font-size: 1.2rem; margin-top: 2rem; letter-spacing: -0.015em; }
.prose h2 + p, .prose h3 + p { margin-top: 0.8rem; }
.prose p, .prose li { color: var(--ink-soft); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li + li { margin-top: 0.45rem; }
.prose li::marker { color: var(--plum); }
.prose a { color: var(--plum); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose a:hover { text-decoration-thickness: 2px; }

/* Fact tables: the citable core of every page. */
.facts {
  width: 100%; border-collapse: collapse;
  font-size: 0.97rem; margin-top: 1.2rem;
  background: var(--surface); border: 1px solid var(--edge); border-radius: var(--radius);
  overflow: hidden;
}
.facts caption { text-align: left; font-weight: 600; color: var(--ink); padding: 0 0 0.6rem; font-size: 0.95rem; }
.facts th, .facts td { text-align: left; vertical-align: top; padding: 0.8rem 1rem; border-top: 1px solid var(--edge); }
.facts thead th { border-top: 0; background: var(--surface-sunk); font-weight: 600; color: var(--ink); font-size: 0.88rem; }
.facts tbody tr:first-child th, .facts tbody tr:first-child td { border-top: 0; }
.facts thead + tbody tr:first-child th, .facts thead + tbody tr:first-child td { border-top: 1px solid var(--edge); }
.facts td { color: var(--ink-soft); }
.facts th[scope="row"] { font-weight: 600; color: var(--ink); width: 42%; }
.facts .num { font-family: var(--display); font-weight: 800; font-size: 1.15rem; color: var(--plum); letter-spacing: -0.01em; white-space: nowrap; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 560px) {
  .facts th, .facts td { padding: 0.7rem 0.75rem; }
  .facts th[scope="row"] { width: 50%; }
}

.note {
  background: var(--plum-tint); border-radius: var(--radius);
  padding: 1rem 1.2rem; font-size: 0.95rem; color: var(--ink-soft);
}
.src { font-size: 0.86rem; color: var(--ink-mute); }
.sources { margin-top: 3rem; padding-top: 1.4rem; border-top: 1px solid var(--edge); }
.sources h2 { font-size: 1.1rem; margin: 0 0 0.8rem; }
.sources ol { font-size: 0.88rem; color: var(--ink-mute); padding-left: 1.2rem; }
.sources li + li { margin-top: 0.35rem; }
.sources a { color: var(--ink-soft); word-break: break-word; }

/* ---- Related + CTA ---- */
.related { margin-top: clamp(3rem, 6vw, 4.5rem); }
.related h2 { font-size: 1.2rem; margin-bottom: 0.9rem; }
.related ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--edge); }
.related li { border-bottom: 1px solid var(--edge); }
.related a {
  display: flex; justify-content: space-between; gap: 1rem; align-items: baseline;
  padding: 0.95rem 0; text-decoration: none; color: var(--ink); font-weight: 500;
}
.related a::after { content: "\2192"; color: var(--plum); transition: transform 200ms var(--ease); }
.related a:hover { color: var(--plum); }
.related a:hover::after { transform: translateX(4px); }

.cta {
  margin-top: clamp(3rem, 6vw, 4.5rem);
  background: var(--plum-deep); color: var(--on-plum);
  border-radius: var(--radius);
  padding: clamp(1.6rem, 4vw, 2.6rem);
  display: grid; gap: 1.2rem;
}
.cta h2 { font-size: clamp(1.45rem, 2.8vw, 2rem); color: var(--on-plum); max-width: 26ch; }
.cta p { color: var(--on-plum-mute); max-width: 56ch; }
.cta .btns { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.cta .btn-primary { background: var(--on-plum); color: var(--plum-deep); }
.cta .btn-primary:hover { background: #fff; }
.cta .btn-ghost { color: var(--on-plum); border-color: rgba(251, 246, 249, 0.34); }
.cta .btn-ghost:hover { background: rgba(251, 246, 249, 0.1); border-color: var(--on-plum); }

/* ---- Hub (guides index) ---- */
.hub-list { list-style: none; margin: 2rem 0 0; padding: 0; border-top: 1px solid var(--edge); max-width: 820px; }
.hub-list li { border-bottom: 1px solid var(--edge); }
.hub-list a { display: block; padding: 1.3rem 0; text-decoration: none; }
.hub-list strong { display: block; font-family: var(--display); font-weight: 800; font-size: clamp(1.2rem, 2.2vw, 1.45rem); letter-spacing: -0.02em; color: var(--ink); }
.hub-list span { display: block; margin-top: 0.35rem; color: var(--ink-soft); max-width: 70ch; }
.hub-list a:hover strong { color: var(--plum); }

/* ---- Footer ---- */
.foot { border-top: 1px solid var(--edge); padding-block: 40px; font-size: 0.9rem; color: var(--ink-mute); }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: space-between; }
.foot nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; }
.foot a, .foot button { color: var(--ink-mute); text-decoration: none; }
.foot a:hover, .foot button:hover { color: var(--plum); }
.linkish { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }

/* Wide comparison tables scroll sideways on phones rather than crushing columns. */
.table-scroll { margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }
.table-scroll .facts:has(thead) { min-width: 580px; }
.table-scroll .facts:has(thead th:nth-child(5)) { min-width: 860px; }
.table-scroll .facts:has(thead th:nth-child(4)):not(:has(thead th:nth-child(5))) { min-width: 680px; }
