/* MHP Research - styles. Same palette and type as the Library. */
.mhp-rs {
  --rs-ink: var(--theme-text-color, #0F172A);
  --rs-soft: var(--theme-palette-color-2, #334155);
  --rs-muted: #6B6B73;
  --rs-bronze: #7D6752;
  --rs-gold: #C5A059;
  --rs-sage: var(--relic-tag-main, #ACBFB1);
  --rs-panel: #FFFFFF;
  --rs-line: rgba(15, 23, 42, 0.15);
  --rs-btn: #0F172A;
  --rs-btn-ink: #F9F7F2;
  --rs-label-font: "Cinzel", serif;
  color: var(--rs-ink); font-size: 1.25rem; line-height: 1.5; max-width: 1100px; margin-inline: auto;
}
:root[data-color-mode*="dark"] .mhp-rs {
  --rs-soft: #CBD5E1; --rs-muted: #94A3B8; --rs-bronze: #C5A059; --rs-panel: #1E293B; --rs-line: rgba(249, 247, 242, 0.16);
  --rs-btn: #C5A059; --rs-btn-ink: #0F172A;
}
@media (prefers-color-scheme: dark) {
  :root[data-color-mode*="os-default"] .mhp-rs {
    --rs-soft: #CBD5E1; --rs-muted: #94A3B8; --rs-bronze: #C5A059; --rs-panel: #1E293B; --rs-line: rgba(249, 247, 242, 0.16);
    --rs-btn: #C5A059; --rs-btn-ink: #0F172A;
  }
}
.mhp-rs *, .mhp-rs *::before { box-sizing: border-box; }
.mhp-rs a { color: inherit; text-decoration-color: var(--rs-gold); text-underline-offset: 3px; }
.mhp-rs a:hover { color: var(--rs-bronze); }
.mhp-rs [hidden] { display: none !important; }
.mhp-rs h2 { font-size: 2rem; line-height: 1.2; margin: 0.2rem 0 0.6rem; }
.mhp-rs h2:focus { outline: none; }
.mhp-rs__label, .mhp-rs__crumbs, .mhp-rs__epnum, .mhp-rs__meta, .mhp-rs__btn, .mhp-rs__dl dt, .mhp-rs__h3, .mhp-rs__legend {
  font-family: var(--rs-label-font); font-variant: small-caps; letter-spacing: 0.1em;
}
.mhp-rs__label { margin: 0; font-size: 1rem; color: var(--rs-bronze); }
.mhp-rs__crumbs { font-size: 0.95rem; color: var(--rs-muted); margin: 0 0 1.25rem; }
.mhp-rs__crumbs a { text-decoration: none; }
.mhp-rs__head { margin-bottom: 1.5rem; }
.mhp-rs__lede { color: var(--rs-soft); margin: 0 0 1rem; max-width: 46rem; }
.mhp-rs__empty { text-align: center; color: var(--rs-muted); font-style: italic; padding: 3rem 0; }
.mhp-rs__btn { display: inline-block; padding: 0.45rem 1.1rem; background: var(--rs-btn); color: var(--rs-btn-ink) !important; text-decoration: none; border-radius: 3px; font-size: 0.95rem; }
.mhp-rs__btn:hover { opacity: 0.88; }

/* index */
.mhp-rs__eps { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.mhp-rs__eps a { display: flex; flex-direction: column; gap: 0.35rem; padding: 1.1rem 1.25rem; background: var(--rs-panel); border: 1px solid var(--rs-line); border-top: 3px solid var(--rs-gold); text-decoration: none; height: 100%; }
.mhp-rs__epnum { font-size: 0.9rem; color: var(--rs-bronze); }
.mhp-rs__eptitle { font-size: 1.3rem; font-weight: 600; line-height: 1.25; }
.mhp-rs__q { font-size: 1.05rem; color: var(--rs-soft); }
.mhp-rs__meta { font-size: 0.85rem; color: var(--rs-muted); margin-top: auto; }

/* episode */
.mhp-rs__act { margin: 2rem 0; }
.mhp-rs__h3 { font-size: 1.15rem; color: var(--rs-bronze); margin: 2rem 0 0.75rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--rs-line); }
.mhp-rs__h3 a { text-decoration: none; }
.mhp-rs__h4 { font-size: 1.15rem; margin: 1.25rem 0 0.4rem; font-style: italic; font-weight: 600; }
.mhp-rs__facts { margin: 0 0 0.5rem; padding-left: 1.2rem; }
.mhp-rs__facts li { margin: 0.3rem 0; }
.mhp-rs__facts a { text-decoration: none; }
.mhp-rs__facts a:hover { text-decoration: underline; }
.mhp-rs__cite { white-space: nowrap; font-size: 0.9rem; color: var(--rs-muted); }

/* fact */
.mhp-rs__fact { background: var(--rs-panel); border: 1px solid var(--rs-line); border-left: 4px solid var(--rs-gold); padding: 1.5rem 1.75rem; margin-bottom: 1.5rem; }
.mhp-rs__claim { font-size: 1.6rem !important; font-weight: 500; }
.mhp-rs__words { margin: 1rem 0; padding: 0.25rem 0 0.25rem 1rem; border-left: 2px solid var(--rs-sage); color: var(--rs-soft); font-style: italic; }
.mhp-rs__dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.25rem; margin: 1rem 0; }
.mhp-rs__dl dt { font-size: 0.9rem; color: var(--rs-bronze); padding-top: 0.2rem; }
.mhp-rs__dl dd { margin: 0; }
.mhp-rs__sec { font-style: italic; }
.mhp-rs__actions { margin: 1rem 0 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* graph (drawn on a canvas; colours come from the --rs- variables above) */
.mhp-rs__graph { position: relative; background: var(--rs-panel); border: 1px solid var(--rs-line); margin: 1rem 0 1.5rem; overflow: hidden; }
.mhp-rs__graph canvas { display: block; width: 100%; cursor: grab; touch-action: pan-y; }
.mhp-rs__graph--full canvas { touch-action: none; }
.mhp-rs__graph canvas:active { cursor: grabbing; }
.mhp-rs__graph canvas:focus-visible { outline: 2px solid var(--rs-gold); outline-offset: -2px; }
.mhp-rs__gtools { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; gap: 4px; }
.mhp-rs__gtools button { width: 30px; height: 30px; padding: 0; border: 1px solid var(--rs-line); background: var(--rs-panel); color: var(--rs-ink); font-size: 16px; line-height: 1; border-radius: 4px; cursor: pointer; }
.mhp-rs__gtools button:hover { border-color: var(--rs-gold); }
.mhp-rs__tip { position: absolute; max-width: 320px; padding: 0.4rem 0.6rem; background: var(--rs-btn); color: var(--rs-btn-ink); font-size: 0.9rem; line-height: 1.35; pointer-events: none; border-radius: 3px; z-index: 3; }
.mhp-rs__legend { display: flex; gap: 1.25rem; flex-wrap: wrap; font-size: 0.9rem; color: var(--rs-soft); }
.mhp-rs__legend span::before { content: ""; display: inline-block; width: 0.7em; height: 0.7em; border-radius: 50%; margin-right: 0.4em; vertical-align: 0.05em; }
.mhp-rs__legend .k-ep::before { background: var(--rs-ink); }
.mhp-rs__legend .k-sec::before { background: var(--rs-sage); }
.mhp-rs__legend .k-fact::before { background: var(--rs-gold); }
.mhp-rs__legend .k-src::before { background: var(--rs-bronze); }
@media (max-width: 640px) {
  .mhp-rs { font-size: 1.1rem; }
  .mhp-rs__fact { padding: 1.1rem; }
  .mhp-rs__dl { grid-template-columns: 1fr; }
}

/* citation popover on episode posts */
.mhp-fnpop {
  position: absolute; z-index: 9999; padding: 0.9rem 1rem; background: #FFFFFF; color: #0F172A;
  border: 1px solid rgba(15, 23, 42, 0.15); border-top: 3px solid #C5A059; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  font-size: 1rem; line-height: 1.4; border-radius: 3px;
}
.mhp-fnpop[hidden] { display: none; }
:root[data-color-mode*="dark"] .mhp-fnpop { background: #1E293B; color: #F9F7F2; border-color: rgba(249, 247, 242, 0.16); border-top-color: #C5A059; }
.mhp-fnpop__cite { margin: 0 0 0.5rem; font-family: "Cinzel", serif; font-variant: small-caps; letter-spacing: 0.06em; font-size: 0.9rem; color: #7D6752; }
:root[data-color-mode*="dark"] .mhp-fnpop__cite { color: #C5A059; }
.mhp-fnpop__fact { display: block; color: inherit !important; text-decoration: none; padding: 0.4rem 0; border-top: 1px solid rgba(15, 23, 42, 0.1); }
.mhp-fnpop__fact span { display: block; margin-top: 0.25rem; font-size: 0.9rem; color: #7D6752; }
.mhp-fnpop__fact:hover span { text-decoration: underline; }
.mhp-fnpop__more { margin: 0.5rem 0 0; font-size: 0.85rem; }
.mhp-fnpop__more a { color: inherit; text-decoration-color: #C5A059; }
