/* CP.bot Related Link Box 1.1.1 – minimal, scoped, RTL-safe styling.
 * No automatic paragraph detection, remote resources or card-wide link overlay.
 * The orange label is plain text; only the white article title is a link.
 */
p.cpb-related {
  --cpb-accent: #ff861f;
  position: relative;
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-height: 64px;
  padding: 16px 22px 16px 82px;
  margin: 1.8em 0;
  border: 1px solid rgba(255, 134, 31, .5);
  border-radius: 16px;
  background: linear-gradient(115deg, #17130f, #2b1c10);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .20);
  color: #fff;
  direction: rtl;
  text-align: right !important;
  font-size: 16px;
  line-height: 1.8;
  overflow: hidden;
  overflow-wrap: break-word;
  transition: transform .2s ease;
}

/* Disable the v1.1.0 glow layer (including when an old theme override exists). */
p.cpb-related::before {
  content: none !important;
  display: none !important;
}

/* Keep label and link in the same text flow; both may wrap naturally. */
p.cpb-related > strong,
p.cpb-related > b,
p.cpb-related > .cpb-related-label {
  color: var(--cpb-accent);
  display: inline;
  font-weight: 800;
  white-space: normal;
  background: transparent;
}

p.cpb-related > a,
p.cpb-related > a:visited,
p.cpb-related > .cpb-related-link,
p.cpb-related > .cpb-related-link:visited {
  color: #fff;
  display: inline;
  font-weight: 800;
  text-decoration: none;
  overflow-wrap: anywhere;
  background: transparent;
}

p.cpb-related > a:hover,
p.cpb-related > a:focus-visible {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Actual graphic is perfectly centered with CSS background-position,
 * independent of the arrow glyph's font metrics. Explicit physical LEFT
 * prevents RTL logical-positioning from moving the circle to the right.
 * The SVG is inline data, not a network request. */
p.cpb-related::after {
  content: '';
  position: absolute;
  left: 20px;
  right: auto;
  top: 50%;
  width: 40px;
  height: 40px;
  box-sizing: border-box;
  border-radius: 50%;
  background-color: var(--cpb-accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 12H5M5 12l7-7M5 12l7 7'/%3E%3C/svg%3E");
  background-position: center;
  background-size: 21px 21px;
  background-repeat: no-repeat;
  transform: translateY(-50%);
  pointer-events: none;
}

p.cpb-related:focus-within {
  outline: 2px solid var(--cpb-accent);
  outline-offset: 3px;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  p.cpb-related:hover { transform: translateY(-2px); }
}

@media (max-width: 600px) {
  p.cpb-related {
    min-height: 54px;
    margin: 1.1em 0;
    padding: 10px 12px 10px 54px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.7;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .18);
  }

  p.cpb-related::after {
    left: 12px;
    width: 30px;
    height: 30px;
    background-size: 16px 16px;
  }
}

/* Gutenberg editor fields are intentionally outside the styled paragraph. */
.cpbrb-editor-wrap { margin-block: 16px; }
.cpbrb-editor-wrap .cpbrb-placeholder { color: #f7e1cb; }
