/*
 * Time-on-page popup card — styles
 * Used by time-on-page-popup.js. Include on every page that shows the popup:
 *
 *   <link rel="stylesheet" href="/css/time-on-page-popup.css">
 *
 * All class names start with "cb-" so they won't clash with the site's own styles.
 */

/* ── Card ──────────────────────────────────────────────────────────────── */
.cb-card {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2147483000;
  width: 360px;
  max-width: calc(100vw - 40px);
  box-sizing: border-box;
  border-radius: 8px;
  background: #fff;
  color: #1a1d24;
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12), 0 1px 3px rgba(0, 0, 0, .08);

  /* Hidden until .cb-open is added; slides up and fades in. */
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease, background-color .2s ease;
}

.cb-card.cb-open {
  opacity: 1;
  transform: translateY(0);
}

.cb-card:hover {
  background: #eaf7fa;
}

/* Position variants (set with the "position" option / data-position). */
.cb-card--left {
  left: 20px;
  right: auto;
}

.cb-card--center {
  left: 50%;
  right: auto;
  transform: translate(-50%, 12px);
}

.cb-card--center.cb-open {
  transform: translate(-50%, 0);
}

/* ── Link (the whole card except the close button) ─────────────────────── */
.cb-link {
  display: block;
  padding: 16px 18px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
}

/* ── Headline ──────────────────────────────────────────────────────────── */
.cb-title {
  display: block;
  margin: 0 0 12px;
  padding-right: 28px;          /* room for the close button */
  font-weight: 600;
  font-size: 15px;
  line-height: 20px;
}

/* ── Experts ───────────────────────────────────────────────────────────── */
.cb-experts {
  display: flex;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cb-expert {
  flex: 1 1 0;                  /* the two experts share the row equally */
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  line-height: 17px;
  color: #4a5060;
}

.cb-avatar {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  overflow: hidden;
  background: #e7e9ee;
  /* Used when there is no photo and initials are shown instead. */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #4a5060;
}

.cb-name {
  min-width: 0;
  overflow-wrap: break-word;    /* long names wrap onto more lines */
}

/* ── Reset site styles that can leak into the card ─────────────────────── */
/* Site-wide rules for lists (ul/li) and images (img) can add padding,
   margins or bullets here. The extra ".cb-card" makes these win over most
   site rules. */
.cb-card .cb-experts {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cb-card .cb-experts .cb-expert {
  margin: 0;
  padding: 0;
  list-style: none;
  background: none;
  border: 0;
  text-indent: 0;
}

.cb-card .cb-experts .cb-expert::before,
.cb-card .cb-experts .cb-expert::after {
  content: none;
  display: none;
}

.cb-card .cb-avatar {
  margin: 0;
  padding: 0;
  border: 0;
  max-width: none;
}

/* ── Close button ──────────────────────────────────────────────────────── */
/* 28px button centred on the headline's first line:
   16px padding + 10px (half of the 20px line) - 14px = 12px from the top. */
.cb-close {
  position: absolute;
  top: 12px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #6b7180;
  cursor: pointer;
}

.cb-close:hover {
  background: rgba(0, 0, 0, .06);
  color: #1a1d24;
}

.cb-close:focus-visible,
.cb-link:focus-visible {
  outline: 2px solid #2451d6;
  outline-offset: 2px;
}

/* ── Phones: full width with 16px margins, whatever the position ──────── */
@media (max-width: 600px) {
  .cb-card,
  .cb-card--left,
  .cb-card--center {
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: auto;
    max-width: none;
    transform: translateY(12px);
  }

  .cb-card.cb-open,
  .cb-card--center.cb-open {
    transform: translateY(0);
  }
}

/* Very narrow phones: stack the experts so names still wrap between words. */
@media (max-width: 359px) {
  .cb-experts {
    flex-direction: column;
    gap: 10px;
  }
}

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