* { box-sizing: border-box; }
html, body { height: 100%; }

/* Keep ordinary links and server-rendered pages, but let supporting browsers
   blend one document into the next. Browsers without cross-document view
   transitions ignore this block and retain normal navigation. */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: page-leave 110ms ease-in both; }
::view-transition-new(root) { animation: page-enter 180ms ease-out both; }
@keyframes page-leave { to { opacity: 0; transform: translateY(-2px); } }
@keyframes page-enter { from { opacity: 0; transform: translateY(3px); } }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* Light is Blueprint's body cut; labels and headings ask for Regular. */
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans);
  font-weight: var(--fw-light); display: flex; flex-direction: column;
}

/* --header-bg rather than --bg: three themes point it straight back at the
   page ground, and Studio uses it to put a warmer band behind the chrome than
   behind the columns below it. */
header {
  display: flex; align-items: center; gap: var(--space-s4);
  padding: var(--space-s3) var(--space-s6); border-bottom: 1px solid var(--line); background: var(--header-bg);
}
.brand { display: flex; align-items: center; gap: var(--space-s2); }
.brand h1 { font-family: var(--display); font-size: var(--fs-heading); line-height: var(--lh-heading); margin: 0;
            font-weight: var(--display-weight);
            letter-spacing: var(--display-track); }
.brand h1 a { color: inherit; text-decoration: none; }
.brand h1 a:hover { text-decoration: underline; }
.brand h1 a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.head-right { margin-left: auto; display: flex; align-items: center; gap: var(--space-s4); }
/* A secondary action in the header, button or link: New chat, and an admin's
   Dashboard. Its colours and corners are theme.css's secondary button. */
.head-button {
  display: inline-block; border: 1px solid var(--header-chrome-line); border-radius: var(--radius);
  padding: 7px 13px; background: var(--header-chrome-surface); color: var(--header-fg);
  font: var(--font-label-lg); white-space: nowrap; text-decoration: none; cursor: pointer;
}
.head-button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-strong); }
.head-button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.head-button:disabled { opacity: .45; cursor: default; }
header .engine { font: var(--font-code); color: var(--faint); }

.hint { font: var(--font-hint); color: var(--muted); margin-top: 6px; }
.checks { display: flex; flex-wrap: wrap; gap: var(--space-s2) var(--space-s4); }
.checks label { display: inline-flex; align-items: center; gap: var(--space-s2); font: var(--font-label-lg); color: var(--fg); cursor: pointer; }
.checks input { accent-color: var(--accent); }

.valbar { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-s3) var(--space-s4); background: var(--surface); font: var(--font-hint); }
.valbar.ok { border-color: var(--ok-line); background: var(--ok-soft); color: var(--ok); font-weight: var(--fw-regular); }
.valbar.bad { border-color: var(--err-line); background: var(--err-soft); }

.result { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-s4); background: var(--surface); box-shadow: var(--shadow); }
.result.ok { border-color: var(--ok-line); background: var(--ok-soft); }
.result.bad { border-color: var(--err-line); background: var(--err-soft); }
.result .badge { font: var(--font-hint); }
.result.ok .badge { color: var(--ok); }
.result.bad .badge { color: var(--err); }
.result strong { font-weight: var(--fw-regular); }

.issue { font: var(--font-code); padding: var(--space-s1) 0; }
.issue .sev { font-weight: var(--fw-regular); }
.issue.warning .sev { color: var(--warn); }
.issue.error .sev { color: var(--err); }

/* A note, not an error: the link may simply be waiting on the browser's prompt. */
.vscode-miss { grid-column: 1 / -1; margin-top: var(--space-s2); padding: var(--space-s2) var(--space-s3); font: var(--font-hint);
               color: var(--muted); background: var(--surface2); border: 1px dashed var(--line);
               border-radius: var(--radius-notice); }
.vscode-miss a { color: var(--accent-strong); }
/* Where Open in VS Code's link stands once it is old: renewing, renewed or expired. */
.vscode-fresh { grid-column: 1 / -1; margin-top: 8px; font-size: 12px; line-height: 1.45; color: var(--muted); }

/* A tag in rendered text (md-inline.mjs, ⟦word⟧): the chat's mark for a value
   it proposed, in the draft and the Review dialog. A pill like the project
   cards' own tag, outlined so it holds on a bubble, in every theme and in
   forced colours. Blueprint's medium badge: Label/Regular/XS. */
.md-tag {
  display: inline-block; padding: 0 7px; border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: var(--surface2); color: var(--fg); font: var(--font-hint);
  white-space: nowrap; vertical-align: 1px;
}
.empty { color: var(--faint); font: var(--font-hint); }
pre.spec {
  background: var(--code-bg); border: 1px solid var(--code-line); border-radius: var(--radius); padding: 14px;
  font: var(--font-code); overflow: auto; color: var(--code-fg);
}

.scroll-thin::-webkit-scrollbar, pre::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll-thin::-webkit-scrollbar-thumb, pre::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb); border-radius: 8px; border: 3px solid var(--bg);
}

/* Report a problem stays beside the header cog on every user-facing page. */
.report-problem {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px;
  border: 1px solid transparent; border-radius: var(--radius);
  background: none; color: var(--header-muted); cursor: pointer;
  font: var(--font-label-lg); white-space: nowrap;
}
.report-problem:hover { color: var(--header-fg); background: var(--header-chrome-surface2); }
.report-problem svg { flex-shrink: 0; }
.report-problem:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.head-right[data-tools="on"] .report-problem-label {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

dialog.report-dialog {
  width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  overflow: auto; margin: auto; padding: var(--space-s5) var(--space-s6) var(--space-s4);
  background: var(--surface); color: var(--fg); font-family: var(--sans);
  border: 1px solid var(--line); border-radius: var(--radius-modal);
  box-shadow: var(--shadow-modal);
}
dialog.report-dialog::backdrop {
  background: var(--overlay);
}
.report-title {
  margin: 0 0 var(--space-s3); font: var(--font-h3); color: var(--fg);
}
.report-sub, .report-done {
  margin: 0 0 var(--space-s3); font: var(--font-body-lg);
}
.report-label { display: block; margin: var(--space-s3) 0 6px; font: var(--font-label-lg); }
.report-text {
  display: block; width: 100%; min-height: 104px; resize: vertical;
  padding: var(--space-s2) var(--space-s3); font: var(--font-body-lg);
  color: var(--fg); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.report-text:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-field); }
.report-check {
  display: flex; align-items: center; gap: var(--space-s2); margin: var(--space-s3) 0 0;
  font: var(--font-body-lg); cursor: pointer;
}
.report-check input { margin: 0; accent-color: var(--accent); }
.report-check input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.report-hint {
  margin: 6px 0 0; font: var(--font-hint); color: var(--muted);
}
.report-note { margin: var(--space-s2) 0 0; font: var(--font-hint); color: var(--muted); }
.report-note:empty { display: none; }
.report-note.err { color: var(--err); font-weight: var(--fw-regular); }
.report-actions { display: flex; align-items: center; gap: var(--space-s2); margin-top: var(--space-s4); }
.report-send, .report-cancel {
  border-radius: var(--radius); padding: 8px 18px; cursor: pointer;
  font: var(--font-label-lg);
}
.report-send { border: 1px solid transparent; background: var(--accent); color: var(--surface); }
.report-send:hover:not(:disabled) { background: var(--accent-strong); }
.report-send:disabled { opacity: .5; cursor: default; }
.report-cancel {
  border: 1px solid var(--line); background: none; color: var(--fg);
}
.report-cancel:hover { background: var(--surface2); }
.report-send:focus-visible, .report-cancel:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}

@media (max-width: 640px) {
  .report-problem-label {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
}

@media (max-width: 1020px) {
  .brand .sub { display: none; }
}

@media (max-width: 760px) {
  header { flex-wrap: wrap; }
  .head-right {
    flex: 1 1 100%; min-width: 0; margin-left: 0; gap: 8px; flex-wrap: wrap;
  }
}

@media (forced-colors: active) {
  .report-problem, dialog.report-dialog, .report-text, .report-send, .report-cancel {
    border-color: ButtonText;
  }
  .report-send:disabled { color: GrayText; opacity: 1; }
  dialog.report-dialog::backdrop { background: Canvas; opacity: .7; }
  .md-tag { border-color: CanvasText; color: CanvasText; background: Canvas; }
}
