"""Light shared styles (no heavy themes; keeps default Streamlit + plotly_white)."""
from __future__ import annotations
import streamlit as st
# Feature Insights multipage hub: same title + tagline on every sub-page.
FEATURE_INSIGHTS_TITLE = "Feature Insights"
FEATURE_INSIGHTS_CAPTION = (
"Latent-shift probes, attention rollout, and combined rankings across RNA, ATAC, and Flux."
)
def inject_app_styles() -> None:
"""Panel labels, page background, and shared chrome (all pages)."""
st.markdown(
"""
""",
unsafe_allow_html=True,
)
def plot_help_popover(
help_md: str,
*,
key: str,
page_link: tuple[str, str] | None = None,
) -> None:
"""Small help control next to a figure; opens Markdown guidance for biologists.
If ``page_link`` is ``(path, label)``, a ``st.page_link`` is rendered after the markdown
(e.g. ``("pages/1_Single_Cell_Explorer.py", "Single-Cell Explorer")``).
"""
with st.popover(
" ",
help="What does this figure show?",
icon=":material/help_outline:",
type="tertiary",
width="content",
key=key,
):
st.markdown(help_md)
if page_link:
page_path, page_label = page_link
st.page_link(page_path, label=page_label)
def plot_caption_with_help(caption: str, help_md: str, *, key: str) -> None:
"""One-line caption with an aligned help popover (typical layout above a chart)."""
try:
cap_col, help_col = st.columns([0.9, 0.1], gap="small", vertical_alignment="center")
except TypeError:
cap_col, help_col = st.columns([0.9, 0.1], gap="small")
with cap_col:
st.caption(caption)
with help_col:
plot_help_popover(help_md, key=key)
def inject_home_landing_styles() -> None:
"""Hero, nav cards, and section labels (home page only)."""
st.markdown(
"""
""",
unsafe_allow_html=True,
)