/* Inner pages: pricing, docs, CLI, self-host guide, buy, sign-in, security, 404. Loaded after brand.css. */
:root { --field: color-mix(in srgb, var(--fg) 52%, var(--bg)); }

main code { overflow-wrap: anywhere; }
.doc h1, .pricing h1, .notfound h1 { text-wrap: balance; letter-spacing: -.02em; }
.doc p, .doc li, .doc dd, .pricing p { text-wrap: pretty; }

/* reading measure: prose at ~72 characters; code and tables may run wider */
.doc > :is(p, ul, ol, dl, details, h1, h2, .lead), .doc-body > :is(p, ul, ol, dl, details, h1, h2, .lead) { max-width: 72ch; }
.doc pre { max-width: 60rem; }
.doc table { max-width: 50rem; }
/* code keeps one source line per line (YAML, shell continuations) and scrolls sideways on phones */
main pre { white-space: pre; overflow-x: auto; }
main pre code { white-space: inherit; overflow-wrap: inherit; }

/* commands with a copy button (site.js shows it when the clipboard is available) */
.cmd { position: relative; max-width: 60rem; }
.cmd pre { margin: 12px 0; }
.cmd .copy { font: inherit; font-size: .8rem; font-weight: 600; color: var(--fg); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 0 12px; min-height: 32px; cursor: pointer; }
@media (hover: hover) { .cmd .copy:hover { border-color: var(--muted); } }
@media (min-width: 641px) {
  .cmd .copy { position: absolute; top: 8px; right: 8px; }
  .cmd pre { padding-right: 5.5rem; }
}
@media (max-width: 640px) { .cmd { display: grid; } .cmd pre { margin-bottom: 6px; } .cmd .copy { justify-self: end; min-height: 44px; margin-bottom: 12px; } }

/* key/value tables become a compact list on phones: bold label above its value, a rule between rows */
@media (max-width: 560px) {
  .doc table, .doc tbody, .doc tr, .doc th, .doc td { display: block; width: auto; }
  .doc table { border-top: 1px solid var(--line); }
  .doc tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .doc th, .doc td { border: 0; padding: 0; background: none; }
  .doc tr > td:first-child:not(:only-child) { font-weight: 600; }
}

/* self-host guide: contents beside the text on wide screens, collapsible above it otherwise */
.toc-side { display: none; }
.toc-inline { border: 1px solid var(--line); border-radius: 10px; padding: 0 16px; margin: 16px 0 24px; }
.toc-inline summary { min-height: 44px; display: flex; align-items: center; font-weight: 600; }
.toc-inline ol, .toc-side ol { margin: 0; padding: 0 0 12px 20px; }
.toc-inline ol { columns: 2 11rem; }
.toc-inline li, .toc-side li { padding: 4px 0; }
@media (pointer: coarse) { .toc-inline li { padding: 0; } .toc-inline a { display: inline-block; padding: 10px 0; } }
@media (min-width: 1100px) {
  .with-toc { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: 48px; align-items: start; }
  .toc-side { display: block; position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; font-size: .9rem; }
  .toc-side p { margin: 0 0 8px; font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
  .toc-side ol { list-style: none; padding: 0; }
  .toc-side a { color: var(--muted); text-decoration: none; }
  @media (hover: hover) { .toc-side a:hover { color: var(--fg); } }
  .toc-inline { display: none; }
}

/* docs hub */
.doc .cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); max-width: 48rem; }
.doc .cards a { border-radius: var(--radius); padding: 18px 20px; height: 100%; }
@media (hover: hover) { .doc .cards a:hover { border-color: var(--accent); } }
.doc .cards strong { display: block; margin-bottom: 4px; }

/* fact lists (security) */
.doc .facts { grid-template-columns: 8.5rem minmax(0, 1fr); gap: 6px 20px; margin: 0 0 8px; }
.doc .facts dt { font-weight: 600; color: var(--fg); }
@media (max-width: 560px) { .doc .facts { grid-template-columns: 1fr; } .doc .facts dd { margin-bottom: 10px; } }

/* segmented switches (pricing, buy) */
.switches { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0 0 6px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--panel); }
.seg a { min-height: 44px; padding: 0 14px; display: inline-flex; align-items: center; border-radius: 999px; color: var(--muted);
  text-decoration: none; font-weight: 600; font-size: .92rem; }
@media (hover: hover) { .seg a:hover { color: var(--fg); } }
.seg a[aria-current] { background: var(--bg); color: var(--fg); box-shadow: 0 1px 3px #0000001f, 0 0 0 1px var(--line); }
/* dark: the page colour is darker than the track, so the selected pill gets a lighter fill and a visible edge */
@media (prefers-color-scheme: dark) { .seg a[aria-current] { background: #262c42; box-shadow: 0 0 0 1px var(--muted); } }

/* pricing */
.pricing h1 { margin-bottom: 4px; }
.pricing .lead { margin: 0 0 14px; }
.pricing > .small { margin: 4px 0; }
.pricing .plans { grid-template-columns: minmax(0, 1fr); gap: 16px; margin: 14px 0 16px; }
@media (min-width: 700px) { .pricing .plans { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pricing .plan { border-radius: var(--radius); padding: 20px; gap: 4px; background: var(--bg); }
@supports (grid-template-rows: subgrid) {
  .pricing .plan { display: grid; grid-template-rows: subgrid; grid-row: span 5; }
}
.pricing .plan h2 { font-size: 1.05rem; margin: 0; }
.pricing .price { font-size: 2rem; letter-spacing: -.02em; line-height: 1.15; }
.pricing .note { margin: 0; font-size: .85rem; color: var(--muted); min-height: 1.3em; }
.pricing .plan .btn { justify-content: center; margin: 10px 0 8px; align-self: start; }
.pricing .plan ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; align-content: start; font-size: .92rem; }
.pricing .plan li { padding-left: 22px; position: relative; }
.pricing .plan li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.pricing .plan li.lead-in { padding-left: 0; color: var(--muted); font-size: .85rem; }
.pricing .plan li.lead-in::before { content: none; }
.pricing .plan.featured { border: 2px solid var(--accent); padding: 19px;
  box-shadow: 0 16px 40px -24px color-mix(in srgb, var(--accent) 70%, transparent); }
.pricing .enterprise { border: 1px dashed var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 0 0 12px; }
.pricing details { margin-top: 16px; }
.pricing details summary { padding: 10px 0; }
@media (max-width: 640px) {
  .pricing .plan { padding: 16px; }
  .pricing .plan.featured { padding: 15px; }
  .pricing .price { font-size: 1.7rem; }
  .pricing .note:empty { display: none; }
  .pricing .plan .btn { margin: 8px 0 6px; }
}

/* forms: field boundaries at 3:1, 44 px targets */
.form input[type=text], .form input[type=email], .form select { border-color: var(--field); min-height: 44px; }
.form label.choice { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.form input[type=radio], .form input[type=checkbox] { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--accent); }
.form .seg { justify-self: start; }
.form fieldset { border-color: var(--field); }
body:not(.page-home) main :is(p, strong, .alert) { overflow-wrap: anywhere; }

/* 404 */
.notfound { padding: 40px 0 24px; min-height: 40vh; }
.notfound .links { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 24px; }
.notfound .links a { display: inline-flex; min-height: 44px; align-items: center; }
