/* Citation sheet (pages/citation.js): the excerpt behind a [n]. */

.cite-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  opacity: 0;
  transition: opacity 180ms ease;
}
.cite-backdrop.in { opacity: 1; }

.cite-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 auto;
  max-width: 720px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  padding: var(--space-sm) var(--space-lg) var(--space-lg);
  transform: translateY(100%);
  transition: transform 220ms cubic-bezier(.2, .8, .2, 1);
}
.cite-sheet.in { transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .cite-backdrop, .cite-sheet { transition: none; }
}

.cite-grabber {
  align-self: center;
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong);
  margin-bottom: var(--space-md);
  flex: 0 0 auto;
}

.cite-head {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
  margin-bottom: var(--space-md);
  flex: 0 0 auto;
}

.cite-badge {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  margin-top: 2px;
}

.cite-head-text { flex: 1; min-width: 0; }
.cite-title {
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  /* Three lines, as the sheet clamps it on mobile: a long publisher title
     must not push the excerpt itself below the fold. */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cite-meta { color: var(--text-dim); font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }

.cite-scroll { overflow-y: auto; min-height: 0; flex: 1 1 auto; padding-bottom: var(--space-md); }

.cite-quote {
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  background: var(--surface-alt);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  /* No pre-wrap: the excerpt is rendered markdown now, and its blocks carry
     the source's layout. pre-wrap on top would double every paragraph break. */
  overflow-wrap: anywhere;
  user-select: text;
}
.cite-quote .md > :last-child { margin-bottom: 0; }

.cite-footnote { color: var(--text-faint); font-size: 13px; margin-top: var(--space-sm); }

.cite-also { color: var(--text-dim); font-size: 13px; line-height: 1.45; margin-top: var(--space-md); }
.cite-also ul { margin: var(--space-sm) 0 0; padding-left: var(--space-md); }
.cite-also a, .cite-also button {
  background: none; border: 0; color: inherit; cursor: pointer; font: inherit; padding: 0; text-align: left;
  text-decoration: underline;
}

.cite-actions { margin-top: var(--space-md); flex: 0 0 auto; }

/* An <a>, not a <button>, so the PDF opens in a real tab with middle-click
   and ctrl/cmd-click intact -- hence the flex centring and the reset of the
   link defaults a button never had. */
.cite-open {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-sizing: border-box;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--accent-bg);
  color: var(--accent);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.cite-open:hover { opacity: .85; }

.cite-unavailable {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.45;
  padding: var(--space-sm) 0;
}
