/* Student Commons 5.14.5 — Student Workspace shell geometry parity.
 *
 * 5.14.2/5.14.4 established the right visual language, but the retained
 * centred Community grid still inset the navigation rail relative to the
 * brand and left a visible canvas gap between the topbar and sidebar. This
 * terminal layer makes the signed-in desktop shell structurally continuous:
 * one 252px rail, one aligned topbar, and no WordPress-toolbar offset.
 */

@media (min-width:901px){
  html body.nsc5-document.nsc590-member-document{
    --nsc5145-rail:252px;
    --nsc5145-gutter:30px;
    --nsc5145-right:26px;
  }

  /* The header grid starts at the same left edge and uses the same rail width
   * as the body. No centred 20px page inset remains. */
  html body.nsc5-document.nsc590-member-document .nsc590-member-app .nsc5-topbar-inner{
    box-sizing:border-box!important;
    grid-template-columns:var(--nsc5145-rail) minmax(280px,680px) auto!important;
    gap:var(--nsc5145-gutter)!important;
    width:100%!important;
    max-width:none!important;
    min-height:var(--nsc5-topbar)!important;
    margin:0!important;
    padding:0 var(--nsc5145-right) 0 0!important;
  }

  /* Brand owns the full rail column exactly as Student Workspace does. */
  html body.nsc5-document.nsc590-member-document .nsc590-member-app .nsc5-topbar .nsc5-brand{
    box-sizing:border-box!important;
    width:var(--nsc5145-rail)!important;
    min-width:var(--nsc5145-rail)!important;
    max-width:var(--nsc5145-rail)!important;
    min-height:var(--nsc5-topbar)!important;
    margin:0!important;
    padding:0 18px!important;
    border-radius:0!important;
  }

  /* Body grid shares the exact same origin/rail. Keeping the 30px content
   * gutter preserves the comfortable Workspace spacing to the right. */
  html body.nsc5-document.nsc590-member-document .nsc590-member-app .nsc5-layout:not(.nsc5-layout-focus){
    box-sizing:border-box!important;
    grid-template-columns:var(--nsc5145-rail) minmax(0,790px) minmax(250px,310px)!important;
    gap:var(--nsc5145-gutter)!important;
    width:100%!important;
    max-width:none!important;
    margin:0!important;
    padding:30px var(--nsc5145-right) 80px 0!important;
  }
  html body.nsc5-document.nsc590-member-document .nsc590-member-app .nsc5-layout.nsc5-layout-wide:not(.nsc5-layout-focus){
    grid-template-columns:var(--nsc5145-rail) minmax(0,1fr)!important;
  }

  /* One uninterrupted dark rail from the brand divider to the viewport
   * bottom. The old rounded/inset card treatment is intentionally removed. */
  html body.nsc5-document.nsc590-member-document .nsc590-member-app .nsc5-sidebar.nsc5142-workspace-sidebar{
    box-sizing:border-box!important;
    position:sticky!important;
    top:var(--nsc5-topbar)!important;
    align-self:start!important;
    width:var(--nsc5145-rail)!important;
    min-width:var(--nsc5145-rail)!important;
    max-width:var(--nsc5145-rail)!important;
    height:calc(100vh - var(--nsc5-topbar))!important;
    min-height:calc(100vh - var(--nsc5-topbar))!important;
    max-height:calc(100vh - var(--nsc5-topbar))!important;
    margin:-30px 0 -80px!important;
    padding:20px 14px 22px!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    overscroll-behavior:contain!important;
    border:0!important;
    border-radius:0!important;
    box-shadow:none!important;
  }

  /* The profile card begins naturally below the brand instead of appearing
   * detached or clipped by the old centred layout. */
  html body.nsc5-document.nsc590-member-document .nsc590-member-app .nsc5142-sidebar-identity{
    margin:0 0 16px!important;
  }

  /* The custom Student Commons document suppresses the WP admin toolbar in
   * PHP. These guards prevent stale optimised admin-bar offsets from shifting
   * the app if an old body class survives a cache layer for one request. */
  html body.admin-bar.nsc5-document.nsc590-member-document .nsc590-member-app .nsc5-topbar{top:0!important}
  html body.admin-bar.nsc5-document.nsc590-member-document .nsc590-member-app .nsc5-sidebar.nsc5142-workspace-sidebar{top:var(--nsc5-topbar)!important}
}

@media (forced-colors:active){
  html body.nsc5-document.nsc590-member-document .nsc590-member-app .nsc5-sidebar.nsc5142-workspace-sidebar,
  html body.nsc5-document.nsc590-member-document .nsc590-member-app .nsc5-topbar .nsc5-brand{forced-color-adjust:auto!important}
}
