/* ============================================================================
   NICHEVERSE docs - Beautiful Biology (beautifulbiology.org) visual language.
   Clean white paper, dark charcoal ink, all-sans (Inter), imagery-forward,
   generous whitespace, one restrained teal accent used only for links/CTA/hover.
   Overrides the pydata-sphinx-theme tokens; keeps sidebars + autodoc working.
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ---- Design tokens --------------------------------------------------------- */
:root {
  --nv-paper:  #ffffff;
  --nv-alt:    #f7f7f5;   /* alternate section band              */
  --nv-ink:    #1a1a1a;   /* primary text                        */
  --nv-mut:    #5c5f66;   /* muted / secondary text              */
  --nv-line:   #e7e7e4;   /* hairline borders                    */
  --nv-accent: #9a6a12;   /* single restrained amber accent       */
  --nv-accent-dk: #7a540c;
  --nv-shadow: 0 8px 28px rgba(20, 20, 20, 0.10);
  --nv-shadow-soft: 0 4px 16px rgba(20, 20, 20, 0.07);
  --nv-radius: 10px;
  --nv-maxw: 1120px;

  /* Fonts: Inter for everything, monospace only for code. */
  --nv-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nv-mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  /* pydata theme overrides */
  --pst-font-family-base: var(--nv-sans);
  --pst-font-family-heading: var(--nv-sans);
  --pst-font-family-monospace: var(--nv-mono);
  --pst-font-size-base: 16px;

  --pst-color-primary: #9a6a12;
  --pst-color-primary-highlight: #7a540c;
  --pst-color-secondary: #5c5f66;
  --pst-color-accent: #9a6a12;
  --pst-color-link: #9a6a12;
  --pst-color-link-hover: #7a540c;
  --pst-color-inline-code: #7a540c;

  --pst-color-background: #ffffff;
  --pst-color-on-background: #ffffff;
  --pst-color-surface: #ffffff;
  --pst-color-text-base: #1a1a1a;
  --pst-color-text-muted: #5c5f66;
  --pst-color-border: #e7e7e4;
  --pst-color-heading: #1a1a1a;
}

html[data-theme="dark"] {
  --nv-paper:  #000000;
  --nv-alt:    #0a0b0d;
  --nv-ink:    #e9ebee;
  --nv-mut:    #a2a7b0;
  --nv-line:   #1d2026;
  --nv-accent: #e0a63a;
  --nv-accent-dk: #efc370;
  --nv-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  --nv-shadow-soft: 0 4px 16px rgba(0, 0, 0, 0.4);

  --pst-color-primary: #e0a63a;
  --pst-color-primary-highlight: #efc370;
  --pst-color-link: #e0a63a;
  --pst-color-link-hover: #efc370;
  --pst-color-inline-code: #efc370;
  --pst-color-background: #000000;
  --pst-color-on-background: #000000;
  --pst-color-surface: #0a0b0d;
  --pst-color-text-base: #e9ebee;
  --pst-color-text-muted: #a2a7b0;
  --pst-color-border: #262a30;
  --pst-color-heading: #f4f5f7;
}

/* ---- Base ------------------------------------------------------------------ */
html, body {
  font-family: var(--nv-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--nv-ink);
  background: var(--nv-paper);
}

body { line-height: 1.6; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--nv-sans);
  color: var(--nv-ink);
  letter-spacing: -0.02em;
  font-weight: 700;
}

.bd-article h1 { font-weight: 700; font-size: 2.5rem; line-height: 1.1; margin-bottom: 1rem; }
.bd-article h2 { font-weight: 600; font-size: 1.7rem; line-height: 1.2; margin-top: 2.8rem; letter-spacing: -0.02em; }
.bd-article h3 { font-weight: 600; font-size: 1.25rem; letter-spacing: -0.01em; }
.bd-article h4 { font-weight: 600; font-size: 1.05rem; }
.bd-article p, .bd-article li { font-size: 1rem; line-height: 1.65; color: var(--nv-ink); }
.bd-article p { max-width: 74ch; }

/* links */
a, a.reference, a.headerlink { color: var(--nv-accent); text-decoration: none; }
a:hover { color: var(--nv-accent-dk); text-decoration: underline; }
.headerlink { text-decoration: none !important; }

/* ---- Top navbar (BB: white, hairline bottom, horizontal links) ------------- */
.bd-header {
  background: rgba(255, 255, 255, 0.9) !important;
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  backdrop-filter: saturate(140%) blur(10px);
  box-shadow: none !important;
  border-bottom: 1px solid var(--nv-line);
}
html[data-theme="dark"] .bd-header { background: rgba(16, 18, 21, 0.9) !important; }

.bd-header .navbar-brand,
.navbar-brand.logo {
  font-family: var(--nv-sans);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--nv-ink);
}
.navbar-brand .title { color: var(--nv-ink); }

.bd-header .navbar-nav .nav-link {
  font-family: var(--nv-sans);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--nv-mut);
  padding: 0.35rem 0.7rem;
}
.bd-header .navbar-nav .nav-link:hover,
.bd-header .navbar-nav li.current > .nav-link,
.bd-header .navbar-nav .nav-link.active {
  color: var(--nv-accent);
  text-decoration: none;
}
.bd-header .navbar-nav .dropdown .dropdown-toggle,
.bd-header .navbar-nav .dropdown .btn {
  font-family: var(--nv-sans);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--nv-mut);
}
.bd-header .navbar-icon-links .nav-link,
.bd-header .pst-navbar-icon { color: var(--nv-mut); }
.bd-header .navbar-icon-links .nav-link:hover,
.bd-header .pst-navbar-icon:hover { color: var(--nv-accent); }

/* ---- Sidebars (keep pydata navigation working, restyle only) --------------- */
.bd-sidebar-primary, .bd-sidebar-secondary {
  background: var(--nv-paper);
  border-color: var(--nv-line);
}
.bd-sidebar-primary { border-right: 1px solid var(--nv-line); }

.bd-sidebar-primary .caption-text,
nav.bd-links .caption-text {
  font-family: var(--nv-sans);
  font-size: 0.72rem !important;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--nv-mut);
}
.bd-sidebar-primary a.reference,
.bd-sidebar-primary .toctree-l1 > a,
nav.bd-links a {
  font-size: 0.9rem;
  color: var(--nv-mut);
}
.bd-sidebar-primary a:hover,
nav.bd-links a:hover { color: var(--nv-accent); text-decoration: none; }
.bd-sidebar-primary .current > a,
nav.bd-links li.current > a { color: var(--nv-accent) !important; font-weight: 600; }

.bd-sidebar-secondary .page-toc .nav-link,
.bd-toc .nav-link { font-size: 0.85rem; color: var(--nv-mut); }
.bd-sidebar-secondary .page-toc .nav-link.active,
.bd-toc .nav-link.active {
  color: var(--nv-accent);
  border-left-color: var(--nv-accent);
  font-weight: 600;
}
.bd-sidebar-secondary .page-toc .caption-text,
.toc-h2, .page-toc .title {
  font-family: var(--nv-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--nv-mut);
}

/* content width */
.bd-main .bd-content .bd-article-container { max-width: var(--nv-maxw); }

/* ---- Code (light, subtle - keeps the clean-white BB feel) ------------------ */
div.highlight, .highlight pre, pre {
  background: var(--nv-alt) !important;
  border: 1px solid var(--nv-line);
  border-radius: var(--nv-radius);
}
.highlight pre, pre {
  color: var(--nv-ink);
  padding: 18px 20px !important;
  font-family: var(--nv-mono);
  font-size: 0.85rem;
  line-height: 1.6;
}
html[data-theme="dark"] div.highlight,
html[data-theme="dark"] .highlight pre { background: #16191d !important; }
.copybtn { border-radius: 6px; }

.bd-article code.docutils,
.bd-article code.literal,
.bd-article :not(pre) > code {
  font-family: var(--nv-mono);
  font-size: 0.85em;
  background: var(--nv-alt);
  color: var(--pst-color-inline-code);
  border-radius: 5px;
  padding: 0.12em 0.38em;
  border: 1px solid var(--nv-line);
}

/* ---- Autodoc signatures (dl/dt/dd) - clean data block ---------------------- */
dl.py > dt, dl.py dt.sig, dl.cpp > dt, dl.c > dt {
  background: var(--nv-alt);
  border: 1px solid var(--nv-line);
  border-left: 3px solid var(--nv-accent);
  border-radius: 0 var(--nv-radius) var(--nv-radius) 0;
  padding: 0.55em 0.85em;
  font-family: var(--nv-mono);
  font-size: 0.9em;
}
dl.py dt .sig-name, dl.py dt .sig-name .pre { color: var(--nv-accent-dk); font-weight: 600; }
dl.py dd { border-left: 1px solid var(--nv-line); padding-left: 1rem; margin-left: 0.15rem; }
.py .property, .sig-param, .sig-return { font-family: var(--nv-mono); }
.field-list dt, dl.field-list > dt { color: var(--nv-mut); font-weight: 600; }

/* ---- Admonitions ----------------------------------------------------------- */
.admonition, div.admonition {
  border-radius: var(--nv-radius);
  border: 1px solid var(--nv-line);
  border-left: 3px solid var(--nv-accent);
  box-shadow: none;
}
.admonition > .admonition-title, div.admonition > .admonition-title {
  font-family: var(--nv-sans);
  font-weight: 600;
  background: var(--nv-alt);
}

/* ---- Tables ---------------------------------------------------------------- */
.bd-article table { border-collapse: collapse; }
.bd-article table th {
  font-family: var(--nv-sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--nv-mut);
  border-bottom: 1px solid var(--nv-line);
  background: var(--nv-alt);
}
.bd-article table td { border-bottom: 1px solid var(--nv-line); }
table.autosummary td:first-child {
  white-space: nowrap;
  font-family: var(--nv-mono);
  font-size: 0.88rem;
}
table.autosummary td p { margin-bottom: 0; }

/* ============================================================================
   HOMEPAGE - BB hero, feature grid, gallery preview
   ============================================================================ */

/* Hero (must render sans, never serif) */
.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: 3.2rem;
  align-items: center;
  text-align: left;
  padding: 2.6rem 0 3rem;
  border-bottom: 1px solid var(--nv-line);
  margin-bottom: 3.4rem;
}
.hero-copy, .hero-media { min-width: 0; }
.hero-media .hero-img {
  width: 100%;
  display: block;
  border-radius: 14px;
  box-shadow: var(--nv-shadow);
  background: var(--nv-alt);
}
.hero-media-cap {
  display: block;
  margin-top: 0.7rem;
  font-size: 0.8rem;
  color: var(--nv-mut);
  letter-spacing: 0.01em;
}
@media (max-width: 860px) {
  .landing-hero { grid-template-columns: 1fr; gap: 1.8rem; }
}
.hero-title {
  font-family: var(--nv-sans) !important;
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--nv-ink);
  background: none;
  -webkit-text-fill-color: currentColor;
  margin: 0 0 0.6rem;
  line-height: 1.02;
}
.hero-tagline {
  font-family: var(--nv-sans);
  font-style: normal;
  color: var(--nv-mut);
  font-weight: 500;
  font-size: 0.98rem;
  letter-spacing: -0.005em;
  margin: 0 0 1.2rem;
  max-width: 74ch;
}
.hero-lead {
  font-family: var(--nv-sans);
  margin: 0 0 1.9rem;
  max-width: 62ch;
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--nv-ink);
}
.hero-btn {
  border-radius: 999px !important;
  padding: 0.6rem 1.6rem !important;
  font-family: var(--nv-sans) !important;
  font-size: 0.92rem !important;
  font-weight: 600 !important;
  letter-spacing: -0.005em;
  margin: 0.25rem 0.6rem 0.25rem 0;
  box-shadow: none !important;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.hero-btn:not(.sd-outline-primary) {
  background: var(--nv-accent) !important;
  border-color: var(--nv-accent) !important;
  color: #ffffff !important;
}
.hero-btn:not(.sd-outline-primary):hover {
  background: var(--nv-accent-dk) !important;
  border-color: var(--nv-accent-dk) !important;
  transform: translateY(-1px);
}
.hero-btn.sd-outline-primary {
  color: var(--nv-accent) !important;
  border-color: var(--nv-line) !important;
  background: transparent !important;
}
.hero-btn.sd-outline-primary:hover {
  color: var(--nv-accent-dk) !important;
  border-color: var(--nv-accent) !important;
  transform: translateY(-1px);
}

/* Feature grid */
.nv-features { margin-top: 0.4rem; }
.nv-features .sd-card {
  border: 1px solid var(--nv-line);
  border-radius: 14px;
  box-shadow: none;
  background: var(--nv-paper);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.nv-features .sd-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--nv-shadow-soft);
  border-color: var(--nv-accent);
}
.nv-features .sd-card-title {
  font-family: var(--nv-sans);
  color: var(--nv-ink);
  font-weight: 600;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
}
.nv-features .sd-card-text { color: var(--nv-mut); font-size: 0.95rem; line-height: 1.55; }
.nv-features code {
  background: var(--nv-alt);
  border: 1px solid var(--nv-line);
  color: var(--nv-accent-dk);
}

/* Gallery preview */
.nv-gallery .sd-card {
  border: none;
  box-shadow: none;
  background: transparent;
}
.nv-gallery .sd-card-body { padding: 0.55rem 0 0; }
.nv-gallery img {
  border-radius: var(--nv-radius);
  box-shadow: var(--nv-shadow-soft);
  width: 100%;
  display: block;
}
.nv-gallery .sd-card-title {
  text-align: left;
  font-family: var(--nv-sans);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--nv-mut);
}

/* ============================================================================
   EXPLORE-COLLECTION GALLERY (guides/gallery.md)
   ============================================================================ */
.bb-explore { margin: 0.5rem 0 2rem; }
.bb-explore-header { margin-bottom: 1.6rem; }
.bb-explore-header h2 {
  font-family: var(--nv-sans);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
  color: var(--nv-ink);
}
.bb-explore-lead {
  color: var(--nv-mut);
  font-size: 1.02rem;
  line-height: 1.6;
  max-width: 74ch;
  margin: 0;
}

.bb-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0 1.4rem;
  border-bottom: 1px solid var(--nv-line);
  margin-bottom: 1.8rem;
}
.bb-count {
  font-family: var(--nv-sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--nv-mut);
  margin-right: auto;
}
.bb-count b { color: var(--nv-ink); }

.bb-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.bb-chip {
  font-family: var(--nv-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--nv-mut);
  background: var(--nv-paper);
  border: 1px solid var(--nv-line);
  border-radius: 999px;
  padding: 0.34rem 0.9rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.bb-chip:hover { color: var(--nv-accent); border-color: var(--nv-accent); }
.bb-chip.is-active {
  color: #ffffff;
  background: var(--nv-accent);
  border-color: var(--nv-accent);
}

.bb-viewtoggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--nv-line);
  border-radius: 999px;
  padding: 0.2rem;
}
.bb-viewtoggle .bb-vlabel {
  font-family: var(--nv-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--nv-mut);
  padding: 0 0.5rem 0 0.7rem;
}
.bb-view {
  font-family: var(--nv-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--nv-mut);
  background: transparent;
  border: none;
  border-radius: 999px;
  width: 2rem;
  height: 1.9rem;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.bb-view:hover { color: var(--nv-accent); }
.bb-view.is-active { color: #ffffff; background: var(--nv-accent); }

/* responsive grid, column count driven by JS via data-cols */
.bb-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.bb-grid[data-cols="1"] { grid-template-columns: minmax(0, 1200px); justify-content: center; }
.bb-grid[data-cols="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bb-grid[data-cols="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bb-grid[data-cols="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.bb-grid[data-cols="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.bb-tile { display: flex; flex-direction: column; transition: transform 0.18s ease; }
.bb-tile.is-hidden { display: none; }
.bb-tile:hover { transform: translateY(-4px); }
/* overflow:hidden frame so the image zoom stays contained */
.bb-frame {
  display: block;
  overflow: hidden;
  border-radius: var(--nv-radius);
  box-shadow: var(--nv-shadow-soft);
  transition: box-shadow 0.18s ease;
  background: #000;
}
.bb-tile:hover .bb-frame { box-shadow: var(--nv-shadow); }
.bb-tile img {
  width: 100%;
  display: block;
  transition: transform 0.18s ease;
}
.bb-tile:hover img { transform: scale(1.03); }
.bb-caption {
  margin: 0.6rem 0 0;
  font-family: var(--nv-sans);
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--nv-ink);
}
.bb-caption .bb-sub {
  display: block;
  color: var(--nv-mut);
  font-size: 0.8rem;
  font-weight: 400;
  margin-top: 0.1rem;
}
.bb-caption b { font-weight: 600; }

/* ============================================================================
   MOTION - scroll-reveal, hero crossfade, drifting marquee (BB feel)
   ============================================================================ */

/* ---- Scroll-reveal (driven by bb-motion.js) -------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Homepage hero crossfade (same core: cell states -> spatial niches) ---- */
.hero-anim {
  position: relative;
  width: 100%;
  aspect-ratio: 6 / 5;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--nv-shadow);
  background: var(--nv-alt);
}
.hero-anim img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
  display: block;
}
.hero-anim .ha-cell { animation: hero-x-cell 8s ease-in-out infinite; }
.hero-anim .ha-niche { animation: hero-x-niche 8s ease-in-out infinite; }

.ha-cap {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: block;
  height: 1.7rem;
  z-index: 2;
}
.ha-cap b {
  position: absolute;
  left: 0;
  bottom: 0;
  font-family: var(--nv-sans);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: -0.005em;
  color: #ffffff;
  background: rgba(14, 124, 134, 0.92);
  padding: 0.28rem 0.72rem;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: var(--nv-shadow-soft);
}
.ha-cap .c1 { animation: hero-x-cell 8s ease-in-out infinite; }
.ha-cap .c2 { animation: hero-x-niche 8s ease-in-out infinite; }

/* cell layer visible ~0-45%, niche layer visible ~55-100%, seamless loop */
@keyframes hero-x-cell {
  0%, 45%   { opacity: 1; }
  55%, 95%  { opacity: 0; }
  100%      { opacity: 1; }
}
@keyframes hero-x-niche {
  0%, 45%   { opacity: 0; }
  55%, 95%  { opacity: 1; }
  100%      { opacity: 0; }
}

/* ---- Homepage gallery preview: lift + deepen shadow ------------------------- */
.nv-gallery .sd-card { transition: transform 0.18s ease; }
.nv-gallery .sd-card:hover { transform: translateY(-4px); }
.nv-gallery img { transition: box-shadow 0.18s ease; }
.nv-gallery .sd-card:hover img { box-shadow: var(--nv-shadow); }

/* ---- Gallery drifting marquee ---------------------------------------------- */
.bb-marquee {
  position: relative;
  overflow: hidden;
  margin: 0.2rem 0 2.4rem;
  border-radius: var(--nv-radius);
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%);
}
.bb-marquee-track {
  display: flex;
  width: max-content;
  gap: 16px;
  animation: marquee 40s linear infinite;
}
.bb-marquee:hover .bb-marquee-track { animation-play-state: paused; }
.bb-marquee img {
  height: 168px;
  width: auto;
  display: block;
  border-radius: var(--nv-radius);
  box-shadow: var(--nv-shadow-soft);
  flex: 0 0 auto;
}
/* track holds two copies of the list; shift by half for a seamless loop */
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ---- Accessibility: visible focus ------------------------------------------ */
a:focus-visible,
button:focus-visible,
.bb-chip:focus-visible,
.bb-view:focus-visible,
.hero-btn:focus-visible {
  outline: 2px solid var(--nv-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- Reduced motion -------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .nv-features .sd-card:hover,
  .hero-btn:hover,
  .bb-tile:hover,
  .bb-tile:hover img,
  .nv-gallery .sd-card:hover { transform: none; }
  /* scroll-reveal: show in place, no motion */
  .reveal { opacity: 1; transform: none; }
  /* hero crossfade: freeze on the spatial-niche frame */
  .hero-anim .ha-cell, .ha-cap .c1 { opacity: 0 !important; animation: none !important; }
  .hero-anim .ha-niche, .ha-cap .c2 { opacity: 1 !important; animation: none !important; }
  /* marquee: static row */
  .bb-marquee-track { animation: none !important; transform: none !important; }
}

/* ---- Mobile responsiveness (single column under ~760px) -------------------- */
@media (max-width: 760px) {
  .landing-hero { padding: 2rem 0 1.6rem; }
  .hero-lead { font-size: 1.05rem; }
  /* explore grid -> single column */
  .bb-grid,
  .bb-grid[data-cols="2"],
  .bb-grid[data-cols="3"],
  .bb-grid[data-cols="4"],
  .bb-grid[data-cols="5"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* feature grid + gallery preview -> single column */
  .nv-features .sd-row > [class*="sd-col"],
  .nv-gallery .sd-row > [class*="sd-col"] {
    flex: 0 0 100%;
    max-width: 100%;
  }
  .bb-controls { gap: 0.7rem; }
  .bb-count { margin-right: 0; width: 100%; }
  .bd-article h1 { font-size: 2rem; }
  /* marquee stays a single scrollable row, just shorter */
  .bb-marquee img { height: 128px; }
}

/* ============================================================================
   GALLERY - data-driven controls: search box, site dropdown, category badges
   ========================================================================= */
.bb-search {
  font-family: var(--nv-sans);
  font-size: 0.9rem;
  color: var(--nv-ink);
  background: var(--nv-paper);
  border: 1px solid var(--nv-line);
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
  min-width: 16rem;
  flex: 1 1 16rem;
  transition: border-color 0.15s ease;
}
.bb-search:focus { outline: none; border-color: var(--nv-accent); }
.bb-search::placeholder { color: var(--nv-mut); }

.bb-select {
  font-family: var(--nv-sans);
  font-size: 0.85rem;
  color: var(--nv-ink);
  background: var(--nv-paper);
  border: 1px solid var(--nv-line);
  border-radius: 999px;
  padding: 0.36rem 0.9rem;
  cursor: pointer;
}
.bb-select:focus { outline: none; border-color: var(--nv-accent); }

.bb-badges { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.35rem; }
.bb-badge {
  font-family: var(--nv-sans);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--nv-mut);
  background: var(--nv-alt);
  border: 1px solid var(--nv-line);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  white-space: nowrap;
}
.bb-badge.bb-cat-Cancer { color: #fff; background: #c0392b; border-color: #c0392b; }
.bb-badge.bb-cat-Normal { color: #fff; background: var(--nv-accent); border-color: var(--nv-accent); }
.bb-badge.bb-cat-Developmental { color: #fff; background: #7d3c98; border-color: #7d3c98; }
.bb-badge.bb-cat-Disease { color: #fff; background: #b9770e; border-color: #b9770e; }

.bb-noimg {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; min-height: 140px;
  color: var(--nv-mut); font-family: var(--nv-sans); font-size: 0.8rem;
  background: var(--nv-alt);
}
.bb-tile.is-hidden { display: none; }

/* gallery category-overview collages */
.bb-overview { margin: 2rem 0 2.5rem; text-align: center; }
.bb-overview h2 { margin-bottom: .3rem; }
.bb-overview-fig { margin: .8rem auto; max-width: 100%; }
.bb-overview-fig img { max-width: 100%; height: auto; border-radius: 8px; box-shadow: 0 2px 14px rgba(0,0,0,.35); background:#000; }
.bb-overview-fig figcaption { font-size: .85rem; opacity: .7; margin-top: .25rem; }
.bb-overview-row { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }
.bb-overview-row .bb-overview-fig { flex: 1 1 340px; max-width: 48%; }
@media (max-width: 700px){ .bb-overview-row .bb-overview-fig { max-width: 100%; } }

/* ==================================================================
   NICHEVERSE gallery — dark specimen atlas  (scoped under .gx)
   Signature: the lineage spectrum. Numbers set in monospace.
   ================================================================== */
/* Clarendon-style slab serif for headlines (matches Beautiful Biology's Superclarendon) */
@font-face { font-family: "Zilla Slab"; src: url("fonts/ZillaSlab-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Zilla Slab"; src: url("fonts/ZillaSlab-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Zilla Slab"; src: url("fonts/ZillaSlab-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
.gx {
  --gx-void: #0a0c0f;
  --gx-panel: #0f1319;
  --gx-panel2: #141922;
  --gx-line: #232b36;
  --gx-ink: #eef1f5;
  --gx-mut: #929aa6;
  --gx-dim: #6b7480;
  --gx-teal: #e0a63a;
  --gx-mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --gx-spectrum: linear-gradient(90deg,
    #FF3B30 0%, #FF6A1A 9%, #FF9500 18%, #FFD400 27%, #66A61E 37%, #00D97E 46%,
    #35CABF 55%, #3399FF 64%, #66CCFF 72%, #B07CE8 81%, #FF4FA3 90%, #B8925A 100%);
  --gx-serif: "Zilla Slab", "Superclarendon", "Rockwell", "Roboto Slab", Georgia, serif;
  background: #000;
  border: 0;
  border-radius: 0;
  padding: clamp(2.2rem, 4vw, 4rem) clamp(1.1rem, 3.5vw, 3.5rem) 5rem;
  color: var(--gx-ink);
  overflow: hidden;
  margin: -1rem 0 0;
}
.gx-inner { max-width: 1780px; margin: 0 auto; }
/* lean, editorial header: a refined serif title over a one-line tagline */
.gx-head { margin: 0 0 1.8rem; }
.gx .gx-serif { font-family: var(--gx-serif); font-weight: 500; font-size: clamp(2.2rem, 4.2vw, 3.3rem); line-height: 1.05; letter-spacing: 0.002em; color: #fff; margin: 0 0 0.5rem; max-width: none; }
.gx .gx-tagline { color: var(--gx-mut); font-size: 0.95rem; letter-spacing: 0.01em; margin: 0; font-variant-numeric: tabular-nums; }
/* gallery page only (scoped via :has): make the docs article full-width + strip chrome */
.bd-article:has(.gx),
.bd-content:has(.gx),
.bd-content:has(.gx) .bd-article-container { max-width: none !important; padding-left: 0 !important; padding-right: 0 !important; padding-top: 0 !important; }
.bd-article:has(.gx) .bd-breadcrumbs { display: none !important; }
main:has(.gx) > .bd-article > section > h1:first-child { display: none; }  /* redundant page H1; hero says it */

/* ---- hero ---- */
.gx-hero { max-width: 46rem; }
.gx-eyebrow {
  display: inline-block; font-family: var(--gx-mono); font-size: 0.72rem;
  letter-spacing: 0.28em; text-transform: uppercase; color: var(--gx-teal);
  padding-bottom: 0.9rem;
}
.gx-title {
  font-size: clamp(2rem, 5.2vw, 3.4rem); line-height: 1.02; letter-spacing: -0.028em;
  font-weight: 800; color: #fff; margin: 0 0 0.9rem;
}
.gx-lead { font-size: 1.05rem; line-height: 1.6; color: var(--gx-mut); margin: 0 0 1.6rem; max-width: 40rem; }

/* ---- signature: lineage spectrum ---- */
.gx-spectrum {
  height: 10px; border-radius: 999px; background: var(--gx-spectrum);
  box-shadow: 0 0 26px rgba(53, 202, 191, 0.18), inset 0 0 0 1px rgba(255,255,255,0.06);
  transform-origin: left center; animation: gx-wipe 1.05s cubic-bezier(.2,.7,.2,1) both;
}
.gx-spectrum-cap {
  font-family: var(--gx-mono); font-size: 0.72rem; letter-spacing: 0.02em;
  color: var(--gx-dim); margin: 0.55rem 0 1.8rem;
}
@keyframes gx-wipe { from { transform: scaleX(0); opacity: 0; } to { transform: scaleX(1); opacity: 1; } }

/* ---- live stats ---- */
.gx-stats { display: flex; flex-wrap: wrap; gap: 2.4rem; margin: 0; padding-top: 0.4rem; }
.gx-stat dt {
  font-family: var(--gx-mono); font-size: 0.68rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--gx-dim); margin-bottom: 0.15rem;
}
.gx-stat dd {
  font-family: var(--gx-mono); font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 600;
  color: #fff; margin: 0; font-variant-numeric: tabular-nums; line-height: 1;
}

/* ---- section headings ---- */
.gx-h3 { color: #fff; font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; margin: 2.6rem 0 0.4rem; }
.gx-sub { color: var(--gx-mut); font-size: 0.95rem; line-height: 1.55; margin: 0 0 1.4rem; max-width: 42rem; }
.gx-hero + .gx-overview .gx-h3:first-child { margin-top: 2.2rem; }

/* ---- overview collages ---- */
.gx-overview { border-top: 1px solid var(--gx-line); margin-top: 2.4rem; }
.gx-ovfig { margin: 0.4rem 0 1rem; }
.gx-ovfig img { width: 100%; height: auto; display: block; border-radius: 12px; background: #000; border: 1px solid var(--gx-line); }
.gx-ovfig figcaption { font-family: var(--gx-mono); font-size: 0.72rem; letter-spacing: 0.04em; color: var(--gx-dim); margin-top: 0.4rem; }
.gx-ovrow { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px){ .gx-ovrow { grid-template-columns: 1fr; } }

/* ---- explore: sticky dark controls ---- */
.gx-explore { border-top: 1px solid var(--gx-line); margin-top: 2.6rem; }
.gx-controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem;
  padding: 0.2rem 0 1rem; margin-bottom: 1.3rem;
  border-bottom: 1px solid var(--gx-line);
}
.gx .bb-count { font-family: var(--gx-mono); font-size: 0.8rem; color: var(--gx-mut); margin-right: 0.4rem; }
.gx .bb-count b { color: #fff; font-variant-numeric: tabular-nums; }
.gx .bb-search {
  flex: 1 1 220px; min-width: 180px; background: var(--gx-panel2); color: var(--gx-ink);
  border: 1px solid var(--gx-line); border-radius: 8px; padding: 0.5rem 0.8rem; font-size: 0.9rem;
}
.gx .bb-search::placeholder { color: var(--gx-dim); }
.gx .bb-search:focus { outline: none; border-color: var(--gx-teal); box-shadow: 0 0 0 2px rgba(53,202,191,0.2); }
.gx .bb-select {
  background: var(--gx-panel2); color: var(--gx-ink); border: 1px solid var(--gx-line);
  border-radius: 8px; padding: 0.5rem 1.8rem 0.5rem 0.7rem; font-size: 0.85rem; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23929aa6' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.6rem center;
}
.gx .bb-select:focus { outline: none; border-color: var(--gx-teal); }
.gx .bb-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.gx .bb-chip {
  font-family: var(--gx-mono); font-size: 0.76rem; letter-spacing: 0.02em;
  color: var(--gx-mut); background: transparent; border: 1px solid var(--gx-line);
  border-radius: 999px; padding: 0.35rem 0.85rem; cursor: pointer; transition: all 0.15s ease;
}
.gx .bb-chip:hover { color: var(--gx-ink); border-color: var(--gx-mut); }
.gx .bb-chip.is-active { color: var(--gx-void); background: var(--gx-teal); border-color: var(--gx-teal); font-weight: 600; }
.gx .bb-viewtoggle { display: inline-flex; align-items: center; gap: 0.3rem; margin-left: auto; }
.gx .bb-vlabel { font-family: var(--gx-mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gx-dim); }
.gx .bb-view {
  font-family: var(--gx-mono); width: 1.9rem; height: 1.9rem; color: var(--gx-mut);
  background: var(--gx-panel2); border: 1px solid var(--gx-line); border-radius: 6px; cursor: pointer;
}
.gx .bb-view:hover { color: var(--gx-ink); }
.gx .bb-view.is-active { color: var(--gx-void); background: var(--gx-teal); border-color: var(--gx-teal); }

/* ---- shared cell-state color key (one legend, images stay clean) ---- */
.gx-key { display: flex; flex-wrap: wrap; gap: 0.5rem 1.15rem; margin: 0 0 1.5rem; padding: 1rem 0 0; border-top: 1px solid var(--gx-line); }
.gx-k { display: inline-flex; align-items: center; gap: 0.42rem; font-size: 0.76rem; color: var(--gx-mut); letter-spacing: 0.01em; }
.gx-k i { width: 0.72rem; height: 0.72rem; border-radius: 2px; flex: none; }

/* ---- image-forward specimen grid: square tiles, caption ALWAYS below (Beautiful-Biology style) ---- */
.gx .bb-grid { gap: 32px 18px; }
.gx .bb-tile { background: transparent; border: 0; border-radius: 0; overflow: visible; cursor: zoom-in; }
.gx .bb-tile:hover { transform: none; }
.gx .bb-frame { position: relative; display: block; aspect-ratio: 1 / 1; background: #000; overflow: hidden; box-shadow: none; border-radius: 0; }
.gx .bb-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; background: #000; opacity: 0; transition: transform 0.6s cubic-bezier(0.4,0,0.2,1), opacity 0.6s cubic-bezier(0.4,0,0.2,1); }
.gx .bb-tile img.is-loaded { opacity: 1; }        /* smooth fade-in as each map loads */
.gx .bb-tile:hover img.is-loaded { transform: scale(1.045); }
.gx .bb-tag { position: absolute; top: 0; right: 0; font-size: 0.64rem; letter-spacing: 0.04em; color: rgba(255,255,255,0.92); background: rgba(0,0,0,0.5); padding: 0.24rem 0.5rem; opacity: 0; transition: opacity 0.2s ease; }
.gx .bb-tile:hover .bb-tag { opacity: 1; }
.gx .bb-cap { padding: 0.6rem 0.05rem 0; margin: 0; }
.gx .bb-cap b { display: block; color: #fff; font-weight: 500; font-size: 0.9rem; line-height: 1.28; letter-spacing: 0.004em; }
.gx .bb-cap-sub { display: block; color: var(--gx-dim); font-size: 0.75rem; margin-top: 0.16rem; }
.gx .bb-noimg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--gx-dim); font-size: 0.78rem; background: #000; }
.gx .bb-method { color: var(--gx-dim); font-size: 0.82rem; line-height: 1.55; margin-top: 2.4rem; max-width: 44rem; }
.gx .bb-method code { background: var(--gx-panel2); color: var(--gx-teal); border: 1px solid var(--gx-line); }

@media (prefers-reduced-motion: reduce){ .gx-spectrum { animation: none; } }

/* specificity guard: .gx text must beat pydata .bd-article p/h2/h3 (0,1,1) on the dark panel */
.gx .gx-title { color: #fff; font-size: clamp(2rem, 5.2vw, 3.4rem); line-height: 1.02; margin: 0 0 0.9rem; max-width: none; letter-spacing: -0.028em; font-weight: 800; }
.gx .gx-lead { color: var(--gx-mut); font-size: 1.05rem; line-height: 1.6; margin: 0 0 1.6rem; max-width: 40rem; }
.gx .gx-h3 { color: #fff; font-size: 1.15rem; margin: 2.6rem 0 0.4rem; max-width: none; }
.gx .gx-sub { color: var(--gx-mut); font-size: 0.95rem; line-height: 1.55; margin: 0 0 1.4rem; max-width: 42rem; }
.gx .gx-spectrum-cap { color: var(--gx-dim); font-size: 0.72rem; margin: 0.55rem 0 1.8rem; max-width: none; }
.gx .gx-method { color: var(--gx-dim); font-size: 0.82rem; line-height: 1.55; margin-top: 1.8rem; max-width: 44rem; }
.gx .gx-overview .gx-h3 { margin-top: 0.2rem; }

/* homepage: black-bg specimen hero + collage showcase (replaces white-bg images) */
.hero-shot { margin: 0; }
.hero-shot img { width: 100%; height: auto; display: block; border-radius: 14px; background: #000; border: 1px solid var(--nv-line); box-shadow: 0 12px 44px rgba(0,0,0,.32); }
.hero-shot figcaption { font-size: .82rem; color: var(--nv-mut); margin-top: .55rem; line-height: 1.45; }
html[data-theme="dark"] .hero-shot img { border-color: #20242b; }
.nv-showcase { margin: 1.1rem 0 1.6rem; }
.nv-shot { margin: 0 0 1rem; }
.nv-shot img { width: 100%; height: auto; display: block; border-radius: 12px; background: #000; border: 1px solid var(--nv-line); }
.nv-shot figcaption { font-size: .78rem; color: var(--nv-mut); margin-top: .35rem; text-align: center; }
.nv-shot-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px){ .nv-shot-row { grid-template-columns: 1fr; } }

/* tiles are clickable to open the map large; the hover veil signals it (no corner glyph) */

/* lightbox */
.gx-lightbox { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgba(3,4,6,.94); padding: 2.5vmin; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.gx-lightbox[hidden] { display: none; }
.gx-lb-stage { display: flex; align-items: center; justify-content: center; gap: 2rem; max-width: 96vw; max-height: 92vh; }
.gx-lb-fig { margin: 0; max-width: 74vw; max-height: 92vh; display: flex; flex-direction: column; align-items: center; }
.gx-lb-fig img { max-width: 74vw; max-height: 86vh; width: auto; height: auto; border-radius: 10px; background: #000; box-shadow: 0 24px 90px rgba(0,0,0,.6); }
.gx-lb-fig figcaption { color: #e9ecef; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .85rem; margin-top: .75rem; text-align: center; }
.gx-lb-key { flex: none; width: 208px; max-height: 86vh; overflow-y: auto; display: flex; flex-direction: column; gap: 0.32rem; padding: 0.2rem 0.4rem 0.2rem 0; }
.gx-lb-key .gx-lb-key-h { color: #fff; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; margin-bottom: 0.55rem; }
.gx-lb-key .gx-k { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: #c9ccd1; padding: 0.1rem 0; letter-spacing: 0; }
.gx-lb-key .gx-k i { width: 0.72rem; height: 0.72rem; border-radius: 2px; flex: none; }
@media (max-width: 720px) { .gx-lb-stage { flex-direction: column; gap: 1rem; } .gx-lb-key { width: auto; max-width: 90vw; max-height: 22vh; flex-flow: row wrap; } .gx-lb-fig, .gx-lb-fig img { max-width: 92vw; } }
.gx-lb-close { position: fixed; top: 1.1rem; right: 1.4rem; z-index: 1001; width: 2.4rem; height: 2.4rem; border: none; border-radius: 50%; background: rgba(255,255,255,.1); color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.gx-lb-close:hover { background: rgba(255,255,255,.2); }

/* homepage live counter (filled from the catalogue by gallery.js) */
.nv-homestats { display: flex; flex-wrap: wrap; gap: 1.4rem 2.4rem; margin: 1.7rem 0 0; padding-top: 1.3rem; border-top: 1px solid var(--nv-line); }
.nv-hs { display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
.nv-hs dd { margin: 0; font-size: 1.75rem; font-weight: 700; line-height: 1; letter-spacing: -0.02em; color: var(--nv-ink); font-variant-numeric: tabular-nums; font-family: var(--nv-mono); }
.nv-hs dt { font-size: 0.7rem; letter-spacing: 0.13em; text-transform: uppercase; color: var(--nv-mut); margin-top: 0.32rem; }

/* global developer credit in the footer of every page */
#nv-dev-credit { width: 100%; text-align: center; font-size: 0.8rem; color: var(--nv-mut); margin-top: 0.6rem; padding-top: 0.6rem; }
#nv-dev-credit a { color: var(--nv-teal, #e0a63a); text-decoration: none; }
#nv-dev-credit a:hover { text-decoration: underline; }

/* ============ Beautiful-Biology gallery: left filter sidebar + results bar + image grid ============ */
.gx-body { display: grid; grid-template-columns: 244px minmax(0, 1fr); gap: 36px; align-items: start; }
.gx-side { position: sticky; top: 74px; align-self: start; }
.gx-side-inner { max-height: calc(100vh - 94px); overflow-y: auto; padding-right: 6px; }
.gx-side-inner::-webkit-scrollbar { width: 7px; }
.gx-side-inner::-webkit-scrollbar-thumb { background: #26262a; border-radius: 4px; }

.gx .bb-search { width: 100%; box-sizing: border-box; background: #121214; color: var(--gx-ink); border: 1px solid #26262a; border-radius: 7px; padding: 0.62rem 0.8rem; font-size: 0.86rem; margin: 0 0 0.9rem; }
.gx .bb-search::placeholder { color: var(--gx-dim); }
.gx .bb-search:focus { outline: none; border-color: var(--gx-teal); }
.gx-clear { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--gx-teal); font-size: 0.78rem; letter-spacing: 0.02em; padding: 0 0 0.9rem; cursor: pointer; }

.gx-fgroup { border-top: 1px solid #202024; }
.gx-fhead { width: 100%; display: flex; align-items: center; justify-content: space-between; background: none; border: 0; color: #fff; font-size: 0.73rem; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; padding: 0.95rem 0.1rem 0.8rem; cursor: pointer; }
.gx-fchevron { color: var(--gx-mut); font-size: 1rem; font-weight: 400; line-height: 1; }
.gx-fgroup.is-collapsed .gx-fbody { display: none; }
.gx-fbody { padding-bottom: 0.65rem; }
.gx-fopt { display: flex; align-items: center; gap: 0.6rem; padding: 0.3rem 0.1rem; cursor: pointer; color: var(--gx-mut); font-size: 0.87rem; }
.gx-fopt:hover { color: #fff; }
.gx-fopt input { appearance: none; -webkit-appearance: none; width: 15px; height: 15px; border: 1px solid #3a3a42; border-radius: 3px; background: #121214; flex: none; cursor: pointer; position: relative; margin: 0; }
.gx-fopt input:checked { background: var(--gx-teal); border-color: var(--gx-teal); }
.gx-fopt input:checked::after { content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px; border: solid #06070a; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.gx-fname { flex: 1 1 auto; }
.gx-fcount { color: var(--gx-dim); font-size: 0.78rem; font-variant-numeric: tabular-nums; }

.gx-key { display: block; border-top: 1px solid #202024; margin: 0.4rem 0 0; padding: 1rem 0 0; }
.gx-key-h { display: block; color: #fff; font-size: 0.73rem; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; margin-bottom: 0.7rem; }
.gx .gx-k { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--gx-mut); padding: 0.16rem 0; letter-spacing: 0; }
.gx .gx-k i { width: 0.72rem; height: 0.72rem; border-radius: 2px; flex: none; }

.gx-resbar { display: flex; align-items: center; justify-content: space-between; padding: 0 0 1.05rem; border-bottom: 1px solid #202024; margin-bottom: 1.5rem; }
.gx .bb-count { color: var(--gx-mut); font-size: 0.85rem; letter-spacing: 0.02em; }
.gx .bb-count b { color: #fff; font-variant-numeric: tabular-nums; font-weight: 600; }
.gx .bb-viewtoggle { display: inline-flex; gap: 4px; align-items: center; }
.gx .bb-view { display: inline-flex; align-items: center; gap: 2px; width: auto; height: auto; background: none; border: 0; border-radius: 0; padding: 6px 5px; cursor: pointer; opacity: 0.5; }
.gx .bb-view span { width: 4px; height: 15px; background: var(--gx-mut); display: block; border-radius: 1px; }
.gx .bb-view:hover { opacity: 0.85; }
.gx .bb-view.is-active { opacity: 1; }
.gx .bb-view.is-active span { background: #fff; }

@media (max-width: 820px) {
  .gx-body { grid-template-columns: 1fr; gap: 20px; }
  .gx-side { position: static; }
  .gx-side-inner { max-height: none; overflow: visible; }
}

/* ============ Beautiful-Biology homepage: serif hero + big image + circular showcase ============ */
.nvh { --nvh-serif: "Zilla Slab", "Superclarendon", "Rockwell", Georgia, serif;
  background: #000; color: #eef1f5; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  padding: clamp(1.5rem, 4vw, 4rem) clamp(1.1rem, 5vw, 5rem) clamp(2rem, 5vw, 5rem); box-sizing: border-box; overflow: hidden; margin: -1rem 0 0; }
/* homepage full-width (scoped via :has, same as the gallery) so the hero is not clipped */
.bd-article:has(.nvh), .bd-content:has(.nvh), .bd-content:has(.nvh) .bd-article-container { max-width: none !important; padding-left: 0 !important; padding-right: 0 !important; padding-top: 0 !important; }
.bd-article:has(.nvh) .bd-breadcrumbs { display: none !important; }
.nvh-body { max-width: 1120px; margin: 0 auto; padding: clamp(2rem, 5vw, 4.5rem) clamp(1.1rem, 4vw, 2rem) 3rem; }
.nvh-hero { max-width: 1600px; margin: 0 auto; display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(1.5rem, 4vw, 4rem); align-items: center; min-height: min(78vh, 760px); }
.nvh-eyebrow { display: inline-block; font-size: 0.8rem; letter-spacing: 0.22em; text-transform: uppercase; color: #e0a63a; margin-bottom: 1.1rem; }
.nvh .nvh-title { font-family: var(--nvh-serif); font-weight: 500; font-size: clamp(2.4rem, 5.2vw, 4.4rem); line-height: 1.04; letter-spacing: 0.002em; color: #fff; margin: 0 0 1.6rem; max-width: 20ch; }
.nvh .nvh-lead { font-size: clamp(1rem, 1.35vw, 1.2rem); line-height: 1.62; color: #b9c0ca; margin: 0 0 1.9rem; max-width: 42ch; }
.nvh-cta { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-bottom: 2.4rem; }
.nvh .nvh-btn { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.95rem; font-weight: 600; letter-spacing: 0.01em;
  color: #06070a; background: #e0a63a; border: 1px solid #e0a63a; border-radius: 999px; padding: 0.72rem 1.5rem; text-decoration: none; transition: transform 0.18s cubic-bezier(0.4,0,0.2,1), background 0.18s ease; }
.nvh .nvh-btn::after { content: "\2192"; }
.nvh .nvh-btn:hover { transform: translateX(3px); background: #4fd8ce; }
.nvh .nvh-btn--ghost { color: #eef1f5; background: transparent; border-color: #33404f; }
.nvh .nvh-btn--ghost:hover { background: rgba(255,255,255,0.06); border-color: #4a5a6d; }
.nvh-hero-shot { margin: 0; }
.nvh-hero-shot img { width: 100%; height: min(72vh, 680px); object-fit: cover; display: block; background: #000; border-radius: 6px; }
.nvh .nv-homestats { display: flex; flex-wrap: wrap; gap: 1.3rem 2.6rem; margin: 0; padding-top: 1.6rem; border-top: 1px solid #1c2128; }
.nvh .nv-hs dd { font-family: var(--nvh-serif); font-size: 2rem; font-weight: 500; color: #fff; margin: 0; line-height: 1; font-variant-numeric: tabular-nums; }
.nvh .nv-hs dt { font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: #7c8896; margin-top: 0.4rem; }

.nvh-explore { max-width: 1600px; margin: clamp(2.5rem, 6vw, 6rem) auto 0; display: grid; grid-template-columns: 1fr 0.9fr; gap: clamp(1.5rem, 4vw, 4rem); align-items: center; }
.nvh-circles { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(0.8rem, 1.6vw, 1.4rem); }
.nvh-circles img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 50%; background: #000; display: block; transition: transform 0.4s cubic-bezier(0.4,0,0.2,1); }
.nvh-circles img:hover { transform: scale(1.05); }
.nvh .nvh-h2 { font-family: var(--nvh-serif); font-weight: 500; font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.05; color: #fff; margin: 0 0 1.1rem; }
.nvh .nvh-p { font-size: 1.02rem; line-height: 1.62; color: #b9c0ca; margin: 0 0 1.7rem; max-width: 44ch; }
.nvh .nvh-p b { color: #fff; font-weight: 600; }

/* codebook + vocabulary showcase rows */
.nvh-codebook, .nvh-vocab { max-width: 1600px; margin: clamp(3rem, 7vw, 7rem) auto 0; display: grid; grid-template-columns: 1fr 0.95fr; gap: clamp(1.6rem, 4vw, 4.5rem); align-items: center; }
.nvh-vocab { grid-template-columns: 0.95fr 1fr; }
.nvh-cb-shot, .nvh-vocab-shot { margin: 0; }
.nvh-cb-shot img { width: 100%; max-height: min(74vh, 720px); object-fit: contain; display: block; background: #000; border-radius: 8px; }
.nvh-vocab-shot img { width: 100%; max-height: min(70vh, 680px); object-fit: contain; display: block; background: #0b0b0d; border-radius: 8px; padding: clamp(0.6rem, 1.4vw, 1.2rem); }
.nvh-cb-tags { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.nvh-tag { font-size: 0.82rem; color: #c9ccd1; border: 1px solid #2a2a2f; border-radius: 999px; padding: 0.4rem 0.9rem; letter-spacing: 0.01em; }
.nvh-tag b { color: #e0a63a; font-weight: 700; }

/* encode / quantize / paint pipeline */
.nvh-steps { max-width: 1400px; margin: clamp(3rem, 7vw, 7rem) auto 0; }
.nvh-steplist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1.4rem, 3vw, 3rem); }
.nvh-steplist li { border-top: 2px solid #2a2a2f; padding-top: 1.3rem; }
.nvh-step-n { display: block; font-family: var(--nvh-serif); font-size: clamp(1.6rem, 2.4vw, 2.2rem); font-weight: 600; color: #e0a63a; letter-spacing: 0.02em; margin-bottom: 0.7rem; }
.nvh .nvh-step-h { font-family: var(--nvh-serif); font-weight: 500; font-size: clamp(1.3rem, 2vw, 1.7rem); color: #fff; margin: 0 0 0.55rem; }
.nvh .nvh-step-p { font-size: 0.98rem; line-height: 1.6; color: #b9c0ca; margin: 0; max-width: 34ch; }

/* NICHEVERSE wordmark acrostic footer */
.nvh-wordmark { max-width: 1100px; margin: clamp(3.5rem, 8vw, 8rem) auto 0; padding: clamp(2rem, 5vw, 3.5rem) 0 clamp(2rem, 5vw, 4rem); border-top: 1px solid #17171a; text-align: center; }
.nvh .nvh-wm-mark { font-family: var(--nvh-serif); font-weight: 600; font-size: clamp(2.6rem, 9vw, 6.5rem); line-height: 1; letter-spacing: 0.04em; color: #fff; margin: 0; }
.nvh-wm-exp { font-family: var(--nvh-serif); font-weight: 300; font-size: clamp(1rem, 2.2vw, 1.5rem); line-height: 1.4; color: #8b909b; margin: 1.1rem auto 0; max-width: 40ch; }
.nvh-wm-exp b { color: #e0a63a; font-weight: 600; }
.nvh-wm-desc { font-size: 0.98rem; line-height: 1.62; color: #9aa0aa; margin: 1.6rem auto 0; max-width: 60ch; }

@media (max-width: 860px) {
  .nvh-hero, .nvh-explore, .nvh-codebook, .nvh-vocab { grid-template-columns: 1fr; }
  .nvh-hero-shot { order: -1; } .nvh-hero-shot img { height: 46vh; }
  .nvh-explore { margin-top: 3rem; }
  .nvh-vocab .nvh-vocab-shot { order: -1; }
  .nvh-steplist { grid-template-columns: 1fr; }
}

/* smoothness pass (matches Beautiful Biology: standard ease, smooth scroll, antialiasing) */
html { scroll-behavior: smooth; }
.gx { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
.gx .bb-tile, .gx .bb-frame, .gx-fopt, .gx-fchevron, .gx .bb-view, .gx .bb-view span, .gx .bb-tag,
.gx-clear, .gx .bb-search { transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
.gx .bb-grid { transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1); }
.gx .bb-grid.is-filtering { opacity: 0.35; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .gx .bb-tile img, .gx .bb-grid { transition: none; }
  .gx-spectrum { animation: none; }
}
