/* ============================================================
   Glossary tooltips, link icons, and reading-mode controls
   ============================================================ */

.gloss-term {
  /*font-style: italic;*/
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: help;
  position: relative;
}

.gloss-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 8px;
  height: 8px;
  font-size: 8px;
  line-height: 1;
  border: 1.2px solid var(--nav-link-color);
  border-radius: 50%;
  color: var(--nav-link-color);
  margin-left: 3px;
  vertical-align: 1.05em;
  font-style: normal;
  user-select: none;
  font-weight: bold;
}

.gloss-link {
  /*font-style: italic;*/
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.gloss-ext-icon {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 3px;
  vertical-align: super;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5'><path d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/><polyline points='15 3 21 3 21 9'/><line x1='10' y1='14' x2='21' y2='3'/></svg>") no-repeat center / contain;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5'><path d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/><polyline points='15 3 21 3 21 9'/><line x1='10' y1='14' x2='21' y2='3'/></svg>") no-repeat center / contain;
  opacity: 0.7;
}

/* the floating dark tooltip bubble, injected once by JS and repositioned */
.gloss-bubble {
  position: absolute;
  z-index: 500;
  max-width: 280px;
  background: #1a1a1a;
  color: #f2f2f2;
  font-size: 13px;
  line-height: 1.5em;
  padding: 10px 12px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.gloss-bubble.visible {
  opacity: 1;
  transform: translateY(0);
}

.gloss-bubble::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 16px;
  width: 10px;
  height: 10px;
  background: #1a1a1a;
  transform: rotate(45deg);
}

[data-theme='dark'] .gloss-bubble { background: #f2f2f2; color: #111; }
[data-theme='dark'] .gloss-bubble::after { background: #f2f2f2; }

/* reading-mode "off" state: applies whenever a term is filtered out,
   whether by "Hide All" or by tier in Intermediate/Expert. Italic is
   never removed (it's set on .gloss-term/.gloss-link above and never
   overridden here) — only the underline and the interactive icon go away. */
.gloss-term.gloss-off,
.gloss-link.gloss-off {
  text-decoration: none;
  cursor: text;
}
.gloss-term.gloss-off .gloss-icon,
.gloss-link.gloss-off .gloss-ext-icon {
  display: none;
}

/* === Reading-mode control bar === */
.gloss-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 16px 0 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.gloss-controls .gloss-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--nav-link-color);
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 2px;
}

@media screen and (max-width: 600px) {
  .gloss-controls .gloss-label {
    width: 100%;
    margin-right: 0;
    margin-bottom: 4px;
  }
}

.gloss-pill {
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-color);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.gloss-pill:hover { border-color: var(--text-color); }

.gloss-pill.active {
  background: var(--nav-link-color);
  color: var(--bg-color);
  border-color: var(--nav-link-color);
}

@media screen and (max-width: 600px) {
  .gloss-pill { padding: 6px 10px; font-size: 11px; }
}
