/* ─────────────────────────────────────────────────────────────────────────
   CiteKit — Tooltips, Footnotes, Bibliography
   Class changes in 3.1.0:
     .ck-footnote (tooltip, 3.0.x)       → .ck-tooltip
     .ck-footnote-popup (tooltip, 3.0.x) → .ck-tooltip-popup
   The .ck-footnote / .ck-footnote-popup classes are now used by the new
   numbered-footnote feature (superscript marker with popup + bottom list).
   ───────────────────────────────────────────────────────────────────────── */


/* ── TOOLTIPS ──────────────────────────────────────────────────────────── */

.ck-tooltip {
  position: relative;
  cursor: help;
}

.ck-tooltip.ck-tooltip-dashed {
  text-decoration: underline;
  text-decoration-style: dashed;
  text-decoration-color: currentColor;
  text-underline-offset: 0.15em;
  text-decoration-thickness: from-font;
}

.ck-tooltip.ck-tooltip-dotted {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: currentColor;
  text-underline-offset: 0.15em;
  text-decoration-thickness: from-font;
}

.ck-tooltip.ck-tooltip-symbol {
  cursor: pointer;
}

.ck-tooltip.ck-tooltip-symbol > sup {
  font-size: 0.75em;
  line-height: 0;
  vertical-align: baseline;
  position: relative;
  top: -0.5em;
}

.ck-tooltip-popup {
  display: none;
  position: absolute;
  z-index: 9999;
  top: auto;
  bottom: 1.4em;
  left: 0;
  width: 300px;
  max-width: 280px;
  background: #fff;
  color: #333;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 8px 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  font-size: 0.9rem;
  line-height: 1.4;
  cursor: auto;
  white-space: normal;
}

.ck-tooltip:hover > .ck-tooltip-popup,
.ck-tooltip:focus > .ck-tooltip-popup,
.ck-tooltip.open > .ck-tooltip-popup {
  display: block;
}


/* ── FOOTNOTES (numbered, with hover popup + bottom-of-post list) ───────── */

.ck-footnote {
  position: relative;
  cursor: pointer;
  font-size: 0.75em;
  line-height: 0;
  vertical-align: baseline;
  top: -0.5em;
  margin: 0 0.05em;
  font-weight: 600;
}

.ck-footnote > .ck-footnote-ref {
  text-decoration: none;
  color: inherit;
  padding: 0 0.1em;
}

.ck-footnote > .ck-footnote-ref:hover {
  text-decoration: underline;
}

.ck-footnote-popup {
  display: none;
  position: absolute;
  z-index: 9999;
  top: auto;
  bottom: 1.6em;
  left: 0;
  width: 300px;
  max-width: 280px;
  background: #fff;
  color: #333;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 8px 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  /* Reset relative sizing from parent <sup> */
  font-size: 0.9rem;
  font-weight: normal;
  line-height: 1.5;
  vertical-align: baseline;
  cursor: auto;
  white-space: normal;
}

.ck-footnote:hover > .ck-footnote-popup,
.ck-footnote:focus > .ck-footnote-popup,
.ck-footnote.open > .ck-footnote-popup {
  display: block;
}

/* Bottom-of-post list */
.ck-footnotes-wrapper {
  margin-top: 2em;
  padding: 16px 20px;
  background: #f9fafa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.95em;
  line-height: 1.6;
}

.ck-footnotes-title {
  display: block;
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.75em;
  color: #222;
}

.ck-footnotes {
  margin: 0 0 0 1.25em;
  padding: 0;
}

.ck-footnotes li {
  margin-bottom: 0.35em;
}

.ck-footnotes li:target {
  background: #fff7d6;
  padding: 0.1em 0.25em;
  border-radius: 3px;
}

.ck-footnote-back {
  text-decoration: none;
  margin-left: 0.35em;
  font-size: 0.9em;
  color: #3b8edd;
}

.ck-footnote-back:hover {
  text-decoration: underline;
}


/* ── BIBLIOGRAPHY ──────────────────────────────────────────────────────── */

.ck-bibliography-wrapper {
  margin-top: 2em;
  padding: 20px;
  background: #f9fafa;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ck-bibliography-wrapper ol {
  margin: 0;
  margin-left: 20px;
  padding: 0;
}

.ck-bibliography-title {
  display: block;
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 1em;
  color: #222;
}

.ck-bibliography a {
  text-decoration: none;
  margin-left: 0.3em;
  font-size: 0.9em;
  color: #3b8edd;
}

.ck-bibliography a:hover {
  text-decoration: underline;
}


/* ── CITATION MARKER ───────────────────────────────────────────────────── */

.ck-cite {
  /* Inline, baseline — matches IEEE style and reads cleanly in prose.
     Visually distinct from footnotes (which are superscript) so readers
     can tell citations and footnotes apart at a glance. */
  font-size: inherit;
  vertical-align: baseline;
  white-space: nowrap;
  margin: 0 0.1em;
}

.ck-cite a {
  text-decoration: none;
  color: inherit;
}

.ck-cite a:hover {
  text-decoration: underline;
}


/* ── PRINT ─────────────────────────────────────────────────────────────── */

@media print {
  .ck-tooltip-popup,
  .ck-footnote-popup {
    display: none !important;
  }

  .ck-footnotes-wrapper {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
