/* ─────────────────────────────────────────────────────────────────────────────
   tooltips.css — Wikipedia-style term preview cards
   Version: 1.0 | ai-delegation.ru
   ───────────────────────────────────────────────────────────────────────────── */

/* ── Term link ── */
.term-link {
  color: var(--accent, #2563EB);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--accent, #2563EB);
  text-underline-offset: 2px;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
}

.term-link:hover,
.term-link:focus {
  color: var(--accent, #2563EB);
  text-decoration-style: solid;
}

/* ── Tooltip card ── */
.term-tooltip {
  position: fixed;
  z-index: 9999;
  width: 320px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
  padding: 0;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  overflow: hidden;
}

.term-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ── Tooltip header ── */
.term-tooltip__header {
  background: var(--bg-subtle, #f8f9fa);
  border-bottom: 1px solid #e5e7eb;
  padding: 12px 16px 10px;
}

.term-tooltip__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #0F1923);
  margin: 0;
  line-height: 1.4;
}

/* ── Tooltip body ── */
.term-tooltip__body {
  padding: 12px 16px;
}

.term-tooltip__desc {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted, #6B7280);
  margin: 0 0 12px;
}

/* ── Tooltip footer ── */
.term-tooltip__footer {
  border-top: 1px solid #f3f4f6;
  padding: 8px 16px 10px;
}

.term-tooltip__link {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent, #2563EB);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.15s ease;
}

.term-tooltip__link:hover {
  text-decoration: underline;
  gap: 6px;
}

.term-tooltip__link::after {
  content: "→";
  font-size: 11px;
}

/* ── Tooltip arrow ── */
.term-tooltip__arrow {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-right: none;
  border-bottom: none;
  transform: rotate(45deg);
  top: -6px;
  left: 20px;
}

/* ── Dark mode ── */
@media (prefers-color-scheme: dark) {
  .term-tooltip {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  }

  .term-tooltip__header {
    background: #0f172a;
    border-color: #334155;
  }

  .term-tooltip__title {
    color: #f1f5f9;
  }

  .term-tooltip__desc {
    color: #94a3b8;
  }

  .term-tooltip__footer {
    border-color: #334155;
  }

  .term-tooltip__arrow {
    background: #0f172a;
    border-color: #334155;
  }
}

/* ── Mobile: no tooltips, plain underline ── */
@media (pointer: coarse) {
  .term-link {
    text-decoration: underline;
    text-decoration-style: dotted;
  }

  .term-tooltip {
    display: none !important;
  }
}
