/* ==========================================================================
   Wayback Link Preserver — Styles
   Detects broken external links and shows Wayback Machine archive fallbacks.
   ========================================================================== */

/* --- Archive indicator (clickable badge after a broken link with archive) --- */

.wlp-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  margin-left: 0.35em;
  padding: 0.2em 0.5em;
  border-radius: 4px;
  background-color: #e8f5ed;
  border: 1px solid #b6dfc5;
  color: #1a6b3c;
  font-size: 0.82em;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  vertical-align: baseline;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}

.wlp-indicator:hover,
.wlp-indicator:focus-visible {
  background-color: #d0f0dc;
  border-color: #8acda3;
  outline: none;
}

.wlp-indicator svg {
  width: 0.9em;
  height: 0.9em;
  flex-shrink: 0;
}

.wlp-indicator-text {
  font-size: 0.85em;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* --- Broken link badge (non-clickable, shown when no archive exists) --- */

.wlp-broken-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 0.25em;
  color: #a04040;
  opacity: 0.5;
  vertical-align: baseline;
  line-height: 1;
}

.wlp-broken-badge svg {
  width: 0.75em;
  height: 0.75em;
  flex-shrink: 0;
  vertical-align: -0.05em;
}

/* --- Broken link text styling --- */

a.wlp-broken {
  text-decoration-line: underline line-through;
  text-decoration-style: solid;
  text-decoration-color: rgba(160, 64, 64, 0.35);
}

/* If the broken link has an archive fallback, tone down the "broken" look. */
a.wlp-broken.wlp-has-archive {
  text-decoration-line: underline;
  text-decoration-style: solid;
  text-decoration-color: inherit;
}

/* --- Tooltip --- */

.wlp-indicator[title],
.wlp-broken-badge[title] {
  cursor: help;
}

/* --- Dark mode --- */

@media (prefers-color-scheme: dark) {
  .wlp-indicator {
    background-color: rgba(30, 80, 50, 0.5);
    border-color: rgba(94, 196, 126, 0.3);
    color: #7dd89a;
  }

  .wlp-indicator:hover,
  .wlp-indicator:focus-visible {
    background-color: rgba(40, 100, 60, 0.6);
    border-color: rgba(94, 196, 126, 0.5);
  }

  .wlp-broken-badge {
    color: #d07070;
  }

  a.wlp-broken {
    text-decoration-color: rgba(208, 112, 112, 0.4);
  }
}

/* --- Reduced motion --- */

@media (prefers-reduced-motion: reduce) {
  .wlp-indicator {
    transition: none;
  }
}

/* --- Print: hide all indicators --- */

@media print {
  .wlp-indicator,
  .wlp-broken-badge {
    display: none !important;
  }

  a.wlp-broken {
    text-decoration-line: underline;
  }
}
