/* OPSIN knowledge base — long-form reference pages.
   Layered on top of style.css (.doc). Only add what the long-read needs. */

.doc.kb { max-width: 780px; }

.kb-meta {
  color: var(--ink-3);
  font-size: 12.5px;
  letter-spacing: .3px;
  text-transform: uppercase;
  margin: 0 0 6px;
}

/* ── Headings: give a 17,000-word document visible structure ───────────── */
.kb h1 { font-size: 34px; line-height: 1.18; margin: 6px 0 14px; }
.kb h2 {
  font-size: 23px;
  line-height: 1.25;
  margin: 46px 0 12px;
  padding-top: 18px;
  border-top: 2px solid #f0e3c8;
  scroll-margin-top: 16px;
}
.kb h3 {
  font-size: 17.5px;
  line-height: 1.35;
  margin: 30px 0 8px;
  color: var(--accent-deep);
  scroll-margin-top: 16px;
}
.kb h1 + p em, .kb h1 + p { color: var(--ink-2); }

.kb .anchor {
  text-decoration: none;
  color: var(--ink-3);
  font-weight: 400;
  opacity: 0;
  margin-left: 8px;
  transition: opacity .15s;
}
.kb h2:hover .anchor, .kb h3:hover .anchor,
.kb .anchor:focus { opacity: 1; }

.kb p { margin: 0 0 15px; line-height: 1.68; font-size: 16px; }
.kb li { line-height: 1.6; margin-bottom: 6px; }
.kb hr { border: 0; border-top: 1px solid #eceef2; margin: 34px 0; }

/* ── Contents ──────────────────────────────────────────────────────────── */
.toc {
  background: #fffdf8;
  border: 1px solid #f0e3c8;
  border-radius: 14px;
  padding: 18px 22px 20px;
  margin: 26px 0 34px;
}
.toc h2 {
  font-size: 13px !important;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--ink-2);
  margin: 0 0 10px !important;
  padding-top: 0 !important;
  border-top: 0 !important;
}
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc > ol > li { margin: 0 0 7px; padding: 0; }
.toc > ol > li > a { font-weight: 650; font-size: 14.5px; }
.toc ol ol { margin: 4px 0 10px; padding-left: 14px; }
.toc ol ol li { margin: 0 0 3px; }
.toc ol ol a { font-size: 13px; color: var(--ink-2); font-weight: 400; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }
@media (min-width: 700px) {
  .toc ol ol { columns: 2; column-gap: 26px; }
  .toc ol ol li { break-inside: avoid; }
}

/* ── Citation chips ────────────────────────────────────────────────────── */
.kb .cite {
  display: inline;
  font-size: 11.5px;
  line-height: 1;
  vertical-align: 1.5px;
  white-space: nowrap;
  color: var(--ink-2);
  background: #f2f4f7;
  border-radius: 5px;
  padding: 2px 6px;
  margin: 0 1px 0 4px;
  text-decoration: none;
  border: 1px solid #e6e9ee;
}
.kb .cite:hover { background: #fff3dd; color: var(--accent-deep); border-color: #f3ddb0; }
/* Sources we want the reader to discount: general-audience or commercial pages. */
.kb .cite-weak {
  background: #fdf3f1;
  border-color: #f3d5cf;
  color: #9a4c3c;
  border-style: dashed;
}
/* Sources with a declared position in the debate they're cited in. */
.kb .cite-flag { background: #f4f2fb; border-color: #ddd8f0; color: #4b4a8f; }

/* ── Tables: wide reference tables must survive a phone ────────────────── */
.kb .tw {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 20px 0 24px;
  border: 1px solid #eceef2;
  border-radius: 12px;
  background: #fff;
  /* The min-width on the table below must never escape and widen the page. */
  max-width: 100%;
  min-width: 0;
}
/* Nothing in a long-read should be able to force a horizontal scrollbar. */
.doc.kb { overflow-wrap: break-word; }
.kb .tw:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kb table { border-collapse: collapse; width: 100%; min-width: 540px; font-size: 14px; }
.kb th, .kb td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid #f0f2f6;
  vertical-align: top;
  line-height: 1.5;
}
.kb thead th {
  background: #faf7f1;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--ink-2);
  border-bottom: 1px solid #eceef2;
}
.kb tbody tr:last-child td { border-bottom: 0; }
.kb td .cite { margin-left: 2px; }

/* ── Figures ───────────────────────────────────────────────────────────── */
.kb figure { margin: 26px 0 28px; }
.kb figure img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid #eceef2;
  border-radius: 12px;
  background: #fff;
}
.kb figcaption {
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 9px;
  text-align: center;
}

/* ── Editorial notes ───────────────────────────────────────────────────── */
.kb blockquote.note {
  margin: 22px 0;
  padding: 15px 18px;
  background: #fff8ec;
  border: 1px solid #f3ddb0;
  border-left: 4px solid var(--accent);
  border-radius: 12px;
}
.kb blockquote.note p { margin: 0; font-size: 15px; }

/* ── Print / PDF: people will save this one ────────────────────────────── */
@media print {
  .doc-nav, .toc, .kb .anchor, .kb footer { display: none; }
  .doc.kb { max-width: none; padding: 0; }
  body { background: #fff; }
  .kb h2 { page-break-after: avoid; }
  .kb figure, .kb .tw, .kb blockquote.note { page-break-inside: avoid; }
  .kb .cite { border: 0; background: none; padding: 0; color: #555; }
  .kb .cite::after { content: " (" attr(href) ")"; font-size: 9px; word-break: break-all; }
}
