/* methods-popup.css — Gwern-style hoverable methods popups */

/* --- Trigger link styling --- */
.methods-ref {
  color: var(--link, #256);
  text-decoration: none;
  border-bottom: 1px dotted var(--link, #256);
  cursor: pointer;
}
.methods-ref:hover {
  border-bottom-style: solid;
}

/* --- Popup container --- */
.methods-popup {
  position: absolute;
  z-index: 1001;
  display: flex;
  flex-direction: column;

  width: 680px;
  max-width: calc(100vw - 32px);
  max-height: 480px;

  background: var(--bg, #fcfcf8);
  border: 3px double #ccc;
  box-shadow: 1px 2px 8px 0 #ccc;

  opacity: 1;
  transition: none;

  font-family: 'Merriweather', Georgia, serif;
  font-size: 0.9rem;
  line-height: 1.65;
}

/* Fade-out transition (gwern: 100ms delay + 250ms fade) */
.methods-popup.fading {
  opacity: 0;
  transition: opacity 0.25s ease-in 0.1s;
}

/* Focused state: mouse inside or pinned */
.methods-popup.focused {
  border-color: #aaa;
  box-shadow: 1px 2px 8px 0 #aaa;
}

/* --- Title bar --- */
.methods-popup-title-bar {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 1.6rem;
  padding: 0.2rem 0.5rem;
  border-bottom: 1px solid #ddd;
  background-color: #fff;
  background-image: radial-gradient(circle, #e6e6e6 1px, transparent 1px);
  background-size: 8px 8px;
  user-select: none;
}

.methods-popup.focused .methods-popup-title-bar {
  background-image: radial-gradient(circle, #fff 1px, transparent 1px);
  background-color: #e6e6e6;
}

.methods-popup-title {
  flex: 1 1 auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  color: #aaa;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.methods-popup.focused .methods-popup-title {
  color: #1a1a1a;
}

/* Pin indicator (subtle dot) */
.methods-popup-pin {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  margin-right: 0.25rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.7rem;
  color: #bbb;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.methods-popup-pin:hover {
  color: #1a1a1a;
}
.methods-popup.pinned .methods-popup-pin {
  color: #1a1a1a;
}

/* Expand button */
.methods-popup-expand {
  flex: 0 0 auto;
  width: 1.2rem;
  height: 1.2rem;
  margin-left: 0.25rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
  color: #bbb;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.methods-popup-expand:hover {
  color: #1a1a1a;
}
.methods-popup.focused .methods-popup-expand {
  color: #777;
}

/* Close button */
.methods-popup-close {
  flex: 0 0 auto;
  width: 1.2rem;
  height: 1.2rem;
  margin-left: 0.25rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  color: #bbb;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.methods-popup-close:hover {
  color: #1a1a1a;
}
.methods-popup.focused .methods-popup-close {
  color: #777;
}

/* --- Scrollable content area --- */
.methods-popup-content {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.7em 0.9em 0.8em 0.9em;
  color: var(--text, #1a1a1a);
}
.methods-popup-content.has-scroll {
  overscroll-behavior: contain;
}

.methods-popup-heading {
  margin: 0 0 0.5em 0;
  font-size: 1em;
  font-weight: 700;
  color: var(--text, #1a1a1a);
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 0.4em;
}
.methods-popup-heading + div + .methods-popup-heading {
  margin-top: 1.2em;
}

/* Content typography */
.methods-popup-content p {
  margin: 0 0 0.85em 0;
  text-indent: 0;
}
.methods-popup-content p:last-child {
  margin-bottom: 0;
}

.methods-popup-content code {
  font-family: 'IBM Plex Mono', Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--code-bg, #f5f5f0);
  padding: 0.1em 0.3em;
  border-radius: 2px;
}

.methods-popup-content em {
  font-style: italic;
}

.methods-popup-content .equation {
  text-align: center;
  margin: 0.8em 0;
  font-size: 0.95em;
}

.methods-popup-content .equation-params {
  list-style: none;
  padding-left: 1.5em;
  margin: 0.4em 0 0.8em;
  font-size: 0.92em;
}

/* Hide any cite tooltips and buttons inside the popup */
.methods-popup-content cite {
  font-size: 0.82em;
  vertical-align: super;
  color: var(--link, #256);
}
.methods-popup-content .view-code-btn {
  display: none;
}

/* --- Custom scrollbar (gwern style) --- */
.methods-popup-content::-webkit-scrollbar {
  width: 12px;
}
.methods-popup-content::-webkit-scrollbar-track {
  background: transparent;
}
.methods-popup-content::-webkit-scrollbar-thumb {
  background: #ddd;
  border: 3px solid var(--bg, #fcfcf8);
  border-radius: 6px;
}
.methods-popup-content::-webkit-scrollbar-thumb:hover {
  background: #bbb;
}
.methods-popup-content {
  scrollbar-color: #ddd transparent;
  scrollbar-width: thin;
}

/* --- Fullscreen state --- */
.methods-popup.fullscreen {
  position: fixed;
  top: 0 !important;
  left: var(--sidebar-width, 300px) !important;
  width: calc(100vw - var(--sidebar-width, 300px)) !important;
  max-width: calc(100vw - var(--sidebar-width, 300px));
  height: 100vh;
  max-height: 100vh;
  z-index: 10000;
  border: none;
  border-radius: 0;
}
.methods-popup.fullscreen .methods-popup-content {
  overscroll-behavior: contain;
}
