/* The shared header and footer (templates/chrome.html). Every page loads
   this file after its own stylesheet. The tokens follow the light and dark
   palettes of the vc window; a page with body.theme-auto follows the
   system setting, the home page stays light. */
:root {
  --ch-text: #1e293b;
  --ch-muted: #5b6b80;
  --ch-line: #e2e8f0;
  --ch-link: #2563eb;
  --ch-font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  --ch-width: calc(46rem + 32px);
  --ch-height: 52px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.theme-auto {
    --ch-text: #f1f5f9;
    --ch-muted: #9aa8bb;
    --ch-line: #272c38;
    --ch-link: #60a5fa;
  }
}
/* the /gui/ pages keep a light or dark choice in <html data-theme> */
:root[data-theme="dark"] body.theme-auto {
  --ch-text: #f1f5f9;
  --ch-muted: #9aa8bb;
  --ch-line: #272c38;
  --ch-link: #60a5fa;
}

.site-head {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: var(--ch-width);
  height: var(--ch-height);
  margin: 0 auto;
  padding: env(safe-area-inset-top) 16px 0;
  font-family: var(--ch-font);
}
.site-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--ch-text);
  text-decoration: none;
}
.site-home:hover .site-arrow { transform: translateX(-2px); }
.site-home:focus-visible { outline: 2px solid var(--ch-link); outline-offset: 2px; }
.site-arrow { width: 16px; height: 16px; color: var(--ch-muted); transition: transform 0.12s ease; }
.site-mark { display: block; width: 24px; height: 24px; }
.site-word { font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1; }

footer.site-foot {
  box-sizing: border-box;
  width: 100%;
  max-width: var(--ch-width);
  margin: 64px auto 0;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--ch-line);
  color: var(--ch-muted);
  font-family: var(--ch-font);
  font-size: 0.8rem;
  letter-spacing: normal;
  line-height: 1.5;
  text-align: center;
}
footer.site-foot a { color: inherit; text-underline-offset: 0.2em; }
@media (prefers-reduced-motion: reduce) { .site-arrow { transition: none; } }

/* SHA-256 bubble of a download link (static/sha.js): one filled shape, a
   rounded box with a small triangle whose point touches the link. */
:root {
  --sha-bg: #1e293b;
  --sha-text: #f1f5f9;
  --sha-muted: #b4c0d0;
  --sha-button: #f1f5f9;
  --sha-button-text: #1e293b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.theme-auto {
    --sha-bg: #e2e8f0;
    --sha-text: #0f172a;
    --sha-muted: #475569;
    --sha-button: #0f172a;
    --sha-button-text: #f1f5f9;
  }
}
.sha-bubble {
  --sha-tip: 50%;
  position: fixed;
  z-index: 50;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 4px 12px;
  width: max-content;
  padding: 8px 10px 9px 12px;
  border-radius: 8px;
  background: var(--sha-bg);
  color: var(--sha-text);
  font-family: var(--ch-font);
  font-size: 0.72rem;
  line-height: 1.35;
  text-align: left;
  filter: drop-shadow(0 2px 6px rgba(15, 23, 42, 0.28));
  opacity: 1;
  transition: opacity 1s linear;
}
.sha-bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  left: var(--sha-tip);
  width: 0;
  height: 0;
  margin-left: -9px;
  border: 9px solid transparent;
  border-top-color: var(--sha-bg);
  border-bottom: 0;
}
.sha-bubble.is-below::after {
  top: auto;
  bottom: 100%;
  border-top: 0;
  border-bottom: 9px solid var(--sha-bg);
}
.sha-bubble.is-fading { opacity: 0; }
.sha-label {
  grid-column: 1;
  color: var(--sha-muted);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.sha-hash {
  grid-column: 1;
  font-family: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
  font-size: 0.7rem;
  overflow-wrap: normal;
}
.sha-hash span { display: inline-block; white-space: nowrap; }
.sha-copy {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-width: 4.4rem;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: var(--sha-button);
  color: var(--sha-button-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.sha-copy:focus-visible { outline: 2px solid var(--sha-button); outline-offset: 2px; }
.sha-field { position: fixed; top: 0; left: -9999px; opacity: 0; }
@media (prefers-reduced-motion: reduce) { .sha-bubble { transition: none; } }

/* /gui/ pages (gui.go): their own top bar keeps its links on the right; the
   "<- vc" link takes the place of the page mark, at the shared height and
   gutter. */
body.gui-chrome .bar-in {
  height: var(--ch-height);
  padding-left: 16px;
  padding-right: 16px;
}
body.gui-chrome .top-in {
  min-height: var(--ch-height);
  padding-left: 16px;
  padding-right: 16px;
}
body.gui-chrome .site-home { flex: none; }
