/* Hover link preview — editor only.
   Shown when the mouse dwells on an <a> inside ProseMirror editor content.
   Uses CivNode theme variables so it inherits light/dark/hype palettes. */

.lp-card {
  position: fixed;
  z-index: 2000;
  width: 420px;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 46px -24px rgba(0, 0, 0, 0.55);
  display: grid;
  grid-template-columns: 148px 1fr;
  overflow: hidden;
  font-family: inherit;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 120ms ease, transform 120ms ease;
  pointer-events: auto;
}

/* No image: collapse to single column and let the body breathe. */
.lp-card.lp-no-hero {
  grid-template-columns: 1fr;
  width: 380px;
}
.lp-card.lp-no-hero .lp-image { display: none; }

.lp-card.lp-visible {
  opacity: 1;
  transform: translateY(0);
}

.lp-card .lp-image {
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  position: relative;
  min-height: 130px;
  background-size: cover;
  background-position: center;
}

.lp-card .lp-image.lp-no-image {
  background: var(--bg-secondary);
}

.lp-card .lp-favicon {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  background-size: 60%;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid var(--border);
  overflow: hidden;
}

.lp-card .lp-body {
  padding: 12px 14px 12px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 4px;
}

.lp-card .lp-site {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lp-card .lp-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.3;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lp-card .lp-desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lp-card .lp-url {
  margin-top: auto;
  font-family: var(--font-mono, ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace);
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lp-card .lp-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--border);
  padding: 8px 10px;
  background: var(--bg-secondary);
}

.lp-card .lp-btn {
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.02em;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lp-card .lp-btn:hover {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

.lp-card .lp-btn.lp-primary {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

.lp-card .lp-btn.lp-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.lp-card .lp-btn.lp-icon {
  width: 28px;
  height: 28px;
  padding: 0;
  justify-content: center;
}

.lp-card .lp-icon-glyph {
  display: inline-block;
  width: 14px;
  height: 14px;
  background: currentColor;
  -webkit-mask-size: contain;
          mask-size: contain;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: center;
          mask-position: center;
}

.lp-card .lp-icon-open { -webkit-mask-image: url('/icons/arrow-up-right-from-square.png'); mask-image: url('/icons/arrow-up-right-from-square.png'); }
.lp-card .lp-btn.lp-primary .lp-icon-open,
.lp-card .lp-btn:hover .lp-icon-open { -webkit-mask-image: url('/icons/arrow-up-right-from-square-filled.png'); mask-image: url('/icons/arrow-up-right-from-square-filled.png'); }
.lp-card .lp-icon-copy { -webkit-mask-image: url('/icons/copy.png'); mask-image: url('/icons/copy.png'); }
.lp-card .lp-btn:hover .lp-icon-copy { -webkit-mask-image: url('/icons/copy-filled.png'); mask-image: url('/icons/copy-filled.png'); }
.lp-card .lp-icon-edit { -webkit-mask-image: url('/icons/pencil.png'); mask-image: url('/icons/pencil.png'); }
.lp-card .lp-btn:hover .lp-icon-edit { -webkit-mask-image: url('/icons/pencil-filled.png'); mask-image: url('/icons/pencil-filled.png'); }

.lp-card .lp-kbd {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
}

.lp-card .lp-spacer { flex: 1; }

/* Skeleton loading state */
.lp-card.lp-loading .lp-image,
.lp-card.lp-loading .lp-bar {
  background: linear-gradient(
    110deg,
    var(--bg-secondary) 30%,
    var(--bg-elevated) 50%,
    var(--bg-secondary) 70%
  );
  background-size: 300% 100%;
  animation: lp-shimmer 1.6s linear infinite;
}
.lp-card.lp-loading .lp-bar {
  height: 10px;
  border-radius: 4px;
}
@keyframes lp-shimmer { to { background-position: -200% 0; } }

/* Unavailable state */
.lp-card.lp-unavailable {
  grid-template-columns: 1fr;
  width: 380px;
}
.lp-card.lp-unavailable .lp-image { display: none; }
.lp-card.lp-unavailable .lp-body { padding: 14px 16px; }
.lp-card.lp-unavailable .lp-msg {
  font-size: 12.5px;
  color: var(--text-muted);
}
