/* ============================================================
   RAIL, HEADER & MENU BUTTON — the site's navigation.
   Desktop: left rail on every page.
   Phone: a header at the top on every page — the logo and wordmark,
   with the menu button on the right (partials/topbar.njk).
   ============================================================ */

/* ---- Left rail ---- */
.strip {
  width: var(--rail); background: var(--dark); color: var(--light);
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 0 calc(var(--col-pb) + (var(--btn-h) - var(--logo)) / 2 + env(safe-area-inset-bottom));
}
.rail { position: fixed; inset: 0 auto 0 0; z-index: 60; }
/* Desktop: the rail floats, a dark rounded column inset from the screen edges by --float (the same corners
   as the cards). It and the gap beside it still take up --rail, so the pages sit where they did. */
@media (min-width: 768px) and (min-height: 501px), (min-width: 768px) and (pointer: fine) {
  :root { --float: 12px; }
  .rail {
    inset: var(--float) auto var(--float) var(--float); width: calc(var(--rail) - var(--float));
    border-radius: var(--card-r); box-shadow: 0 8px 24px -12px rgba(38,38,38,.4);
    padding-bottom: calc(var(--col-pb) + (var(--btn-h) - var(--logo)) / 2 - var(--float) + env(safe-area-inset-bottom));
  }
  html.menu-open .rail { box-shadow: none; }   /* while the menu is open, rail and menu are one shape */
}

/* Menu button: four bars, or a × when the menu is open */
.burger {
  width: 44px; height: 44px; display: grid; place-content: center; gap: 3px;
  background: none; border: 0; padding: 0; color: inherit; cursor: pointer;
}
.burger span { display: block; width: 22px; height: 3px; background: currentColor; }
.burger .x { display: none; width: 19px; height: 19px; }

/* Vertical wordmark (reads bottom to top) */
.strip .wordmark {
  margin-top: auto; margin-bottom: 18px;
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-weight: 500; font-size: min(17px, 2.8dvh); letter-spacing: .04em;
  text-transform: uppercase; text-decoration: none; white-space: nowrap; color: var(--light);
}
.wordmark .accent { color: var(--accent); }

/* Logo: the logo study (or studies) named in site.json "logoMarks" (partials/logo.njk).
   Drawn in the text colour, so on the dark rail and header it is an off-white square with
   the paths showing the dark behind. One mark is the design; if more are ever listed, they
   stack upwards in the rail (the first at the bottom) and sit side by side in the header. */
.logo { display: flex; align-items: center; gap: 4px; flex-shrink: 0; color: var(--light); --mark: var(--logo); }
.rail .logo { flex-direction: column-reverse; }   /* stacked upwards, 4px apart */
.logo .mark { display: block; width: var(--mark); height: var(--mark); }

@media (min-width: 768px) and (min-height: 501px), (min-width: 768px) and (pointer: fine) {
  .strip { padding-top: 16px; }   /* 28px from the top of the screen, as before (the rail starts --float lower) */
  .burger { width: 52px; height: 52px; gap: 3.5px; }   /* same 52px target; smaller bars */
  .burger span { width: 22px; height: 3px; }
  .burger .x { width: 17px; height: 17px; }
  .strip .wordmark { font-size: min(17px, 2.8dvh); margin-bottom: 24px; }
}

/* ---- Phone header (partials/topbar.njk) ----
   Every page. A floating bar: a dark rounded rectangle, inset from the screen edges in line with the
   page's cards, with the same corners. It and the gap above it fill --header-h, so the pages start
   where they did. Hides when scrolling down, returns when scrolling up (site.js).
   Sits above the open menu (z-index 70 over the menu's 65), so the × stays where the menu button was. */
.topbar {
  --bar-top: 20px;   /* the same as the side gutter and the gap between cards: one spacing on phones */
  position: fixed; z-index: 70;
  top: calc(var(--bar-top) + env(safe-area-inset-top));
  left: max(20px, env(safe-area-inset-left)); right: max(20px, env(safe-area-inset-right));   /* the page's side gutter */
  height: calc(var(--header-h) - var(--bar-top));
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--dark); color: var(--light); border-radius: var(--card-r);
  box-shadow: 0 6px 18px -8px rgba(38,38,38,.35);
  transition: transform .35s var(--ease);
}
.topbar.is-hidden { transform: translateY(calc(-100% - var(--bar-top) - env(safe-area-inset-top) - 16px)); }
html.menu-open .topbar { transform: none; }   /* always shown while the menu is open */
/* Menu button on the right, sized to sit level with the 34px logo: 28px bars in a 48px button,
   pushed over so the bars line up with the page's right edge */
.topbar .burger { width: 48px; height: 48px; gap: 4.5px; margin-left: auto; margin-right: -8px; flex-shrink: 0; }
.topbar .burger span { width: 28px; height: 3px; }
.topbar .burger .x { width: 24px; height: 24px; }
.topbar .wordmark {
  font-weight: 500; font-size: 15px; letter-spacing: .04em;
  text-transform: uppercase; text-decoration: none; color: var(--light);
}
.topbar .logo { --mark: var(--logo); }

@media (min-width: 768px) and (min-height: 501px), (min-width: 768px) and (pointer: fine) { .topbar { display: none; } }
@media (max-width: 767px), (max-height: 500px) and (pointer: coarse) { .rail { display: none; } }

/* ---- While the menu is open: the menu button becomes a × ---- */
html.menu-open .burger span { display: none; }
html.menu-open .burger .x { display: block; }

