/* The prototype bar: one calm band across the very top of every page the desk or a run's viewer serves. Shared by all of them (the desk's
   own pages, the run's package, review and price pages, the "How this was built" page and the compare page), so a page cannot forget it:
   tests/test_proto_bar.py fails for any .html file under viewer/ that does not carry it first in <body>.

   It is a solid BLUE band with white lettering, the same in the light and the dark theme, so it is the one thing on every page that cannot be missed
   (the user: "the header needs to be more obvious, a blue background"). The blue is #1b4acb: 7.3 to 1 against the white lettering (tests/test_proto_bar.py holds it
   to 7 to 1) and it is not the coral, which stays the page's one accent. --proto-bar-bg and --proto-bar-fg name the two colours. No icon, no stripe, nothing else on it
   but the Instructions control at the right end (last in this file).

   It is fixed to the top of the window and the body leaves room for it, so a page that lays itself out to the window's height (the review
   screen, the project page, the price page) loses exactly the band's height and nothing overflows, and a page that scrolls keeps it in sight.
   --proto-bar-h is its height; whatever else is pinned to the top of the window (the drawing drawer, the skip link) starts below it. On a
   phone the words wrap to two lines, so the height is the fixed two-line one at 560px and below (the sentence is about 350px wide and the Instructions
   control, laid over the bar's right end, needs about 130px beside it, so one line fits from about 490px; 560 leaves room for a wider font). */

:root { --proto-bar-h: 32px; --proto-bar-bg: #1b4acb; --proto-bar-fg: #ffffff; }
@media (max-width: 560px) { :root { --proto-bar-h: 48px; } }

html { scroll-padding-top: var(--proto-bar-h); }
body { padding-top: var(--proto-bar-h); }

.proto-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  box-sizing: border-box; min-height: var(--proto-bar-h);
  display: flex; align-items: center; justify-content: center;
  margin: 0; padding: 0 16px;
  background: var(--proto-bar-bg, #1b4acb);
  color: var(--proto-bar-fg, #ffffff);
  font: 600 13px/32px ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  text-align: center;
  -webkit-font-smoothing: antialiased;
}
@media (max-width: 560px) {
  .proto-bar { padding: 6px 12px; line-height: 18px; text-wrap: balance; }
}

@media print {
  .proto-bar { position: static; }
  body { padding-top: 0; }
}

/* INSTRUCTIONS: the one control on the bar and the panel it opens (viewer/js/instructions.js adds both; a page with no script keeps the bare
   bar above). The button is laid over the right end of the bar and stays the bar's own colours turned the other way round, so it takes no
   colour of its own; the panel hangs from the bar's lower edge and uses the page's own surface and ink, with a fallback for every token
   (the desk and the run's review pages name them --surface, --text, --border-strong; the older run pages --ink, --rule). No coral, no icon
   file (the chevron is drawn here), no animation. The page's own focus ring is not relied on: this one is plain ink on both. */

html[data-proto-ins] .proto-bar { padding-left: 140px; padding-right: 140px; }
@media (max-width: 720px) {
  html[data-proto-ins] .proto-bar { padding-left: 16px; padding-right: 136px; }
}
@media (max-width: 560px) {
  html[data-proto-ins] .proto-bar { padding-left: 12px; padding-right: 124px; }
}
@media (max-width: 360px) {
  html[data-proto-ins] .proto-bar { padding-right: 116px; }
}

:root .proto-ins-btn {
  position: fixed; z-index: 1001; top: calc((var(--proto-bar-h) - 24px) / 2); right: 12px;
  box-sizing: border-box; height: 24px; margin: 0; padding: 0 9px 0 10px;
  display: inline-flex; align-items: center; gap: 7px;
  background: transparent; color: var(--proto-bar-fg, #ffffff);
  border: 1px solid currentColor; border-radius: 4px;
  font: 600 13px/1 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0; text-transform: none; white-space: nowrap; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
:root .proto-ins-btn:hover, :root .proto-ins-btn[aria-expanded="true"] { background: var(--proto-bar-fg, #ffffff); color: var(--proto-bar-bg, #1b4acb); }
:root .proto-ins-btn:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
@media (max-width: 560px) {
  :root .proto-ins-btn { right: 8px; height: 28px; top: calc((var(--proto-bar-h) - 28px) / 2); padding: 0 8px 0 9px; gap: 6px; }
}
.proto-ins-chev {
  display: inline-block; flex: none; width: 6px; height: 6px; margin-top: -3px;
  border-style: solid; border-color: currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.proto-ins-btn[aria-expanded="true"] .proto-ins-chev { margin-top: 3px; transform: rotate(-135deg); }

:root .proto-ins-panel {
  position: fixed; z-index: 1001; top: var(--proto-bar-h); right: 12px;
  box-sizing: border-box; width: min(460px, calc(100vw - 24px)); max-height: calc(100vh - var(--proto-bar-h) - 12px); max-height: calc(100dvh - var(--proto-bar-h) - 12px);
  margin: 0; padding: 16px 16px 20px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface, #ffffff); color: var(--text, var(--ink, #0f1115));
  border: 1px solid var(--border-strong, var(--rule, #d4d6db)); border-top: 0; border-radius: 0 0 8px 8px;
  box-shadow: 0 12px 32px -8px rgb(0 0 0 / 0.28);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; text-align: left;
}
:root .proto-ins-panel[hidden] { display: none; }
@media (max-width: 560px) {
  :root .proto-ins-panel { left: 8px; right: 8px; width: auto; padding: 14px 14px 18px; }
}
:root .proto-ins-panel :is(p, ol, li, .proto-ins-h, .proto-ins-gh) { margin: 0; padding: 0; }
:root .proto-ins-panel .proto-ins-h { font-size: 16px; line-height: 24px; font-weight: 600; }
:root .proto-ins-panel .proto-ins-lead { margin-top: 2px; color: var(--text-2, var(--ink-2, #5b616e)); }

:root .proto-ins-panel .proto-ins-guides { margin: 14px 0 0; display: grid; gap: 6px; }
:root .proto-ins-panel .proto-ins-tab {
  box-sizing: border-box; width: 100%; min-height: 40px; margin: 0; padding: 6px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left;
  background: transparent; color: inherit; border: 1px solid var(--border-strong, var(--rule, #d4d6db)); border-radius: 6px;
  font: inherit; font-weight: 500; cursor: pointer; -webkit-appearance: none; appearance: none;
}
:root .proto-ins-panel .proto-ins-tab:hover { background: var(--surface-2, var(--surface-3, #f4f4f5)); }
:root .proto-ins-panel .proto-ins-tab[aria-pressed="true"] { background: var(--surface-3, var(--surface-2, #ececee)); border: 2px solid var(--text, var(--ink, #0f1115)); padding: 5px 11px; font-weight: 600; }
:root .proto-ins-panel .proto-ins-here { flex: none; font-size: 12px; font-weight: 600; color: var(--text-2, var(--ink-2, #5b616e)); }
:root .proto-ins-panel .proto-ins-here:empty { display: none; }

:root .proto-ins-panel .proto-ins-guide { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-strong, var(--rule, #d4d6db)); }
:root .proto-ins-panel .proto-ins-gh { font-size: 15px; line-height: 22px; font-weight: 600; }
:root .proto-ins-panel .proto-ins-intro { margin-top: 4px; color: var(--text-2, var(--ink-2, #5b616e)); }
:root .proto-ins-panel .proto-ins-steps { margin-top: 12px; padding-left: 22px; list-style: decimal; }
:root .proto-ins-panel .proto-ins-steps li { margin: 0 0 10px; padding-left: 4px; list-style: decimal; }
:root .proto-ins-panel .proto-ins-steps li::marker { font-weight: 600; }
:root .proto-ins-panel .proto-ins-actions { margin-top: 14px; display: grid; gap: 10px; justify-items: start; }

:root .proto-ins-panel :is(.proto-ins-go, .proto-ins-sample) {
  box-sizing: border-box; display: inline-flex; align-items: center; min-height: 36px; margin: 0; padding: 0 14px;
  background: transparent; color: var(--text, var(--ink, #0f1115)); border: 1px solid var(--text, var(--ink, #0f1115)); border-radius: 6px;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; -webkit-appearance: none; appearance: none;
}
:root .proto-ins-panel :is(.proto-ins-go, .proto-ins-sample):hover { background: var(--surface-3, var(--surface-2, #ececee)); }
:root .proto-ins-panel .proto-ins-sample:disabled { opacity: 0.7; cursor: default; }
:root .proto-ins-panel .proto-ins-sample-intro { margin-top: 6px; color: var(--text-2, var(--ink-2, #5b616e)); }
:root .proto-ins-panel .proto-ins-problem { color: var(--text, var(--ink, #0f1115)); font-weight: 600; }
:root .proto-ins-panel :focus-visible { outline: 2px solid var(--text, var(--ink, #0f1115)); outline-offset: 2px; }

/* FEEDBACK AND THE NOTICE: only in a desk other people reach (viewer/js/instructions.js adds them; a desk on one's own computer has neither). FEEDBACK is a second control
   in the bar, left of Instructions, in the same colours turned the other way round; it sits where it fits. The sentence needs about 350px, Instructions about 116px and
   Feedback about 84px, so Feedback is a bar control from 641px up and, below that, a button at the top of the Instructions panel (the sentence needs the room). The script
   measures the two buttons into --proto-ins-w and --proto-fb-w, so the room kept beside the sentence follows the real width of the words. Its panel is the Instructions panel's
   own look (it carries that class too) hung from the bar in the same place. The NOTICE is a modal <dialog> in the page's own surface and ink: nothing behind it can be
   reached, and it is not dismissed by Esc. No coral, no stripe, no motion. */

:root .proto-fb-btn {
  position: fixed; z-index: 1001; top: calc((var(--proto-bar-h) - 24px) / 2); right: calc(12px + var(--proto-ins-w, 116px) + 8px);
  box-sizing: border-box; height: 24px; margin: 0; padding: 0 10px;
  display: inline-flex; align-items: center;
  background: transparent; color: var(--proto-bar-fg, #ffffff);
  border: 1px solid currentColor; border-radius: 4px;
  font: 600 13px/1 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0; text-transform: none; white-space: nowrap; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
:root .proto-fb-btn:hover, :root .proto-fb-btn[aria-expanded="true"] { background: var(--proto-bar-fg, #ffffff); color: var(--proto-bar-bg, #1b4acb); }
:root .proto-fb-btn:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
@media (min-width: 641px) {
  html[data-proto-ins][data-proto-fb] .proto-bar { padding-left: 16px; padding-right: calc(var(--proto-ins-w, 116px) + var(--proto-fb-w, 84px) + 36px); }
}
@media (min-width: 960px) {
  html[data-proto-ins][data-proto-fb] .proto-bar { padding-left: calc(var(--proto-ins-w, 116px) + var(--proto-fb-w, 84px) + 36px); }
}
@media (max-width: 640px) {
  :root .proto-fb-btn { display: none; }
}

:root .proto-ins-panel .proto-fb-in { display: none; }
@media (max-width: 640px) {
  :root .proto-ins-panel .proto-fb-in {
    box-sizing: border-box; display: inline-flex; align-items: center; min-height: 40px; margin: 12px 0 0; padding: 0 14px;
    background: transparent; color: var(--text, var(--ink, #0f1115)); border: 1px solid var(--text, var(--ink, #0f1115)); border-radius: 6px;
    font: inherit; font-weight: 600; cursor: pointer; -webkit-appearance: none; appearance: none;
  }
  :root .proto-ins-panel .proto-fb-in:hover { background: var(--surface-3, var(--surface-2, #ececee)); }
}

:root .proto-fb-panel .proto-fb-moods { margin: 12px 0 0; display: grid; gap: 6px; }
:root .proto-fb-panel .proto-fb-mood {
  box-sizing: border-box; width: 100%; min-height: 40px; margin: 0; padding: 6px 12px; text-align: left;
  background: transparent; color: inherit; border: 1px solid var(--border-strong, var(--rule, #d4d6db)); border-radius: 6px;
  font: inherit; font-weight: 500; cursor: pointer; -webkit-appearance: none; appearance: none;
}
:root .proto-fb-panel .proto-fb-mood:hover { background: var(--surface-2, var(--surface-3, #f4f4f5)); }
:root .proto-fb-panel .proto-fb-mood[aria-pressed="true"] { background: var(--surface-3, var(--surface-2, #ececee)); border: 2px solid var(--text, var(--ink, #0f1115)); padding: 5px 11px; font-weight: 600; }
:root .proto-fb-panel .proto-fb-label { display: block; margin: 14px 0 0; font-weight: 600; }
:root .proto-fb-panel .proto-fb-text {
  box-sizing: border-box; display: block; width: 100%; min-height: 112px; margin: 6px 0 0; padding: 8px 10px;
  background: var(--surface, #ffffff); color: var(--text, var(--ink, #0f1115)); border: 1px solid var(--border-strong, var(--rule, #d4d6db)); border-radius: 6px;
  font: inherit; resize: vertical;
}
:root .proto-fb-panel .proto-fb-problem { margin: 8px 0 0; color: var(--text, var(--ink, #0f1115)); font-weight: 600; }
:root .proto-fb-panel .proto-fb-actions { margin: 12px 0 0; }
:root .proto-fb-panel .proto-fb-thanks p { margin: 6px 0 0; color: var(--text-2, var(--ink-2, #5b616e)); }
:root .proto-fb-panel .proto-fb-send {
  box-sizing: border-box; display: inline-flex; align-items: center; min-height: 40px; margin: 0; padding: 0 18px;
  background: var(--text, var(--ink, #0f1115)); color: var(--surface, #ffffff); border: 1px solid var(--text, var(--ink, #0f1115)); border-radius: 6px;
  font: inherit; font-weight: 600; cursor: pointer; -webkit-appearance: none; appearance: none;
}
:root .proto-fb-panel .proto-fb-send:disabled { opacity: 0.7; cursor: default; }
:root .proto-fb-panel :focus-visible { outline: 2px solid var(--text, var(--ink, #0f1115)); outline-offset: 2px; }
:root .proto-fb-panel #proto-fb-thanks:focus { outline: none; }

:root dialog.proto-consent {
  box-sizing: border-box; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px);
  margin: auto; padding: 0; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface, #ffffff); color: var(--text, var(--ink, #0f1115));
  border: 1px solid var(--border-strong, var(--rule, #d4d6db)); border-radius: 8px;
  box-shadow: 0 16px 48px -8px rgb(0 0 0 / 0.45);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; text-align: left;
}
:root dialog.proto-consent::backdrop { background: rgb(0 0 0 / 0.6); }
:root dialog.proto-consent .proto-consent-box { padding: 20px 20px 22px; }
:root dialog.proto-consent :is(p, .proto-consent-h) { margin: 0; padding: 0; }
:root dialog.proto-consent .proto-consent-h { font-size: 18px; line-height: 26px; font-weight: 600; }
:root dialog.proto-consent .proto-consent-text { margin-top: 10px; }
:root dialog.proto-consent .proto-consent-problem { margin-top: 12px; font-weight: 600; }
:root dialog.proto-consent .proto-consent-actions { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 10px; }
:root dialog.proto-consent :is(.proto-consent-yes, .proto-consent-no) {
  box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; margin: 0; padding: 0 20px;
  border: 1px solid var(--text, var(--ink, #0f1115)); border-radius: 6px; font: inherit; font-weight: 600; cursor: pointer; -webkit-appearance: none; appearance: none;
}
:root dialog.proto-consent .proto-consent-yes { background: var(--text, var(--ink, #0f1115)); color: var(--surface, #ffffff); }
:root dialog.proto-consent .proto-consent-no { background: transparent; color: var(--text, var(--ink, #0f1115)); }
:root dialog.proto-consent :is(.proto-consent-yes, .proto-consent-no):disabled { opacity: 0.7; cursor: default; }
:root dialog.proto-consent :focus-visible { outline: 2px solid var(--text, var(--ink, #0f1115)); outline-offset: 2px; }
@media (max-width: 560px) {
  :root dialog.proto-consent .proto-consent-box { padding: 16px 16px 18px; }
  :root dialog.proto-consent .proto-consent-actions { flex-direction: column; }
  :root dialog.proto-consent :is(.proto-consent-yes, .proto-consent-no) { width: 100%; }
}

@media print {
  .proto-ins-btn, .proto-ins-panel, .proto-fb-btn, .proto-fb-panel, .proto-consent { display: none !important; }
}
