/* PowerQueue public service website (REQ-6177). One stylesheet for every
   page; native CSS only, no external resources. Colours are tokens, with a
   dark set for prefers-color-scheme. Contrast of --fg and --muted on --bg
   and --code-bg is above WCAG AA's 4.5:1 in both sets. */
:root {
  --bg: #fbfbf9;
  --surface: #ffffff;
  --fg: #1c1c1a;
  --muted: #55554f;
  --rule: #dad9d2;
  --code-bg: #f1f0ea;
  --accent: #1f4f9c;
  --accent-fg: #ffffff;
  --warn-bg: #fff4d6;
  --warn-rule: #e0b84a;
  --bad-bg: #fde8e6;
  --bad-rule: #d9776c;
  --measure: 48rem;
  --gutter: 1rem;
  --radius: 6px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17171a;
    --surface: #1e1e22;
    --fg: #e7e7e3;
    --muted: #a9a9a2;
    --rule: #36363d;
    --code-bg: #24242a;
    --accent: #8db4f2;
    --accent-fg: #101014;
    --warn-bg: #3a3118;
    --warn-rule: #a8862e;
    --bad-bg: #3d2020;
    --bad-rule: #a5554c;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* Long names (package paths, URLs) wrap instead of widening a phone's page. */
  overflow-wrap: break-word;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--surface);
  padding: .5rem 1rem;
}
.skip:focus { left: var(--gutter); }

/* Header and navigation */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}
.site-header .inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: .75rem var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1.5rem;
}
.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--fg);
  text-decoration: none;
}
.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1rem;
}
.site-nav a { text-decoration: none; }
.site-nav a:hover { text-decoration: underline; }
.site-nav a[aria-current="page"] { color: var(--fg); font-weight: 600; }

main {
  display: block;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.5rem var(--gutter) 4rem;
}

.site-footer {
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: .9rem;
}
.site-footer .inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1rem var(--gutter) 2rem;
}

/* Text */
h1 { font-size: 1.85rem; line-height: 1.25; margin: .5rem 0 .5rem; }
h2 {
  font-size: 1.3rem;
  line-height: 1.3;
  margin: 2.5rem 0 .6rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}
h3 { font-size: 1.05rem; margin: 1.6rem 0 .4rem; }
h4 { font-size: 1rem; margin: 1.2rem 0 .3rem; }
p, ul, ol, dl { margin: .55rem 0; }
li + li { margin-top: .2rem; }
dt { font-weight: 600; margin-top: .6rem; }
dd { margin-left: 1.25rem; }
.lede { font-size: 1.1rem; color: var(--muted); }
.muted, .note { color: var(--muted); }
.note { font-size: .93rem; }

code, pre, kbd, samp { font-family: var(--mono); font-size: .9em; }
code {
  background: var(--code-bg);
  padding: .05em .3em;
  border-radius: 3px;
  overflow-wrap: anywhere;
}
pre {
  background: var(--code-bg);
  padding: .8rem 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: .5rem 0;
  line-height: 1.5;
  tab-size: 4;
}
pre code { background: none; padding: 0; overflow-wrap: normal; font-size: 1em; }

/* Code blocks get a copy button from the page script, above the code so
   it never covers it. */
.code { display: flex; flex-direction: column; margin: .5rem 0; }
.code pre { margin: 0; order: 2; }
.code .copy {
  order: 1;
  align-self: flex-end;
  font-size: .8rem;
  padding: .1rem .55rem;
  margin-bottom: .25rem;
}

/* Callouts */
.callout {
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent);
  background: var(--surface);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin: 1rem 0;
}
.callout.warn { border-left-color: var(--warn-rule); background: var(--warn-bg); }
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }

.facts {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: .75rem;
  margin: 1.25rem 0;
}
.facts li {
  margin: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  padding: .7rem .9rem;
}
.facts strong { display: block; }

/* Buttons and inputs */
button, .button {
  font: inherit;
  font-size: .92rem;
  padding: .35rem .85rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

/* The identifier box (hidden until the page script shows it). */
.idbox {
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  padding: .9rem 1rem;
  margin: 1rem 0;
}
.idbox label { display: block; font-weight: 600; margin-bottom: .35rem; }
.idbox .row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.idbox input {
  flex: 1 1 16rem;
  min-width: 0;
  font: 600 1.05rem/1.4 var(--mono);
  padding: .35rem .5rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
}
.idbox input[aria-invalid="true"] { border-color: var(--bad-rule); }
.idbox .status { margin: .4rem 0 0; font-size: .9rem; color: var(--muted); }

/* Tables scroll inside their wrapper, never the page. */
.table-wrap { overflow-x: auto; margin: .6rem 0; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
caption { text-align: left; color: var(--muted); font-size: .9rem; padding-bottom: .3rem; }
th, td { text-align: left; vertical-align: top; padding: .4rem .6rem .4rem 0; border-bottom: 1px solid var(--rule); }
th { font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Live statistics */
.stats {
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  padding: 1rem;
  margin: 1.25rem 0;
}
.stats h2 { border: 0; margin: 0 0 .5rem; padding: 0; font-size: 1.1rem; }
.stats dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: .75rem;
  margin: .5rem 0;
}
.stats dl div { margin: 0; }
.stats dt { font-weight: 400; color: var(--muted); font-size: .88rem; margin: 0; }
.stats dd { margin: 0; font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats .state { margin: .25rem 0; }
.stats .state.warn { border-left: 4px solid var(--warn-rule); background: var(--warn-bg); padding: .4rem .7rem; }
.stats .state.bad { border-left: 4px solid var(--bad-rule); background: var(--bad-bg); padding: .4rem .7rem; }

/* Quick starts and docs navigation */
details {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  margin: .5rem 0;
}
details > summary {
  cursor: pointer;
  padding: .6rem 1rem;
  font-weight: 600;
}
details > :not(summary) { margin-left: 1rem; margin-right: 1rem; }
details[open] > summary { border-bottom: 1px solid var(--rule); }
details > :last-child { margin-bottom: 1rem; }

.doc-nav {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  padding: .6rem 1rem;
  margin: 1rem 0;
  font-size: .95rem;
}
.doc-nav ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.doc-nav a[aria-current="page"] { color: var(--fg); font-weight: 600; text-decoration: none; }

.toc { font-size: .95rem; }
.toc ol { padding-left: 1.25rem; }

.cards {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: .75rem;
}
.cards li {
  margin: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  padding: .75rem 1rem;
}
.cards a { font-weight: 600; }
.cards p { margin: .25rem 0 0; color: var(--muted); font-size: .93rem; }

[hidden] { display: none; }

@media (max-width: 30rem) {
  h1 { font-size: 1.5rem; }
  .stats dd { font-size: 1.25rem; }
}
