/* The Planetary Republic — receipts pattern
   Inline citable phrases open a popover with verified sources.
   Native HTML popover API (Chrome 114+, Safari 17+, Firefox 125+).
   Old browsers gracefully degrade: button does nothing if popover unsupported. */

.receipt-link {
  background: none;
  border: none;
  padding: 0 1px;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-bottom: 1px dotted #d4861b;
  text-decoration: none;
  transition: background-color 0.15s ease;
  text-align: inherit;
  display: inline;
  line-height: inherit;
}

.receipt-link:hover {
  background-color: rgba(212, 134, 27, 0.12);
}

.receipt-link:focus-visible {
  outline: 2px solid #d4861b;
  outline-offset: 2px;
}

.receipt-link::after {
  content: "\2295"; /* circled plus — "open evidence" */
  font-size: 0.72em;
  color: #d4861b;
  vertical-align: super;
  margin-left: 2px;
  font-weight: 500;
}

/* Native popover container.
   Relies on the UA-default centering for [popover]:
     position:fixed; inset:0; margin:auto; width:fit-content; height:fit-content.
   We only override width and max-height so the card is bounded; height stays
   fit-content so the element is content-sized (not viewport-sized), which keeps
   click-outside-to-dismiss working since the backdrop region is the actual
   space outside the visible card. */
.receipt-popover {
  width: min(580px, calc(100vw - 2rem));
  max-height: min(720px, calc(100vh - 4rem));
  border: 1px solid rgba(26, 24, 24, 0.12);
  background: #faf7f2;
  color: #1a1818;
  padding: 0;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28), 0 2px 8px rgba(0, 0, 0, 0.08);
  border-radius: 3px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

.receipt-popover:popover-open {
  display: flex;
  flex-direction: column;
}

.receipt-popover::backdrop {
  background: rgba(26, 24, 24, 0.5);
  backdrop-filter: blur(3px);
}

.receipt-popover header {
  padding: 1.1rem 1.5rem 0.85rem;
  border-bottom: 1px solid #e8e2d8;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
}

.receipt-popover header > div {
  flex: 1;
  min-width: 0;
}

.receipt-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #d4861b;
  margin: 0 0 0.35rem;
  font-weight: 600;
}

.receipt-claim {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.12rem;
  font-style: italic;
  color: #1a1818;
  margin: 0;
  line-height: 1.35;
  font-weight: 500;
}

.receipt-close {
  background: none;
  border: 1px solid transparent;
  font-size: 1.4rem;
  line-height: 1;
  color: #1a1818;
  cursor: pointer;
  padding: 0.1rem 0.45rem 0.2rem;
  flex-shrink: 0;
  opacity: 0.45;
  border-radius: 2px;
  transition: opacity 0.15s, background-color 0.15s;
}

.receipt-close:hover {
  opacity: 1;
  background-color: rgba(26, 24, 24, 0.06);
}

.receipt-close:focus-visible {
  outline: 2px solid #d4861b;
  outline-offset: 2px;
  opacity: 1;
}

.receipt-list {
  list-style: none;
  padding: 0.25rem 1.5rem 1.25rem;
  margin: 0;
  overflow-y: auto;
}

.receipt-list > li {
  padding: 0.9rem 0;
  border-bottom: 1px solid #ece6dc;
}

.receipt-list > li:last-child {
  border-bottom: none;
}

.receipt-title {
  display: block;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1a1818;
  line-height: 1.35;
  margin: 0 0 0.2rem;
}

.receipt-source {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.74rem;
  color: #6a6560;
  margin: 0 0 0.4rem;
  letter-spacing: 0.02em;
}

.receipt-shows {
  font-size: 0.88rem;
  color: #2a2826;
  line-height: 1.5;
  margin: 0 0 0.45rem;
}

.receipt-url {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.76rem;
  color: #d4861b;
  text-decoration: none;
  word-break: break-all;
  border-bottom: 1px dotted transparent;
}

.receipt-url:hover {
  border-bottom-color: #d4861b;
}

.receipt-pending {
  padding: 1.25rem 1.5rem 1.5rem;
  font-style: italic;
  color: #6a6560;
  font-size: 0.92rem;
  line-height: 1.5;
}

.receipt-pending strong {
  font-weight: 600;
  font-style: normal;
  color: #1a1818;
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.78rem;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.receipt-footer {
  padding: 0.8rem 1.5rem;
  border-top: 1px solid #e8e2d8;
  background: #f3ede3;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  color: #6a6560;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.receipt-footer a {
  color: #d4861b;
  text-decoration: none;
}

.receipt-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  .receipt-popover {
    width: calc(100vw - 1rem);
    max-height: calc(100vh - 2rem);
  }
  .receipt-popover header {
    padding: 1rem 1.1rem 0.75rem;
  }
  .receipt-list {
    padding: 0.25rem 1.1rem 1rem;
  }
}
