/* scaffold.css: the prototype control bar only. Visibly outside the design:
   monospace, inverted, fixed above the page. Reads tokens, defines no colours.
   Nvok can ignore this file.

   The bar is a drawer. Closed, it slides up out of the viewport and only a
   small tab in the top right corner stays, so the page reads without it.
   The tab hangs off the bar's bottom edge, so one transform moves both. */
body { padding-top: var(--scaffold-h); }
html[data-scaffold="closed"] body { padding-top: 0; }

.scaffold {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1000;
  height: var(--scaffold-h);
  background: var(--text);
  color: var(--ground);
  font: 12px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  transition: transform var(--hover-duration);
}
html[data-scaffold="closed"] .scaffold { transform: translateY(-100%); }

.scaffold__inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 100%;
  padding: 0 var(--space-2);
  overflow-x: auto;
  white-space: nowrap;
}
.scaffold__label { font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.scaffold__note { margin-left: auto; opacity: 0.6; }
.scaffold__group { display: inline-flex; align-items: center; gap: 4px; }
.scaffold__group > span { opacity: 0.6; margin-right: 4px; }
.scaffold button {
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--ground);
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.scaffold button[aria-pressed="true"] { background: var(--ground); color: var(--text); }
.scaffold button:focus-visible { outline: 2px solid var(--ground); outline-offset: 1px; }

/* The tab. Sits under the bar's right corner; when the bar is up, the tab is
   the only thing left at the top edge. Written as .scaffold .scaffold__toggle
   so it outranks the generic button rule above. */
.scaffold .scaffold__toggle {
  position: absolute;
  top: 100%;
  right: var(--space-2);
  height: 24px;
  padding: 0 10px;
  border: 0;
  border-radius: 0 0 4px 4px;
  background: var(--text);
  color: var(--ground);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.scaffold .scaffold__toggle:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.scaffold__toggle::after { content: "\25B4"; /* small up triangle */ }
html[data-scaffold="closed"] .scaffold__toggle::after { content: "\25BE"; /* small down triangle */ }

/* Older versions. The trigger reads like the buttons beside it and fills
   when the version on screen is one of the older ones. The menu is a
   popover that hangs off the bar's bottom edge like the tab; scaffold.js
   sets its top and left, so the browser's centring is switched off here. */
.scaffold__more::after { content: "\25BE"; margin-left: 6px; /* small down triangle */ }
.scaffold__more[aria-expanded="true"]::after { content: "\25B4"; /* small up triangle */ }
.scaffold .scaffold__more.is-current { background: var(--ground); color: var(--text); }
.scaffold__menu {
  inset: auto;
  margin: 0;
  padding: 7px 8px;
  border: 0;
  border-radius: 0 0 4px 4px;
  background: var(--text);
  color: var(--ground);
}
.scaffold__menu:popover-open { display: flex; gap: 4px; }

/* ---- The Mobile view (Step 25, reference/MOBILE-BRIEF.md section 11).
        View: Desktop | Mobile is the first group in the bar. Mobile replaces
        the page with a canvas: a quiet ground and a phone frame, 390 x 844
        CSS pixels inside a thin bezel, no notch, no status bar, holding an
        iframe of the same page with frame=1. The page inside renders its
        phone tier natively; this is only a way to see it on a laptop. On a
        real phone the group hides under 640 and the view is desktop. ---- */
@media (width < 640px) { .scaffold__group--view { display: none; } }
html[data-view="mobile"] { overflow: hidden; }
html[data-view="mobile"] body > :not(.scaffold, .scaffold__canvas) { display: none !important; }
.scaffold__canvas {
  min-height: calc(100dvh - var(--scaffold-h));
  padding: var(--space-3) var(--space-2);
  background: var(--scaffold-canvas);
  color: var(--scaffold-caption);
  font: 12px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
html[data-scaffold="closed"] .scaffold__canvas { min-height: 100dvh; }
/* The stage holds the frame's scaled height (scaffold.js sets it) so the
   caption follows the frame rather than the frame's unscaled box. */
.scaffold__stage { display: grid; justify-items: center; gap: var(--space-2); }
.scaffold__phone {
  box-sizing: content-box;
  width: 390px;
  height: 844px;
  padding: 12px;
  border-radius: 44px;
  background: var(--scaffold-bezel);
  box-shadow: var(--scaffold-bezel-shadow);
  transform-origin: top center;
}
.scaffold__frame {
  display: block;
  width: 390px;
  height: 844px;
  border: 0;
  border-radius: 32px;
  background: var(--ground);
}
.scaffold__caption { margin: 0; }

/* Inside the frame (frame=1, or window.self !== window.top): no bar, no tab,
   no bar padding, and no classic scrollbar, which would take 15px of the 390
   on a laptop and the headless shell. A phone's scrollbars overlay anyway. */
html[data-frame] { scrollbar-width: none; }
html[data-frame]::-webkit-scrollbar { display: none; }

/* Handoff build (handoff/build.mjs): the way back to the hub. */
.scaffold__home { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border: 1px solid var(--ground); border-radius: 4px; color: inherit; text-decoration: none; }
.scaffold__home:hover { background: var(--ground); color: var(--text); }
.scaffold__home:focus-visible { outline: 2px solid var(--ground); outline-offset: 1px; }

/* Handoff build (handoff/build.mjs, from handoff/lib/whats-new.css): the
   "New in v1.x" tab beside Controls, its panel, and its outlines on the page
   (js/whats-new.js).
   Scaffolding, not design: the bar's inverted monospace, tokens only. */
/* The tab runs down the window's right edge, just under the header, so it
   covers no control (since 20 October; hung beside Controls it sat on
   the top of Search and Donate). It hangs off the bar, so it moves with it
   and shows while the bar is closed. The text reads top to bottom, and the
   triangles turn with it, pointing to where the panel opens. */
.scaffold .scaffold__new-tab {
  position: absolute;
  top: calc(100% + var(--header-h) + var(--frame-rule) + var(--space-1));
  right: 0;
  width: 24px;
  height: auto;
  max-height: calc(100dvh - var(--header-h) - var(--space-4));
  overflow: hidden;
  padding: 10px 0;
  border: 0;
  border-radius: 4px 0 0 4px;
  background: var(--text);
  color: var(--ground);
  writing-mode: vertical-rl;
  white-space: nowrap;
}
.scaffold .scaffold__new-tab.is-on { box-shadow: inset 3px 0 0 var(--ground); }
.scaffold .scaffold__new-tab:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.scaffold__new-tab::after { content: "\25BE"; margin-top: 6px; /* small down triangle, turned to point left */ }
.scaffold__new-tab[aria-expanded="true"]::after { content: "\25B4"; /* small up triangle, turned to point right */ }
/* Not in a phone-wide window (Jeremy, 20 October): there it covered the
   page's right gutter. Controls' Mobile view keeps it, since the window
   showing the phone frame is desktop wide. */
@media (width < 640px) { .scaffold .scaffold__new-tab { display: none; } }
.scaffold__new-panel {
  inset: auto;
  margin: 0;
  width: min(34rem, calc(100vw - 32px));
  max-height: 70vh;
  overflow-y: auto;
  padding: var(--space-2);
  border: 0;
  border-radius: 4px 0 4px 4px;
  background: var(--text);
  color: var(--ground);
  font: 12px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  white-space: normal;
}
.scaffold__new-panel p { margin: 0 0 var(--space-1); }
.scaffold__new-panel button { height: 26px; padding: 0 10px; border: 1px solid var(--ground); border-radius: 4px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.scaffold__new-panel button[aria-pressed="true"] { background: var(--ground); color: var(--text); }
.scaffold__new-panel button:focus-visible { outline: 2px solid var(--ground); outline-offset: 1px; }
.scaffold__new-panel .whats-new-h { margin-top: var(--space-1); opacity: 0.6; }
.scaffold__new-panel ul { margin: 0 0 var(--space-2); padding: 0; list-style: none; }
.scaffold__new-panel li { padding-block: 4px; border-top: 1px solid color-mix(in srgb, var(--ground) 20%, transparent); }
.scaffold__new-panel a { color: inherit; text-underline-offset: 3px; }
.scaffold__new-panel a:focus-visible { outline: 2px solid var(--ground); outline-offset: 1px; }
.whats-new-view { display: inline-block; margin-right: 6px; padding: 0 5px; border: 1px solid var(--ground); border-radius: 4px; }
[data-whats-new] { outline: 2px dashed var(--text) !important; outline-offset: 2px; }
.whats-new-label {
  position: absolute;
  z-index: 999;
  display: block;
  max-width: 28rem;
  padding: 3px 8px;
  border-radius: 0 0 4px 0;
  background: var(--text);
  color: var(--ground);
  font: 12px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  pointer-events: none;
}
.whats-new-label__head { display: block; opacity: 0.7; }
.whats-new-label__line { display: block; }
.whats-new-label__line + .whats-new-label__line { margin-top: 2px; padding-top: 2px; border-top: 1px solid color-mix(in srgb, var(--ground) 25%, transparent); }
