/* pqbox site. System fonts only, no external resources. */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --bg-alt: #f5f6f8;
  --fg: #16181d;
  --muted: #4a5060;
  --border: #d5d9e0;
  --accent: #1d4ed8;
  --accent-fg: #ffffff;
  --link: #1d4ed8;
  --code-bg: #f1f3f6;
  --code-fg: #1b1f27;
  --warn-bg: #fff7e6;
  --warn-border: #b45309;
  --focus: #b45309;
  --radius: 6px;
  --measure: 72ch;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --bg-alt: #161a21;
    --fg: #e6e8ec;
    --muted: #a9b0bd;
    --border: #2c323d;
    --accent: #7aa2ff;
    --accent-fg: #0f1115;
    --link: #8fb1ff;
    --code-bg: #1a1f28;
    --code-fg: #e6e8ec;
    --warn-bg: #2a2110;
    --warn-border: #f0b35a;
    --focus: #f0b35a;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4rem;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1rem/1.6 var(--sans);
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  padding: 0.5rem 0.75rem;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: var(--radius);
  z-index: 10;
}

.skip-link:focus {
  top: 0.5rem;
}

.wrap {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 3.25rem;
  flex-wrap: wrap;
}

.brand {
  font: 700 1.125rem/1 var(--mono);
  color: var(--fg);
  text-decoration: none;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0;
  padding: 0.5rem 0;
  list-style: none;
  font-size: 0.9375rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--fg);
  text-decoration: underline;
}

/* Sections */

main > section {
  padding: 3rem 0;
  border-bottom: 1px solid var(--border);
}

main > section:nth-of-type(even) {
  background: var(--bg-alt);
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 0.75rem;
}

h1 {
  font: 700 clamp(2.25rem, 6vw, 3.25rem) / 1.1 var(--mono);
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.625rem;
}

h3 {
  font-size: 1.1875rem;
  margin-top: 2rem;
}

p,
ul,
ol {
  max-width: var(--measure);
}

.lead {
  font-size: 1.1875rem;
  color: var(--fg);
}

.muted {
  color: var(--muted);
}

.hero {
  padding: 3.5rem 0 3rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.button {
  display: inline-block;
  padding: 0.6rem 1rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
}

.button.primary {
  background: var(--accent);
  color: var(--accent-fg);
}

.button.secondary {
  color: var(--link);
}

.grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  margin-top: 1.5rem;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  background: var(--bg);
}

.card h3 {
  margin-top: 0;
  font-size: 1.0625rem;
}

.card p,
.card ul {
  margin: 0.5rem 0 0;
}

.note {
  border-left: 4px solid var(--warn-border);
  background: var(--warn-bg);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  max-width: var(--measure);
}

.note p {
  margin: 0;
}

/* Tables */

.table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 36rem;
  font-size: 0.9375rem;
}

table :not(pre) > code {
  overflow-wrap: normal;
  white-space: nowrap;
}

caption {
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

thead th {
  background: var(--bg-alt);
  font-weight: 600;
  white-space: nowrap;
}

/* Code */

code,
pre {
  font-family: var(--mono);
  font-size: 0.875rem;
}

:not(pre) > code {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  overflow-wrap: anywhere;
}

.code {
  position: relative;
  margin: 0.75rem 0 1.25rem;
}

pre {
  margin: 0;
  padding: 1rem 1.25rem;
  background: var(--code-bg);
  color: var(--code-fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.5;
  tab-size: 4;
}

pre .c {
  color: var(--muted);
}

.copy {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  padding: 0.25rem 0.6rem;
  font: 600 0.8125rem/1.4 var(--sans);
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}

.copy:hover {
  border-color: var(--muted);
}

/* Tabs (built by app.js; without JavaScript every panel is shown with its heading) */

.tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin: 1.5rem 0 0;
}

.tablist button {
  font: 600 0.9375rem/1.4 var(--sans);
  color: var(--muted);
  background: none;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0.5rem 1rem;
  margin-bottom: -1px;
  cursor: pointer;
}

.tablist button[aria-selected="true"] {
  color: var(--fg);
  background: var(--bg);
  border-color: var(--border);
}

.tabs-ready .tab-heading {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.tabpanel {
  padding-top: 0.5rem;
}

.tabpanel h4 {
  margin: 1.25rem 0 0.25rem;
  font-size: 1rem;
}

/* Footer */

.site-footer {
  padding: 2rem 0 3rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

.site-footer p {
  margin: 0.25rem 0;
}

.links {
  columns: 2 14rem;
  padding-left: 1.25rem;
}

.links li {
  break-inside: avoid;
  margin-bottom: 0.25rem;
}

@media (max-width: 40rem) {
  main > section {
    padding: 2.25rem 0;
  }

  .site-nav ul {
    gap: 0.25rem 0.75rem;
    font-size: 0.875rem;
  }

  pre {
    padding: 0.85rem 1rem;
  }
}

@media print {
  .site-header,
  .copy,
  .tablist {
    display: none;
  }

  .tabpanel[hidden] {
    display: block;
  }
}
