/* Research Explorer overlay. Reuses the app's design tokens (styles.css :root). */

/* saved-research card shown in the chat column (reopens the overlay) */
.research-card {
  max-width: var(--col);
  margin: 3rem auto 0;
  padding: 1.6rem 1.7rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.research-card-eyebrow {
  font: var(--microlabel);
  letter-spacing: var(--microlabel-ls);
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.5rem;
}
.research-card-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  line-height: 1.2;
  color: var(--text);
  margin: 0 0 1.1rem;
}
.research-card-open {
  background: var(--gold-dim);
  color: var(--gold);
  border: 1px solid rgba(217, 169, 103, 0.4);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font: 600 0.85rem var(--font-ui);
  cursor: pointer;
}
.research-card-open:hover { background: rgba(217, 169, 103, 0.22); }

.rx-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--ink);
  display: none;
  overflow: hidden;
}
.rx-overlay.visible { display: block; }
body.rx-open { overflow: hidden; }

.rx-close {
  position: absolute;
  top: 16px;
  right: 18px;
  z-index: 2;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
}
.rx-close:hover { color: var(--text); background: var(--panel-2); }

.research-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-rows: minmax(0, 1fr); /* pin the row to viewport height so children can scroll */
  height: 100%;
}
@media (max-width: 860px) {
  .research-layout { grid-template-columns: 1fr; }
  .rx-sidebar { display: none; }
}

.rx-main { min-width: 0; min-height: 0; height: 100%; }
.rx-scroll {
  height: 100%;
  overflow-y: auto;
  padding: 3.2rem clamp(1.1rem, 5vw, 3rem) 4rem;
  max-width: 56rem;
  margin: 0 auto;
}

.rx-eyebrow {
  font: var(--microlabel);
  letter-spacing: var(--microlabel-ls);
  text-transform: uppercase;
  color: var(--gold);
}
.rx-topic {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2.15rem);
  line-height: 1.15;
  color: var(--text);
  margin: 0.5rem 0 0;
}

.rx-controls { display: flex; gap: 0.6rem; margin-top: 1rem; flex-wrap: wrap; }
.rx-select {
  background: var(--panel);
  color: var(--text-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  font: 500 0.82rem var(--font-ui);
  cursor: pointer;
}
.rx-select:focus { outline: 1px solid var(--gold); }

/* perspective chips */
.rx-chips { display: flex; gap: 0.55rem; margin: 1.5rem 0 0.5rem; flex-wrap: wrap; }
.rx-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 0.8rem;
  color: var(--muted);
}
.rx-chip-name { font-weight: 600; color: var(--text-soft); }
.rx-chip-angle { font-size: 0.72rem; color: var(--faint); }
.rx-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.rx-chip.loading .rx-dot { background: var(--gold); animation: rx-pulse 1s ease-in-out infinite; }
.rx-chip.loading { border-color: rgba(217, 169, 103, 0.4); }
.rx-chip.done .rx-dot { background: var(--teal); }
@keyframes rx-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

/* tabs */
.rx-tabs { display: flex; gap: 0.3rem; border-bottom: 1px solid var(--line); margin: 1.2rem 0 1.4rem; }
.rx-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 0.5rem 0.7rem;
  font: 600 0.82rem var(--font-ui);
  cursor: pointer;
  margin-bottom: -1px;
}
.rx-tab:hover { color: var(--text-soft); }
.rx-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

/* prose panels */
.rx-panel { font-family: var(--font-prose); color: var(--text-soft); line-height: 1.72; font-size: 1.02rem; }
.rx-panel h2 {
  font-family: var(--font-display);
  color: var(--text);
  font-size: 1.28rem;
  margin: 1.8rem 0 0.6rem;
}
.rx-panel h3 { color: var(--text); font-size: 1.08rem; margin: 1.3rem 0 0.4rem; }
.rx-panel p { margin: 0 0 0.9rem; }
.rx-panel ul, .rx-panel ol { margin: 0 0 0.9rem 1.2rem; }
.rx-panel code { font-family: var(--font-mono); font-size: 0.86em; background: var(--ink-deep); padding: 0.1em 0.35em; border-radius: 4px; }
.rx-panel pre { background: var(--ink-deep); padding: 0.9rem 1rem; border-radius: 8px; overflow-x: auto; }
.rx-panel a { color: var(--gold); }

.rx-caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  background: var(--gold);
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: rx-blink 1s step-end infinite;
}
@keyframes rx-blink { 50% { opacity: 0; } }

.rx-error { color: var(--red); }
.rx-notice { text-align: center; padding: 2rem 0; color: var(--muted); }
.rx-retry, .rx-export {
  background: var(--gold-dim);
  color: var(--gold);
  border: 1px solid rgba(217, 169, 103, 0.4);
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font: 600 0.85rem var(--font-ui);
  cursor: pointer;
}
.rx-retry:hover, .rx-export:hover { background: rgba(217, 169, 103, 0.22); }
.rx-export { margin-top: 2.4rem; }

/* charts */
.rx-charts { margin-top: 2.4rem; }
.rx-charts-head { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 1rem; }
.rx-gemini-badge {
  font: var(--microlabel);
  letter-spacing: var(--microlabel-ls);
  text-transform: uppercase;
  color: var(--violet);
  border: 1px solid rgba(167, 139, 219, 0.4);
  border-radius: 5px;
  padding: 0.2rem 0.45rem;
}
.rx-charts-title { font: 600 0.95rem var(--font-ui); color: var(--text); }
.rx-charts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 640px) { .rx-charts-grid { grid-template-columns: 1fr; } }
.rx-chart-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
}
.rx-chart-wide { grid-column: 1 / -1; }
.rx-chart-title { font: 600 0.9rem var(--font-ui); color: var(--text); }
.rx-chart-insight { font-size: 0.78rem; color: var(--muted); margin: 0.25rem 0 0.7rem; }
.rx-chart-holder { position: relative; width: 100%; }
.rx-chart-disclaimer { font-size: 0.74rem; color: var(--faint); font-style: italic; margin-top: 0.9rem; }
.rx-skeleton {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--panel-2), var(--line), var(--panel-2));
  background-size: 200% 100%;
  animation: rx-shimmer 1.4s linear infinite;
  margin: 0.5rem 0;
}
.rx-skeleton:last-child { width: 60%; }
@keyframes rx-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* sidebar */
.rx-sidebar {
  border-left: 1px solid var(--line);
  background: var(--ink-deep);
  padding: 3.2rem 1.3rem;
  overflow-y: auto;
  min-height: 0;
  height: 100%;
}
.rx-side-title {
  font: var(--microlabel);
  letter-spacing: var(--microlabel-ls);
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1rem;
}
.rx-questions { display: flex; flex-direction: column; gap: 0.6rem; }
.rx-question {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.7rem 0.8rem;
  color: var(--text-soft);
  font: 400 0.85rem/1.4 var(--font-ui);
  cursor: pointer;
}
.rx-question:hover { border-color: rgba(217, 169, 103, 0.4); background: var(--panel-2); }
.rx-q-num { color: var(--gold); font-weight: 600; flex: none; }
.rx-q-text { flex: 1; }
.rx-q-arrow { color: var(--faint); flex: none; }
.rx-empty { color: var(--faint); font-size: 0.85rem; }
