/* Click-a-word pop-ups for articles and course lessons (pairs with popups.js).
   Adapted from the earlier assets/verse-popup.css; uses the site variables from style.css. */
button.pop-ref {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 0;
  border-radius: 0;
  margin: 0;
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  color: inherit;
  text-align: inherit;
  display: inline;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--dust);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  -webkit-tap-highlight-color: rgba(196, 180, 154, 0.25);
}
button.pop-term { overflow-wrap: anywhere; }
button.pop-term strong { color: var(--paper); font-weight: 600; }
button.pop-verse { color: var(--dust); white-space: nowrap; }
button.pop-ref:hover,
button.pop-ref[aria-expanded="true"] { color: var(--paper); text-decoration-style: solid; }
button.pop-ref:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.pop-box {
  position: absolute;
  z-index: 60;
  top: 0;
  left: 0;
  width: min(360px, calc(100vw - 24px));
  box-sizing: border-box;
  background: #151515;
  color: var(--paper);
  border: 1px solid rgba(196, 180, 154, 0.45);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.65);
  padding: 0.85rem 1rem 0.8rem;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  text-align: left;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}
.pop-box.is-open { opacity: 1; transform: translateY(0); }
.pop-box[hidden] { display: none; }
.pop-box::after {
  content: "";
  position: absolute;
  left: var(--arrow-x, 50%);
  bottom: -7px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  background: #151515;
  border-right: 1px solid rgba(196, 180, 154, 0.45);
  border-bottom: 1px solid rgba(196, 180, 154, 0.45);
  transform: rotate(45deg);
}
.pop-box.is-below::after { bottom: auto; top: -7px; transform: rotate(225deg); }
.pop-box-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}
.pop-box-title {
  margin: 0;
  font-family: var(--font-chrome);
  font-size: var(--size-small);
  letter-spacing: 0.04em;
  color: var(--dust);
  font-weight: 400;
}
.pop-box-close {
  flex: none;
  appearance: none;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--paper);
  width: 2rem;
  height: 2rem;
  margin: -0.35rem -0.45rem 0 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.pop-box-close:hover { border-color: var(--dust); color: var(--dust); }
.pop-box-close:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.pop-box-text { margin: 0; overflow-wrap: anywhere; }
.pop-box.is-verse .pop-box-text { font-family: var(--font-display); font-size: 1.06rem; }
.pop-box-text sup {
  font-family: var(--font-chrome);
  font-size: 0.68em;
  color: var(--muted);
  margin-right: 0.2em;
}
.pop-box-link { margin: 0.55rem 0 0; font-size: var(--size-small); }
.pop-box-link a { color: var(--dust); text-decoration: underline; text-underline-offset: 3px; }
.pop-box-credit {
  margin: 0.6rem 0 0;
  padding-top: 0.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--muted);
}
@media (prefers-reduced-motion: reduce) {
  .pop-box { transition: none; transform: none; }
}
