html {
  color: #1a1a1a;
  background-color: #fdfdfd;
}
body {
  margin: 0 auto;
  max-width: 36em;
  padding-left: 50px;
  padding-right: 50px;
  padding-top: 50px;
  padding-bottom: 50px;
  hyphens: auto;
  overflow-wrap: break-word;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
}
@media (max-width: 600px) {
  body {
    font-size: 0.9em;
    padding: 12px;
  }
  h1 {
    font-size: 1.8em;
  }
}
@media print {
  html {
    background-color: white;
  }
  body {
    background-color: transparent;
    color: black;
    font-size: 12pt;
  }
  p, h2, h3 {
    orphans: 3;
    widows: 3;
  }
  h2, h3, h4 {
    page-break-after: avoid;
  }
}
p {
  margin: 1em 0;
}
a {
  color: #1a1a1a;
}
a:visited {
  color: #1a1a1a;
}
img {
  max-width: 100%;
}
h1, h2, h3, h4, h5, h6 {
  margin-top: 1.4em;
}
h5, h6 {
  font-size: 1em;
  font-style: italic;
}
h6 {
  font-weight: normal;
}
ol, ul {
  padding-left: 1.7em;
  margin-top: 1em;
}
li > ol, li > ul {
  margin-top: 0;
}
blockquote {
  margin: 1em 0 1em 1.7em;
  padding-left: 1em;
  border-left: 2px solid #e6e6e6;
  color: #606060;
}
div.abstract {
  margin: 2em 2em 2em 2em;
  text-align: left;
  font-size: 85%;
}
div.abstract-title {
  font-weight: bold;
  text-align: center;
  padding: 0;
  margin-bottom: 0.5em;
}
code {
  font-family: Menlo, Monaco, Consolas, 'Lucida Console', monospace;
  font-size: 85%;
  margin: 0;
  hyphens: manual;
}
pre {
  margin: 1em 0;
  overflow: auto;
}
pre code {
  padding: 0;
  overflow: visible;
  overflow-wrap: normal;
}
.sourceCode {
  background-color: transparent;
  overflow: visible;
}
hr {
  background-color: #1a1a1a;
  border: none;
  height: 1px;
  margin: 1em 0;
}
table {
  margin: 1em 0;
  border-collapse: collapse;
  width: 100%;
  overflow-x: auto;
  display: block;
  font-variant-numeric: lining-nums tabular-nums;
}
table caption {
  margin-bottom: 0.75em;
}
tbody {
  margin-top: 0.5em;
  border-top: 1px solid #1a1a1a;
  border-bottom: 1px solid #1a1a1a;
}
th {
  border-top: 1px solid #1a1a1a;
  padding: 0.25em 0.5em 0.25em 0.5em;
}
td {
  padding: 0.125em 0.5em 0.25em 0.5em;
}
header {
  margin-bottom: 4em;
  text-align: center;
}
#TOC li {
  list-style: none;
}
#TOC ul {
  padding-left: 1.3em;
}
#TOC > ul {
  padding-left: 0;
}
#TOC a:not(:hover) {
  text-decoration: none;
}
code { white-space: pre-wrap; }
span.smallcaps { font-variant: small-caps; }
div.columns { display: flex; gap: min(4vw, 1.5em); }
div.column { flex: auto; overflow-x: auto; }
div.hanging-indent { margin-left: 1.5em; text-indent: -1.5em; }
ul.task-list { list-style: none; }
ul.task-list li input[type="checkbox"] {
  width: 0.8em;
  margin: 0 0.8em 0.2em -1.6em;
  vertical-align: middle;
}
/* CSS for citations */
div.csl-bib-body { }
div.csl-entry {
  clear: both;
}
.hanging-indent div.csl-entry {
  margin-left: 2em;
  text-indent: -2em;
}
div.csl-left-margin {
  min-width: 2em;
  float: left;
}
div.csl-right-inline {
  margin-left: 2em;
  padding-left: 1em;
}
div.csl-indent {
  margin-left: 2em;
}

/* =========================================================
   Comment extension (block + inline, left/right)
   ========================================================= */

/* Shared visual style */
div.comment-right,
div.comment-left,
.comment-overlay.comment-right,
.comment-overlay.comment-left,
span.comment-pin > span.comment-right,
span.comment-pin > span.comment-left {
  box-sizing: border-box;
  padding: 0.45rem 0.65rem;
  border: 1px solid #5aa0ff;
  background: #eaf3ff;
  color: #1a1a1a;
  border-radius: 0.45rem;
  font-size: 0.85em;
  line-height: 1.25;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.10);
}

/* ---------- Block comments (fenced Divs) ---------- */

div.comment-right,
div.comment-left {
  position: relative;
  width: 11rem;   /* narrowed so left bubble fits */
  margin-top: 0.2rem;
  margin-bottom: 0.5rem;
  z-index: 20;
}

div.comment-right {
  float: right;
  clear: right;
  margin-right: -11.5rem; /* -(width + 0.5rem gap): zero net text-footprint */
  margin-left: 0.5rem;    /* smaller gap */
}

div.comment-left {
  float: left;
  clear: left;
  margin-left: -11.5rem;  /* -(width + 0.5rem gap): zero net text-footprint */
  margin-right: 0.5rem;   /* smaller gap; preserves zero footprint */
}

/* ---------- Inline comments (mid-paragraph via nested spans) ---------- */

span.comment-pin {
  position: relative;
  display: inline-block;
  width: 0;
  height: 0;
  vertical-align: baseline;
  overflow: visible;
}

span.comment-pin > span.comment-right,
span.comment-pin > span.comment-left {
  position: absolute;
  top: -0.35em;
  width: 22em;   /* match block width */
  display: block;
  z-index: 50;
}

span.comment-pin > span.comment-right {
  left: 0.5rem;   /* match smaller gap */
}

span.comment-pin > span.comment-left {
  right: 0.5rem;  /* match smaller gap */
}

/* Pointer triangles (inline right) */
span.comment-pin > span.comment-right::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--comment-left-arrow-width));
  top: 0.55rem;
  border-width: var(--comment-arrow-height) var(--comment-left-arrow-width) var(--comment-arrow-height) 0;
  border-style: solid;
  border-color: transparent #5aa0ff transparent transparent;
}
span.comment-pin > span.comment-right::after {
  content: "";
  position: absolute;
  left: calc(-1 * var(--comment-left-arrow-width) + 1px);
  top: 0.55rem;
  border-width: var(--comment-arrow-height) var(--comment-left-arrow-width) var(--comment-arrow-height) 0;
  border-style: solid;
  border-color: transparent #eaf3ff transparent transparent;
}

/* Pointer triangles (inline left) */
span.comment-pin > span.comment-left::before {
  content: "";
  position: absolute;
  right: calc(-1 * var(--comment-arrow-width));
  top: 0.55rem;
  border-width: var(--comment-arrow-height) 0 var(--comment-arrow-height) var(--comment-arrow-width);
  border-style: solid;
  border-color: transparent transparent transparent #5aa0ff;
}
span.comment-pin > span.comment-left::after {
  content: "";
  position: absolute;
  right: calc(-1 * var(--comment-arrow-width) + 1px);
  top: 0.55rem;
  border-width: var(--comment-arrow-height) 0 var(--comment-arrow-height) var(--comment-arrow-width);
  border-style: solid;
  border-color: transparent transparent transparent #eaf3ff;
}

/* ---------- Print ---------- */
@media print {
  div.comment-right,
  div.comment-left,
  span.comment-pin > span.comment-right,
  span.comment-pin > span.comment-left {
    display: none !important;
  }
}

/* ---------- Mobile fallback ---------- */
@media (max-width: 900px) {
  div.comment-right,
  div.comment-left,
  span.comment-pin > span.comment-right,
  span.comment-pin > span.comment-left {
    position: static;
    float: none;
    clear: none;
    width: auto;
    max-width: 100%;
    display: block;
    margin: 0.4em 0;
  }

  span.comment-pin {
    display: inline;
    width: auto;
    height: auto;
  }

  .comment-overlay.comment-margin-left {
    position: static !important;
    float: none !important;
    clear: none !important;
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    box-sizing: border-box;
    margin: 0.4em 0 !important;
  }

  .comment-inline-break-marker {
    display: inline !important;
  }

  span.comment-pin > span.comment-right::before,
  span.comment-pin > span.comment-right::after,
  span.comment-pin > span.comment-left::before,
  span.comment-pin > span.comment-left::after,
  .comment-overlay.comment-right::before,
  .comment-overlay.comment-right::after,
  .comment-overlay.comment-left::before,
  .comment-overlay.comment-left::after {
    display: none;
  }
}
.comment-hidden {
  opacity: 0.2;
}
/* --- Overlay block comments emitted by Lua (contain ul/paras/etc) --- */

.comment-overlay {
  position: absolute;
  z-index: 100;          /* above text */
  margin: 0 !important;  /* do not participate in normal layout */
  float: none !important;
  clear: none !important;
}

/* Ensure overlay uses the same visual bubble styling */
.comment-overlay.comment-right,
.comment-overlay.comment-left {
  width: 22rem;          /* match your current bubble width */
}

/* Margin-mode inline comments should use the narrower left-margin bubble size. */
.comment-overlay.comment-inline-margin,
.comment-overlay.comment-margin-left {
  width: 11rem;
}

.comment-inline-break-marker {
  display: none;
}

/* Pointer triangles for overlay block comments */
.comment-overlay.comment-right::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--comment-left-arrow-width));
  top: 0.55rem;
  border-width: var(--comment-arrow-height) var(--comment-left-arrow-width) var(--comment-arrow-height) 0;
  border-style: solid;
  border-color: transparent #5aa0ff transparent transparent;
}
.comment-overlay.comment-right::after {
  content: "";
  position: absolute;
  left: calc(-1 * var(--comment-left-arrow-width) + 1px);
  top: 0.55rem;
  border-width: var(--comment-arrow-height) var(--comment-left-arrow-width) var(--comment-arrow-height) 0;
  border-style: solid;
  border-color: transparent #eaf3ff transparent transparent;
}
.comment-overlay.comment-left::before {
  content: "";
  position: absolute;
  right: calc(-1 * var(--comment-arrow-width));
  top: 0.55rem;
  border-width: var(--comment-arrow-height) 0 var(--comment-arrow-height) var(--comment-arrow-width);
  border-style: solid;
  border-color: transparent transparent transparent #5aa0ff;
}
.comment-overlay.comment-left::after {
  content: "";
  position: absolute;
  right: calc(-1 * var(--comment-arrow-width) + 1px);
  top: 0.55rem;
  border-width: var(--comment-arrow-height) 0 var(--comment-arrow-height) var(--comment-arrow-width);
  border-style: solid;
  border-color: transparent transparent transparent #eaf3ff;
}

/* Optional: click-to-hide behavior styling (your JS toggles this) */
.comment-hidden {
  opacity: 0.12;
}

/* Anchor produced for block comments: zero footprint */
span.comment-pin-block {
  display: inline-block;
  width: 0;
  height: 0;
  overflow: visible;
}
:root {
  --comment-gap: 0.5rem;
  --comment-overlap-shift: 1rem;
  --comment-overlay-right-shift: 0.45rem;
  --comment-overlay-rise: 0.65rem;
  --comment-inline-rise: 0.35rem;
  --comment-arrow-height: 8px;
  --comment-arrow-width: 8px;
  --comment-left-arrow-width: 16px;
}
