/* Inline annotation marker — uniform across layers, soft underline. */
.anno {
  text-decoration: underline solid rgba(127, 127, 127, 0.35);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: help;
  transition: text-decoration-color 0.15s ease;
}
.anno:hover, .anno:focus-visible {
  text-decoration-color: var(--color-ink);
  background: var(--color-shade);
}

/* Hide underline when an annotation has no remaining visible layers.
   data-anno-layers lists the layer keys present in the annotation; if
   none of them are in the body's data-layers attr, the JS adds .anno-empty. */
.anno.anno-empty {
  text-decoration: none;
  cursor: default;
}

/* Tippy theme override */
.tippy-box[data-theme~="ulysses"] {
  background: var(--color-bg);
  color: var(--color-ink);
  border: 1px solid var(--color-rule);
  border-radius: 0.35rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
  font-family: var(--font-ui);
  font-size: 0.92rem;
  line-height: 1.55;
}
.tippy-box[data-theme~="ulysses"] .tippy-content {
  padding: 0.85rem 1rem;
  max-height: min(70vh, 32rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}
/* Subtle scrollbar inside the popover (WebKit-only; non-WebKit gets default). */
.tippy-box[data-theme~="ulysses"] .tippy-content::-webkit-scrollbar {
  width: 6px;
}
.tippy-box[data-theme~="ulysses"] .tippy-content::-webkit-scrollbar-thumb {
  background: var(--color-rule);
  border-radius: 3px;
}
.tippy-box[data-theme~="ulysses"] .tippy-arrow {
  color: var(--color-bg);
}
.tippy-box[data-theme~="ulysses"] .anno-card .phrase {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1rem;
  color: var(--color-ink);
  border-bottom: 1px solid var(--color-rule);
  padding-bottom: 0.4rem;
  margin-bottom: 0.5rem;
}
.tippy-box[data-theme~="ulysses"] .anno-section {
  border-left: 3px solid var(--anno-section-color, var(--color-rule));
  padding: 0.15rem 0 0.15rem 0.65rem;
  margin: 0.55rem 0;
}
.tippy-box[data-theme~="ulysses"] .anno-section .label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--anno-section-color, var(--color-ink-soft));
  margin-bottom: 0.2rem;
  font-weight: 500;
}
.tippy-box[data-theme~="ulysses"] .anno-section .content {
  margin: 0;
  color: var(--color-ink);
}
.tippy-box[data-theme~="ulysses"] .anno-section .source {
  font-size: 0.78rem;
  color: var(--color-ink-soft);
  margin-top: 0.3rem;
  font-style: italic;
}

/* Cross-references inlined from other Gifford notes — collapsible block.
   The recursive cross-ref inliner (scripts/inline-gifford-crossrefs.mjs) wraps
   resolved targets in sentinel markers; tippy-init.js parses those out and
   renders them as the structure below. */
.tippy-box[data-theme~="ulysses"] .anno-xrefs {
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px dashed var(--color-rule);
}
.tippy-box[data-theme~="ulysses"] .anno-xrefs > summary {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-ink-soft);
  cursor: pointer;
  user-select: none;
  list-style: none;
  padding: 0.1rem 0;
}
.tippy-box[data-theme~="ulysses"] .anno-xrefs > summary::-webkit-details-marker {
  display: none;
}
.tippy-box[data-theme~="ulysses"] .anno-xrefs > summary::before {
  content: "▸ ";
  display: inline-block;
  width: 0.9em;
  transition: transform 0.15s ease;
}
.tippy-box[data-theme~="ulysses"] .anno-xrefs[open] > summary::before {
  content: "▾ ";
}
.tippy-box[data-theme~="ulysses"] .anno-xrefs > summary:hover {
  color: var(--color-ink);
}
.tippy-box[data-theme~="ulysses"] .anno-xrefs ul {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0 0;
}
.tippy-box[data-theme~="ulysses"] .anno-xref {
  margin: 0.45rem 0;
  padding-left: 0.65rem;
  border-left: 2px solid var(--color-rule);
}
.tippy-box[data-theme~="ulysses"] .anno-xref-header {
  font-size: 0.74rem;
  color: var(--color-ink-soft);
  font-family: var(--font-ui);
  margin-bottom: 0.18rem;
}
.tippy-box[data-theme~="ulysses"] .anno-xref-body {
  font-size: 0.88rem;
  color: var(--color-ink);
  line-height: 1.5;
}

/* Layer dot used in controls */
.dot {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  vertical-align: middle;
  margin: 0 0.3rem;
}
.dot-vocabulary { background: var(--color-layer-vocabulary); }
.dot-foreign    { background: var(--color-layer-foreign); }
.dot-gifford    { background: var(--color-layer-gifford); }
.dot-slote      { background: var(--color-layer-slote); }
.dot-dolan      { background: var(--color-layer-dolan); }

/* Gabler page-number markers — injected at build time as the first child
   of the <p> that opens each PDF page. Absolute-positioned in the right
   outer margin of the chapter, baseline-aligned to the paragraph's first
   line. Hidden by default; controls panel toggles `data-pagenumbers` on
   the html element to show. */
.gabler-page {
  display: none;
  position: absolute;
  right: -6ch;
  top: 0;
  font-family: var(--font-ui);
  font-size: 0.78em;
  font-weight: 400;
  color: var(--color-ink-soft);
  font-variant-numeric: tabular-nums;
  /* Match the body's line-height so the marker's baseline aligns with
     the paragraph's first-line baseline. Body uses 1.65 (typography.css);
     keeping that here means top:0 puts both baselines on the same row. */
  line-height: 1.65;
  user-select: none;
  text-align: left;
  opacity: 0.75;
  pointer-events: none;
}

.episode-body p { position: relative; }

[data-pagenumbers="on"] .gabler-page { display: inline-block; }

/* The right gutter inside .content is small (~3ch by default); widen the
   page on wide viewports when page numbers are on so the markers don't
   crowd the body text. */
@media (min-width: 1024px) {
  [data-pagenumbers="on"] .page { max-width: calc(var(--measure) + 28rem); }
}

/* On narrow viewports there's no outer margin to render markers in.
   The marker would either overlap the body text (ugly) or get clipped.
   Hide instead — page numbers are a scholarly aid, not core reading. */
@media (max-width: 1023px) {
  [data-pagenumbers="on"] .gabler-page { display: none; }
}
