/* S1 — Site shell. The public-web frame: horizontal top bar, full-screen
 * overlay below 768. Governed by NAVIGATION-CANON.md v1.0 §S1.
 *
 * The shell owns the frame, the collapse, and nothing else. What sits inside
 * the bar is library/menu.css; what sits inside the overlay is the same list of
 * links. No component is reimplemented here.
 *
 * The collapse rule is enforced by construction: the toggle is display:none at
 * and above 768px, so nav_hamburger_above_breakpoint cannot be violated by a
 * page that uses this shell. The guard rule of the same name exists to catch
 * hand-written markup that does not.
 */

.mn-shell-site {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-base);
  border-bottom: 1px solid var(--border-subtle);
}

.mn-shell-site__bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: var(--space-2) var(--gutter);
}

.mn-shell-site__brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  margin-right: auto;
  text-decoration: none;
}

.mn-shell-site__brand img {
  display: block;
  height: 2.5rem;
  width: auto;
}

/* Primary navigation — hidden below the collapse width, where the overlay
 * carries the same links. */
.mn-shell-site__nav {
  display: none;
  align-items: center;
  gap: var(--space-1);
}

.mn-shell-site__item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.5rem var(--space-2);
  min-height: 44px;
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  font-weight: var(--fw-ui);
  line-height: var(--lh-ui);
  color: var(--text-secondary);
  text-decoration: none;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease;
}

.mn-shell-site__item:hover { color: var(--text-primary); background-color: var(--bg-sunken); }

/* Current location. Weight plus a rule beneath — never colour alone, and never
 * a thread colour, which encodes content area rather than position. */
.mn-shell-site__item[aria-current="page"] {
  color: var(--text-primary);
  font-weight: var(--fw-button);
  box-shadow: inset 0 -2px 0 var(--border-strong);
  border-radius: 0;
}

/* Depth 2 — a top-level item plus one dropdown. There is no third level, by
 * canon; nothing here styles one. */
.mn-shell-site__group { position: relative; }

.mn-shell-site__group > .menu {
  position: absolute;
  top: calc(100% + var(--space-1));
  left: 0;
  z-index: 10;
  display: none;
}

/* Opens on hover and on keyboard focus, in CSS, so the dropdown still works
 * with JavaScript disabled. nav.js only mirrors this into aria-expanded. */
.mn-shell-site__group:hover > .menu,
.mn-shell-site__group:focus-within > .menu { display: block; }

.mn-shell-site__utility {
  display: none;
  align-items: center;
  gap: var(--space-2);
}

/* The toggle. Carries a visible label, not an icon alone — a bare hamburger is
 * measurably under-recognised, and canon rule 7 forbids icon-only nav controls
 * on every surface. */
.mn-shell-site__toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.5rem var(--space-2);
  min-height: 44px;
  min-width: 44px;
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  font-weight: var(--fw-ui);
  color: var(--text-primary);
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.mn-shell-site__overlay {
  width: 100vw;
  max-width: 100vw;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  background-color: var(--bg-base);
  border: 0;
  color: var(--text-primary);
}

.mn-shell-site__overlay::backdrop { background-color: rgba(26, 24, 20, 0.4); }

.mn-shell-site__overlay > nav {
  display: flex;
  flex-direction: column;
  padding: var(--space-2) var(--gutter) var(--space-5);
}

.mn-shell-site__overlay .mn-shell-site__item {
  justify-content: flex-start;
  width: 100%;
  font-size: var(--fs-body);
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 0;
}

.mn-shell-site__close {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  align-self: flex-end;
  margin: var(--space-2) var(--gutter) 0 auto;
  padding: 0.5rem var(--space-2);
  min-height: 44px;
  min-width: 44px;
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  font-weight: var(--fw-ui);
  color: var(--text-primary);
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* The collapse boundary. Above it the bar is complete and the toggle does not
 * exist; below it the reverse. One breakpoint, stated once. */
@media (min-width: 768px) {
  .mn-shell-site__nav,
  .mn-shell-site__utility { display: flex; }

  .mn-shell-site__toggle { display: none; }

  .mn-shell-site__brand img { height: 3rem; }
}
