/* RFSX: X-style research stream
   Loaded only on RFSX.php via $extraCss.
*/

/* Hide the default OpenMel chrome on this page (we replace it with a 3-column layout). */
body.rfsx-page .site-header,
body.rfsx-page .site-footer {
  display: none;
}

body.rfsx-page {
  background: #000;
  /* Hint browsers to render native controls (select dropdowns) in dark mode. */
  color-scheme: dark;
}

body.rfsx-page main.wrap {
  max-width: 1300px;
  padding: 0;
}

/* Layout */
.rfsx-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 620px) 360px;
  gap: 18px;
  margin: 0 auto;
  min-height: 100vh;
}

@media (max-width: 1180px) {
  .rfsx-layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }
  .rfsx-side { display: none; }
}

@media (max-width: 760px) {
  .rfsx-layout {
    grid-template-columns: 1fr;
  }
  .rfsx-nav { display: none; }
  .rfsx-feedcol {
    border-left: none !important;
    border-right: none !important;
  }
}



/* Hide sidebar scrollbars (X-style). Side columns still scroll, but the scrollbar UI is hidden. */
.rfsx-nav,
.rfsx-side {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE 10+ */
}
.rfsx-nav::-webkit-scrollbar,
.rfsx-side::-webkit-scrollbar {
  width: 0;
  height: 0;
}
/* Left nav */
.rfsx-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 16px 10px;
  overflow-y: auto;
}

.rfsx-brand {
  margin: 6px 6px 18px;
}

.rfsx-brand-link {
  color: var(--text);
  font-weight: 800;
  font-size: 1.25rem;
  text-decoration: none;
}

.rfsx-brand-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.rfsx-navlinks {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rfsx-navsection {
  margin: 16px 12px 6px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: .3px;
  text-transform: uppercase;
}

.rfsx-navitem {
  display: block;
  padding: 10px 12px;
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
}

.rfsx-navitem:hover {
  background: rgba(255,255,255,0.06);
}

.rfsx-navitem.active {
  background: rgba(255,255,255,0.10);
}

.rfsx-navfoot {
  margin-top: 18px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.rfsx-navfoot a {
  color: var(--muted);
  text-decoration: none;
}

.rfsx-navfoot a:hover {
  text-decoration: underline;
}

/* Center feed */
.rfsx-feedcol {
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  min-height: 100vh;
}

.rfsx-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(0,0,0,0.80);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.rfsx-toprow {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 6px;
}

.rfsx-topleft {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rfsx-iconbtn {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 900;
  cursor: pointer;
}

.rfsx-iconbtn:hover {
  background: rgba(255,255,255,0.08);
}

.rfsx-title {
  font-weight: 900;
  font-size: 1.25rem;
}

/* (subtitle removed for production) */

.rfsx-mini {
  display: inline-block;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

/* Mobile top-right filters affordance */
.rfsx-filterlink {
  display: none;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}

.rfsx-filterlink:hover {
  background: rgba(255,255,255,0.08);
}

.rfsx-mini:hover {
  background: rgba(255,255,255,0.10);
}

.rfsx-filters-desktop {
  display: grid;
  grid-template-columns: 1fr 150px 160px 140px;
  gap: 10px;
  padding: 10px 16px 14px;
}

@media (max-width: 760px) {
  .rfsx-iconbtn { display: inline-flex; align-items:center; justify-content:center; }
  .rfsx-mini { display: none; }
  .rfsx-filterlink { display: inline-flex; align-items:center; justify-content:center; }
  /* On mobile, filters live in the hamburger modal. */
  .rfsx-filters-desktop { display: none; }
}

.rfsx-filters-desktop input,
.rfsx-filters-desktop select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  outline: none;
}

/* Custom (JS-enhanced) dropdowns: fixes white OS option menu on desktop */
.rfsx-selectwrap {
  position: relative;
  width: 100%;
}

.rfsx-selectwrap.is-enhanced select {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.rfsx-selectbtn {
  width: 100%;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  outline: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  font-weight: 800;
}

.rfsx-selectbtn:hover {
  border-color: rgba(255,255,255,0.22);
}

.rfsx-selectbtn .rfsx-selecthint {
  color: var(--muted);
  font-weight: 700;
}

.rfsx-selectmenu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 200;
  border: 1px solid var(--border);
  background: #000;
  border-radius: 16px;
  padding: 6px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.55);
  display: none;
  max-height: 320px;
  overflow: auto;
}

.rfsx-selectwrap.open .rfsx-selectmenu { display: block; }

.rfsx-selectopt {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 10px 10px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
}

.rfsx-selectopt:hover { background: rgba(255,255,255,0.06); }
.rfsx-selectopt.is-selected { background: rgba(255,255,255,0.12); }

.rfsx-filters-desktop input:focus,
.rfsx-filters-desktop select:focus {
  border-color: rgba(255,255,255,0.25);
}

.rfsx-feed {
  display: flex;
  flex-direction: column;
}

.rfsx-card {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}

.rfsx-card-link {
  display: block;
  color: var(--text);
  /* Some global site CSS is more specific (e.g., .wrap a {...}) so we force this off. */
  text-decoration: none !important;
}

.rfsx-card-link * {
  text-decoration: none !important;
}

.rfsx-card:hover {
  background: rgba(255,255,255,0.02);
}

.rfsx-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.rfsx-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.rfsx-card-title {
  margin: 10px 0 6px;
  font-size: 1.05rem;
  line-height: 1.35;
}

.rfsx-card-snippet {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

/* Mobile modal */
.rfsx-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
}

.rfsx-modal.open {
  display: block;
}

.rfsx-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
}

.rfsx-modal-panel {
  position: absolute;
  inset: 0;
  background: #000;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.rfsx-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.90);
  backdrop-filter: blur(12px);
}

.rfsx-modal-tabs {
  display: flex;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
}

.rfsx-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
  padding: 10px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.rfsx-tab.active {
  background: rgba(255,255,255,0.12);
  color: var(--text);
}

.rfsx-modal-close {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
}

.rfsx-modal-close:hover {
  background: rgba(255,255,255,0.08);
}

.rfsx-modal-body {
  padding: 12px;
  overflow-y: auto;
}

.rfsx-pane { display: none; }
.rfsx-pane.active { display: block; }

.rfsx-pane-title {
  font-weight: 900;
  font-size: 1.0rem;
  margin: 6px 0 10px;
}

.rfsx-pane-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rfsx-pane-foot {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.rfsx-pane-foot a { color: var(--muted); text-decoration: none; }
.rfsx-pane-foot a:hover { text-decoration: underline; }

.rfsx-filters-mobile {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rfsx-filters-mobile input,
.rfsx-filters-mobile select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  outline: none;
}

.rfsx-filters-mobile input:focus,
.rfsx-filters-mobile select:focus {
  border-color: rgba(255,255,255,0.25);
}

.rfsx-primary {
  display: inline-block;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  text-decoration: none;
  font-weight: 900;
}

.rfsx-primary:hover { background: rgba(255,255,255,0.10); }

.rfsx-clear {
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}

.rfsx-clear:hover { background: rgba(255,255,255,0.10); }

/* Lock background scroll when modal is open */
body.rfsx-modal-open {
  overflow: hidden;
}

/* The mobile modal is a mobile-only affordance; keep it hidden on desktop. */
@media (min-width: 761px) {
  .rfsx-modal { display: none !important; }
}

.rfsx-card-media {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255,255,255,0.02);
  aspect-ratio: 16 / 9;
}

.rfsx-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rfsx-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  align-items: center;
}

.rfsx-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  font-size: 1rem;
}

.rfsx-action.rfsx-action-wide {
  width: auto;
  padding: 0 12px;
  gap: 8px;
}

.rfsx-action-ico { font-size: 1rem; }

.rfsx-action-txt {
  font-size: 0.9rem;
  font-weight: 900;
  color: var(--muted);
}

.rfsx-action:hover .rfsx-action-txt { color: var(--text); }

@media (max-width: 760px) {
  .rfsx-action.rfsx-action-wide {
    width: 36px;
    padding: 0;
  }
  .rfsx-action-txt { display: none; }
}

.rfsx-action:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

.rfsx-loading,
.rfsx-empty,
.rfsx-noscript {
  padding: 18px 16px;
  color: var(--muted);
}

.rfsx-sentinel {
  height: 1px;
}

/* Badges */
.rfsx-badge {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: .3px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
  text-transform: uppercase;
}

/* Effect palette */
.rfsx-eff-harm { color: #ffd6d6; border-color: rgba(210,60,60,0.45); background: rgba(210,60,60,0.18); }
.rfsx-eff-mixed { color: #ffe1e9; border-color: rgba(240,138,160,0.45); background: rgba(240,138,160,0.16); }
.rfsx-eff-no_effect { color: #eaeaea; border-color: rgba(255,255,255,0.20); background: rgba(255,255,255,0.06); }
.rfsx-eff-unclear { color: #fff2c7; border-color: rgba(244,197,66,0.45); background: rgba(244,197,66,0.16); }
.rfsx-eff-benefit { color: #d6ffdd; border-color: rgba(47,179,68,0.45); background: rgba(47,179,68,0.16); }
.rfsx-eff-unknown { color: #e0e0e0; border-color: rgba(140,140,140,0.40); background: rgba(140,140,140,0.16); }

/* Evidence palette */
.rfsx-ev-high { color: #d6ffdd; border-color: rgba(47,179,68,0.45); background: rgba(47,179,68,0.16); }
.rfsx-ev-moderate { color: #d8fff8; border-color: rgba(76,201,176,0.45); background: rgba(76,201,176,0.14); }
.rfsx-ev-low { color: #fff2c7; border-color: rgba(244,197,66,0.45); background: rgba(244,197,66,0.16); }
.rfsx-ev-very_low { color: #ffe7d1; border-color: rgba(240,138,36,0.45); background: rgba(240,138,36,0.14); }
.rfsx-ev-insufficient { color: #ffd6d6; border-color: rgba(210,60,60,0.45); background: rgba(210,60,60,0.18); }
.rfsx-ev-unknown { color: #e0e0e0; border-color: rgba(140,140,140,0.40); background: rgba(140,140,140,0.16); }

/* Right sidebar */
.rfsx-side {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 16px 10px;
  overflow-y: auto;
}

.rfsx-sidecard {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 14px;
}

.rfsx-side-title {
  font-weight: 900;
  margin-bottom: 10px;
}

.rfsx-kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.rfsx-kv:last-child {
  border-bottom: none;
}

.rfsx-kv span {
  color: var(--muted);
  font-size: 0.95rem;
}

.rfsx-kv strong {
  font-size: 1.05rem;
}

.rfsx-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rfsx-chip {
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 750;
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.rfsx-chip:hover {
  background: rgba(255,255,255,0.06);
}

.rfsx-chip-count {
  color: var(--muted);
  font-weight: 900;
  font-size: 0.9rem;
}

.rfsx-side-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}
