/* Liddelow Lab data portal.
   One stylesheet for the landing page and every dataset page, so the whole
   portal reads as one thing. No framework, no build step. */

:root {
  --ink: #1d1b20;
  --ink-2: #46424f;
  --muted: #6f6b7a;
  --line: #e5e2ea;
  --line-2: #efedf3;
  /* The sticky top bar, which the dataset menu sizes itself against. */
  --topbar-h: 56px;
  --surface: #ffffff;
  --bg: #faf9fc;

  --brand: #4a2e63;
  --brand-2: #6d4b91;
  --brand-soft: #f4effa;
  --brand-line: #e0d4ee;

  --ok: #1f7a52;
  --warn: #a5570c;
  --danger: #b3261e;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(29, 27, 32, .05), 0 6px 18px rgba(29, 27, 32, .05);
  --shadow-lift: 0 2px 4px rgba(29, 27, 32, .06), 0 14px 34px rgba(29, 27, 32, .1);

  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* Several components below set `display`, which would otherwise win over the
   [hidden] attribute the pages use to show and hide sections. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 650; letter-spacing: -.011em; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }
h5 { font-size: .93rem; }
p { margin: 0 0 .9rem; }
a { color: var(--brand-2); text-underline-offset: 2px; }
a:hover { color: var(--brand); }
code, .mono { font-family: var(--mono); font-size: .9em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.6rem 0; }

.wrap { max-width: 1360px; margin: 0 auto; padding: 0 1.25rem; }
.narrow { max-width: 900px; }

/* ---------------------------------------------------------------- top bar */

.topbar {
  position: sticky; top: 0; z-index: 60;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 2px 12px rgba(29, 27, 32, .18);
}
.topbar .wrap { display: flex; align-items: center; gap: 1rem; height: var(--topbar-h); }
.topbar a { color: #fff; text-decoration: none; }
.brand { display: flex; align-items: baseline; gap: .55rem; font-weight: 700; letter-spacing: -.01em; }
.brand .mark { font-size: 1.05rem; }
.brand .sub { font-size: .78rem; font-weight: 500; opacity: .72; letter-spacing: .04em; text-transform: uppercase; }

.topnav { margin-left: auto; display: flex; align-items: center; gap: .2rem; }
.topnav > a, .topnav > .navmenu > button {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .38rem .7rem; border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 500; color: #fff;
  background: transparent; border: 0; cursor: pointer; font-family: inherit;
}
.topnav > a:hover, .topnav > .navmenu > button:hover { background: rgba(255, 255, 255, .14); }
.topnav > a[aria-current="page"] { background: rgba(255, 255, 255, .2); }

.navmenu { position: relative; }
.navmenu > button::after { content: "▾"; font-size: .7em; opacity: .8; }
/* Capped at the space below the bar and scrolled past that, so the list stays
   reachable however many datasets the registry grows to. */
.navmenu .menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 310px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lift); padding: .35rem;
  max-height: calc(100vh - var(--topbar-h) - 1.4rem);
  overflow: hidden auto; overscroll-behavior: contain;
}
.navmenu .menu a {
  display: block; padding: .5rem .6rem; border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none; font-size: .88rem;
}
.navmenu .menu a:hover { background: var(--brand-soft); }
.navmenu .menu a .m-sub { display: block; font-size: .78rem; color: var(--muted); }
.navmenu .menu a[aria-current="page"] { background: var(--brand-soft); font-weight: 600; }
.navmenu .menu hr { margin: .35rem .3rem; }
.navmenu .menu .m-head {
  padding: .45rem .6rem .2rem; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); font-weight: 700;
  /* Held at the top of the scroll, so a long list never loses its section. */
  position: sticky; top: -.35rem; background: var(--surface); z-index: 1;
}

/* On a phone the bar has room for the wordmark and the dataset menu only.
   The menu still lists every dataset, so nothing becomes unreachable. */
@media (max-width: 620px) {
  :root { --topbar-h: 52px; }
  .topbar .wrap { gap: .5rem; }
  .brand .sub { display: none; }
  .topnav > a { display: none; }
  .navmenu .menu { min-width: min(88vw, 320px); }
  .navmenu > button {
    max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    display: inline-block;
  }
}

/* ------------------------------------------------------------- landing page */

.hero { padding: 3rem 0 1.75rem; }
.hero h1 { font-size: 2.35rem; max-width: 22ch; }
.hero .lede { font-size: 1.06rem; color: var(--ink-2); max-width: 68ch; }
.hero .counts { display: flex; gap: 1.75rem; margin-top: 1.4rem; flex-wrap: wrap; }
.hero .counts div { display: flex; flex-direction: column; }
.hero .counts b { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.hero .counts span { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.filters {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem 1.1rem .7rem; margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.filters .frow { display: flex; gap: .8rem; align-items: flex-start; flex-wrap: wrap; margin-bottom: .65rem; }
.filters .flabel {
  flex: 0 0 92px; font-size: .78rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; padding-top: .42rem;
}
.filters .chips { display: flex; flex-wrap: wrap; gap: .38rem; flex: 1 1 auto; min-width: 0; }
.chip-toggle {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; padding: .24rem .7rem; font-size: .83rem; font-family: inherit;
  cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, color .12s;
}
.chip-toggle:hover { border-color: var(--brand-line); background: var(--brand-soft); }
.chip-toggle[aria-pressed="true"] {
  background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 550;
}
.chip-toggle .n { opacity: .6; margin-left: .3rem; font-variant-numeric: tabular-nums; }

.filters .foot {
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  border-top: 1px solid var(--line-2); margin-top: .3rem; padding-top: .6rem;
}
.filters .foot .count { font-size: .85rem; color: var(--muted); }
.search-box { position: relative; flex: 1 1 240px; max-width: 340px; }
.search-box input {
  width: 100%; font: inherit; font-size: .9rem; padding: .4rem .7rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.search-box input:focus { outline: 2px solid var(--brand-line); border-color: var(--brand-2); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 1.1rem; }
.card {
  display: flex; flex-direction: column; position: relative;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.05rem 1.1rem 1rem; box-shadow: var(--shadow);
  transition: box-shadow .15s, transform .15s, border-color .15s;
}
.card:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); border-color: var(--brand-line); }
.card .year {
  font-size: .74rem; font-weight: 700; letter-spacing: .06em; color: var(--brand-2);
  text-transform: uppercase;
}
.card h3 { margin: .1rem 0 .35rem; font-size: 1.06rem; }
/* Where a dataset comes from, when that is worth saying (the Barres lab's
   resources): a small outlined tag in the card's top-right corner and beside
   the dataset page's title. */
.origin {
  display: inline-block; font-size: .66rem; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: #8a5a00; background: #fff6e0; border: 1px solid #efd9a3;
  border-radius: 999px; padding: .12rem .5rem; vertical-align: middle; white-space: nowrap;
}
.card .year.with-origin { display: flex; align-items: center; gap: .6rem; }
.card .year.with-origin .origin { margin-left: auto; flex: 0 0 auto; }
.dshead h1 .origin { font-size: .62rem; margin-left: .5rem; position: relative; top: -.15em; }
.dshead .titleblock.multi-cite .cite { margin-bottom: .1rem; }
.dshead .titleblock.multi-cite .cite:last-of-type { margin-bottom: .7rem; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card .desc { font-size: .875rem; color: var(--ink-2); margin: 0 0 .75rem; }
.card .badges { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .8rem; }
.card .stats {
  margin: auto 0 .5rem; font-size: .8rem; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.card .foot {
  margin-top: auto; display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  border-top: 1px solid var(--line-2); padding-top: .6rem; font-size: .8rem;
}
.card .stats + .foot { margin-top: 0; }
.card .foot a { position: relative; z-index: 1; color: var(--muted); }
/* The paper link: a small outlined pill, so it reads as a second action beside
   Explore rather than as footnote text. */
.card .foot .paper-link {
  font: inherit; font-weight: 600; color: var(--brand); text-decoration: none; cursor: pointer;
  background: transparent; line-height: inherit;
  border: 1px solid var(--brand-line); border-radius: 999px; padding: .2rem .7rem;
  transition: background .15s;
}
.card .foot .paper-link:hover,
.card .foot .paper-link[aria-expanded="true"] { background: var(--brand-soft); }
.card .foot .paper-menu { position: relative; z-index: 2; }
.card.menu-open { z-index: 20; }
.card .hosted-at {
  align-self: flex-start; margin: 0 0 .7rem; font-size: .76rem; font-weight: 600;
  color: var(--ink-2); background: var(--line-2); border-radius: 999px; padding: .12rem .6rem;
}
.card .go {
  margin-left: auto; font-weight: 600; color: var(--brand-2); display: inline-flex; gap: .25rem;
}
.card.external { background: linear-gradient(180deg, #fff 0%, #fcfbfd 100%); }
.card.external .go { color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; gap: .28rem;
  font-size: .74rem; font-weight: 600; letter-spacing: .01em;
  padding: .16rem .5rem; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge.species { background: #eef4fb; color: #1d4e79; border-color: #d7e6f5; }
.badge.model { background: #eef7f6; color: #1f5f5a; border-color: #d5ebe8; }
.badge.celltype { background: #f0f6ef; color: #2b5c2e; border-color: #dcebda; }
.badge.assay { background: #f6f1fb; color: #5c3a80; border-color: #e7dbf3; }
.badge.context { background: #fdf3ec; color: #8a4a12; border-color: #f6e2d2; }
.badge.plain { background: var(--line-2); color: var(--ink-2); border-color: var(--line); }

.section-head { display: flex; align-items: baseline; gap: .8rem; margin: 2.4rem 0 1rem; }
.section-head h2 { margin: 0; }
.section-head p { margin: 0; color: var(--muted); font-size: .88rem; }
.section-head { flex-wrap: wrap; row-gap: .2rem; }
.section-head.first { margin-top: .4rem; }

.empty-state {
  grid-column: 1 / -1; text-align: center; padding: 3rem 1rem; color: var(--muted);
  border: 1px dashed var(--line); border-radius: var(--radius);
}

.sitefoot {
  margin-top: 4rem; border-top: 1px solid var(--line); background: var(--surface);
  padding: 2rem 0; color: var(--muted); font-size: .85rem;
}
.sitefoot .wrap { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: center; }
.sitefoot a { color: var(--ink-2); }

/* ------------------------------------------------------------ dataset page */

.dshead { background: var(--surface); border-bottom: 1px solid var(--line); padding: 1.6rem 0 1.3rem; }
.dshead h1 { font-size: 1.6rem; margin-bottom: .3rem; }
.dshead .cite { color: var(--muted); font-size: .95rem; margin: 0 0 .7rem; }
.dshead .badges { display: flex; flex-wrap: wrap; gap: .35rem; }
.dshead .links { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* The Paper button's menu: journal and PubMed Central, styled after the
   dataset menu in the top bar. */
.paper-menu { position: relative; }
/* A step up from the plain .btn: it is the one way out to the study itself. */
.btn.paper {
  font-size: .95rem; font-weight: 600; padding: .45rem 1rem;
  border-color: var(--brand-line); color: var(--brand);
}
.btn.paper:hover, .btn.paper[aria-expanded="true"] { background: var(--brand-soft); }
.paper-menu .menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lift); padding: .35rem;
}
.paper-menu .menu a {
  display: block; padding: .5rem .6rem; border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none; font-size: .88rem; white-space: nowrap;
}
.paper-menu .menu a:hover { background: var(--brand-soft); }
.paper-menu.align-left .menu { left: 0; right: auto; }
.paper-menu .menu .m-sub { display: block; font-size: .78rem; color: var(--muted); }
.dshead .wrap { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.dshead .titleblock { flex: 1 1 460px; min-width: 0; }

/* padding-block only: the shorthand would drop the horizontal padding
   `.wrap` sets on the same element. */
.layout { display: flex; gap: 1.6rem; align-items: flex-start; padding-block: 1.5rem 4rem; }
/* Wide enough for the longest select option a dataset offers -- "Explore
   disease-associated DEGs" was being clipped at 288px. */
.side {
  flex: 0 0 328px; position: sticky; top: 72px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; box-shadow: var(--shadow);
  max-height: calc(100vh - 88px); overflow-y: auto;
}
.main { flex: 1 1 auto; min-width: 0; }

@media (max-width: 980px) {
  .layout { flex-direction: column; }
  .side { flex: 1 1 auto; width: 100%; position: static; max-height: none; }
  /* Stacked, the column's items are aligned to the start and would otherwise
     size to their own content -- the tab strip's natural width -- and push the
     page sideways. Held to the screen so the strip scrolls instead. */
  .main { width: 100%; }
}

.field { margin-bottom: 1.1rem; }
.field > label, .field > .lab {
  display: block; font-size: .78rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: .35rem;
}
.field .hint { font-size: .8rem; color: var(--muted); margin: .35rem 0 0; }

select.control, input.control {
  width: 100%; font: inherit; font-size: .92rem; padding: .42rem .6rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
}
select.control:focus, input.control:focus { outline: 2px solid var(--brand-line); border-color: var(--brand-2); }

.radio-list label, .cbg label {
  display: flex; align-items: center; gap: .4rem; font-size: .9rem;
  padding: .12rem 0; cursor: pointer;
}
.cbg { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: .1rem .4rem; }
.cbg-actions { display: flex; gap: .6rem; margin-bottom: .3rem; }
.link-btn {
  border: 0; background: none; padding: 0; font: inherit; font-size: .8rem;
  color: var(--brand-2); cursor: pointer; text-decoration: underline;
}

.thr-label { font-size: .82rem; color: var(--ink-2); margin-bottom: .2rem; }
.slider { display: flex; align-items: center; gap: .6rem; }
.slider input[type=range] { flex: 1; accent-color: var(--brand-2); }
.slider output {
  min-width: 2.9rem; text-align: center; font-size: .82rem; font-variant-numeric: tabular-nums;
  background: var(--brand-2); color: #fff; border-radius: 999px; padding: .05rem .45rem;
}

/* combo box (stands in for Shiny's selectize) */
.combo { position: relative; }
.combo input {
  width: 100%; font: inherit; font-size: .92rem; padding: .42rem .6rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.combo input:focus { outline: 2px solid var(--brand-line); border-color: var(--brand-2); }
.combo .options {
  position: absolute; z-index: 50; left: 0; right: 0; top: 100%;
  max-height: 340px; overflow-y: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift); margin-top: 3px;
}
/* In the sidebar the list takes its place in the flow instead of floating.
   The sidebar scrolls (overflow-y: auto) so a tall one stays reachable, and a
   scroll container clips anything positioned outside it: floated, the list was
   cut to the sidebar's own height and showed a single row. In flow, the sidebar
   grows to hold it. */
.side .combo .options { position: static; }
.combo .options div { padding: .3rem .6rem; cursor: pointer; font-size: .9rem; }
.combo .options div:hover, .combo .options div.active { background: var(--brand-2); color: #fff; }
.combo .options div.none {
  color: var(--muted); font-style: italic; cursor: default; background: none;
}
.combo .chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .35rem; }
.combo .chip {
  background: var(--brand-soft); color: var(--brand); border: 1px solid var(--brand-line);
  border-radius: 999px; padding: .1rem .3rem .1rem .55rem; font-size: .82rem; font-weight: 550;
  display: inline-flex; gap: .25rem; align-items: center;
}
.combo .chip button {
  border: 0; background: none; cursor: pointer; padding: 0 .2rem; color: var(--brand-2);
  font-size: 1rem; line-height: 1;
}

/* The one control that switches a whole page between two framings of the same
   data. Deliberately more prominent than a sidebar field: everything below it
   changes when it does. */
.view-switch {
  display: flex; align-items: center; justify-content: center; gap: .75rem;
  flex-wrap: wrap; margin: 0 0 1.2rem;
}
.view-switch-label {
  font-size: .78rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
}
.segmented {
  display: inline-flex; background: var(--line-2); border-radius: 999px; padding: 3px;
}
.segmented button {
  border: 0; background: none; font: inherit; font-size: .87rem; font-weight: 550;
  color: var(--muted); padding: .3rem .95rem; border-radius: 999px; cursor: pointer;
  white-space: nowrap;
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"] {
  background: var(--surface); color: var(--brand);
  box-shadow: 0 1px 2px rgba(29, 27, 32, .12);
}

/* Controls that belong to one figure sit directly above it, not in the page
   sidebar: they change that plot and nothing else, so that is where the hand
   should already be. */
.plot-controls {
  display: flex; flex-direction: column; gap: .3rem;
  margin: .1rem 0 .8rem; padding: .5rem .8rem;
  background: #fbfafc; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
}
.plot-controls .ctl-row {
  display: flex; align-items: center; gap: 1.2rem 2rem; flex-wrap: wrap;
  justify-content: space-between;
}
/* With two groups they take opposite ends of the strip; with one it just sits
   left, which is what space-between does with a single child. */
.plot-controls .ctl-row > .ctl:only-child { margin-right: auto; }
.plot-controls .ctl-row.stacked {
  flex-direction: column; align-items: flex-start; justify-content: flex-start;
  gap: .45rem;
}
/* A second caption line, for details of the experiment rather than of the
   figure -- doses, genotypes. Quieter than the caption it follows. */
.panel-head .caption.detail { font-size: .8rem; margin-top: .15rem; opacity: .85; }
.panel-head .caption.detail sup { font-size: .8em; }
/* Further lines about the figure itself -- the significance key, what the
   plot below shows -- read at the caption's own size. */
.panel-head .caption.detail.figure-line { font-size: .87rem; opacity: 1; }

/* Notes stack: each is a separate statement about the figure, and side by side
   two of them read as one run-on sentence. */
.plot-controls .ctl-notes { display: flex; flex-direction: column; gap: .25rem; }
.plot-controls .ctl-notes:empty { display: none; }
/* Wraps so a label and its slider can take two lines on a narrow screen rather
   than pushing the strip past the panel. */
.plot-controls .ctl { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.plot-controls .ctl-label {
  font-size: .78rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.plot-controls .ctl-slot { min-width: 150px; flex: 1 1 150px; }
.plot-controls .ctl-slot .slider { margin: 0; }
.plot-controls .ctl-check {
  font-size: .87rem; color: var(--ink-2); cursor: pointer; gap: .4rem;
}
.plot-controls .ctl-note { font-size: .8rem; color: var(--muted); }
.plot-controls .ctl-radio { display: flex; gap: .9rem; flex-wrap: wrap; }
.plot-controls .ctl-radio label {
  display: inline-flex; align-items: center; gap: .3rem; margin: 0;
  font-size: .87rem; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.plot-controls .ctl-radio input { margin: 0; accent-color: var(--brand-2); }

/* ------------------------------------------------------------------- panels */

/* Dataset pages sit on plain white and separate their sections with space and a
   hairline rather than with cards: a page of boxed figures reads as a dashboard,
   and these are figures to look at. The landing page keeps its cards, because
   there the boxes *are* the content. */
body.ds { background: var(--surface); }
body.ds .side {
  background: #fbfaFc; border: 1px solid var(--line); box-shadow: none;
}

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.2rem 1.2rem; margin-bottom: 1.25rem; box-shadow: var(--shadow);
}
body.ds .panel {
  background: none; border: 0; border-radius: 0; box-shadow: none;
  padding: 0; margin: 0 0 2.4rem;
}
body.ds .panel + .panel { border-top: 1px solid var(--line-2); padding-top: 1.6rem; }
.panel > h2, .panel > h3 { margin-top: 0; }
.panel .caption { color: var(--muted); font-size: .87rem; margin: -.25rem 0 .9rem; }
.panel-head {
  display: flex; align-items: flex-start; gap: 1rem; margin-bottom: .6rem; flex-wrap: wrap;
}
.panel-head > div:first-child { flex: 1 1 220px; min-width: 0; }
.panel-head .caption { margin: .1rem 0 0; }
.panel-head h3 { margin: 0; }
/* A gene symbol. Italic is the convention for one; in a heading it also takes
   the extra weight that keeps it picked out from the words around it. */
.gene { font-style: italic; }
.gene-name { font-weight: 800; font-style: italic; }

.panel-head .actions { margin-left: auto; display: flex; gap: .4rem; flex-shrink: 0; }

/* The analysis's verdict for the chosen gene, beside the heading it answers.
   Loud enough to read at a glance, since it is the answer to the question the
   card's title asks. */
.panel-head .call-badge {
  margin-left: auto; align-self: center; flex-shrink: 0;
  padding: .2rem .6rem; border-radius: 999px;
  font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid transparent; white-space: nowrap;
}
.panel-head .call-badge.up { background: #e6f4ec; color: #1f7a52; border-color: #b9e0cb; }
.panel-head .call-badge.down { background: #fdeceb; color: #b3261e; border-color: #f4c7c3; }
.panel-head .call-badge.none { background: var(--brand-soft); color: var(--muted); border-color: var(--line); }
.fig-actions { display: flex; justify-content: flex-end; gap: .4rem; margin: 0 0 .3rem; }
.fig-actions:empty { display: none; }
/* The download button is a quiet affordance, not a call to action: it only
   shows its outline once the pointer is on the figure or the button itself. */
body.ds .fig-actions .btn { border-color: transparent; color: var(--muted); }
body.ds .panel:hover .fig-actions .btn,
body.ds .fig-actions .btn:focus-visible { border-color: var(--line); }

.btn {
  display: inline-flex; align-items: center; gap: .35rem;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: var(--radius-sm); padding: .3rem .7rem; font: inherit; font-size: .84rem;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }

/* Scrolls sideways on a narrow screen, never up and down. The baseline is an
   inset shadow rather than a border, so the selected tab's underline can cover
   it without hanging a pixel below the strip -- that overhang is what made the
   strip scroll vertically, since a box that scrolls on one axis scrolls on both. */
.tabs {
  display: flex; gap: .25rem; box-shadow: inset 0 -1px 0 var(--line);
  margin-bottom: 1.25rem; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin;
  overscroll-behavior-x: contain;
}
.tabs button {
  border: 0; background: none; font: inherit; font-size: .93rem; font-weight: 550;
  color: var(--muted); padding: .55rem .9rem; cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; flex: 0 0 auto;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }

.fig-wrap { position: relative; max-width: 100%; overflow-x: auto; }
.fig-wrap canvas { display: block; }
.plot { min-height: 40px; }
.plot-note { color: var(--muted); font-size: .85rem; font-style: italic; padding: .8rem 0; }
.plot-busy { color: var(--muted); font-size: .88rem; padding: .8rem 0; }
.plot-busy::before {
  content: ""; display: inline-block; width: .7em; height: .7em; margin-right: .5em;
  border: 2px solid var(--brand-line); border-top-color: var(--brand-2); border-radius: 50%;
  animation: spin .7s linear infinite; vertical-align: -1px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Centred, as the Sadick Shiny app had it: the gene is the subject of the page,
   not a label in its top-left corner. */
.gene-head { margin: 0 0 1.4rem; text-align: center; }
.gene-head h2 { font-size: 1.55rem; margin-bottom: .1rem; font-style: italic; }
.gene-head h2 a { color: var(--ink); }
/* Molecules that are not genes (lipids, metabolites, proteins) are not italic. */
.gene-head.plain-head h2 { font-style: normal; }
.gene-head .desc { color: var(--ink-2); margin: 0 0 .2rem; }
.gene-head .syn { color: var(--muted); font-size: .87rem; margin: 0; }
.gene-head :empty { display: none; }
.gene-head .name-note { color: var(--ink-2); font-size: .88rem; max-width: 46rem; margin: .5rem auto 0; }
/* Zhang: the searched gene, then one row per species naming the gene that
   species' card shows. A row whose gene goes by another name is picked out. */
.pair-head .species-rows { display: inline-grid; gap: .3rem; margin: .7rem auto 0; text-align: left; }
.pair-head .species-row { display: flex; align-items: baseline; gap: .55rem; flex-wrap: wrap;
  font-size: .9rem; color: var(--ink-2); padding: .2rem .55rem; border-radius: 8px; }
.pair-head .species-row .sym { font-style: italic; font-weight: 700; color: var(--ink); }
.pair-head .species-row .desc { color: var(--muted); }
.pair-head .species-row .none { color: var(--muted); font-style: italic; }
.pair-head .species-row.differs { background: #fff6e0; box-shadow: inset 0 0 0 1px #efd9a3; }
.pair-head .species-row .linklike { font: inherit; font-style: italic; color: var(--brand-2); background: none;
  border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.sp-tag { font-size: .66rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--brand-2); background: var(--brand-soft); border-radius: 999px; padding: .1rem .5rem; min-width: 3.6rem; text-align: center; }
/* A card showing a gene under a different name from the one searched. */
.name-flag { display: flex; gap: .55rem; align-items: flex-start; margin: .55rem 0 0;
  padding: .5rem .7rem; border-radius: 8px; background: #fff6e0; border: 1px solid #efd9a3;
  color: #6b4a00; font-size: .88rem; font-weight: 550; }
.name-flag .icon { flex: 0 0 auto; width: 1.15rem; height: 1.15rem; border-radius: 50%; background: #c98a00;
  color: #fff; font-weight: 800; font-size: .75rem; display: grid; place-items: center; margin-top: .05rem; }
.gene-head .rat-note { color: var(--ink-2); font-size: .88rem; max-width: 46rem; margin: .5rem auto 0; }
.gene-head .rat-note .linklike, .plot-note .linklike { font: inherit; font-style: italic; color: var(--brand-2); background: none;
  border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.gene-head .rat-note .absent, .plot-note .absent { font-style: italic; color: var(--muted); }

.info dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.2rem; margin: 0; }
.info dt { font-weight: 650; color: var(--ink-2); }
.info dd { margin: 0; }

.callout {
  border-left: 3px solid var(--brand-line); background: var(--brand-soft);
  padding: .7rem .9rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .88rem; color: var(--ink-2); margin: 0 0 1rem;
}

/* ---------------------------------------------------------------- downloads */

.dl-list { display: flex; flex-direction: column; gap: .6rem; margin-top: .4rem; }
.dl-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1.2rem;
  padding: .8rem 1rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
}
.dl-name { font-weight: 600; }
.dl-sub { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.dl-object {
  border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem;
  background: var(--surface);
}
.dl-object-head { display: flex; align-items: baseline; gap: .7rem; flex-wrap: wrap; }
.dl-object .dl-name { font-size: 1rem; }
.dl-contents {
  margin: .5rem 0 .2rem; padding-left: 1.1rem; font-size: .86rem; color: var(--ink-2);
}
.dl-contents li { margin: .1rem 0; }
.dl-note { margin: .35rem 0 0; font-size: .82rem; color: #8a4a12; }
.dl-desc { margin: .4rem 0 0; font-size: .86rem; color: var(--ink-2); max-width: 78ch; }
.dl-section {
  margin: 1.3rem 0 .5rem; font-size: .76rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
}
.dl-section:first-of-type { margin-top: .6rem; }
.dl-buttons { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.dl-btn { display: inline-flex; align-items: baseline; gap: .55rem; text-decoration: none; }
.dl-btn::before { content: "↓"; font-weight: 700; }
/* A link out to a repository rather than a file: outlined, and it points away. */
.dl-btn.dl-link { border-color: var(--brand-line); color: var(--brand); background: var(--surface); }
.dl-btn.dl-link:hover { background: var(--brand-soft); }
.dl-btn.dl-link::before { content: none; }
.dl-btn.dl-link::after { content: "↗"; font-weight: 700; }
.dl-btn-size { font-size: .78rem; opacity: .8; font-variant-numeric: tabular-nums; }

/* --------------------------------------- collapsible significance detail ---- */

.sig { margin: .4rem 0 0; font-size: .85rem; }
.sig summary {
  cursor: pointer; color: var(--brand-2); width: fit-content;
  padding: .2rem 0; font-weight: 550;
}
.sig summary:hover { text-decoration: underline; }
/* The rows are nowrap, so on a narrow screen the table scrolls on its own
   rather than widening the page. */
.sig details { overflow-x: auto; }
.sig table { border-collapse: collapse; margin: .5rem 0 0; }
.sig th, .sig td {
  padding: .22rem .9rem .22rem 0; text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--line-2);
}
.sig th { font-weight: 600; color: var(--muted); font-size: .78rem; }
.sig td.num { text-align: right; font-variant-numeric: tabular-nums; }
.sig td.mark-up { color: var(--ok); font-weight: 700; text-align: center; }
.sig td.mark-down { color: var(--danger); font-weight: 700; text-align: center; }
.sig td.mark-none { color: var(--muted); text-align: center; }
.sig td.mark-star { color: var(--ink); font-weight: 700; text-align: center; white-space: nowrap; }
.sig .sig-caption { color: var(--muted); margin: .5rem 0 0; font-size: .8rem; }

/* ------------------------------------------------------- tables (DT stand-in) */

.dt-root { margin: .3rem 0 .2rem; font-size: .87rem; }
.dt-top { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: .5rem; }
.dt-buttons { display: flex; gap: .3rem; }
.dt-btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm);
  padding: .18rem .55rem; font-size: .8rem; font-family: inherit; cursor: pointer; color: var(--ink-2);
}
.dt-btn:hover { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand); }
.dt-length { margin-left: auto; font-size: .8rem; color: var(--muted); }
.dt-search { font-size: .8rem; color: var(--muted); }
.dt-length select, .dt-search input {
  font-family: inherit; font-size: .8rem; padding: .12rem .35rem; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.dt-caption { color: var(--muted); font-size: .82rem; margin: 0 0 .4rem; }
.dt-scroll { overflow-x: auto; border: 1px solid var(--line-2); border-radius: var(--radius-sm); }
.dt-table { width: 100%; border-collapse: collapse; }
.dt-table th, .dt-table td {
  padding: .38rem .6rem; border-bottom: 1px solid var(--line-2); text-align: left; white-space: nowrap;
}
.dt-table tbody tr:last-child td { border-bottom: 0; }
.dt-table th {
  background: #fbfafd; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none;
  position: sticky; top: 0; padding-right: 1.2rem; font-weight: 650; font-size: .82rem;
  color: var(--ink-2); letter-spacing: .01em;
}
.dt-table th.sort-asc::after { content: "▲"; position: absolute; right: .4rem; font-size: .58rem; opacity: .7; }
.dt-table th.sort-desc::after { content: "▼"; position: absolute; right: .4rem; font-size: .58rem; opacity: .7; }
.dt-table td.num { text-align: right; font-variant-numeric: tabular-nums; padding-right: 1.2rem; }
/* Numbers hug the right edge, so their headers do too; the sort arrow keeps the
   padding it already had beside the label. Numeric columns take only the width
   they need, leaving the rest to the text columns. */
.dt-table th.num { text-align: right; }
.dt-table th.num, .dt-table td.num { width: 1%; }
.dt-filter { display: flex; align-items: flex-start; gap: .6rem; margin: 0 0 .45rem; }
.dt-filter-label {
  flex: 0 0 auto; min-width: 5.2rem; padding-top: .3rem;
  font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em;
}
.dt-filter-chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.dt-filter .chip-toggle { padding: .14rem .6rem; font-size: .8rem; font-variant-numeric: tabular-nums; }
.dt-table tbody tr:hover { background: #fbfafd; }
.dt-table tbody tr.selected { background: var(--brand-soft); }
.dt-empty { color: var(--muted); font-style: italic; }
.dt-info { font-size: .8rem; color: var(--muted); margin-top: .45rem; }
.dt-pager { display: flex; flex-wrap: wrap; gap: .2rem; margin-top: .4rem; }
.dt-pager button {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm);
  padding: .12rem .5rem; font-size: .8rem; font-family: inherit; cursor: pointer; color: var(--ink-2);
}
.dt-pager button.current { background: var(--brand); border-color: var(--brand); color: #fff; }
.dt-pager button:disabled { opacity: .45; cursor: default; }
.dt-selection {
  display: flex; align-items: center; gap: .6rem; margin: .3rem 0 .1rem;
  font-size: .83rem; color: var(--ink-2);
}

.up { color: var(--ok); font-weight: 600; }
.down { color: var(--danger); font-weight: 600; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 1200px) { .grid2 { grid-template-columns: 1fr; } }

.err {
  border: 1px solid #f0c9c6; background: #fdf3f2; color: #8a2018;
  padding: .8rem 1rem; border-radius: var(--radius); margin: 1rem 0;
}

@media print {
  .topbar, .side, .btn, .dt-pager, .filters { display: none !important; }
  .panel { break-inside: avoid; box-shadow: none; }
}

/* Frazel: marker-gene quick picks in the sidebar, and a tab's lead paragraph. */
.marker-groups { display: flex; flex-direction: column; gap: .7rem; }
.marker-label {
  display: block; font-size: .72rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: .3rem;
}
.marker-chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.marker-chips .chip-toggle { padding: .16rem .55rem; font-size: .8rem; font-style: italic; }
.tab-intro { color: var(--ink-2); margin: .2rem 0 1rem; max-width: 70ch; }
.card .foot .paper-menu .menu a { color: var(--ink); text-decoration: none; }
.card .hosted-at a { position: relative; z-index: 2; color: inherit; }
.card .hosted-at a:hover { color: var(--brand); }

/* Prakash: the bar chart and the row of volcanoes share one card. */
.prakash-volcanoes { margin-top: 1.4rem; }
/* Prakash 2023: the bars and the volcano side by side, stacking when the card
   is too narrow for both. */
.p23-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1.4rem 1.5rem; }
.p23-row > div { min-width: 0; max-width: 100%; }
