Jump to content

User:Gibcus/common.css: Difference between revisions

From BioMicro Center
No edit summary
Tag: Reverted
No edit summary
Tag: Reverted
Line 1: Line 1:
/* ============================================================
/**
  BioMicro Center Wiki — CSS-only modern UI
* BioMicro Center Wiki — Full DOM Replacement
  Paste into: User:USERNAME/common.css
* Paste into: User:USERNAME/common.js
  Targets: MediaWiki Vector (legacy) skin
*
  Mimics: about.html design without requiring JavaScript
* Strategy:
  ============================================================ */
* 1. Extract wiki article content from MediaWiki's DOM
* 2. Inject the complete about.html shell structure
* 3. Place article content inside the shell
* MediaWiki still runs underneath for editing, search, login, etc.
*/


/* ── Base & Reset ───────────────────────────────────────────── */
( function () {
*, *::before, *::after { box-sizing: border-box; }
  'use strict';


/* Universal sans-serif — covers every element MW might leave in a serif/system font */
  /* ── Nav definition (matches about.html exactly) ──────────── */
body.bmc-active, body.bmc-active * { font-family: 'Helvetica Neue', Arial, sans-serif !important; }
  var NAV = [
body.bmc-active code, body.bmc-active pre, body.bmc-active kbd,
    {
body.bmc-active tt, body.bmc-active samp { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace !important; }
      label: 'About',
      href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:AboutBMC',
      match: [ 'AboutBMC' ]
    },
    {
      label: 'News',
      href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:News',
      match: [ 'News', 'Seminar' ],
      items: [
        { label: 'Latest News',        href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:News' },
        { label: 'Seminars',          href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:News' },
        { label: 'Classes & Training', href: 'https://igb.mit.edu/mini-courses', ext: true }
      ]
    },
    {
      label: 'Services',
      href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:Assisted_Services',
      match: [ 'Assisted_Services', 'Walkup', 'Service', 'Consumable', 'SingleCell', 'SpTx', 'Sequencing', 'Analysis' ],
      items: [
        { label: 'Walkup',      href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:Walkup_Services' },
        { label: 'Assisted',    href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:Assisted_Services' },
        { label: 'Consumables', href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:Consumables' },
        { label: 'Training',    href: 'https://igb.mit.edu/mini-courses', ext: true },
        { label: 'Informatics', href: 'https://igb.mit.edu/', ext: true }
      ]
    },
    {
      label: 'Submission',
      href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:Submission',
      match: [ 'Submission', 'Submit', 'Pricing' ],
      items: [
        { groupLabel: 'MIT Users' },
        { label: 'Submit a Sample', href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:Submission' },
        { label: 'MIT Pricing',    href: 'https://bmcwiki.mit.edu/index.php/MIT:Pricing' },
        { divider: true },
        { groupLabel: 'Non-MIT Users' },
        { label: 'External Submission', href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:Submission' },
        { label: 'External Pricing',   href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:Pricing' }
      ]
    },
    {
      label: 'Staff',
      href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:People',
      match: [ 'People', 'Staff' ]
    },
    {
      label: 'Resources',
      href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:FAQ',
      match: [ 'FAQ', 'Resource', 'Form', 'Acknowledgement', 'Consulting' ],
      items: [
        { label: 'FAQs',                   href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:FAQ' },
        { label: 'Consulting',              href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:Consulting' },
        { label: 'Grant Support & Pricing', href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:Pricing' },
        { label: 'Acknowledgements',       href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:Acknowledgement' }
      ]
    }
  ];


body, html {
  /* ── Build topbar HTML ─────────────────────────────────────── */
  font-family: 'Helvetica Neue', Arial, sans-serif !important;
  function buildTopbar() {
  color: #1a1a1a !important;
    var d = document.createElement( 'div' );
  background: #f4f4f4 !important;
    d.className = 'bmc-topbar';
  line-height: 1.6 !important;
    d.innerHTML =
  font-size: 16px !important;
      '<div class="inner">' +
  margin: 0 !important;
        '<a href="mailto:biomicro@mit.edu">biomicro@mit.edu</a>' +
   padding: 0 !important;
        '<span>|</span>' +
}
        '617-715-4533' +
        '<span>|</span>' +
        'Building 68-322' +
      '</div>';
    return d;
   }


a { color: #750014 !important; text-decoration: none !important; }
  /* ── Build nav dropdown item ───────────────────────────────── */
a:hover { text-decoration: underline !important; color: #5c0010 !important; }
  function buildDropdownMenu( items ) {
    var menu = document.createElement( 'div' );
    menu.className = 'bmc-dropdown-menu';
    items.forEach( function ( item ) {
      if ( item.divider ) {
        var div = document.createElement( 'div' );
        div.className = 'bmc-divider';
        menu.appendChild( div );
      } else if ( item.groupLabel ) {
        var gl = document.createElement( 'div' );
        gl.className = 'bmc-group-label';
        gl.textContent = item.groupLabel;
        menu.appendChild( gl );
      } else {
        var a = document.createElement( 'a' );
        a.href = item.href;
        a.textContent = item.label;
        if ( item.ext ) a.target = '_blank';
        menu.appendChild( a );
      }
    } );
    return menu;
  }


/* ── Contact topbar (CSS pseudo-element, decorative) ─────────── */
  /* ── Build full header ─────────────────────────────────────── */
/* Shows contact info as a red strip above the header */
  function buildHeader( currentPage ) {
#mw-page-base {
    /* Logo */
  background: #750014 !important;
    var logo = document.createElement( 'a' );
  height: 32px !important;
    logo.href = 'https://bmcwiki.mit.edu/index.php/BioMicroCenter';
  position: fixed !important;
    logo.className = 'bmc-logo';
  top: 0 !important;
    logo.innerHTML =
  left: 0 !important;
      '<img class="bmc-logo-img" src="https://bmcwiki.mit.edu/images/c/c9/Logo.png" alt="MIT BioMicro Center" />';
  right: 0 !important;
  z-index: 200 !important;
}


#mw-page-base::after {
    /* Nav */
  content: "biomicro@mit.edu  ·  617-715-4533  ·  Building 68-322";
    var ul = document.createElement( 'ul' );
  display: block;
    NAV.forEach( function ( item ) {
  text-align: right;
      var li = document.createElement( 'li' );
  color: rgba(255,255,255,0.9);
      var isActive = ( item.match || [] ).some( function ( m ) {
  font-size: 0.72rem;
        return currentPage.indexOf( m ) !== -1;
  font-family: 'Helvetica Neue', Arial, sans-serif;
      } );
  padding: 7px 28px;
      if ( isActive ) li.classList.add( 'bmc-active' );
  letter-spacing: 0.02em;
      if ( item.items ) li.classList.add( 'bmc-dropdown' );
}


/* ── Header (#mw-head) ──────────────────────────────────────── */
      var a = document.createElement( 'a' );
#mw-head {
      a.href = item.href;
  background: #fff !important;
      a.textContent = item.label;
  border-bottom: 1px solid #e0e0e0 !important;
      li.appendChild( a );
  box-shadow: 0 1px 4px rgba(0,0,0,0.07) !important;
  height: 60px !important;
  top: 32px !important; /* sit below the red topbar */
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 150 !important;
}


#mw-head-base {
      if ( item.items ) {
  height: 92px !important; /* 32px topbar + 60px header */
        li.appendChild( buildDropdownMenu( item.items ) );
  background: #fff !important;
      }
}
      ul.appendChild( li );
    } );


/* Page tabs (Read / Edit / History) */
    var nav = document.createElement( 'nav' );
#left-navigation {
    nav.className = 'bmc-nav';
  margin-left: 0 !important;
    nav.appendChild( ul );
}
#left-navigation li a,
#right-navigation li a {
  font-family: 'Helvetica Neue', Arial, sans-serif !important;
  font-size: 0.83rem !important;
  font-weight: 500 !important;
  color: #555 !important;
  background: transparent !important;
  border: none !important;
  border-radius: 4px !important;
  padding: 6px 12px !important;
  transition: background 0.15s, color 0.15s !important;
}
#left-navigation li.selected a,
#left-navigation li a:hover,
#right-navigation li a:hover {
  background: #f5f5f5 !important;
  color: #750014 !important;
  border: none !important;
}


/* Search box in header */
    /* Search */
#p-search {
    var searchForm = document.createElement( 'form' );
  margin-top: 14px !important;
    searchForm.className = 'bmc-search-form';
}
    searchForm.method = 'get';
#searchInput {
    searchForm.action = '/index.php';
  border: 1px solid #e0e0e0 !important;
    searchForm.innerHTML =
  border-radius: 4px !important;
      '<input type="hidden" name="title" value="Special:Search">' +
  padding: 5px 10px !important;
      '<input type="search" name="search" placeholder="Search wiki…" aria-label="Search">' +
  font-size: 0.83rem !important;
      '<button type="submit" aria-label="Search"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg></button>';
  font-family: 'Helvetica Neue', Arial, sans-serif !important;
  color: #333 !important;
  width: 180px !important;
  outline: none !important;
  transition: border-color 0.15s !important;
  background: #fff !important;
}
#searchInput:focus { border-color: #750014 !important; }
#searchButton, #mw-searchButton {
  background: #750014 !important;
  border: none !important;
  border-radius: 4px !important;
  color: #fff !important;
  font-size: 0.83rem !important;
  padding: 5px 10px !important;
  cursor: pointer !important;
  margin-left: 4px !important;
}


/* Personal tools (login/logout) */
    var right = document.createElement( 'div' );
#p-personal li a {
    right.className = 'bmc-header-right';
  font-size: 0.8rem !important;
    right.appendChild( nav );
  color: #666 !important;
    right.appendChild( searchForm );
  font-family: 'Helvetica Neue', Arial, sans-serif !important;
}
#p-personal li a:hover { color: #750014 !important; }


/* ── Logo & Sidebar container (#mw-navigation) ──────────────── */
    /* Inner wrapper */
#mw-navigation {
    var inner = document.createElement( 'div' );
  background: #fff !important;
    inner.className = 'bmc-header-inner';
  border-right: 1px solid #e8e8e8 !important;
    inner.appendChild( logo );
  top: 92px !important; /* below topbar + header */
    inner.appendChild( right );
  position: fixed !important;
  left: 0 !important;
  bottom: 0 !important;
  width: 180px !important;
  overflow-y: auto !important;
  z-index: 100 !important;
}


/* Logo area */
    var header = document.createElement( 'header' );
#p-logo {
    header.className = 'bmc-header';
  position: static !important;
    header.appendChild( inner );
  width: auto !important;
    return header;
  height: auto !important;
   }
  margin: 0 !important;
  padding: 20px 16px 16px !important;
   border-bottom: 1px solid #e8e8e8 !important;
}


/* Hide the actual logo image; replace with CSS text badge */
  /* ── Build page hero ───────────────────────────────────────── */
#p-logo a {
  function buildHero( titleText ) {
  background-image: none !important;
    var crumb = document.createElement( 'div' );
  display: flex !important;
    crumb.className = 'bmc-breadcrumb';
  align-items: center !important;
    crumb.innerHTML =
  gap: 10px !important;
      '<a href="https://bmcwiki.mit.edu/index.php/BioMicroCenter">Home</a>' +
  text-decoration: none !important;
      '<span class="sep">›</span>' +
  height: auto !important;
      document.createTextNode( titleText ).textContent; // plain text, no XSS
  width: auto !important;
  float: none !important;
}


#p-logo a::before {
    var h1 = document.createElement( 'h1' );
  content: "BMC";
    h1.textContent = titleText;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  background: #750014;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 4px;
  letter-spacing: -0.5px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
}


#p-logo a::after {
    var inner = document.createElement( 'div' );
  content: "MIT BioMicro Center";
    inner.className = 'inner';
  display: block;
    inner.appendChild( crumb );
  font-size: 0.82rem;
    inner.appendChild( h1 );
  font-weight: 700;
  color: #1a1a1a;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.3;
  letter-spacing: -0.1px;
}


/* ── Sidebar navigation portlets (#mw-panel) ─────────────────── */
    var hero = document.createElement( 'div' );
#mw-panel {
    hero.className = 'bmc-page-hero';
  position: static !important;
    hero.appendChild( inner );
  width: auto !important;
    return hero;
  float: none !important;
   }
   padding: 12px 0 !important;
  background: transparent !important;
}


.portlet,
   /* ── Build sidebar TOC from MediaWiki #toc or heading scan ─── */
.mw-portlet {
   function buildSidebarToc( mwToc, contentEl ) {
   margin: 0 !important;
    var toc = document.createElement( 'div' );
   padding: 0 0 8px !important;
    toc.className = 'bmc-toc';
  border: none !important;
  background: transparent !important;
}


/* Portlet headings */
    var h3 = document.createElement( 'h3' );
.portlet h3,
    h3.textContent = 'On this page';
.mw-portlet-heading,
    toc.appendChild( h3 );
div.portlet h3 {
  font-family: 'Helvetica Neue', Arial, sans-serif !important;
  font-size: 0.68rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  color: #999 !important;
  padding: 10px 16px 4px !important;
  margin: 0 !important;
  border: none !important;
  background: none !important;
}


/* Portlet links */
    var list;
.portlet li,
.mw-portlet-body li {
  padding: 0 !important;
  margin: 0 !important;
  list-style: none !important;
  border: none !important;
}
.portlet li a,
.mw-portlet-body li a {
  display: block !important;
  padding: 5px 16px !important;
  font-size: 0.82rem !important;
  font-family: 'Helvetica Neue', Arial, sans-serif !important;
  color: #444 !important;
  border-radius: 4px !important;
  margin: 0 6px !important;
  transition: background 0.12s, color 0.12s !important;
  text-decoration: none !important;
}
.portlet li a:hover,
.mw-portlet-body li a:hover {
  background: #f0e8ea !important;
  color: #750014 !important;
  text-decoration: none !important;
}


/* ── Main content area (#content) ───────────────────────────── */
    if ( mwToc ) {
#content,
      /* Clone only the list from the MediaWiki TOC */
#mw-content-wrapper {
      var mwList = mwToc.querySelector( 'ul' );
  margin-left: 180px !important; /* match sidebar width */
      if ( mwList ) {
  margin-top: 92px !important;   /* topbar 32 + header 60 */
        list = mwList.cloneNode( true );
  margin-right: 0 !important;
        /* Mark sub-items */
  margin-bottom: 0 !important;
        list.querySelectorAll( 'li li' ).forEach( function ( li ) {
  padding: 0 !important;
          li.classList.add( 'bmc-sub' );
  background: #fff !important;
        } );
  border: none !important;
      }
  box-shadow: none !important;
    } else if ( contentEl ) {
  border-radius: 0 !important;
      /* Fall back to scanning h2/h3 headings directly */
  float: none !important;
      var headings = Array.prototype.slice.call(
  min-height: calc(100vh - 92px) !important;
        contentEl.querySelectorAll( 'h2, h3' )
}
      );
      if ( headings.length > 0 ) {
        list = document.createElement( 'ul' );
        headings.forEach( function ( heading ) {
          var anchor = heading.querySelector( '.mw-headline' );
          if ( !anchor || !anchor.id ) return;
          var li = document.createElement( 'li' );
          if ( heading.tagName === 'H3' ) li.classList.add( 'bmc-sub' );
          var a = document.createElement( 'a' );
          a.href = '#' + anchor.id;
          a.textContent = anchor.textContent.trim();
          li.appendChild( a );
          list.appendChild( li );
        } );
      }
    }


/* Hide MediaWiki "From bmcwiki..." subtitle */
    if ( !list || list.childNodes.length === 0 ) return null;
#siteSub,
#contentSub { display: none !important; }


/* ── Page Hero: style #firstHeading as the about.html hero ───── */
    toc.appendChild( list );
#firstHeading,
.mw-first-heading {
  background: linear-gradient(135deg, #750014 0%, #5c0010 100%) !important;
  color: #fff !important;
  font-family: 'Helvetica Neue', Arial, sans-serif !important;
  font-size: 1.9rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.5px !important;
  padding: 36px 40px 32px !important;
  margin: 0 !important;
  border: none !important;
  width: 100% !important;
  display: block !important;
}


/* Breadcrumb "Home ›" before the title */
    var aside = document.createElement( 'aside' );
#firstHeading::before {
    aside.className = 'bmc-sidebar';
  content: "Home  ›";
    aside.appendChild( toc );
  display: block;
    return aside;
  font-size: 0.78rem;
   }
  font-weight: 400;
  color: rgba(255,255,255,0.75);
  margin-bottom: 8px;
   letter-spacing: 0;
}


/* ── Body content area ──────────────────────────────────────── */
  /* ── Build footer ──────────────────────────────────────────── */
#bodyContent {
  function buildFooter() {
  padding: 36px 40px 60px !important;
    var inner = document.createElement( 'div' );
  max-width: 860px !important;
    inner.className = 'bmc-footer-inner';
  background: #fff !important;
    inner.innerHTML =
}
      '<div>' +
        '<h4>MIT BioMicro Center</h4>' +
        '<ul>' +
          '<li>Building 68-322</li>' +
          '<li>Cambridge, MA 02139</li>' +
          '<li><a href="mailto:biomicro@mit.edu">biomicro@mit.edu</a></li>' +
          '<li>617-715-4533</li>' +
        '</ul>' +
      '</div>' +
      '<div>' +
        '<h4>Services</h4>' +
        '<ul>' +
          '<li><a href="https://bmcwiki.mit.edu/index.php/BioMicroCenter:Sequencing">Bulk Sequencing</a></li>' +
          '<li><a href="https://bmcwiki.mit.edu/index.php/BioMicroCenter:SingleCell">Single Cell</a></li>' +
          '<li><a href="https://bmcwiki.mit.edu/index.php/BioMicroCenter:SpTx">Spatial Genomics</a></li>' +
          '<li><a href="https://igb.mit.edu/" target="_blank">Informatics</a></li>' +
        '</ul>' +
      '</div>' +
      '<div>' +
        '<h4>Resources</h4>' +
        '<ul>' +
          '<li><a href="https://bmcwiki.mit.edu/index.php/BioMicroCenter:FAQ">FAQs</a></li>' +
          '<li><a href="https://bmcwiki.mit.edu/index.php/BioMicroCenter:Consulting">Consulting</a></li>' +
          '<li><a href="https://bmcwiki.mit.edu/index.php/BioMicroCenter:Pricing">Grant Support &amp; Pricing</a></li>' +
          '<li><a href="https://bmcwiki.mit.edu/index.php/BioMicroCenter:Acknowledgement">Acknowledgements</a></li>' +
        '</ul>' +
      '</div>';


/* ── Typography ─────────────────────────────────────────────── */
    var bottom = document.createElement( 'div' );
.mw-parser-output {
    bottom.className = 'bmc-footer-bottom';
  font-family: 'Helvetica Neue', Arial, sans-serif !important;
    bottom.innerHTML =
  font-size: 0.9rem !important;
      '<span>&copy; ' + new Date().getFullYear() + ' MIT BioMicro Center</span>' +
  line-height: 1.6 !important;
      '<span>' +
  color: #333 !important;
        '<a href="https://bmcwiki.mit.edu/index.php/Special:UserLogin">Log in</a>' +
}
        ' &nbsp;|&nbsp; ' +
        '<a href="https://accessibility.mit.edu" target="_blank">Accessibility</a>' +
      '</span>';


.mw-parser-output h2 {
    var footer = document.createElement( 'footer' );
  font-size: 1.35rem !important;
    footer.className = 'bmc-footer';
  font-weight: 700 !important;
    footer.appendChild( inner );
  color: #1a1a1a !important;
    footer.appendChild( bottom );
  padding-bottom: 10px !important;
    return footer;
  border-bottom: 2px solid #750014 !important;
   }
  border-left: none !important;
   border-top: none !important;
  border-right: none !important;
  background: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  margin: 40px 0 16px !important;
  letter-spacing: -0.2px !important;
  scroll-margin-top: 100px !important;
}
.mw-parser-output h2:first-child { margin-top: 0 !important; }


.mw-parser-output h3 {
  /* ── Smooth scroll for anchor links ───────────────────────── */
  font-size: 1rem !important;
  function initSmoothScroll( container ) {
  font-weight: 600 !important;
    container.addEventListener( 'click', function ( e ) {
  color: #1a1a1a !important;
      var a = e.target.closest( 'a[href^="#"]' );
  margin: 24px 0 8px !important;
      if ( !a ) return;
}
      var id = decodeURIComponent( a.getAttribute( 'href' ).slice( 1 ) );
      var target = document.getElementById( id );
      if ( target ) {
        e.preventDefault();
        target.scrollIntoView( { behavior: 'smooth', block: 'start' } );
        history.pushState( null, '', '#' + id );
      }
    } );
  }


.mw-parser-output h4 {
  /* ── Fix row separators on tables with rowspan cells ──────── */
  font-size: 0.88rem !important;
  function fixRowspanSeparators( container ) {
  font-weight: 700 !important;
    container.querySelectorAll( '.wikitable' ).forEach( function ( table ) {
  color: #1a1a1a !important;
      var tbody = table.querySelector( 'tbody' ) || table;
  margin: 16px 0 6px !important;
      var rows = Array.from( tbody.querySelectorAll( 'tr' ) );
  letter-spacing: -0.1px !important;
      if ( !rows.length ) return;
}


.mw-parser-output p {
      rows.forEach( function ( row, rowIdx ) {
  margin-bottom: 14px !important;
        row.querySelectorAll( 'td[rowspan], th[rowspan]' ).forEach( function ( cell ) {
  color: #333 !important;
          var span = parseInt( cell.getAttribute( 'rowspan' ), 10 );
}
          if ( !span || span <= 1 ) return;


.mw-parser-output ul,
          cell.style.position = 'relative';
.mw-parser-output ol {
  margin: 0 0 14px 22px !important;
  color: #333 !important;
}
.mw-parser-output li { margin-bottom: 4px !important; }


/* ── TOC (Table of Contents) ────────────────────────────────── */
          for ( var i = 1; i < span; i++ ) {
#toc, .toc {
            var targetRow = rows[ rowIdx + i ];
  background: #f9f9f9 !important;
            if ( !targetRow ) break;
  border: 1px solid #e8e8e8 !important;
  border-radius: 8px !important;
  padding: 18px 20px !important;
  display: inline-block !important;
  min-width: 200px !important;
  font-size: 0.82rem !important;
  float: none !important;
  margin: 0 0 28px !important;
}
.toctitle h2,
#toc .toctitle h2 {
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  color: #999 !important;
  margin-bottom: 10px !important;
  border: none !important;
  background: none !important;
  padding: 0 !important;
  box-shadow: none !important;
}
#toc ul, .toc ul {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
#toc ul li, .toc ul li { margin: 0 0 2px !important; }
#toc ul li a, .toc ul li a {
  font-size: 0.82rem !important;
  color: #444 !important;
  padding: 3px 8px !important;
  display: block !important;
  border-radius: 4px !important;
  text-decoration: none !important;
  transition: background 0.12s, color 0.12s !important;
}
#toc ul li a:hover, .toc ul li a:hover {
  background: #f0e8ea !important;
  color: #750014 !important;
  text-decoration: none !important;
}
/* Sub-items */
#toc ul ul li a, .toc ul ul li a {
  padding-left: 18px !important;
  font-size: 0.78rem !important;
  color: #666 !important;
}


/* ── Edit section links ──────────────────────────────────────── */
            var cellRect  = cell.getBoundingClientRect();
.mw-editsection { display: inline !important; }
            var rowRect   = targetRow.getBoundingClientRect();
.mw-editsection a {
            var offsetTop = rowRect.top - cellRect.top;
   font-size: 0.72rem !important;
  color: #999 !important;
  margin-left: 8px !important;
}
.mw-editsection a:hover { color: #750014 !important; }
.mw-editsection-bracket { color: #ddd !important; }


/* ── Tables ─────────────────────────────────────────────────── */
            var sep = document.createElement( 'div' );
/* Scoped to .wikitable only — layout tables (no class) handled separately below */
            sep.style.cssText =
 
              'position:absolute;left:0;right:0;' +
.wikitable {
              'top:' + offsetTop + 'px;' +
  border-collapse: collapse !important;
              'height:1px;background:#e0e0e0;' +
  width: 100% !important;
              'pointer-events:none;z-index:1;';
  margin: 1em 0 !important;
            cell.appendChild( sep );
  font-size: 0.875rem !important;
          }
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif !important;
        } );
  border: none !important;
      } );
  border-radius: 6px !important;
    } );
  overflow: hidden !important;
  }
  background: #fff !important;
  table-layout: auto !important;
}
.wikitable th {
  background: #750014 !important;
  color: #fff !important;
  font-weight: 600 !important;
  font-size: 0.875rem !important;
  padding: 13px 18px !important;
  text-align: left !important;
  border: none !important;
  white-space: normal !important;
  overflow-wrap: break-word !important;
  line-height: 1.4 !important;
}
.wikitable td {
  padding: 12px 18px !important;
  border: none !important;
  border-bottom: 1px solid #e0e0e0 !important;
  vertical-align: top !important;
  color: #222 !important;
  font-size: 0.875rem !important;
  text-align: left !important;
  line-height: 1.5 !important;
  background: #fff !important;
  overflow-wrap: break-word !important;
}
/* Row separator */
.wikitable tr:last-child td { border-bottom: none !important; }
/* Section-description rows (colspan td used as sub-headers in Pricing tables) */
.wikitable td[colspan] {
  background: #f5f5f5 !important;
  color: #444 !important;
  font-size: 0.82rem !important;
  text-align: left !important;
  line-height: 1.5 !important;
}
/* Links inside table cells */
.wikitable td a { color: #750014 !important; }
.wikitable td a:hover { color: #750014 !important; text-decoration: underline !important; }
 
/* Images inside table cells */
.wikitable td img {
  max-width: 160px !important;
  height: auto !important;
  display: block !important;
  margin: 6px 0 8px !important;
}
 
/* Paragraphs inside table cells */
.wikitable td p {
  margin: 0 0 6px !important;
  font-size: 0.875rem !important;
  line-height: 1.5 !important;
  color: #222 !important;
}
.wikitable td p:last-child { margin-bottom: 0 !important; }
 
/* ── Code ───────────────────────────────────────────────────── */
.mw-parser-output code,
.mw-parser-output pre,
.mw-parser-output tt {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace !important;
  background: #f4f4f4 !important;
  border: 1px solid #e8e8e8 !important;
  border-radius: 4px !important;
  font-size: 0.85rem !important;
}
.mw-parser-output code,
.mw-parser-output tt { padding: 1px 5px !important; }
.mw-parser-output pre { padding: 12px 16px !important; overflow-x: auto !important; }
 
/* ── Component classes (wiki editors add these to markup) ────── */
 
.service-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 20px 0 28px;
}
.service-card {
  background: #f9f9f9;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 20px 22px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.service-card:hover { border-color: #c8a0a8; box-shadow: 0 2px 10px rgba(117,0,20,0.07); }
.service-card h4 { font-size: 0.88rem !important; font-weight: 700 !important; color: #1a1a1a !important; margin-bottom: 6px !important; }
.service-card p { font-size: 0.82rem !important; color: #555 !important; margin: 0 !important; line-height: 1.5 !important; }
 
.staff-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.staff-card { background: #f9f9f9; border: 1px solid #e8e8e8; border-radius: 8px; padding: 16px 18px; }
.staff-card .staff-name { font-size: 0.88rem; font-weight: 700; color: #1a1a1a; display: block; }
.staff-card .staff-role { font-size: 0.78rem; color: #666; margin-top: 3px; line-height: 1.4; display: block; }
.staff-card.director { grid-column: 1 / -1; background: #fdf5f6; border-color: #d4a0a8; display: flex; align-items: center; gap: 18px; }
.director-badge { width: 44px; height: 44px; background: #750014; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 1rem; flex-shrink: 0; }
.staff-card.director .staff-name { font-size: 1rem !important; }
.staff-card.director .staff-role { font-size: 0.82rem !important; color: #444 !important; font-weight: 500; }
 
.pub-list { list-style: none !important; margin: 0 !important; padding: 0 !important; }
.pub-list li { padding: 14px 0 !important; border-bottom: 1px solid #f0f0f0 !important; font-size: 0.85rem !important; }
.pub-list li:last-child { border-bottom: none !important; }
.pub-list .pub-lab { font-weight: 700; color: #1a1a1a; display: block; }
.pub-list .pub-desc { color: #444; margin-top: 3px; line-height: 1.5; display: block; }
.pub-list .pub-cite { display: inline-block; margin-top: 5px; font-size: 0.75rem; background: #f0f0f0; color: #555; padding: 2px 8px; border-radius: 10px; }
 
.affil-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 18px 0 24px; }
.affil-card { background: #f9f9f9; border: 1px solid #e8e8e8; border-radius: 8px; padding: 16px 18px; }
.affil-card .affil-name { font-size: 0.85rem; font-weight: 700; color: #1a1a1a; display: block; }
.affil-card .affil-rep { font-size: 0.78rem; color: #666; margin-top: 4px; display: block; }
 
.note { background: #fdf6f0; border-left: 3px solid #e07b39; padding: 10px 14px; border-radius: 0 6px 6px 0; font-size: 0.82rem; color: #555; margin: 12px 0 18px; }
.note strong { color: #1a1a1a; }
.note.note-info { background: #f0f6ff; border-left-color: #3b7dd8; }
 
.contact-block { background: #f9f9f9; border: 1px solid #e8e8e8; border-radius: 8px; padding: 22px 24px; display: flex; gap: 40px; flex-wrap: wrap; font-size: 0.85rem; }
.contact-item { display: flex; flex-direction: column; gap: 3px; }
.contact-item .label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: #999; }
.contact-item .value { color: #1a1a1a; font-weight: 500; }
.contact-item a { color: #750014 !important; }


/* ── Footer ─────────────────────────────────────────────────── */
  /* ── Edit bar for logged-in users ─────────────────────────── */
#footer {
  function buildEditBar( currentPage ) {
  background: #1a1a1a !important;
    if ( !mw.config.get( 'wgUserId' ) ) return null;
  color: #aaa !important;
    var bar = document.createElement( 'div' );
  font-size: 0.82rem !important;
    bar.className = 'bmc-edit-bar';
  display: flex !important;
    var editHref = mw.util.getUrl( currentPage, { action: 'edit' } );
  gap: 32px !important;
    var histHref = mw.util.getUrl( currentPage, { action: 'history' } );
  padding: 40px 24px 0 !important;
    var talkHref = mw.util.getUrl( 'Talk:' + currentPage );
  margin-top: 48px !important;
    bar.innerHTML =
  border-top: 3px solid #750014 !important;
      '<a href="' + editHref + '">Edit</a>' +
}
      '<a href="' + histHref + '">History</a>' +
#footer .bmc-footer-col { flex: 1 1 0; min-width: 0; }
      '<a href="' + talkHref + '">Talk</a>';
#footer h4 { font-size: 0.75rem !important; font-weight: 700 !important; text-transform: uppercase !important; letter-spacing: 0.08em !important; color: #fff !important; margin: 0 0 12px !important; border: none !important; background: none !important; padding: 0 !important; box-shadow: none !important; }
     return bar;
#footer ul { list-style: none !important; margin: 0 !important; padding: 0 !important; }
#footer ul li { margin-bottom: 6px !important; padding: 0 !important; }
#footer a { color: #aaa !important; text-decoration: none !important; }
#footer a:hover { color: #fff !important; }
 
/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 860px) {
  #mw-navigation {
    position: static !important;
    width: 100% !important;
    border-right: none !important;
     border-bottom: 1px solid #e8e8e8 !important;
   }
   }
  #content, #mw-content-wrapper {
    margin-left: 0 !important;
    margin-top: 0 !important;
  }
  #footer { margin-left: 0 !important; }
  .service-grid, .staff-grid, .affil-grid { grid-template-columns: 1fr !important; }
  .contact-block { flex-direction: column !important; gap: 16px !important; }
}


/* ── Hide original MW chrome once the BMC wrapper is injected ── */
  /* ── Main: build and inject the shell ─────────────────────── */
/* common.js adds .bmc-active to <body> after injecting #bmc-wrapper,
  function buildShell() {
  so this only fires on view pages, leaving edit/special pages intact.
    var currentPage = mw.config.get( 'wgPageName' ) || '';
  The child selector hides ALL original MW elements regardless of skin
  version (Vector legacy, Vector 2022, etc.) without needing to list
  every possible ID.                                                   */
body.bmc-active > *:not(#bmc-wrapper):not(script):not(style) {
  display: none !important;
}


/* ── BMC Shell (injected by common.js) ─────────────────────── */
    /* 1. Extract wiki content BEFORE any DOM manipulation */
    var mwContentText = document.getElementById( 'mw-content-text' );
    if ( !mwContentText ) return; /* not a content page, bail */


#bmc-wrapper {
    var contentClone = mwContentText.cloneNode( true );
  font-family: 'Helvetica Neue', Arial, sans-serif;
  color: #1a1a1a;
  background: #fff;
  line-height: 1.6;
}


/* Topbar */
    /* 2. Extract page title */
.bmc-topbar { background: #750014; color: rgba(255,255,255,0.9); font-size: 0.75rem; padding: 6px 0; text-align: right; }
    var titleEl = document.getElementById( 'firstHeading' ) ||
.bmc-topbar .inner { max-width: 1140px; margin: 0 auto; padding: 0 24px; }
      document.querySelector( '.mw-first-heading' );
.bmc-topbar a { color: rgba(255,255,255,0.85) !important; text-decoration: none !important; }
    var titleText = titleEl
.bmc-topbar a:hover { color: #fff !important; text-decoration: none !important; }
      ? titleEl.textContent.trim()
.bmc-topbar span { margin: 0 6px; opacity: 0.5; }
      : ( mw.config.get( 'wgTitle' ) || 'BioMicro Center' );


/* Header */
    /* 3. Extract MediaWiki TOC from the cloned content */
.bmc-header { background: #fff; border-bottom: 1px solid #e0e0e0; position: sticky; top: 0; z-index: 100; box-shadow: 0 1px 4px rgba(0,0,0,0.07); }
    var mwToc = contentClone.querySelector( '#toc, .toc' );
.bmc-header-inner { max-width: 1140px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; height: 68px; }
    if ( mwToc ) mwToc.parentNode.removeChild( mwToc ); /* remove from content body */
.bmc-header-right { display: flex; align-items: center; gap: 16px; }


/* Logo */
    /* 3b. Hide the BMC logo/header sticker by exact image filename.
.bmc-logo { display: flex !important; align-items: center !important; text-decoration: none !important; }
          The sticker is BMC_Header_2020_3.png (from the {{BioMicroCenter}} template)
.bmc-logo-img { height: 56px !important; width: auto !important; display: block !important; }
          and bmc_logo_square.png. Target the nearest meaningful container so the
          surrounding content (nav links, table structure) is preserved. */
    contentClone.querySelectorAll( 'img' ).forEach( function ( img ) {
      var src = img.getAttribute( 'src' ) || '';
      if ( /BMC_Header|bmc_logo_square|Bmc_logo|\/Logo\.png/i.test( src ) ) {
        var container = img.closest( '.thumb' ) || img.closest( 'figure' ) || img.closest( 'td' );
        if ( container ) {
          container.style.display = 'none';
        } else {
          img.style.display = 'none';
        }
      }
    } );


/* Nav */
    /* 4. Build shell elements */
.bmc-nav { display: flex; align-items: center; }
    var topbar = buildTopbar();
.bmc-nav > ul { list-style: none !important; display: flex !important; gap: 2px; margin: 0 !important; padding: 0 !important; }
    var header = buildHeader( currentPage );
.bmc-nav > ul > li { position: relative; }
    var hero  = buildHero( titleText );
.bmc-nav > ul > li > a { display: block !important; padding: 8px 14px !important; font-size: 0.85rem !important; font-weight: 500 !important; color: #333 !important; border-radius: 4px !important; white-space: nowrap; transition: background 0.15s, color 0.15s; text-decoration: none !important; background: transparent !important; border: none !important; }
.bmc-nav > ul > li > a:hover { background: #f5f5f5 !important; color: #750014 !important; text-decoration: none !important; }
.bmc-nav > ul > li.bmc-active > a { background: transparent !important; color: #750014 !important; text-decoration: none !important; }
.bmc-nav > ul > li.bmc-active > a:hover { background: #f5f5f5 !important; }


/* Dropdown */
    /* Page layout grid */
.bmc-dropdown { position: relative; }
    var layout = document.createElement( 'div' );
.bmc-dropdown > a::after { content: ' '; font-size: 0.65rem; opacity: 0.6; }
    layout.className = 'bmc-page-layout';
.bmc-dropdown-menu { display: none; position: absolute; top: calc(100% + 4px); left: 0; background: #fff; border: 1px solid #e0e0e0; border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,0.10); min-width: 200px; padding: 6px 0; z-index: 200; }
.bmc-dropdown-menu::before { content: ''; position: absolute; top: -8px; left: 0; right: 0; height: 8px; background: transparent; }
.bmc-dropdown:hover .bmc-dropdown-menu { display: block; }
.bmc-dropdown-menu a { display: block !important; padding: 8px 18px !important; font-size: 0.83rem !important; color: #333 !important; white-space: nowrap; text-decoration: none !important; background: transparent !important; transition: background 0.12s; }
.bmc-dropdown-menu a:hover { background: #faf0f0 !important; color: #750014 !important; text-decoration: none !important; }
.bmc-divider { border-top: 1px solid #eee; margin: 4px 0; }
.bmc-group-label { padding: 6px 18px 2px; font-size: 0.7rem; font-weight: 600; color: #999; text-transform: uppercase; letter-spacing: 0.05em; }


/* Logged-in username display */
    /* Sidebar — skip on the home page */
.bmc-user-info {
    var isHome = ( currentPage === 'BioMicroCenter' ||
  font-size: 0.8rem;
                  currentPage === 'Main_Page' );
  color: #555;
    var sidebar = isHome ? null : buildSidebarToc( mwToc, contentClone );
  font-weight: 500;
    if ( sidebar ) {
  white-space: nowrap;
      layout.appendChild( sidebar );
  padding-left: 12px;
    } else {
  border-left: 1px solid #e0e0e0;
      /* No TOC — collapse to single-column via inline style */
  margin-left: 4px;
      layout.style.gridTemplateColumns = '1fr';
}
    }


/* Search form */
    /* Main content area */
.bmc-search-form { display: flex; align-items: center; gap: 4px; }
    var main = document.createElement( 'main' );
.bmc-search-form input[type="search"] { border: 1px solid #e0e0e0; border-radius: 4px; padding: 5px 10px; font-size: 0.83rem; font-family: 'Helvetica Neue', Arial, sans-serif; color: #333; width: 180px; outline: none; background: #fff; }
    main.className = 'bmc-content';
.bmc-search-form input[type="search"]:focus { border-color: #750014; }
    var editBar = buildEditBar( currentPage );
.bmc-search-form button { background: #750014; border: none; border-radius: 4px; color: #fff; font-size: 0.85rem; padding: 5px 10px; cursor: pointer; }
    if ( editBar ) { main.appendChild( editBar ); }
.bmc-search-form button:hover { background: #5c0010; }
    main.appendChild( contentClone );
    layout.appendChild( main );


/* Page hero */
    var footer = buildFooter();
.bmc-page-hero { background: linear-gradient(135deg, #750014 0%, #5c0010 100%); color: #fff; padding: 40px 0 36px; }
.bmc-page-hero .inner { max-width: 1140px; margin: 0 auto; padding: 0 24px; }
.bmc-breadcrumb { font-size: 0.78rem; margin-bottom: 10px; opacity: 0.75; }
.bmc-breadcrumb a { color: #fff !important; text-decoration: none !important; }
.bmc-breadcrumb .sep { margin: 0 6px; }
.bmc-page-hero h1 { font-size: 2rem !important; font-weight: 700 !important; letter-spacing: -0.5px !important; color: #fff !important; margin: 0 !important; border: none !important; background: none !important; padding: 0 !important; box-shadow: none !important; }
.bmc-hero-links { display: flex !important; flex-wrap: wrap !important; gap: 10px !important; margin-top: 4px !important; }
.bmc-hero-link { color: #fff !important; background: rgba(255,255,255,0.15) !important; border: 1px solid rgba(255,255,255,0.38) !important; border-radius: 20px !important; padding: 6px 16px !important; font-size: 0.85rem !important; font-weight: 500 !important; text-decoration: none !important; transition: background 0.18s ease, border-color 0.18s ease !important; white-space: nowrap !important; }
.bmc-hero-link:hover { background: rgba(255,255,255,0.28) !important; border-color: rgba(255,255,255,0.65) !important; text-decoration: none !important; }


/* Page layout */
    /* 5. Build wrapper */
.bmc-page-layout { max-width: 1140px; margin: 0 auto; padding: 40px 24px 80px; display: grid; grid-template-columns: 220px 1fr; gap: 40px; }
    var wrapper = document.createElement( 'div' );
    wrapper.id = 'bmc-wrapper';
    wrapper.appendChild( topbar );
    wrapper.appendChild( header );
    wrapper.appendChild( hero );
    wrapper.appendChild( layout );
    wrapper.appendChild( footer );


/* Sidebar */
    /* 6. Inject into body (prepend so it appears first) */
.bmc-sidebar { position: sticky; top: 84px; align-self: start; }
    document.body.insertBefore( wrapper, document.body.firstChild );
.bmc-toc { background: #f9f9f9; border: 1px solid #e8e8e8; border-radius: 8px; padding: 20px; }
.bmc-toc h3 { font-size: 0.78rem !important; font-weight: 700 !important; text-transform: uppercase !important; letter-spacing: 0.08em !important; color: #999 !important; margin-bottom: 12px !important; border: none !important; background: none !important; padding: 0 !important; box-shadow: none !important; }
.bmc-toc ul { list-style: none !important; margin: 0 !important; padding: 0 !important; }
.bmc-toc ul li { margin-bottom: 2px !important; }
.bmc-toc ul li a { font-size: 0.82rem !important; color: #444 !important; padding: 4px 8px !important; display: block !important; border-radius: 4px !important; text-decoration: none !important; transition: background 0.12s, color 0.12s; }
.bmc-toc ul li a:hover { background: #f0e8ea !important; color: #750014 !important; text-decoration: none !important; }
.bmc-toc ul li.bmc-sub a { padding-left: 20px !important; color: #666 !important; font-size: 0.78rem !important; }


/* Content */
    /* 7. Add class immediately so the CSS rule kicks in and hides
.bmc-content { min-width: 0; font-family: 'Helvetica Neue', Arial, sans-serif; font-size: 0.9rem; line-height: 1.6; color: #333; }
          all original MW elements (works for any skin version) */
.bmc-content h2 { font-size: 1.35rem !important; font-weight: 700 !important; color: #1a1a1a !important; padding-bottom: 10px !important; border-bottom: 2px solid #750014 !important; border-left: none !important; border-top: none !important; border-right: none !important; background: none !important; box-shadow: none !important; border-radius: 0 !important; margin: 48px 0 18px !important; letter-spacing: -0.2px !important; scroll-margin-top: 88px !important; }
    document.body.classList.add( 'bmc-active' );
.bmc-content h2:first-child { margin-top: 0 !important; }
.bmc-content h3 { font-size: 1rem !important; font-weight: 600 !important; color: #1a1a1a !important; margin: 28px 0 10px !important; scroll-margin-top: 88px !important; }
.bmc-content p { margin-bottom: 14px; font-size: 0.9rem; color: #333; }
.bmc-content p:last-child { margin-bottom: 0; }
.bmc-content ul, .bmc-content ol { margin: 0 0 14px 22px; color: #333; }
.bmc-content li { margin-bottom: 4px; }


/* Edit bar — shown to logged-in users at top of content area */
    /* 8. Smooth scroll */
.bmc-edit-bar { display: flex !important; gap: 12px !important; justify-content: flex-end !important; padding: 6px 0 10px !important; border-bottom: 1px solid #e8e8e8 !important; margin-bottom: 16px !important; }
    initSmoothScroll( main );
.bmc-edit-bar a { font-size: 0.78rem !important; color: #750014 !important; text-decoration: none !important; font-weight: 500 !important; }
    initSmoothScroll( sidebar || main );
.bmc-edit-bar a:hover { text-decoration: underline !important; }


/* Responsive (bmc shell) */
    /* 9. Auto-style plain tables in content */
@media (max-width: 860px) {
    main.querySelectorAll(
  .bmc-page-layout { grid-template-columns: 1fr; }
      '.mw-parser-output table:not(.wikitable):not(.infobox):not(.navbox)'
  .bmc-sidebar { position: static; }
    ).forEach( function ( t ) {
  #footer { flex-wrap: wrap; }
      t.classList.add( 'wikitable' );
  #footer .bmc-footer-col { flex: 1 1 45%; }
    } );
}
@media (max-width: 580px) {
  #footer .bmc-footer-col { flex: 1 1 100%; }
  .bmc-nav > ul { display: none !important; }
  .bmc-page-hero h1 { font-size: 1.5rem !important; }
}


/* ── Content overrides: clean up main-page legacy styling ─── */
    /* 10. Fix row separators on rowspan tables */
    requestAnimationFrame( function () {
      fixRowspanSeparators( main );
    } );


/* Hide the BMC header/logo sticker images (JS handles this by src; CSS is a fallback) */
img[src*="BMC_Header"],
img[src*="bmc_logo_square"],
img[src*="Bmc_logo"] {
  display: none !important;
}


/* Keep header background even if inline style is present */
   }
.wikitable th[style*="background"] { background: #750014 !important; }
 
/* ── Layout tables (non-wikitable): clean up legacy styling ──── */
/* The wiki uses plain tables (no .wikitable) for service grids and
  column layouts. Keep them as standard HTML tables — do NOT flex —
  but replace the legacy black borders with subtle card styling.      */
 
/* Outer layout table: remove legacy table-level border/background */
.bmc-content .mw-parser-output > table:not(.wikitable):not(.navbox):not(.infobox) {
   border: none !important;
  background: transparent !important;
  width: 100% !important;
  max-width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 6px !important;
  margin-bottom: 24px !important;
}
 
/* Layout cells with inline border (service grid cards) */
.bmc-content .mw-parser-output > table:not(.wikitable) td[style*="border"] {
  border: 1px solid #e8e8e8 !important;
  border-radius: 6px !important;
  padding: 18px 20px !important;
  vertical-align: top !important;
  background: #ffffff !important;
  transition: background 0.18s ease !important;
}
 
/* Section-header cells (Assisted Services / Walkup / Informatics) — colspan rows */
.bmc-content .mw-parser-output > table:not(.wikitable) td[colspan][style*="border"] {
  background: transparent !important;
  border-radius: 6px !important;
  padding: 10px 16px !important;
  text-align: left !important;
}
 
/* Inner nested tables inside service cards — strip borders (non-wikitable only) */
.bmc-content .mw-parser-output td > table:not(.wikitable) {
  border: none !important;
  background: transparent !important;
  border-spacing: 0 !important;
  width: 100% !important;
}
.bmc-content .mw-parser-output td > table:not(.wikitable) td {
  border: none !important;
  padding: 0 !important;
  background: transparent !important;
}
 
/* Service card headings: wiki uses <big><b>title</b></big> */
.bmc-content .mw-parser-output big b,
.bmc-content .mw-parser-output big strong {
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  color: #1a1a1a !important;
  display: block !important;
  margin-bottom: 6px !important;
  font-family: 'Helvetica Neue', Arial, sans-serif !important;
}
 
/* Lists inside service cards */
.bmc-content .mw-parser-output > table:not(.wikitable) ul,
.bmc-content .mw-parser-output > table:not(.wikitable) li {
  font-size: 1rem !important;
  color: #444 !important;
  margin-bottom: 3px !important;
}
 
/* Plain layout cells without border (e.g. News page columns) */
.bmc-content .mw-parser-output > table:not(.wikitable) td:not([style*="border"]) {
  border: none !important;
  padding: 6px 8px !important;
  vertical-align: top !important;
  background: transparent !important;
}
 
/* ── Home page: service card hover-to-reveal bullet lists ───────── */
 
/* ▾ indicator on card headings — signals the heading is interactive */
.bmc-home .bmc-content .mw-parser-output big b::after,
.bmc-home .bmc-content .mw-parser-output big strong::after {
  content: ' ▾';
  font-size: 0.65rem;
  font-weight: 400;
  opacity: 0.35;
  transition: opacity 0.2s;
}
.bmc-home .bmc-content .mw-parser-output > table:not(.wikitable) td[style*="border"]:hover big b::after,
.bmc-home .bmc-content .mw-parser-output > table:not(.wikitable) td[style*="border"]:hover big strong::after {
  opacity: 0.75;
}
 
/* Grey background on hover for home page service cards */
.bmc-home .bmc-content .mw-parser-output > table:not(.wikitable) td[style*="border"]:hover {
  background: #f0f0f0 !important;
}
 
/* No ▾ arrow on cards that have no expandable list */
.bmc-home .bmc-content .mw-parser-output big b.bmc-no-list::after,
.bmc-home .bmc-content .mw-parser-output big strong.bmc-no-list::after {
  content: none !important;
}
/* No ▾ arrow on headings inside the service browser panels */
.bmc-panel-item big b::after,
.bmc-panel-item big strong::after {
  content: none !important;
}
 
/* Hide bullet lists inside service cards by default */
.bmc-home .bmc-content .mw-parser-output > table:not(.wikitable) td[style*="border"] ul {
  max-height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  transition: max-height 0.32s ease, opacity 0.25s ease !important;
}
 
/* Slide down and fade in on card hover */
.bmc-home .bmc-content .mw-parser-output > table:not(.wikitable) td[style*="border"]:hover ul {
  max-height: 400px !important;
  opacity: 1 !important;
  margin-top: 6px !important;
}


/* Home page overview dropdown */
  /* ── Entry point ───────────────────────────────────────────── */
  mw.hook( 'wikipage.content' ).add( function () {
    /* Skip special pages (edit forms, history, etc.) to not break them */
    var ns = mw.config.get( 'wgNamespaceNumber' );
    var action = mw.config.get( 'wgAction' );
    if ( action !== 'view' ) return;
    if ( ns < 0 ) return; /* Special: pages */


/* ── Home page: service browser ─────────────────────────── */
    buildShell();
.bmc-service-browser {
   } );
  display: flex;
  gap: 20px;
  margin: 0 0 32px;
  align-items: flex-start;
  min-height: 220px;
}
.bmc-category-list {
  flex: 0 0 340px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* margin-left set by JS; transition added by JS after first paint */
}
.bmc-browser-active .bmc-category-list {
  flex-basis: 230px;
}
.bmc-category-btn {
  padding: 18px 22px !important;
  border: 1px solid #e8e8e8 !important;
  border-radius: 8px !important;
  background: #fff !important;
  text-align: left !important;
  cursor: pointer !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  color: #1a1a1a !important;
  transition: background 0.15s, border-color 0.15s !important;
  width: 100% !important;
}
.bmc-category-btn:hover { background: #f0f0f0 !important; }
.bmc-category-btn.bmc-cat-active {
  border-color: #750014 !important;
  color: #750014 !important;
}
.bmc-category-panels {
  flex: 1;
  min-width: 0;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-width 0.38s ease, opacity 0.28s ease 0.15s;
}
.bmc-browser-active .bmc-category-panels {
  max-width: 1000px;
  opacity: 1;
}
.bmc-category-panel { display: none; border: 1px solid #e8e8e8; border-radius: 8px; overflow: hidden; }
.bmc-category-panel.bmc-panel-visible { display: block; }
.bmc-panel-items { padding: 4px 0 !important; }
.bmc-panel-item {
  padding: 10px 20px !important;
  border-bottom: 1px solid #f5f5f5 !important;
  font-size: 1rem !important;
  color: #333 !important;
}
.bmc-panel-item:last-child { border-bottom: none !important; }
/* Force uniform 1rem on every inline element inside panel items and sublists */
.bmc-panel-item *, .bmc-panel-sublist * {
  font-size: 1rem !important;
}
/* Reset block display from general big b rules so injected HTML renders inline */
.bmc-panel-item big, .bmc-panel-item b, .bmc-panel-item strong {
  display: inline !important;
  font-size: 1rem !important;
  margin: 0 !important;
}
.bmc-panel-item a {
  color: #333 !important;
  text-decoration: none !important;
  font-weight: 500 !important;
}
.bmc-panel-item a:hover {
  color: #750014 !important;
  text-decoration: underline !important;
}.mw-parser-output .bmc-panel-sublist {
  margin: 0 !important;
  padding: 6px 0 4px 20px !important;
  list-style-type: disc !important;
  list-style-position: outside !important;
}
.mw-parser-output .bmc-panel-sublist li {
  font-size: 1rem !important;
  color: #555 !important;
  padding: 4px 0 !important;
  margin: 0 !important;
  display: list-item !important;
  list-style-type: disc !important;
}
@media ( max-width: 640px ) {
  .bmc-service-browser { flex-direction: column !important; min-height: 0 !important; }
   .bmc-category-list { flex-basis: auto !important; width: 100% !important; margin-left: 0 !important; }
  .bmc-category-panels { max-width: 100% !important; opacity: 1 !important; }
}


/* ── Pricing page: flex-based table layout ──────────────────
} )();
  Converts every .wikitable on the Pricing page to a flex
  row model so header cells and data cells always align.
  colspan cells get flex-grow set by JS (step 11) to span
  the correct number of columns proportionally.            */
.bmc-pricing .wikitable {
  display: block !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  width: 100% !important;
  border-collapse: separate !important;
  border-radius: 6px !important;
  border: 1px solid #e0e0e0 !important;
  margin: 1em 0 !important;
}
.bmc-pricing .wikitable thead,
.bmc-pricing .wikitable tbody,
.bmc-pricing .wikitable tfoot {
  display: block !important;
  width: 100% !important;
}
.bmc-pricing .wikitable tr {
  display: flex !important;
  width: 100% !important;
  border-bottom: 1px solid #e0e0e0 !important;
}
.bmc-pricing .wikitable tr:last-child {
  border-bottom: none !important;
}
.bmc-pricing .wikitable th,
.bmc-pricing .wikitable td {
  display: block !important;
  flex: 1 1 0% !important;    /* overridden per-cell by JS for colspan */
  min-width: 0 !important;
  box-sizing: border-box !important;
  border: none !important;
  border-right: 1px solid rgba(255,255,255,0.18) !important;
  border-bottom: none !important;
  padding: 13px 18px !important;
  white-space: normal !important;
  overflow-wrap: break-word !important;
  word-break: normal !important;
  vertical-align: top !important;
}
.bmc-pricing .wikitable td {
  border-right-color: #f0f0f0 !important;
  background: #fff !important;
  font-size: 0.875rem !important;
  color: #222 !important;
  line-height: 1.5 !important;
}
.bmc-pricing .wikitable th:last-child,
.bmc-pricing .wikitable td:last-child {
  border-right: none !important;
}
/* Section-description spanning rows stay grey-tinted */
.bmc-pricing .wikitable td[colspan] {
  background: #f5f5f5 !important;
  color: #444 !important;
  font-size: 0.82rem !important;
}

Revision as of 15:08, 30 June 2026

/**
 * BioMicro Center Wiki — Full DOM Replacement
 * Paste into: User:USERNAME/common.js
 *
 * Strategy:
 * 1. Extract wiki article content from MediaWiki's DOM
 * 2. Inject the complete about.html shell structure
 * 3. Place article content inside the shell
 * MediaWiki still runs underneath for editing, search, login, etc.
 */

( function () {
  'use strict';

  /* ── Nav definition (matches about.html exactly) ──────────── */
  var NAV = [
    {
      label: 'About',
      href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:AboutBMC',
      match: [ 'AboutBMC' ]
    },
    {
      label: 'News',
      href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:News',
      match: [ 'News', 'Seminar' ],
      items: [
        { label: 'Latest News',        href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:News' },
        { label: 'Seminars',           href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:News' },
        { label: 'Classes & Training', href: 'https://igb.mit.edu/mini-courses', ext: true }
      ]
    },
    {
      label: 'Services',
      href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:Assisted_Services',
      match: [ 'Assisted_Services', 'Walkup', 'Service', 'Consumable', 'SingleCell', 'SpTx', 'Sequencing', 'Analysis' ],
      items: [
        { label: 'Walkup',      href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:Walkup_Services' },
        { label: 'Assisted',    href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:Assisted_Services' },
        { label: 'Consumables', href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:Consumables' },
        { label: 'Training',    href: 'https://igb.mit.edu/mini-courses', ext: true },
        { label: 'Informatics', href: 'https://igb.mit.edu/', ext: true }
      ]
    },
    {
      label: 'Submission',
      href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:Submission',
      match: [ 'Submission', 'Submit', 'Pricing' ],
      items: [
        { groupLabel: 'MIT Users' },
        { label: 'Submit a Sample', href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:Submission' },
        { label: 'MIT Pricing',     href: 'https://bmcwiki.mit.edu/index.php/MIT:Pricing' },
        { divider: true },
        { groupLabel: 'Non-MIT Users' },
        { label: 'External Submission', href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:Submission' },
        { label: 'External Pricing',    href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:Pricing' }
      ]
    },
    {
      label: 'Staff',
      href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:People',
      match: [ 'People', 'Staff' ]
    },
    {
      label: 'Resources',
      href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:FAQ',
      match: [ 'FAQ', 'Resource', 'Form', 'Acknowledgement', 'Consulting' ],
      items: [
        { label: 'FAQs',                    href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:FAQ' },
        { label: 'Consulting',              href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:Consulting' },
        { label: 'Grant Support & Pricing', href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:Pricing' },
        { label: 'Acknowledgements',        href: 'https://bmcwiki.mit.edu/index.php/BioMicroCenter:Acknowledgement' }
      ]
    }
  ];

  /* ── Build topbar HTML ─────────────────────────────────────── */
  function buildTopbar() {
    var d = document.createElement( 'div' );
    d.className = 'bmc-topbar';
    d.innerHTML =
      '<div class="inner">' +
        '<a href="mailto:biomicro@mit.edu">biomicro@mit.edu</a>' +
        '<span>|</span>' +
        '617-715-4533' +
        '<span>|</span>' +
        'Building 68-322' +
      '</div>';
    return d;
  }

  /* ── Build nav dropdown item ───────────────────────────────── */
  function buildDropdownMenu( items ) {
    var menu = document.createElement( 'div' );
    menu.className = 'bmc-dropdown-menu';
    items.forEach( function ( item ) {
      if ( item.divider ) {
        var div = document.createElement( 'div' );
        div.className = 'bmc-divider';
        menu.appendChild( div );
      } else if ( item.groupLabel ) {
        var gl = document.createElement( 'div' );
        gl.className = 'bmc-group-label';
        gl.textContent = item.groupLabel;
        menu.appendChild( gl );
      } else {
        var a = document.createElement( 'a' );
        a.href = item.href;
        a.textContent = item.label;
        if ( item.ext ) a.target = '_blank';
        menu.appendChild( a );
      }
    } );
    return menu;
  }

  /* ── Build full header ─────────────────────────────────────── */
  function buildHeader( currentPage ) {
    /* Logo */
    var logo = document.createElement( 'a' );
    logo.href = 'https://bmcwiki.mit.edu/index.php/BioMicroCenter';
    logo.className = 'bmc-logo';
    logo.innerHTML =
      '<img class="bmc-logo-img" src="https://bmcwiki.mit.edu/images/c/c9/Logo.png" alt="MIT BioMicro Center" />';

    /* Nav */
    var ul = document.createElement( 'ul' );
    NAV.forEach( function ( item ) {
      var li = document.createElement( 'li' );
      var isActive = ( item.match || [] ).some( function ( m ) {
        return currentPage.indexOf( m ) !== -1;
      } );
      if ( isActive ) li.classList.add( 'bmc-active' );
      if ( item.items ) li.classList.add( 'bmc-dropdown' );

      var a = document.createElement( 'a' );
      a.href = item.href;
      a.textContent = item.label;
      li.appendChild( a );

      if ( item.items ) {
        li.appendChild( buildDropdownMenu( item.items ) );
      }
      ul.appendChild( li );
    } );

    var nav = document.createElement( 'nav' );
    nav.className = 'bmc-nav';
    nav.appendChild( ul );

    /* Search */
    var searchForm = document.createElement( 'form' );
    searchForm.className = 'bmc-search-form';
    searchForm.method = 'get';
    searchForm.action = '/index.php';
    searchForm.innerHTML =
      '<input type="hidden" name="title" value="Special:Search">' +
      '<input type="search" name="search" placeholder="Search wiki…" aria-label="Search">' +
      '<button type="submit" aria-label="Search"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg></button>';

    var right = document.createElement( 'div' );
    right.className = 'bmc-header-right';
    right.appendChild( nav );
    right.appendChild( searchForm );

    /* Inner wrapper */
    var inner = document.createElement( 'div' );
    inner.className = 'bmc-header-inner';
    inner.appendChild( logo );
    inner.appendChild( right );

    var header = document.createElement( 'header' );
    header.className = 'bmc-header';
    header.appendChild( inner );
    return header;
  }

  /* ── Build page hero ───────────────────────────────────────── */
  function buildHero( titleText ) {
    var crumb = document.createElement( 'div' );
    crumb.className = 'bmc-breadcrumb';
    crumb.innerHTML =
      '<a href="https://bmcwiki.mit.edu/index.php/BioMicroCenter">Home</a>' +
      '<span class="sep">›</span>' +
      document.createTextNode( titleText ).textContent; // plain text, no XSS

    var h1 = document.createElement( 'h1' );
    h1.textContent = titleText;

    var inner = document.createElement( 'div' );
    inner.className = 'inner';
    inner.appendChild( crumb );
    inner.appendChild( h1 );

    var hero = document.createElement( 'div' );
    hero.className = 'bmc-page-hero';
    hero.appendChild( inner );
    return hero;
  }

  /* ── Build sidebar TOC from MediaWiki #toc or heading scan ─── */
  function buildSidebarToc( mwToc, contentEl ) {
    var toc = document.createElement( 'div' );
    toc.className = 'bmc-toc';

    var h3 = document.createElement( 'h3' );
    h3.textContent = 'On this page';
    toc.appendChild( h3 );

    var list;

    if ( mwToc ) {
      /* Clone only the list from the MediaWiki TOC */
      var mwList = mwToc.querySelector( 'ul' );
      if ( mwList ) {
        list = mwList.cloneNode( true );
        /* Mark sub-items */
        list.querySelectorAll( 'li li' ).forEach( function ( li ) {
          li.classList.add( 'bmc-sub' );
        } );
      }
    } else if ( contentEl ) {
      /* Fall back to scanning h2/h3 headings directly */
      var headings = Array.prototype.slice.call(
        contentEl.querySelectorAll( 'h2, h3' )
      );
      if ( headings.length > 0 ) {
        list = document.createElement( 'ul' );
        headings.forEach( function ( heading ) {
          var anchor = heading.querySelector( '.mw-headline' );
          if ( !anchor || !anchor.id ) return;
          var li = document.createElement( 'li' );
          if ( heading.tagName === 'H3' ) li.classList.add( 'bmc-sub' );
          var a = document.createElement( 'a' );
          a.href = '#' + anchor.id;
          a.textContent = anchor.textContent.trim();
          li.appendChild( a );
          list.appendChild( li );
        } );
      }
    }

    if ( !list || list.childNodes.length === 0 ) return null;

    toc.appendChild( list );

    var aside = document.createElement( 'aside' );
    aside.className = 'bmc-sidebar';
    aside.appendChild( toc );
    return aside;
  }

  /* ── Build footer ──────────────────────────────────────────── */
  function buildFooter() {
    var inner = document.createElement( 'div' );
    inner.className = 'bmc-footer-inner';
    inner.innerHTML =
      '<div>' +
        '<h4>MIT BioMicro Center</h4>' +
        '<ul>' +
          '<li>Building 68-322</li>' +
          '<li>Cambridge, MA 02139</li>' +
          '<li><a href="mailto:biomicro@mit.edu">biomicro@mit.edu</a></li>' +
          '<li>617-715-4533</li>' +
        '</ul>' +
      '</div>' +
      '<div>' +
        '<h4>Services</h4>' +
        '<ul>' +
          '<li><a href="https://bmcwiki.mit.edu/index.php/BioMicroCenter:Sequencing">Bulk Sequencing</a></li>' +
          '<li><a href="https://bmcwiki.mit.edu/index.php/BioMicroCenter:SingleCell">Single Cell</a></li>' +
          '<li><a href="https://bmcwiki.mit.edu/index.php/BioMicroCenter:SpTx">Spatial Genomics</a></li>' +
          '<li><a href="https://igb.mit.edu/" target="_blank">Informatics</a></li>' +
        '</ul>' +
      '</div>' +
      '<div>' +
        '<h4>Resources</h4>' +
        '<ul>' +
          '<li><a href="https://bmcwiki.mit.edu/index.php/BioMicroCenter:FAQ">FAQs</a></li>' +
          '<li><a href="https://bmcwiki.mit.edu/index.php/BioMicroCenter:Consulting">Consulting</a></li>' +
          '<li><a href="https://bmcwiki.mit.edu/index.php/BioMicroCenter:Pricing">Grant Support &amp; Pricing</a></li>' +
          '<li><a href="https://bmcwiki.mit.edu/index.php/BioMicroCenter:Acknowledgement">Acknowledgements</a></li>' +
        '</ul>' +
      '</div>';

    var bottom = document.createElement( 'div' );
    bottom.className = 'bmc-footer-bottom';
    bottom.innerHTML =
      '<span>&copy; ' + new Date().getFullYear() + ' MIT BioMicro Center</span>' +
      '<span>' +
        '<a href="https://bmcwiki.mit.edu/index.php/Special:UserLogin">Log in</a>' +
        ' &nbsp;|&nbsp; ' +
        '<a href="https://accessibility.mit.edu" target="_blank">Accessibility</a>' +
      '</span>';

    var footer = document.createElement( 'footer' );
    footer.className = 'bmc-footer';
    footer.appendChild( inner );
    footer.appendChild( bottom );
    return footer;
  }

  /* ── Smooth scroll for anchor links ───────────────────────── */
  function initSmoothScroll( container ) {
    container.addEventListener( 'click', function ( e ) {
      var a = e.target.closest( 'a[href^="#"]' );
      if ( !a ) return;
      var id = decodeURIComponent( a.getAttribute( 'href' ).slice( 1 ) );
      var target = document.getElementById( id );
      if ( target ) {
        e.preventDefault();
        target.scrollIntoView( { behavior: 'smooth', block: 'start' } );
        history.pushState( null, '', '#' + id );
      }
    } );
  }

  /* ── Fix row separators on tables with rowspan cells ──────── */
  function fixRowspanSeparators( container ) {
    container.querySelectorAll( '.wikitable' ).forEach( function ( table ) {
      var tbody = table.querySelector( 'tbody' ) || table;
      var rows = Array.from( tbody.querySelectorAll( 'tr' ) );
      if ( !rows.length ) return;

      rows.forEach( function ( row, rowIdx ) {
        row.querySelectorAll( 'td[rowspan], th[rowspan]' ).forEach( function ( cell ) {
          var span = parseInt( cell.getAttribute( 'rowspan' ), 10 );
          if ( !span || span <= 1 ) return;

          cell.style.position = 'relative';

          for ( var i = 1; i < span; i++ ) {
            var targetRow = rows[ rowIdx + i ];
            if ( !targetRow ) break;

            var cellRect  = cell.getBoundingClientRect();
            var rowRect   = targetRow.getBoundingClientRect();
            var offsetTop = rowRect.top - cellRect.top;

            var sep = document.createElement( 'div' );
            sep.style.cssText =
              'position:absolute;left:0;right:0;' +
              'top:' + offsetTop + 'px;' +
              'height:1px;background:#e0e0e0;' +
              'pointer-events:none;z-index:1;';
            cell.appendChild( sep );
          }
        } );
      } );
    } );
  }

  /* ── Edit bar for logged-in users ─────────────────────────── */
  function buildEditBar( currentPage ) {
    if ( !mw.config.get( 'wgUserId' ) ) return null;
    var bar = document.createElement( 'div' );
    bar.className = 'bmc-edit-bar';
    var editHref = mw.util.getUrl( currentPage, { action: 'edit' } );
    var histHref = mw.util.getUrl( currentPage, { action: 'history' } );
    var talkHref = mw.util.getUrl( 'Talk:' + currentPage );
    bar.innerHTML =
      '<a href="' + editHref + '">Edit</a>' +
      '<a href="' + histHref + '">History</a>' +
      '<a href="' + talkHref + '">Talk</a>';
    return bar;
  }

  /* ── Main: build and inject the shell ─────────────────────── */
  function buildShell() {
    var currentPage = mw.config.get( 'wgPageName' ) || '';

    /* 1. Extract wiki content BEFORE any DOM manipulation */
    var mwContentText = document.getElementById( 'mw-content-text' );
    if ( !mwContentText ) return; /* not a content page, bail */

    var contentClone = mwContentText.cloneNode( true );

    /* 2. Extract page title */
    var titleEl = document.getElementById( 'firstHeading' ) ||
      document.querySelector( '.mw-first-heading' );
    var titleText = titleEl
      ? titleEl.textContent.trim()
      : ( mw.config.get( 'wgTitle' ) || 'BioMicro Center' );

    /* 3. Extract MediaWiki TOC from the cloned content */
    var mwToc = contentClone.querySelector( '#toc, .toc' );
    if ( mwToc ) mwToc.parentNode.removeChild( mwToc ); /* remove from content body */

    /* 3b. Hide the BMC logo/header sticker by exact image filename.
           The sticker is BMC_Header_2020_3.png (from the {{BioMicroCenter}} template)
           and bmc_logo_square.png. Target the nearest meaningful container so the
           surrounding content (nav links, table structure) is preserved. */
    contentClone.querySelectorAll( 'img' ).forEach( function ( img ) {
      var src = img.getAttribute( 'src' ) || '';
      if ( /BMC_Header|bmc_logo_square|Bmc_logo|\/Logo\.png/i.test( src ) ) {
        var container = img.closest( '.thumb' ) || img.closest( 'figure' ) || img.closest( 'td' );
        if ( container ) {
          container.style.display = 'none';
        } else {
          img.style.display = 'none';
        }
      }
    } );

    /* 4. Build shell elements */
    var topbar = buildTopbar();
    var header = buildHeader( currentPage );
    var hero   = buildHero( titleText );

    /* Page layout grid */
    var layout = document.createElement( 'div' );
    layout.className = 'bmc-page-layout';

    /* Sidebar — skip on the home page */
    var isHome = ( currentPage === 'BioMicroCenter' ||
                   currentPage === 'Main_Page' );
    var sidebar = isHome ? null : buildSidebarToc( mwToc, contentClone );
    if ( sidebar ) {
      layout.appendChild( sidebar );
    } else {
      /* No TOC — collapse to single-column via inline style */
      layout.style.gridTemplateColumns = '1fr';
    }

    /* Main content area */
    var main = document.createElement( 'main' );
    main.className = 'bmc-content';
    var editBar = buildEditBar( currentPage );
    if ( editBar ) { main.appendChild( editBar ); }
    main.appendChild( contentClone );
    layout.appendChild( main );

    var footer = buildFooter();

    /* 5. Build wrapper */
    var wrapper = document.createElement( 'div' );
    wrapper.id = 'bmc-wrapper';
    wrapper.appendChild( topbar );
    wrapper.appendChild( header );
    wrapper.appendChild( hero );
    wrapper.appendChild( layout );
    wrapper.appendChild( footer );

    /* 6. Inject into body (prepend so it appears first) */
    document.body.insertBefore( wrapper, document.body.firstChild );

    /* 7. Add class immediately so the CSS rule kicks in and hides
          all original MW elements (works for any skin version) */
    document.body.classList.add( 'bmc-active' );

    /* 8. Smooth scroll */
    initSmoothScroll( main );
    initSmoothScroll( sidebar || main );

    /* 9. Auto-style plain tables in content */
    main.querySelectorAll(
      '.mw-parser-output table:not(.wikitable):not(.infobox):not(.navbox)'
    ).forEach( function ( t ) {
      t.classList.add( 'wikitable' );
    } );

    /* 10. Fix row separators on rowspan tables */
    requestAnimationFrame( function () {
      fixRowspanSeparators( main );
    } );


  }

  /* ── Entry point ───────────────────────────────────────────── */
  mw.hook( 'wikipage.content' ).add( function () {
    /* Skip special pages (edit forms, history, etc.) to not break them */
    var ns = mw.config.get( 'wgNamespaceNumber' );
    var action = mw.config.get( 'wgAction' );
    if ( action !== 'view' ) return;
    if ( ns < 0 ) return; /* Special: pages */

    buildShell();
  } );

} )();