/* FAQ. Light and dark themes from the same tokens; every text colour meets WCAG 2.2 AA on its background. An FAQ's own
   colour (faq_accent_css) replaces --brand, --head, and the light theme's --link. */
:root {
  --bg: #f3f7f8; --card: #ffffff; --ink: #14262a; --muted: #4b5f64; --line: #d8e4e6;
  --brand: #0e5a63; --brand-ink: #ffffff; --link: #0b5560; --head: #0b3d44; --head-ink: #ffffff; --head-soft: #cfe9ec;
  --danger: #b42318; --danger-ink: #ffffff; --focus: #b45309;
  --ok-bg: #e6f4ea; --ok-ink: #14532d; --warn-bg: #fff3d4; --warn-ink: #5e4100; --err-bg: #fde8e6; --err-ink: #8a1c12;
  --tag-bg: #e6f0f1; --mark: #fff0b3;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1719; --card: #16242a; --ink: #e8f2f3; --muted: #a9c0c4; --line: #2b3d42;
    --brand: #7fd0d8; --brand-ink: #062a2e; --link: #8fdae1; --head: #081214; --head-ink: #ffffff; --head-soft: #cfe9ec;
    --danger: #ff8f80; --danger-ink: #2a0905; --focus: #f5c542;
    --ok-bg: #163a24; --ok-ink: #c8efd2; --warn-bg: #3a2e0c; --warn-ink: #ffe3a3; --err-bg: #3d1611; --err-ink: #ffd2cb;
    --tag-bg: #22363b; --mark: #5c4a00;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
a { color: var(--link); text-underline-offset: 2px; }
img { max-width: 100%; height: auto; }
h1 { font-size: 1.7rem; line-height: 1.2; margin: 0 0 .6rem; }
h2 { font-size: 1.25rem; line-height: 1.25; margin: 1.2rem 0 .6rem; }
h3 { font-size: 1.05rem; margin: 14px 0 6px; }
.card > h2:first-child, .card > h1:first-child { margin-top: 0; }
p { margin: 0 0 .8rem; }
code { font-size: .92em; }
blockquote { margin: 0 0 12px; padding: 8px 14px; border-left: 4px solid var(--brand); background: var(--tag-bg); border-radius: 0 8px 8px 0; overflow-wrap: anywhere; }
:is(a, button, input, select, textarea, summary, label.btn, [tabindex]):focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--card); color: var(--ink); padding: 8px 12px; z-index: 2000; }
.skip:focus { left: 8px; top: 8px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 16px; }
main:focus { outline: none; }
.js-only { display: none; }
.js .js-only { display: block; }
.js .md-toolbar.js-only { display: flex; }

/* Header */
.site-header { background: var(--head); color: var(--head-ink); }
.site-header .bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { color: var(--head-ink); text-decoration: none; font-weight: 800; font-size: 1.2rem; padding: 8px 0; }
.brand span, .hero h1 span { margin-right: .3em; }
.nav-out { color: var(--head-soft); padding: 8px 0; white-space: nowrap; }
.site-header .bar > .row { flex-wrap: wrap; justify-content: flex-end; column-gap: 14px; row-gap: 0; }
.site-header .btn.small { background: var(--head-ink); color: var(--head); border-color: var(--head-ink); }
.menu { border-top: 1px solid rgba(255,255,255,.14); }
.menu-row { display: flex; flex-wrap: wrap; gap: 2px 18px; }
.menu a { color: var(--head-soft); text-decoration: none; padding: 10px 0; display: inline-block; border-bottom: 3px solid transparent; min-height: 24px; }
.menu a:hover { color: var(--head-ink); }
.menu a.active { color: var(--head-ink); border-bottom-color: var(--head-soft); font-weight: 600; }

/* Blocks */
.card, .panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 0 0 16px; }   /* a panel: a card that doesn't fold (an answer's own page) */
.card.narrow { max-width: 560px; margin: 24px auto; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1fr; }
@media (min-width: 760px) { .grid.two { grid-template-columns: 1fr 1fr; } }
.grid.two.tight-cols { gap: 0 14px; }
.grid.three { grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 640px) { .grid.three { grid-template-columns: repeat(3, 1fr); } }
.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.wrap-row { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.hint { color: var(--muted); font-size: .9rem; margin: .3rem 0 .6rem; }
.center { text-align: center; }
.plain { list-style: none; padding: 0; margin: 0 0 1rem; }
.plain li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.tag { display: inline-block; font-size: .78rem; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--tag-bg); color: var(--muted); vertical-align: middle; }
.tag.draft { background: var(--warn-bg); color: var(--warn-ink); }
.chips { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; background: var(--tag-bg); color: var(--ink); border-radius: 99px; padding: 2px 12px; font-size: .92rem; text-decoration: none; }
a.chip:hover { text-decoration: underline; }
.crumbs { margin: 0 0 10px; }
.copy-link code { display: block; padding: 8px 10px; background: var(--tag-bg); border-radius: 8px; overflow-wrap: anywhere; white-space: pre-wrap; font-size: .9rem; margin: 0 0 8px; }
.danger-text { color: var(--danger); }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }

/* Alerts */
.alert, .flash { padding: 12px 14px; border-radius: 8px; margin: 0 0 14px; }
.alert.ok, .flash.ok { background: var(--ok-bg); color: var(--ok-ink); }
.alert.warn { background: var(--warn-bg); color: var(--warn-ink); }
.alert.error, .flash.error { background: var(--err-bg); color: var(--err-ink); }
.alert a, .flash a { color: inherit; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--brand); color: var(--brand-ink); border: 2px solid var(--brand);
  border-radius: 10px; padding: 9px 16px; min-height: 44px; font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--link); border-color: currentColor; }
.btn.big { font-size: 1.1rem; padding: 12px 22px; min-height: 52px; }
.btn.small { min-height: 34px; padding: 4px 12px; font-size: .92rem; }
.btn.wide { width: 100%; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: var(--danger-ink); }
.btn.ghost.danger-text { color: var(--danger); }
.btn[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.linkish { background: none; border: 0; padding: 4px 0; min-height: 24px; font: inherit; color: var(--link); text-decoration: underline; cursor: pointer; }
.linkish.danger { color: var(--danger); }
form { margin: 0; }

/* Forms */
fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend { font-weight: 750; font-size: 1.1rem; margin-bottom: 8px; padding: 0; }
.field { margin: 0 0 14px; }
.field > label, .field > .label { display: block; font-weight: 650; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=search], input[type=url], input[type=date], input[type=file], select, textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--muted); border-radius: 8px; background: var(--card); color: var(--ink); }
input[type=file] { padding: 8px; }
input[type=color] { width: 64px; height: 44px; padding: 2px; border: 1px solid var(--muted); border-radius: 8px; background: var(--card); }
textarea { resize: vertical; }
.check-row { display: flex; gap: 10px; align-items: flex-start; min-height: 32px; margin: 0 0 8px; }
.check-row input[type=checkbox], .check-row input[type=radio] { width: 22px; height: 22px; flex: none; margin-top: 2px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.inline-form .field { max-width: 420px; }
.inline-fields { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.inline-fields .field { margin: 0; flex: 1 1 11rem; }
.inline-fields .btn, .inline-fields .check-row { flex: none; }
.slug-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.slug-row input { flex: 1 1 12rem; width: auto; }

/* Home */
.hero { padding: 16px 0 8px; }
.hero h1 { font-size: 2.2rem; }
.hero .how-card { margin: 12px 0 16px; }
.lead { font-size: 1.3rem; font-weight: 600; }
.steps { padding-left: 1.3rem; margin: 0 0 1rem; }
.steps li { margin-bottom: .6rem; }
.faq-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.faq-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.faq-list .info { display: flex; flex-direction: column; min-width: 0; flex: 1 1 260px; }
.faq-list .t { font-weight: 700; font-size: 1.08rem; }
.meta { color: var(--muted); font-size: .9rem; }

/* Cards that open and close (app.js) */
.card-toggle { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 24px; margin: 0; padding: 0; border: 0; border-radius: 4px; background: none; color: inherit; font: inherit; line-height: inherit; text-align: left; cursor: pointer; }
.card-toggle::after { content: ''; flex: none; margin-left: auto; margin-right: 4px; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); opacity: .75; }
.card-toggle[aria-expanded="false"]::after { transform: rotate(-45deg); }
.card-toggle:hover { color: var(--link); }
.card.collapsed > h1, .card.collapsed > h2 { margin-bottom: 0; }
.has-side-toggle { display: flex; align-items: center; gap: 10px; }
.card-toggle.card-toggle-side { width: auto; min-width: 32px; min-height: 32px; margin-left: auto; justify-content: center; flex: none; }
.card-toggle.card-toggle-side::after { margin: 0; }
@media (prefers-reduced-motion: no-preference) { .card-toggle::after { transition: transform .15s; } }

/* Admin and insights */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 0 0 14px; }
.tile { background: var(--bg); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.tile .lbl { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tile .num { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: .85rem; color: var(--muted); }
.table-wrap { overflow-x: auto; margin: 0 0 16px; border-radius: 6px; }
table.data { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.data th, table.data td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
table.data tbody th { font-weight: 600; }
table.data .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── An FAQ as visitors see it ─────────────────────────────────────────────── */
.faq-title { font-size: 2rem; margin: 8px 0 .5rem; }
.faq-intro { font-size: 1.08rem; margin: 0 0 14px; }
.faq-search { margin: 6px 0 4px; }
.faq-search input { font-size: 1.05rem; padding: 12px 14px; border-radius: 10px; border-width: 2px; border-color: var(--brand); }
.faq-count { min-height: 1.2em; margin: 4px 0 8px; color: var(--muted); font-size: .9rem; }
.faq-cats .chips { margin: 4px 0 6px; }
.faq-group { margin: 0 0 18px; }
.faq-cat { font-size: 1.3rem; margin: 22px 0 8px; }
details.faq-q { background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin: 0 0 8px; }
details.faq-q > summary { list-style: none; cursor: pointer; display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; min-height: 44px; font-weight: 650; font-size: 1.05rem; border-radius: 10px; }
details.faq-q > summary::-webkit-details-marker { display: none; }
details.faq-q > summary::after { content: '+'; flex: none; margin-left: auto; font-size: 1.4rem; line-height: 1; color: var(--link); font-weight: 400; }
details.faq-q[open] > summary::after { content: '−'; }
details.faq-q > summary:hover .faq-qt { text-decoration: underline; }
details.faq-q[open] > summary { border-bottom: 1px solid var(--line); border-radius: 10px 10px 0 0; }
details.faq-q > :not(summary) { margin-left: 16px; margin-right: 16px; }
.faq-a { padding-top: 12px; overflow-wrap: anywhere; }
.faq-a ul, .faq-a ol { padding-left: 1.4rem; margin: 0 0 .8rem; }
.faq-a li { margin-bottom: .25rem; }
.faq-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: .88rem; margin: 0 0 8px; }
.faq-vote { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; }
.faq-vote-q { font-size: .92rem; font-weight: 600; }
.faq-vote-said { font-size: .92rem; color: var(--ok-ink); }
.faq-vote-said a { color: inherit; }
.faq-vote-done { color: var(--ok-ink); background: var(--ok-bg); padding: 8px 12px; border-radius: 8px; }
.faq-vote-done a { color: inherit; }
mark { background: var(--mark); color: inherit; border-radius: 2px; }
.faq-contact { margin: 18px 0; padding: 14px 16px; border-radius: 10px; background: var(--tag-bg); }
.faq-contact p:last-child, .faq-intro p:last-child, .faq-a p:last-child { margin-bottom: 0; }
.faq-a p:last-child { margin-bottom: 12px; }
.faq-ask { margin-top: 22px; }
.faq-one h1 { font-size: 1.6rem; }
.faq-one .faq-a { padding-top: 0; font-size: 1.05rem; }
.more-qs li { border-bottom: 1px solid var(--line); }
.editor-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 10px 14px; margin: 0 0 14px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-ink); }
.editor-bar a:not(.btn) { color: inherit; }
.example .faq { margin-top: 8px; }

/* An FAQ in someone else's site: no header, a little smaller margins, one line of credit */
body.embedded { background: transparent; }
body.embedded main.wrap { padding: 4px 4px 0; max-width: none; }
.faq-credit { font-size: .8rem; color: var(--muted); margin: 8px auto 12px; max-width: none; padding: 0 4px; }

/* ── Editors' pages ────────────────────────────────────────────────────────── */
.qlist, .catlist { list-style: none; padding: 0; margin: 0 0 .6rem; }
.qlist li, .catlist li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.qlist .info { display: flex; flex-direction: column; min-width: 0; flex: 1 1 280px; }
.qlist .t { font-weight: 650; }
.catlist .inline-fields { flex: 1 1 300px; }
.move { display: inline-flex; gap: 6px; flex: none; }
.move .btn { min-width: 40px; }
.md-toolbar { flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
.md-toolbar .btn { min-height: 34px; }
.preview-box { border: 1px dashed var(--muted); border-radius: 8px; padding: 10px 14px 4px; margin: 6px 0; min-height: 60px; }
.preview-box.faq-a { padding-top: 10px; }
.asked-box { background: var(--tag-bg); border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; }
.asked-box blockquote { background: var(--card); }
.tabs { display: flex; flex-wrap: wrap; gap: 6px 18px; border-bottom: 1px solid var(--line); margin: 6px 0 0; }
.tabs a { padding: 8px 0; text-decoration: none; border-bottom: 3px solid transparent; font-weight: 600; min-height: 24px; }
.tabs a[aria-current="page"] { border-bottom-color: var(--brand); color: var(--ink); }
.ask-h { font-size: 1.05rem; }
.actions { margin: 0 0 10px; }
details.reply > summary { cursor: pointer; color: var(--link); font-weight: 600; padding: 6px 0; min-height: 24px; }
details.reply[open] > summary { margin-bottom: 8px; }
.handled li p { margin-bottom: .3rem; }

@media print {
  .site-header, .site-footer, .btn, .faq-search, .faq-vote, .faq-ask, .editor-bar, .md-toolbar, .faq-credit { display: none !important; }
  body { background: #fff; } .card { border: 0; }
  details.faq-q > :not(summary) { display: block; }
  .card-body[hidden] { display: block !important; } .card-toggle::after { display: none; }
}
