/* Digest item anchors: copy-link buttons, scroll offset and target highlight.
   Uses the Obsidian Codex tokens defined in obsidian-codex.css. */

.digest-item {
  scroll-margin-top: 1.5rem; /* room above the target when jumping to #id (header is not sticky today) */
  border-radius: var(--radius-sm, 4px);
}

.digest-item.is-targeted {
  background: rgba(16, 185, 129, 0.12);
  box-shadow: 0 0 0 0.5rem rgba(16, 185, 129, 0.12), 0 0 0 calc(0.5rem + 1px) rgba(78, 222, 163, 0.45);
  transition: background 1.2s ease, box-shadow 1.2s ease;
}

.digest-item.is-targeted.is-targeted-fade {
  background: transparent;
  box-shadow: 0 0 0 0.5rem transparent, 0 0 0 calc(0.5rem + 1px) transparent;
}

/* ——— copy-link button ——— */
.copy-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  margin: -2px 0 0 0.6rem;
  float: right;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm, 4px);
  cursor: pointer;
  opacity: 0.7;
  line-height: 1;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.copy-link[hidden] {
  display: none;
}

h2 .copy-link {
  float: none;
  margin: 0 0 0.15em 0.6rem;
  vertical-align: middle;
  width: 26px;
  height: 26px;
}

.digest-item:hover > .copy-link,
.copy-link:hover,
.copy-link:focus-visible {
  opacity: 1;
  color: var(--primary-bright, #4edea3);
  border-color: var(--primary, #10b981);
  background: rgba(16, 185, 129, 0.1);
}

.copy-link:focus-visible {
  outline: 2px solid var(--secondary, #06b6d4);
  outline-offset: 2px;
}

.copy-link.is-copied {
  opacity: 1;
  color: var(--surface-obsidian, #0a0d14);
  background: var(--primary, #10b981);
  border-color: var(--primary, #10b981);
}

@media (hover: none), (max-width: 719px) {
  /* touch: larger tap target, always visible */
  .copy-link,
  h2 .copy-link {
    width: 36px;
    height: 36px;
    opacity: 0.85;
  }
}

/* ——— "Link copied" toast ——— */
.copy-link-toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 1000;
  transform: translate(-50%, 0.5rem);
  max-width: calc(100vw - 2rem);
  padding: 0.55rem 1rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--text-parchment, #f1f5f9);
  background: var(--surface-elevated, #151c27);
  border: 1px solid var(--primary, #10b981);
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.copy-link-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  .digest-item.is-targeted,
  .copy-link,
  .copy-link-toast {
    transition: none;
  }
}
