/* Glossary popovers — readers click a named entity in the manifesto to see a
   neutral 2-3 sentence summary + canonical link. Distinct visual treatment
   from .receipt-link (dashed underline, no after-marker) so receipts vs.
   glossary are at-a-glance distinguishable. */

.glossary-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-bottom: 1px dashed rgba(212, 134, 27, 0.55);
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
  text-align: inherit;
  display: inline;
  line-height: inherit;
}

.glossary-link:hover {
  background-color: rgba(212, 134, 27, 0.08);
  border-bottom-color: #d4861b;
}

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

/* Glossary popover — narrower than receipts because content is short */
.glossary-popover {
  width: min(420px, calc(100vw - 2rem));
  max-height: min(560px, 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;
}

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

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

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

.glossary-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #d4861b;
  margin: 0 0 0.3rem;
  font-weight: 600;
}

.glossary-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.35rem;
  color: #1a1818;
  margin: 0;
  line-height: 1.25;
  font-weight: 500;
  letter-spacing: -0.005em;
}

.glossary-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;
}

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

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

.glossary-body {
  padding: 0.85rem 1.25rem 1rem;
  overflow-y: auto;
}

.glossary-summary {
  font-size: 0.92rem;
  line-height: 1.55;
  color: #2a2826;
  margin: 0 0 0.7rem;
}

.glossary-summary:last-child {
  margin-bottom: 0;
}

.glossary-context {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.96rem;
  line-height: 1.45;
  color: #5a5550;
  margin: 0 0 0.85rem;
  padding: 0.5rem 0 0.5rem 0.85rem;
  border-left: 2px solid #d4861b;
}

.glossary-link-out {
  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;
  margin-top: 0.2rem;
}

.glossary-link-out:hover {
  border-bottom-color: #d4861b;
}

.glossary-aliases {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  color: #6a6560;
  margin: 0.45rem 0 0;
  letter-spacing: 0.02em;
}

.glossary-footer {
  padding: 0.55rem 1.25rem;
  border-top: 1px solid #e8e2d8;
  background: #f3ede3;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  color: #6a6560;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

.glossary-pending {
  padding: 1rem 1.25rem;
  font-style: italic;
  color: #6a6560;
  font-size: 0.9rem;
}

@media (max-width: 480px) {
  .glossary-popover {
    width: calc(100vw - 1rem);
  }
  .glossary-popover header {
    padding: 0.9rem 1rem 0.6rem;
  }
  .glossary-body {
    padding: 0.75rem 1rem 0.9rem;
  }
}
