/* ============================================================
   THE TOP BAR (1.12.26, Donald's pick "C · Now"). It stays at the top of
   the screen at every scroll, on every page; the nine cards are in its menu.

   ONE stylesheet for:
     - the site itself (Header.jsx; main.jsx imports it last);
     - the pages the site does not render with React (the event report,
       /event-report/): at build time scripts/site-bar.mjs copies this file
       to dist/site-bar/bar.css and adds the same bar to those pages.
   So it is self-contained: its own button look, its own pulse, its own
   focus plate. It reads only tokens that both the
   site (index.css) and the brand's reality-tokens.css define (--bg, --fg,
   --blue, --mont …). Never a site-only token here (--lead, --tkt-edge).
   ============================================================ */

/* ── The bar: stuck to the top, under a 3px chrome rule. ── */
.mh {
  position: sticky; top: 0; z-index: 40;
  background: var(--bg); color: var(--fg); border-bottom: 3px solid var(--fg);
}
.mh, .mh * { box-sizing: border-box; }

/* --mh-h: the bar's height, so whatever lands under it (an anchor, the menu
   board's chapter list, a link on the event report) clears it. Every piece of
   the bar is a fixed height (48px controls, a live row of one line), so it is
   known here; the fit check (and the seam, which measures it) hold it to that.
     below 1024px   8 + 48 + 8 (the row) + 48 (the live row) + 3 (the rule) = 115
     from 1024px   14 + 48 + 14 + 3 = 79 */
:root { --mh-h: 115px; }
@media (min-width: 1024px) { :root { --mh-h: 79px; } }

.mh-in {
  max-width: 1368px; margin: 0 auto; padding: 8px 16px;
  display: flex; align-items: center; gap: 8px;
}
@media (min-width: 761px) { .mh-in { padding: 8px 32px; } }
@media (min-width: 1024px) { .mh-in { padding: 14px 32px; } }
@media (max-width: 340px) { .mh-in { padding: 8px 10px; } }
.mh-acts { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
@media (min-width: 640px) { .mh-acts { gap: 8px; } }

/* where a piece shows: the desktop row from 1024px (lg), the phone row below */
.mh-lg { display: none !important; }
@media (min-width: 1024px) {
  .mh-lg { display: flex !important; }
  .mh-sm { display: none !important; }
}

/* The wordmark in its ink box (the brand never sets it bare on a busy page),
   48px tall like every control beside it; the full ink strip one module off
   it from 640px. */
.mh-brand { display: flex; align-items: center; flex: none; }
.mh-wm { display: flex; align-items: center; height: 48px; background: var(--fg); line-height: 0; flex: none; }
.mh-wm svg { display: block; height: 24px; width: auto; margin: 0 -3px 0 -6px; }
@media (min-width: 768px) { .mh-wm svg { height: 28px; } }
@media (max-width: 340px) { .mh-wm svg { height: 20px; } }
.mh-ink { display: none; align-items: center; margin-left: 8px; flex: none; }
@media (min-width: 640px) { .mh-ink { display: flex; } }
/* …except from 1024 to 1279px, where the desktop row needs the room for the
   live line (it has the menu button too since the bar stays at the top) */
@media (min-width: 1024px) and (max-width: 1279px) { .mh-ink { display: none; } }

/* ── Controls: 48px floor, square, 2px ink. Ink = the webapp; paper = the
   rest. (The same look as the site's .btn-primary / .btn-secondary, written
   out here so the bar carries it to pages without the site's stylesheet.) */
.mh-btn {
  min-width: 48px; min-height: 48px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 700 12px/1.15 var(--mont); letter-spacing: var(--tr-button, .11em); text-transform: uppercase;
  white-space: nowrap; text-decoration: none; cursor: pointer;
  border: 2px solid var(--fg); box-shadow: var(--sh-default);
  background: var(--bg); color: var(--fg);
  transition: transform var(--dur-tap) ease, box-shadow var(--dur-tap) ease;
}
.mh-btn.mh-label { padding: 0 16px; }
.mh-btn.mh-dark { background: var(--fg); color: var(--bg); }
.mh-btn:hover { transform: translateY(-3px); box-shadow: var(--sh-heavy); }
.mh-btn:active { transform: translateY(2px); box-shadow: var(--sh-light); }
.mh-btn svg { flex: none; }
.mh-wide { width: 100%; }
/* the site's language menu, at the bar's 48px */
.mh-lang { position: relative; display: inline-flex; }
.mh-lang button[aria-haspopup] { min-width: 48px; min-height: 48px; padding: 0 12px; }

/* The misregister plate (G1): the face slips 4px up-left off a plate of the
   accent. The site's index.css says the same for every control; this copy is
   for the pages that only have this file. */
.mh :focus-visible { outline: none; }
.mh-btn:focus-visible, .mh-wm:focus-visible, .mh-live:focus-visible, .mh-pop a:focus-visible {
  transform: translate(-4px, -4px); box-shadow: 4px 4px 0 0 var(--accent);
  transition: transform var(--dur-quick) var(--ease-snap), box-shadow var(--dur-quick) var(--ease-snap);
}
.mh-btn:focus-visible, .mh-live:focus-visible, .mh-pop a:focus-visible { background-color: var(--bg); }
.mh-btn.mh-dark:focus-visible, .mh-wm:focus-visible { background-color: var(--fg); }
@media (prefers-reduced-motion: reduce) { .mh :focus-visible { transition: none; } }

/* ── The live line: what the building is doing this minute. A link to card
   01. On a desktop it sits in the row; below 1024px it is a ruled row of
   its own under the bar. Its first line says what is on (the rooms in use,
   what starts next, or the hours). From 761px, while a song is playing, the
   song is a second, smaller line under it; on a phone the song is in card
   01 only (Donald 1.12.26). Both fit the 48px the row already has, so the
   bar's height (--mh-h) does not change. Each line is one line: what does
   not fit ends in an ellipsis. ── */
.mh-live {
  display: flex; align-items: center; min-width: 0; min-height: 48px;
  font: 500 13px/1.3 var(--grotesk); color: var(--fg); text-decoration: none;
  white-space: nowrap; overflow: hidden;
}
.mh-in > .mh-live { flex: 1 1 auto; margin: 0 4px 0 24px; padding: 0 14px; border-left: 2px solid var(--fg); }
.mh-row { padding: 0 16px; gap: 10px; border-top: 2px solid var(--fg); }
.mh-row > svg { flex: none; margin-left: auto; }
@media (min-width: 761px) { .mh-row { padding: 0 32px; } }
@media (max-width: 340px) { .mh-row { padding: 0 10px; } }
.mh-lines { display: flex; flex-direction: column; justify-content: center; flex: 1 1 auto; min-width: 0; }
.mh-seg { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mh-song { display: none; margin-top: 2px; font-size: 12px; }
@media (min-width: 761px) { .mh-song { display: block; } }
/* space permitting: where the line is narrow (1024px in the longer
   languages), the song steps out rather than show a word of a title */
.mh-live { container-type: inline-size; }
@container (max-width: 239px) { .mh-song { display: none; } }
.mh-k { font: 700 12px/1 var(--mont); letter-spacing: .1em; text-transform: uppercase; margin-right: 8px; }
.mh-song .mh-k { font-size: 11px; letter-spacing: .14em; }
.mh-t { font-weight: 600; }
.mh-a { color: var(--fg-dim); margin-left: 6px; }
.mh-a::before { content: '— '; }
@media (hover: hover) { .mh-live:hover .mh-t { text-decoration: underline; text-underline-offset: 3px; } }
@media (prefers-reduced-motion: no-preference) {
  /* a new song prints in from the left behind a hard edge */
  .mh-song { animation: mh-wipe 520ms var(--ease-out) both; }
}
@keyframes mh-wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* Live Pulse — the one loop. A small square that beats ahead of anything
   true right now. Scale only. One swell is 2 s: two beats of the page's
   clock (lib/beat.js; keep it a whole number of beats if BEAT_MS changes),
   and deck/ambient.js keeps every square in phase with that clock. */
.dk-pulse {
  display: inline-block; width: 9px; height: 9px; margin-right: 8px;
  background: var(--red); animation: dk-pulse 2s var(--ease-snap) infinite;
}
.dk-pulse-off { background: transparent; box-shadow: inset 0 0 0 2px currentColor; animation: none; }
@keyframes dk-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.6); } }
@media (prefers-reduced-motion: reduce) { .dk-pulse { animation: none; } }

/* ── The menu: the nine cards three across, at every width. Below 1024px a
   sheet hung from the bar's rule, the webapp first and the socials and Night
   last; from 1024px a panel under the menu button, the cards only (the row
   has the rest). Its lower edge travels down to uncover it. It scrolls on
   its own if the screen is shorter than it (a phone on its side). ── */
.mh-sheet {
  position: absolute; left: 0; right: 0; top: 100%; margin-top: 3px; z-index: 45;
  background: var(--bg); color: var(--fg); border-bottom: 3px solid var(--fg);
  max-height: calc(100vh - var(--mh-h)); max-height: calc(100dvh - var(--mh-h));
  overflow-y: auto; overscroll-behavior: contain;
}
.mh-sheet-in { max-width: 1368px; margin: 0 auto; padding: 14px 16px 16px; display: grid; gap: 10px; }
@media (min-width: 761px) { .mh-sheet-in { padding: 16px 32px 20px; } }
@media (max-width: 340px) { .mh-sheet-in { padding: 12px 10px 14px; } }
@media (min-width: 1024px) {
  .mh-sheet {
    left: auto; right: max(32px, calc((100% - 1368px) / 2 + 32px)); width: 520px;
    border: 2px solid var(--fg); border-top: 0; box-shadow: var(--sh-default);
  }
  .mh-sheet-in { padding: 16px; }
}
.mh-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mh-cards .mh-btn { padding: 0 6px; white-space: normal; text-align: center; }
/* the card being read (the home page): blue's job, a bar along its foot */
.mh-cards .mh-btn[aria-current="true"] { box-shadow: inset 0 -5px 0 var(--blue), var(--sh-default); }
.mh-foot { display: flex; align-items: center; gap: 10px; }
.mh-foot > .mh-btn, .mh-foot > button { flex: 1; }
@media (prefers-reduced-motion: no-preference) {
  .mh-sheet { animation: mh-drop 260ms var(--ease-out) both; }
}
@keyframes mh-drop { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 -8px 0); } }

/* ── The language list (the event report's; the site's own is LangMenu). ── */
.mh-pop {
  position: absolute; right: 0; top: 100%; margin-top: 8px; z-index: 50; min-width: 164px;
  background: var(--bg); border: 2px solid var(--fg); box-shadow: var(--sh-light);
}
.mh-pop a {
  display: flex; align-items: baseline; gap: 8px; padding: 10px 16px;
  font: 700 12px/1.3 var(--mont); letter-spacing: .08em; color: var(--fg); text-decoration: none;
}
.mh-pop a[aria-current] { background: var(--fg); color: var(--bg); }
.mh-pop a span:first-child { width: 24px; opacity: .6; }
.mh-btn .mh-chev { transition: transform var(--dur-tap) ease; }
.mh-btn[aria-expanded="true"] .mh-chev { transform: rotate(180deg); }

/* ── on the event report (scripts/site-bar.mjs) ── */
html.has-site-bar .masthead .top-row,
html.has-site-bar .masthead .wordmark-row,
html.has-site-bar #theme-toggle { display: none !important; }
html.has-site-bar .masthead { padding-top: var(--space-7, 32px); }
html.has-site-bar { scroll-padding-top: calc(var(--mh-h) + 12px); }
.mh [data-site-theme] .ti-sun { display: none; }
[data-theme="dark"] .mh [data-site-theme] .ti-moon { display: none; }
[data-theme="dark"] .mh [data-site-theme] .ti-sun { display: block; }
.mh a { text-decoration: none; }
