/* Layout 4 — top bar with only the top-level menus (no dropdowns); whichever
   chapter the visitor is currently inside (its own page, or any of its
   submenu pages) shows its submenus as a contextual sidebar instead. A
   hybrid of `navbar` (top-level bar) and `sidebar` (a docked column for
   "where am I within this section").

   `#site-nav` (the <nav> every page already provides) IS the top bar here —
   no separate wrapper needed. `.hybrid-sidebar` is a second, genuinely
   separate element that js/page-init.js creates as a direct sibling of
   `#site-nav`/`#page-content` inside `.layout-shell` (not present in the
   static per-page HTML, not nested inside `#site-nav` either) — see
   js/nav-render.js's renderHybridTree() for why: nesting both pieces inside
   one shared `<nav>` and un-boxing it with `display: contents` resolved
   each piece's grid *position* correctly but not its *size* (an item meant
   to span both columns silently collapsed to one column's width instead) —
   a real rendering quirk with `display: contents` grandchildren, not
   something more CSS tuning fixes. A true, separate grid item avoids it
   entirely. */

body.layout-hybrid .layout-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: auto 1fr;
}

body.layout-hybrid .site-nav {
  grid-row: 1;
  grid-column: 1 / -1;
  border-bottom: 1px solid var(--color-border, var(--color-secondary, #e5e5e5));
  padding: 0.5rem 1.5rem;
  background: var(--color-header-bg, var(--color-bg, #ffffff));
}

body.layout-hybrid .site-nav .nav-list {
  display: flex;
  /* Matches .page-content's own max-width/centering below, and each item
     stretches to fill an equal share of that width instead of just sitting
     at its own text width — same treatment as the plain `navbar` layout's
     top bar (see css/layout-navbar.css), for a consistent look between the
     two top-bar-based layouts. */
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  gap: 0.5rem;
}

body.layout-hybrid .site-nav .nav-item {
  flex: 1;
}

body.layout-hybrid .site-nav .nav-link {
  text-align: center;
}

body.layout-hybrid .hybrid-sidebar {
  display: block;
  grid-row: 2;
  grid-column: 1;
  position: sticky;
  top: var(--header-height);
  max-height: calc(100vh - var(--header-height));
  overflow-y: auto;
  border-right: 1px solid var(--color-border, var(--color-secondary, #e5e5e5));
  padding: 1.5rem 1rem;
  background: var(--color-sidebar-bg, var(--color-bg, #ffffff));
}

body.layout-hybrid .page-content {
  grid-row: 2;
  grid-column: 2;
  max-width: 900px;
}
