/* Doc reading pages: GLP-1 brand guides, side-effect pages, comparisons.
   Approved redesign 2026-11-10. Loads after styles.css, v3.css and pages.css
   and uses their tokens (--page, --text-1/2/3, --hair, --outline, Field --accent).
   Markup: scripts/lib/doc-page.js. Behaviour: public/doc.js.
   No cards: structure is spacing, type size and hairlines. Fills only on controls. */

:root{
  --doc-placebo:#48484A;
  /* phone jump bar: it sticks --doc-toc-gap below the floating nav pill.
     --doc-nav-bottom is the pill's bottom edge; the fallback is the pill at
     393px (top 12px + 55px tall). doc.js replaces it with the measured value. */
  --doc-nav-bottom:calc(env(safe-area-inset-top, 0px) + 67px);
  --doc-toc-gap:8px;
  --doc-toc-h:46px;
  --doc-toc-top:calc(var(--doc-nav-bottom) + var(--doc-toc-gap));
}
@media (prefers-color-scheme: light){ :root:not([data-theme="dark"]){ --doc-placebo:#B7B7BD; } }
:root[data-theme="light"]{ --doc-placebo:#B7B7BD; }

.doc{ --doc-pad:20px; position:relative; z-index:1; max-width:1240px; margin:0 auto; padding:0 var(--doc-pad); color:var(--text-1); font-size:15px; line-height:1.5; }
.doc a{ text-decoration:none; }
.doc-body{ display:block; }

/* ---------- head ---------- */
.doc-head{ padding:104px 0 8px; }
.doc-crumb{ display:flex; flex-wrap:wrap; gap:4px 8px; font-family:var(--font-mono); font-size:11px; letter-spacing:.1em; text-transform:uppercase; color:var(--text-3); margin:0 0 14px; }
.doc-crumb a{ color:var(--text-3); } .doc-crumb a:hover{ color:var(--text-1); text-decoration:none; }
.doc-crumb span[aria-hidden]{ opacity:.6; }
.doc-head h1{ font-size:31px; font-weight:700; letter-spacing:-0.04em; line-height:1.06; margin:0; text-wrap:balance; }
.doc-meta{ font-size:14px; color:var(--text-2); margin:12px 0 0; }
.doc-answer{ margin:22px 0 0; font-size:18px; line-height:1.5; color:var(--text-1); max-width:62ch; text-wrap:pretty; }
.doc-rest{ margin:10px 0 0; font-size:15.5px; line-height:1.65; color:var(--text-2); max-width:66ch; }
.doc-label{ font-family:var(--font-mono); font-size:10.5px; letter-spacing:.1em; text-transform:uppercase; color:var(--text-3); margin:0 0 4px; }

/* at a glance: label left, value right */
.doc-glance{ margin:26px 0 0; max-width:640px; }
.doc-glance dl{ margin:0; }
.doc-glance .row{ display:flex; justify-content:space-between; align-items:baseline; gap:16px; padding:12px 0; border-top:1px solid var(--hair); font-size:15.5px; }
.doc-glance .row:first-child{ border-top:0; }
.doc-glance dt{ color:var(--text-2); flex:none; max-width:46%; }
.doc-glance dd{ margin:0; font-weight:600; text-align:right; font-variant-numeric:tabular-nums; min-width:0; text-wrap:balance; }

/* compare rows (vs pages) */
.doc-cmp{ margin:26px 0 0; max-width:720px; }
.doc-cmp .ch, .doc-cmp .cr{ display:grid; grid-template-columns:repeat(var(--n,2),minmax(0,1fr)); column-gap:18px; }
.doc-cmp .ch{ padding:0 0 8px; font-weight:700; font-size:14.5px; letter-spacing:-0.01em; }
.doc-cmp .cr{ padding:12px 0; border-top:1px solid var(--hair); font-size:15px; line-height:1.45; }
.doc-cmp .k{ grid-column:1 / -1; font-family:var(--font-mono); font-size:10.5px; letter-spacing:.1em; text-transform:uppercase; color:var(--text-3); margin:0 0 5px; }
.doc-cmp .v{ font-weight:600; min-width:0; }
.doc-cmp .v small{ display:block; font-weight:400; color:var(--text-2); font-size:13.5px; margin-top:2px; }
.doc-cmp .ch .hk{ display:none; }
.doc-cmp sup{ font-weight:600; }

/* the one quiet app line */
.doc-track{ display:inline-block; margin:22px 0 0; font-size:15px; font-weight:600; color:var(--accent) !important; }
.doc-track:hover{ text-decoration:underline !important; text-underline-offset:3px; }

/* ---------- on this page: sticky jump bar on phones ---------- */
/* full bleed: the negative margin matches .doc's side padding at every width */
.doc-toc{ position:sticky; top:var(--doc-toc-top); z-index:30; background:var(--page); margin:22px calc(-1 * var(--doc-pad)) 0; padding:0 var(--doc-pad); border-bottom:1px solid color-mix(in oklab, var(--text-1) 14%, transparent); }
.doc-toc .doc-label{ display:none; }
.doc-toc ol{ position:relative; list-style:none; margin:0; padding:0; display:flex; gap:20px; overflow-x:auto; scrollbar-width:none; }
.doc-toc ol::-webkit-scrollbar{ display:none; }
.doc-toc a{ display:block; padding:13px 0 11px; font-size:14px; font-weight:500; color:var(--text-2); white-space:nowrap; border-bottom:2px solid transparent; }
.doc-toc a:hover{ color:var(--text-1); text-decoration:none; }
.doc-toc a.on{ color:var(--text-1); border-bottom-color:var(--accent); }
@media (max-width:959.98px){
  /* solid page colour from the screen top down to the bar, behind the pill,
     once the bar is stuck (doc.js sets .is-stuck), so no text shows there */
  .doc-toc::before{ content:""; position:absolute; left:0; right:0; bottom:100%; height:calc(var(--doc-toc-top) + 2px); background:var(--page); pointer-events:none; opacity:0; transition:opacity .12s linear; }
  .doc-toc.is-stuck::before{ opacity:1; }
  .doc-toc ol{ gap:24px; scroll-padding-inline:var(--doc-pad); }
  /* soft fade on an edge that has more items behind it (doc.js sets the classes) */
  .doc-toc ol{ --fl:#000; --fr:#000; -webkit-mask-image:linear-gradient(90deg,var(--fl),#000 28px,#000 calc(100% - 32px),var(--fr)); mask-image:linear-gradient(90deg,var(--fl),#000 28px,#000 calc(100% - 32px),var(--fr)); }
  .doc-toc.has-less ol{ --fl:transparent; }
  .doc-toc.has-more ol{ --fr:transparent; }
  .doc-toc a{ display:flex; align-items:center; box-sizing:border-box; min-height:var(--doc-toc-h); padding:2px 0 0; font-size:15px; letter-spacing:-0.005em; color:color-mix(in oklab, var(--text-1) 76%, var(--page)); }
  .doc-toc a:hover{ color:var(--text-1); }
  .doc-toc a.on{ color:var(--accent); }
  /* a tapped section lands below the pill and the bar */
  .doc-main [id], .doc-sec h2, .doc-sec h3{ scroll-margin-top:calc(var(--doc-toc-top) + var(--doc-toc-h) + 18px); }
}

/* ---------- sections ---------- */
.doc-main{ padding-bottom:24px; min-width:0; }
.doc-sec{ padding:30px 0; border-top:1px solid var(--hair); }
.doc-main > .doc-sec:first-child{ border-top:0; }
.doc-sec h2{ font-size:22px; font-weight:700; letter-spacing:-0.03em; line-height:1.2; margin:0 0 12px; text-wrap:balance; }
.doc-sec h3{ font-size:17px; font-weight:650; letter-spacing:-0.015em; margin:22px 0 8px; }
.doc-sec p, .doc-sec li{ font-size:15.5px; line-height:1.65; color:var(--text-2); max-width:68ch; }
.doc-sec p{ margin:0 0 12px; }
.doc-sec b, .doc-sec strong{ color:var(--text-1); font-weight:600; }
.doc-sec .lead{ color:var(--text-1); font-size:16.5px; }
.doc-sec ul, .doc-sec ol{ margin:0 0 12px; padding-left:20px; }
.doc-sec ul li, .doc-sec ol li{ margin:0 0 8px; }
.doc-sec p a, .doc-sec li a, .doc-faq .faq-body a{ color:var(--accent); font-weight:500; }
.doc-sec p a:hover, .doc-sec li a:hover{ text-decoration:underline; text-underline-offset:3px; }
.doc sup.cite, .doc sup{ font-size:11px; line-height:0; margin-left:1px; }
.doc sup a{ color:var(--accent); font-weight:600; padding:0 1px; text-decoration:none !important; border:0 !important; }
.doc-src{ font-family:var(--font-mono); font-size:10.5px; letter-spacing:.08em; text-transform:uppercase; color:var(--text-3); margin-right:6px; }
.doc-sec p.doc-tracker{ margin:14px 0 0; }
.doc-fine{ font-size:13.5px !important; color:var(--text-3) !important; }
.doc-fine a{ color:var(--text-2) !important; font-weight:400 !important; }

/* tables: hairline rows, no fills */
.doc .chart-wrap{ overflow-x:auto; margin:6px 0 14px; -webkit-overflow-scrolling:touch; }
.doc table.chart{ border-collapse:collapse; width:100%; font-size:14.5px; font-variant-numeric:tabular-nums; }
.doc table.chart caption{ text-align:left; font-size:13px; color:var(--text-3); padding:0 0 8px; caption-side:top; line-height:1.45; }
.doc table.chart th, .doc table.chart td{ text-align:left; padding:10px 14px 10px 0; border-bottom:1px solid var(--hair); vertical-align:top; white-space:normal; }
.doc table.chart thead th{ font-family:var(--font-mono); font-size:10.5px; letter-spacing:.08em; text-transform:uppercase; color:var(--text-3); font-weight:500; }
.doc table.chart tbody th{ font-weight:600; color:var(--text-1); font-size:14.5px; }
.doc table.chart td{ color:var(--text-2); font-family:inherit; }
.doc table.chart td.key{ color:var(--text-1); font-weight:600; }
.doc .chart-wrap.wide table.chart{ min-width:640px; }
.doc table.vs-table th, .doc table.vs-table td{ min-width:150px; }

/* show more: a plain accent line with a hairline, nothing boxed */
details.doc-more{ margin:4px 0 0; }
details.doc-more > summary{ list-style:none; cursor:pointer; display:flex; align-items:center; gap:8px; padding:12px 0; font-size:15px; font-weight:600; color:var(--accent); border-top:1px solid var(--hair); }
details.doc-more > summary::-webkit-details-marker{ display:none; }
details.doc-more > summary::after{ content:""; width:7px; height:7px; border-right:1.6px solid currentColor; border-bottom:1.6px solid currentColor; rotate:45deg; translate:0 -2px; transition:rotate .15s; }
details.doc-more[open] > summary::after{ rotate:225deg; translate:0 2px; }
details.doc-more > summary .hd{ display:none; }
details.doc-more[open] > summary .sh{ display:none; }
details.doc-more[open] > summary .hd{ display:inline; }
details.doc-more .doc-more-in{ padding:6px 0 4px; }

/* paired bars (drug vs placebo), one scale */
.doc-bars{ margin:8px 0 10px; max-width:640px; }
.doc-bars .bl{ display:flex; flex-wrap:wrap; gap:4px 16px; font-family:var(--font-mono); font-size:10.5px !important; letter-spacing:.1em; text-transform:uppercase; color:var(--text-3) !important; margin:0 0 6px !important; }
.doc-bars .bl .a{ color:var(--accent); }
.doc-bars .br{ display:grid; grid-template-columns:minmax(0,1fr) auto; column-gap:14px; row-gap:6px; padding:11px 0; border-top:1px solid var(--hair); align-items:center; }
.doc-bars .br .n{ font-size:15px; color:var(--text-1); }
.doc-bars .br .p{ font-size:14.5px; font-weight:600; font-variant-numeric:tabular-nums; white-space:nowrap; text-align:right; }
.doc-bars .br .p span{ color:var(--text-3); font-weight:500; }
.doc-bars .br .viz{ grid-column:1 / -1; display:flex; flex-direction:column; gap:3px; }
.doc-bars .br .viz i{ display:block; height:6px; border-radius:3px; background:var(--accent); min-width:3px; }
.doc-bars .br .viz i.pl{ background:var(--doc-placebo); }

/* numbered findings with their label section */
.doc-finds{ list-style:none; margin:0 !important; padding:0 !important; }
.doc-finds li{ padding:12px 0; border-top:1px solid var(--hair); margin:0 !important; }
.doc-finds li:first-child{ border-top:0; }

/* FAQ: +/- rows */
.doc-faq .faq{ background:none; border:0; border-radius:0; padding:0; box-shadow:none; opacity:1; transform:none; border-top:1px solid var(--hair); cursor:auto; }
.doc-faq .faq:last-child{ border-bottom:1px solid var(--hair); }
.doc-faq .faq summary{ list-style:none; cursor:pointer; display:flex; justify-content:space-between; align-items:baseline; gap:16px; padding:15px 0; font-size:16px; font-weight:500; color:var(--text-1); line-height:1.4; letter-spacing:-0.01em; }
.doc-faq .faq summary::-webkit-details-marker{ display:none; }
.doc-faq .faq summary::after{ content:"+"; font-size:20px; font-weight:400; color:var(--text-3); line-height:1; flex:none; }
.doc-faq .faq[open] summary::after{ content:"\2212"; }
.doc-faq .faq summary:hover{ color:var(--accent); }
.doc-faq .faq-body{ padding:0 0 16px; font-size:15.5px; }
.doc-faq .faq-body p{ margin:0; }

/* related links: rows, two columns when there is room */
.doc-links{ list-style:none; margin:0 !important; padding:0 !important; display:grid; grid-template-columns:minmax(0,1fr); column-gap:40px; }
.doc-links li{ margin:0 !important; border-top:1px solid var(--hair); max-width:none !important; }
.doc-links a{ display:block; padding:12px 0; }
.doc-links a:hover{ text-decoration:none; }
.doc-links b{ display:block; font-size:15px; font-weight:600; color:var(--text-1); letter-spacing:-0.01em; }
.doc-links small{ display:block; font-size:13.5px; color:var(--text-3); margin-top:2px; }
.doc-links a:hover b{ color:var(--accent); }
.doc-sublab{ font-family:var(--font-mono); font-size:10.5px !important; letter-spacing:.1em; text-transform:uppercase; color:var(--text-3) !important; margin:22px 0 4px !important; }

/* sources */
.doc-sources ol{ margin:0 0 12px; padding-left:22px; }
.doc-sources li{ font-size:14px !important; line-height:1.55; margin:0 0 8px; color:var(--text-2); word-break:break-word; }
.doc-sources li a{ color:var(--text-2) !important; font-weight:400 !important; text-decoration:underline; text-decoration-color:var(--outline); text-underline-offset:3px; }

@media (min-width:700px){
  .doc-cmp .ch, .doc-cmp .cr{ grid-template-columns:150px repeat(var(--n,2),minmax(0,1fr)); }
  .doc-cmp .ch .hk{ display:block; visibility:hidden; }
  .doc-cmp .k{ grid-column:auto; margin:3px 0 0; }
  .doc-bars .br{ grid-template-columns:190px minmax(0,1fr) 108px; }
  .doc-bars .br .viz{ grid-column:2; grid-row:1; }
  .doc-bars .br .p{ grid-column:3; grid-row:1; }
  .doc-links{ grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (min-width:860px){
  .doc{ --doc-pad:40px; }
  .doc-head{ padding-top:150px; }
  .doc-head h1{ font-size:46px; }
  .doc-answer{ font-size:20px; }
  .doc-sec h2{ font-size:26px; }
}
/* rail + main on desktop */
@media (min-width:960px){
  .doc-body{ display:grid; grid-template-columns:184px minmax(0,720px); column-gap:72px; grid-template-areas:"rail head" "rail main"; justify-content:center; }
  .doc-head{ grid-area:head; }
  .doc-toc{ grid-area:rail; top:104px; align-self:start; margin:150px 0 0; padding:0; border:0; background:none; }
  .doc-toc .doc-label{ display:block; margin:0 0 10px; }
  .doc-toc ol{ flex-direction:column; gap:0; overflow:visible; }
  .doc-toc a{ padding:7px 0; border:0; white-space:normal; line-height:1.35; }
  .doc-toc a.on{ color:var(--accent); }
  .doc-main{ grid-area:main; }
  .doc-sec h2, .doc-sec h3{ scroll-margin-top:100px; }
}

/* ---------- flow pages: the older .page-hero + .section / .prose pages ----------
   scripts/lib/doc-layout.js wraps them in the same rail layout. Their own type
   and blocks stay as they were; only the frame changes: one centred column
   with the rail beside it, or the column alone when a page has under three
   sections (.no-toc). Tool pages keep the tool full width above (.no-top). */
.doc-flow{ --doc-pad:20px; position:relative; z-index:1; max-width:1240px; margin:0 auto; padding:0 var(--doc-pad); }
.doc-flow .container{ max-width:none; margin-left:0; margin-right:0; padding-left:0; padding-right:0; }
.doc-flow .prose{ max-width:none; }
.doc-flow .page-hero{ padding-bottom:28px; }
.doc-flow .doc-toc{ margin-top:0; }
.doc-flow .doc-toc + .doc-main{ padding-top:28px; }
.doc-flow .doc-main{ padding-bottom:0; }
@media (min-width:860px){
  .doc-flow{ --doc-pad:40px; }
}
@media (min-width:960px){
  .doc-flow .doc-top{ grid-area:head; min-width:0; }
  .doc-flow .page-hero{ padding-bottom:48px; }
  .doc-flow .doc-toc{ margin-top:140px; }
  .doc-flow .doc-toc + .doc-main{ padding-top:0; }
  .doc-flow.no-top .doc-body{ grid-template-areas:"rail main"; }
  .doc-flow.no-top .doc-toc{ margin-top:48px; }
  .doc-flow.no-toc .doc-body{ grid-template-columns:minmax(0,760px); grid-template-areas:"head" "main"; }
  .doc-flow .doc-main [id]{ scroll-margin-top:100px; }
}

/* wide desktop: the content column sits in the middle of the page, right
   under the nav pill, and the rail sits in the left margin beside it (it
   narrows a little before the layout falls back to the centred group above). */
@media (min-width:1180px){
  .doc, .doc-flow{ max-width:none; --doc-pad:24px; }
  .doc-body{ --doc-col:720px; --doc-rail-gap:48px; grid-template-columns:minmax(0,1fr) minmax(0,var(--doc-col)) minmax(0,1fr); column-gap:0; grid-template-areas:"rail head ." "rail main ."; }
  .doc-toc{ justify-self:end; width:min(184px, calc(100% - var(--doc-rail-gap))); margin-right:var(--doc-rail-gap); }
  .doc-flow.no-top .doc-body{ grid-template-areas:"rail main ."; }
  .doc-flow.no-toc .doc-body{ grid-template-columns:minmax(0,760px); grid-template-areas:"head" "main"; justify-content:center; }
}

@media print{
  .nav, .nav-drawer, .footer, .glow, .appbar2, .doc-toc, .doc-track, details.doc-more > summary{ display:none !important; }
  .doc-head{ padding-top:0; }
  .doc table.chart td, .doc table.chart th{ color:#000 !important; border-color:#999 !important; }
}
@media (prefers-reduced-motion: reduce){
  details.doc-more > summary::after, .doc-toc::before{ transition:none; }
}
