/*
 * Help center stylesheet (plan 08 D23). Tokens copied from the inbox (web/src/styles.css), with a dark theme via
 * prefers-color-scheme. Served as /assets/help.<hash>.css; the help CSP allows no inline styles.
 */
:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --note-bg: #fffbeb;
  --note-border: #fcd34d;
  --code-bg: #f3f4f6;
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #111318;
    --surface: #1a1d24;
    --text: #e8e9ec;
    --muted: #9aa1ad;
    --border: #2c313b;
    --accent: #8b93ff;
    --accent-soft: #252a45;
    --note-bg: #2a2412;
    --note-border: #8a6d1d;
    --code-bg: #232731;
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow-wrap: anywhere;
}

a {
  color: var(--accent);
}

.wrap {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 16px;
}

.muted,
.meta,
.count {
  color: var(--muted);
}

.count {
  font-size: 0.85em;
}

/* Header and footer */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.header-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  min-width: 0;
}

.header-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.header-nav a {
  font-weight: 600;
  text-decoration: none;
}

.brand {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.site-footer {
  margin-top: 48px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85em;
}

main {
  padding-top: 24px;
}

/* Search */

.search-form {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.search-form input {
  flex: 1 1 auto;
  min-width: 0;
  width: 220px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.search-hero input {
  width: 100%;
  padding: 12px 14px;
}

.search-form button {
  padding: 8px 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.results {
  padding: 0;
  list-style: none;
}

.results li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.results .result-title {
  font-weight: 600;
}

.results p {
  margin: 4px 0 0;
}

/* Listings */

.collection-list,
.article-list,
.sub-collections {
  padding: 0;
  list-style: none;
}

.collection-list > li {
  margin-bottom: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.collection-list > li > a {
  font-weight: 600;
}

.collection-list p {
  margin: 4px 0 0;
  color: var(--muted);
}

.sub-collections {
  margin: 8px 0 0;
  padding-left: 12px;
  border-left: 2px solid var(--border);
}

.article-list li {
  padding: 6px 0;
}

/* Breadcrumbs and pager */

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  font-size: 0.9em;
}

.crumbs li + li::before {
  content: "\203A";
  margin-right: 4px;
  color: var(--muted);
}

.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
}

.pager a {
  flex: 1 1 240px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  text-decoration: none;
}

.pager-next {
  text-align: right;
}

.pager span {
  display: block;
  color: var(--muted);
  font-size: 0.8em;
}

/* Article body */

.article h1 {
  margin: 0 0 4px;
  line-height: 1.25;
}

.article .meta {
  margin: 0 0 24px;
  font-size: 0.9em;
}

.article-body img,
.article-body iframe {
  max-width: 100%;
  height: auto;
}

.article-body iframe {
  aspect-ratio: 16 / 9;
  width: 100%;
  border: 0;
}

.article-body pre {
  overflow-x: auto;
  padding: 12px;
  background: var(--code-bg);
  border-radius: 8px;
}

.article-body code {
  padding: 1px 4px;
  background: var(--code-bg);
  border-radius: 4px;
  font-size: 0.9em;
}

.article-body pre code {
  padding: 0;
  background: none;
}

.article-body table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  max-width: 100%;
}

.article-body th,
.article-body td {
  padding: 6px 10px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.article-body blockquote {
  margin: 16px 0;
  padding: 8px 16px;
  background: var(--note-bg);
  border-left: 4px solid var(--note-border);
}

.article-body hr {
  border: 0;
  border-top: 1px solid var(--border);
}

@media (max-width: 480px) {
  :root {
    font-size: 15px;
  }

  .header-row,
  .header-tools {
    flex-direction: column;
    align-items: stretch;
  }

  .search-form input {
    width: 100%;
  }
}

/* Staging banner (plan 10a P-D6): injected by the server as the first element of <body> when STAGING=true; the
   client portal loads this stylesheet too. */
.staging-banner {
  padding: 6px 16px;
  background: #b45309;
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
  text-align: center;
  letter-spacing: 0.02em;
}
