/* term-explanation.css
   Include in BOTH content_css (editor) and your public stylesheet.
   Requires term-explanation.js to build the label/box structure — see that file.
*/

:root {
  --term-explanation-border-color: currentColor;
  --term-explanation-border-width: 2px;
  --term-explanation-open-bg: var(--bg-pale);
  --term-explanation-hint-bg: #1f1f1f;
  --term-explanation-hint-color: #fff;
}

.term-explanation {
  position: relative;
  display: inline-block;
}

.term-explanation-label {
  border-bottom: var(--term-explanation-border-width) dotted var(--term-explanation-border-color);
  cursor: pointer;
  position: relative;
}

.term-explanation-label:hover {
  border-bottom-style: solid;
}

.term-explanation.open .term-explanation-label {
  border: none;
  outline: var(--term-explanation-border-width) dotted var(--term-explanation-border-color) ;
  background: var(--term-explanation-open-bg);
}

/* --- hover hint, like a native tooltip, appears above the word --- */

.term-tooltip {
    position: fixed;
    display: none;
    background: var(--term-explanation-hint-bg);
    color: var(--term-explanation-hint-color);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: .78rem;
    line-height: 1.3;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1100;
}

.term-tooltip.visible {
    display: block;
}

.term-tooltip-arrow {
    position: absolute;
    width: 10px;
    height: 10px;
    background: inherit;
    transform: rotate(45deg);
    bottom: -5px;
    margin-left: -5px;
}

/* --- the explanation box, appears below the word when open --- */

.term-explanation-box {
  display: none;
  position: fixed;
  background: #fff;
  color: #222;
  border: var(--term-explanation-border-width) dotted var(--term-explanation-border-color);
  border-radius: 4px;
  padding: 10px 28px 10px 12px;
  font-size: 0.9rem;
  line-height: 1.4;
  min-width: 200px;
  max-width: 320px;
  white-space: normal;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  z-index: 1000;
}

.term-explanation-box.open {
  display: block;
}

.term-explanation-close {
  position: absolute;
  top: 2px;
  right: 6px;
  background: none;
  border: none;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  padding: 2px 4px;
}

.term-explanation-close:hover {
  opacity: 0.6;
}