/* ==========================================================================
   Across Protocol — encyclopedic article styles
   Clean white, Wikipedia-like reading layout with a sticky left contents panel
   ========================================================================== */

:root {
  --text: #202122;
  --link: #3366cc;
  --link-visited: #3366cc;
  --rule: #c8ccd1;
  --rule-soft: #eaecf0;
  --infobox-head: #cfe2f3;
  --infobox-bg: #f8f9fa;
  --sidebar-bg: #ffffff;
  --max-width: 1200px;
  --content-font: Georgia, "Times New Roman", Times, serif;
  --ui-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: #ffffff;
  color: var(--text);
  font-family: var(--content-font);
  font-size: 16px;
  line-height: 1.6;
}

/* ---------- Top masthead ---------- */
.masthead {
  border-bottom: 1px solid var(--rule);
  padding: 14px 24px;
}
.masthead .wordmark {
  font-family: var(--ui-font);
  font-size: 18px;
  font-weight: 600;
}

/* ---------- Page shell: sidebar + article ---------- */
.layout {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 32px;
  padding: 24px;
}

/* ---------- Sticky table of contents ---------- */
.toc {
  position: sticky;
  top: 16px;
  align-self: start;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  font-family: var(--ui-font);
  font-size: 13.5px;
  line-height: 1.5;
  border: 1px solid var(--rule-soft);
  background: var(--sidebar-bg);
  padding: 14px 16px;
}
.toc__title {
  font-weight: 700;
  font-size: 15px;
  margin: 0 0 10px;
}
.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc;
}
.toc > ol { counter-reset: section; }
.toc li { margin: 4px 0; }
.toc a {
  color: var(--link);
  text-decoration: none;
}
.toc a:hover { text-decoration: underline; }
.toc ol ol { margin-left: 14px; }

/* numbered like an encyclopedia contents list */
.toc > ol > li { counter-increment: section; }
.toc > ol > li > a::before {
  content: counter(section) ". ";
}
.toc > ol > li > ol { counter-reset: sub; }
.toc > ol > li > ol > li { counter-increment: sub; }
.toc > ol > li > ol > li > a::before {
  content: counter(section) "." counter(sub) " ";
}

/* ---------- Article column ---------- */
.article { min-width: 0; }
.article__title {
  font-size: 30px;
  font-weight: 400;
  line-height: 1.25;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}
.article h2 {
  font-size: 23px;
  font-weight: 400;
  margin: 28px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
}
.article h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 22px 0 8px;
}
.article p { margin: 0 0 14px; }
.article a { color: var(--link); text-decoration: none; }
.article a:hover { text-decoration: underline; }

.lead { /* opening summary paragraph block */ }

/* ---------- Infobox (top-right) ---------- */
.infobox {
  float: right;
  width: 300px;
  margin: 4px 0 18px 24px;
  border: 1px solid var(--rule);
  background: var(--infobox-bg);
  font-family: var(--ui-font);
  font-size: 13.5px;
  line-height: 1.45;
}
.infobox caption,
.infobox__head {
  background: var(--infobox-head);
  font-weight: 700;
  text-align: center;
  padding: 8px;
  border-bottom: 1px solid var(--rule);
}
.infobox table { width: 100%; border-collapse: collapse; }
.infobox th,
.infobox td {
  text-align: left;
  vertical-align: top;
  padding: 7px 9px;
  border-top: 1px solid var(--rule-soft);
}
.infobox th { width: 38%; font-weight: 700; }

/* ---------- 404 ---------- */
.notfound {
  max-width: 640px;
  margin: 80px auto;
  padding: 0 24px;
  text-align: center;
}

/* ---------- Responsive: stack TOC above content ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .toc {
    position: static;
    max-height: none;
  }
  .infobox { float: none; width: 100%; margin: 0 0 18px; }
}
