/*
 * Scoped copy of the .tbv-term* rules from bookcompile's templates/shared/web/style.css (the True
 * Bible HTML viewer's stylesheet), kept to just the glossary-tooltip classes term-popup.js renders —
 * not the full viewer stylesheet, so this doesn't carry its page layout/typography into the WP theme.
 * Colors copied from that file's :root, renamed with a tgt- prefix so they can't collide with (or get
 * overridden by) any --color-* custom properties the active WP theme happens to define at :root.
 */
:root {
  --tgt-color-bg:        #fbfaf7;
  --tgt-color-text:      #262220;
  --tgt-color-subtle:    #6b6259;
  --tgt-color-accent:    #8a5a2b;
  --tgt-color-rule:      #e4ddd2;
  --tgt-color-title-bg:  #f3ede2;
}

.tbv-term {
  font-style: inherit;
  cursor: help;
  border-bottom: 1px dotted var(--tgt-color-accent);
  text-decoration: none;
}
.tbv-term:hover,
.tbv-term:focus-visible {
  background: var(--tgt-color-title-bg);
  outline: none;
}
.tbv-term:focus-visible { box-shadow: 0 0 0 2px var(--tgt-color-accent); border-radius: 2px; }

.tbv-term-bubble {
  position: fixed;
  z-index: 50;
  max-width: min(22rem, calc(100vw - 1rem));
  padding: 0.5rem 0.75rem;
  background: var(--tgt-color-text);
  color: var(--tgt-color-bg);
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  font-size: 0.875rem;
  line-height: 1.5;
}
.tbv-term-bubble[hidden] { display: none; }
.tbv-term-bubble strong { display: block; margin-bottom: 0.15rem; }

.tbv-term-dialog {
  width: min(36rem, calc(100vw - 2rem));
  max-height: min(80vh, 40rem);
  padding: 0;
  border: 1px solid var(--tgt-color-rule);
  border-radius: 10px;
  background: var(--tgt-color-bg);
  color: var(--tgt-color-text);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  overflow: auto;
}
.tbv-term-dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
.tbv-term-dialog-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.9rem 3rem 0.7rem 1.1rem;
  background: var(--tgt-color-title-bg);
  border-bottom: 1px solid var(--tgt-color-rule);
}
.tbv-term-dialog-head h2 { margin: 0; font-size: 1.15rem; }
.tbv-term-sema { color: var(--tgt-color-subtle); font-size: 0.9rem; }
.tbv-term-close {
  position: absolute;
  top: 0.45rem;
  inset-inline-end: 0.6rem;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--tgt-color-subtle);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.tbv-term-close:hover { background: var(--tgt-color-rule); }
.tbv-term-dialog-body { padding: 0.9rem 1.1rem 0.4rem; }
.tbv-term-dialog-body img { max-width: 100%; height: auto; }
.tbv-term-more { display: inline-block; margin: 0.2rem 1.1rem 1rem; color: var(--tgt-color-accent); }

@media print {
  .tbv-term { border-bottom: 0; cursor: auto; }
  .tbv-term-bubble,
  .tbv-term-dialog { display: none !important; }
}
