/* Shared stylesheet for the statically-baked docs pages (help, changelog, privacy, terms).
   Self-contained (no dependency on tokens.css) — mirrors the landing brand palette.
   Generated pages are light-only, matching landing/index.html. */
:root {
  --iris: #6F5FC3;
  --iris-deep: #574AA0;
  --iris-tint: #ECEAF8;
  --night: #1E1B2A;
  --ink: #34302B;
  --ink-soft: #6B655C;
  --ink-faint: #9A938A;
  --hairline: #E4E2DD;
  --paper: #FBFAF7;
  --card: #FFFFFF;
  --ok: #1FA565;
  --r: 12px;
}
* , *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
  font-size: 16.5px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--iris); text-decoration: none; }
a:hover { text-decoration: underline; }

.doc-wrap { max-width: 820px; margin: 0 auto; padding: 0 24px; }

/* ── NAV ── */
.doc-nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251, 250, 247, 0.9);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.doc-nav-inner { display: flex; align-items: center; gap: 20px; padding: 14px 24px; max-width: 1040px; margin: 0 auto; }
.doc-logo img { height: 26px; display: block; }
.doc-nav-links { display: flex; align-items: center; gap: 22px; margin-left: auto; }
.doc-nav-links a { font-size: 14.5px; color: var(--ink-soft); font-weight: 500; }
.doc-nav-links a:hover { color: var(--ink); text-decoration: none; }
.doc-btn {
  background: var(--iris); color: #fff !important; padding: 8px 16px;
  border-radius: 8px; font-size: 14px; font-weight: 600;
}
.doc-btn:hover { background: var(--iris-deep); text-decoration: none !important; }

/* ── MAIN ── */
.doc-main { padding: 40px 24px 72px; }
.doc-breadcrumb { font-size: 13px; color: var(--ink-faint); margin-bottom: 24px; }
.doc-breadcrumb a { color: var(--ink-soft); }
.doc-breadcrumb span { margin: 0 7px; opacity: .5; }

.doc-body h1 { font-family: 'Space Grotesk', sans-serif; font-size: 34px; font-weight: 600; letter-spacing: -.02em; line-height: 1.18; color: var(--night); margin: 0 0 20px; }
.doc-body h2 { font-family: 'Space Grotesk', sans-serif; font-size: 23px; font-weight: 600; letter-spacing: -.01em; color: var(--night); margin: 38px 0 12px; }
.doc-body h3 { font-family: 'Space Grotesk', sans-serif; font-size: 18.5px; font-weight: 600; color: var(--night); margin: 28px 0 10px; }
.doc-body p { margin: 0 0 15px; }
.doc-body ul, .doc-body ol { margin: 0 0 16px; padding-left: 24px; }
.doc-body li { margin: 0 0 7px; }
.doc-body strong { font-weight: 600; color: var(--ink); }
.doc-body a { font-weight: 500; }
.doc-body blockquote { border-left: 3px solid var(--iris); background: var(--iris-tint); padding: 12px 18px; border-radius: 0 8px 8px 0; margin: 0 0 16px; color: var(--ink-soft); }
.doc-body code { font-family: 'Space Mono', ui-monospace, monospace; font-size: 13.5px; background: #F1EFEA; padding: 2px 6px; border-radius: 5px; color: var(--iris-deep); overflow-wrap: anywhere; } /* inline code may break at phone width — a long path used to widen the whole page (2026-09-21) */
.doc-body pre { background: var(--night); color: #E8E6F2; padding: 18px 20px; border-radius: var(--r); overflow-x: auto; margin: 0 0 18px; font-size: 13.5px; line-height: 1.6; }
.doc-body pre code { background: none; padding: 0; color: inherit; font-size: 13.5px; overflow-wrap: normal; }
.doc-body img { max-width: 100%; height: auto; border-radius: 8px; }
.doc-body hr { border: none; border-top: 1px solid var(--hairline); margin: 32px 0; }
.doc-table-wrap { overflow-x: auto; margin: 0 0 18px; }
.doc-body table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
.doc-body th, .doc-body td { border: 1px solid var(--hairline); padding: 8px 12px; text-align: left; }
.doc-body th { background: #F5F3EE; font-weight: 600; }
.doc-meta { font-family: 'Space Mono', monospace; font-size: 12.5px; color: var(--ink-faint); margin-bottom: 22px; }
.doc-legal-links { margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--hairline); font-size: 14.5px; }

/* ── HELP / CHANGELOG INDEX ── */
.doc-lead { font-size: 18px; color: var(--ink-soft); margin: 0 0 32px; }
.doc-cat { margin: 0 0 34px; }
.doc-cat-title { font-family: 'Space Grotesk', sans-serif; font-size: 20px; font-weight: 600; color: var(--night); margin: 0 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--hairline); }
.doc-card-list { display: grid; gap: 10px; }
.doc-card { display: block; background: var(--card); border: 1px solid var(--hairline); border-radius: var(--r); padding: 15px 18px; }
.doc-card:hover { border-color: var(--iris); text-decoration: none; box-shadow: 0 2px 12px rgba(111,95,195,.07); }
.doc-card-title { font-weight: 600; color: var(--night); font-size: 15.5px; }
.doc-card-excerpt { color: var(--ink-soft); font-size: 14px; margin-top: 3px; }

/* ── RELATED (article footer) ── */
.doc-related { margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--hairline); }
.doc-related-title { font-family: 'Space Grotesk', sans-serif; font-size: 15px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 14px; }

/* ── CHANGELOG ── */
.cl-entry { padding: 0 0 32px; margin: 0 0 32px; border-bottom: 1px solid var(--hairline); }
.cl-entry:last-child { border-bottom: none; }
.cl-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.cl-badge { font-family: 'Space Mono', monospace; font-size: 12px; color: var(--iris); background: var(--iris-tint); border: 1px solid rgba(111,95,195,.2); padding: 2px 10px; border-radius: 999px; }
.cl-date { font-family: 'Space Mono', monospace; font-size: 12.5px; color: var(--ink-faint); }
.cl-entry h2 { margin-top: 0 !important; }

/* ── FOOTER ── */
.doc-footer { border-top: 1px solid var(--hairline); padding: 28px 24px; text-align: center; font-size: 14px; color: var(--ink-soft); }
.doc-footer a { color: var(--ink-soft); }
.doc-copy { color: var(--ink-faint); font-size: 12.5px; margin-top: 10px; }

@media (max-width: 560px) {
  .doc-nav-links { gap: 14px; }
  .doc-nav-links a:not(.doc-btn) { display: none; }
  .doc-body h1 { font-size: 28px; }
}

/* ── GUIDES (long-form) ── */
.guide-meta { margin-bottom: 18px; }
.guide-lead { font-size: 19px; line-height: 1.6; color: var(--ink-soft); margin: 0 0 22px; }
.guide-toc { border: 1px solid var(--hairline); border-radius: var(--r); background: var(--card); padding: 16px 20px; margin: 0 0 28px; }
.guide-toc-title { font-family: 'Space Mono', monospace; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 8px; }
.guide-toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 28px; font-size: 14.5px; }
.guide-toc li { margin: 0 0 5px; break-inside: avoid; }
.guide-cta { background: var(--night); color: #fff; border-radius: 16px; padding: 30px 32px; margin: 44px 0 0; }
.guide-cta h2 { color: #fff; margin: 0 0 10px; }
.guide-cta p { color: #B7B1C6; margin: 0 0 18px; }
.guide-cta-acts { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; }
.guide-cta-acts a { color: #fff; font-weight: 600; }
.guide-cta-acts .doc-btn { background: #fff; color: var(--night) !important; }
.guide-cta-acts .doc-btn:hover { background: var(--iris-tint); }
.guide-card-meta { font-family: 'Space Mono', monospace; font-size: 11.5px; color: var(--ink-faint); margin-top: 8px; }
.doc-guide .doc-body table { font-size: 14px; }
.doc-guide .doc-body h2 { scroll-margin-top: 80px; }
@media (max-width: 560px) { .guide-toc ol { columns: 1; } .guide-cta { padding: 24px 20px; } }

/* ── DEVICE CATALOG (/devices/, generated from iotone/content/catalog) ── */
.dev-meta, .dev-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dev-badge { font-family: 'Space Mono', monospace; font-size: 11.5px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--hairline); color: var(--ink-soft); background: var(--card); white-space: nowrap; }
.dev-badge-bench, .dev-badge-community { color: var(--ok); border-color: rgba(31,165,101,.35); background: #EAF7F0; }
.dev-steps li { margin: 0 0 12px; }
.dev-note { font-size: 14px; color: var(--ink-soft); }
.dev-requires { border-left: 3px solid var(--iris); background: var(--iris-tint); padding: 10px 16px; border-radius: 0 8px 8px 0; font-size: 15px; }
.doc-device .doc-body th[scope="row"] { width: 38%; }

/* guide index card thumbnail (frontmatter `hero`) */
.doc-card-thumb { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; border-radius: 8px; margin: 0 0 10px; }

/* ── GATEWAY PROTOCOL (/protocol/, generated from iotone/schemas/mqtt/v1) ── */
.proto-schema { margin: 0 0 28px; }
.proto-schema-head { font-size: 14px; color: var(--ink-soft); margin: 0 0 10px; }
.proto-schema-head code { font-family: 'Space Mono', monospace; font-size: 12.5px; }
.proto-schema .doc-table-wrap table { font-size: 13.5px; }
.proto-schema td:first-child code { white-space: nowrap; }
.proto-example { margin: 10px 0 0; }
/* Protocol tables. `.doc-body code` breaks anywhere (phone-width safety, 2026-09-21) — inside a
   table that let the browser shrink Topic/Payload to a few characters while Notes took the width.
   The topic tables now stay in the text column with FIXED column shares: Topic and Payload get
   the width they need (a topic may wrap only at the <wbr> after each "/", a schema name never
   wraps), Direction and QoS share one narrow column, and Notes wraps onto more lines instead.
   Shares come from measured widths: 21 of 28 topics fit 30% of 772px on one line, the longest
   schema name (firmware-response, 142px at 12.5px) fits 23% as long as the table is ≥ 740px — so
   that is the table's min-width, and narrower screens scroll inside the wrapper instead. */
.proto-topics table { table-layout: fixed; min-width: 740px; font-size: 14px; }
.proto-topics th:nth-child(1) { width: 30%; }
.proto-topics th:nth-child(2) { width: 14%; }
.proto-topics th:nth-child(3) { width: 23%; }
.proto-topics code { font-size: 12.5px; overflow-wrap: normal; word-break: normal; }
.proto-topics td:nth-child(3) code { white-space: nowrap; }
.proto-topics .proto-json { display: block; margin-top: 4px; font-size: 13px; white-space: nowrap; }
.proto-qos { display: block; margin-top: 6px; font-size: 13px; color: var(--ink-soft); }
.proto-topics td:nth-child(4) { overflow-wrap: anywhere; }   /* Notes is prose: an inline JSON literal may break, a name may not */
.proto-props code { white-space: nowrap; overflow-wrap: normal; word-break: normal; }
.proto-props table { min-width: 720px; }
.proto-props td:nth-child(5) { min-width: 260px; }
