/* rsch public content pages (guides, About, sample Chapter 4). Static, no build step.
   Same tokens, fonts and header and footer pattern as the app and the landing page, in light and dark.
   Theme: follows the visitor's choice (rsch:theme, shared with the app) or the system setting. */

:root {
  --bg: #f2f2fe;
  --surface: #ffffff;
  --sunk: #e6e6fd;
  --line: #dcdcf7;
  --ink: #15122b;
  --muted: #55546b;
  --link: #3d3bf3;
  --cobalt: #3d3bf3;
  --lime: #d7ff3a;
  --drop: #3d3bf3;
  --nav: rgba(242, 242, 254, 0.82);
  --panel: #15122b;
  --panel-edge: transparent;
  --head: "Outfit", system-ui, sans-serif;
  --body: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e0c1f;
  --surface: #15122b;
  --sunk: #24215a;
  --line: #2a2745;
  --ink: #f2f2fe;
  --muted: #a3a2bd;
  --link: #a9a8fa;
  --drop: #d7ff3a;
  --nav: rgba(14, 12, 31, 0.82);
  --panel: #1e1b3d;
  --panel-edge: rgba(242, 242, 254, 0.14);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0c1f;
    --surface: #15122b;
    --sunk: #24215a;
    --line: #2a2745;
    --ink: #f2f2fe;
    --muted: #a3a2bd;
    --link: #a9a8fa;
    --drop: #d7ff3a;
    --nav: rgba(14, 12, 31, 0.82);
    --panel: #1e1b3d;
    --panel-edge: rgba(242, 242, 254, 0.14);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.7;
  overflow-x: hidden;
  transition: background-color 250ms ease, color 250ms ease;
}
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 3px; border-radius: 6px; }

/* header: the same as the landing page */
.sx-head { position: sticky; top: 0; z-index: 30; background: var(--nav); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.sx-head-in { max-width: 1180px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 14px; }
.sx-logo { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); }
.sx-logo svg { width: 28px; height: 28px; display: block; flex: none; }
.sx-logo .m1 { fill: var(--ink); }
.sx-logo .m3 { fill: var(--drop); }
.sx-word { font-family: var(--head); font-weight: 700; font-size: 29px; letter-spacing: -0.02em; line-height: 1; }
.sx-nav { display: flex; gap: 22px; margin-left: 18px; }
.sx-nav a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; opacity: 0.8; }
.sx-nav a:hover { opacity: 1; text-decoration: underline; }
.sx-space { flex: 1; }
.sx-theme { width: 42px; height: 42px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--surface); color: var(--ink); cursor: pointer; box-shadow: inset 0 0 0 1px var(--line); }
.sx-theme svg { width: 20px; height: 20px; display: none; }
.sx-theme[data-mode="system"] .i-system, .sx-theme[data-mode="light"] .i-light, .sx-theme[data-mode="dark"] .i-dark { display: block; }
.sx-signin { color: var(--ink); font-weight: 700; font-size: 15px; text-decoration: none; padding: 0 4px; }
.sx-signin:hover { text-decoration: underline; }
.sx-cta { background: var(--cobalt); color: #fff; font-family: var(--head); font-weight: 700; font-size: 16px; text-decoration: none; padding: 11px 20px; border-radius: 999px; white-space: nowrap; }
.sx-cta:hover { background: var(--ink); color: var(--bg); }
@media (max-width: 640px) { .sx-nav { display: none; } .sx-signin { display: none; } .sx-word { font-size: 26px; } .sx-cta { padding: 10px 16px; font-size: 15px; } }

/* page layout: contents on the left on wide screens, collapsed on top on phones */
.sx-main { max-width: 1180px; margin: 0 auto; padding: 36px 20px 72px; }
.sx-layout { display: flex; flex-direction: column; gap: 20px; }
.sx-article { min-width: 0; max-width: 740px; }
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 4px 16px; font-size: 15px; }
.toc summary { cursor: pointer; font-family: var(--head); font-weight: 700; font-size: 16px; padding: 12px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: "+"; font-size: 22px; color: var(--muted); }
.toc[open] summary::after { content: "\2212"; }
.toc ol { margin: 0 0 12px; padding: 0; list-style: none; display: grid; gap: 2px; }
.toc a { display: block; padding: 7px 10px; border-radius: 10px; color: var(--muted); text-decoration: none; line-height: 1.35; }
.toc a:hover, .toc a.is-on { background: var(--sunk); color: var(--ink); }
@media (min-width: 960px) {
  .sx-layout { display: grid; grid-template-columns: 250px minmax(0, 740px); gap: 56px; justify-content: center; align-items: start; }
  .toc { position: sticky; top: 92px; max-height: calc(100vh - 120px); overflow: auto; }
  .toc summary { cursor: default; pointer-events: none; }
  .toc summary::after { content: none; }
}

/* article */
.eyebrow { display: inline-block; margin: 0 0 12px; font-family: var(--head); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--link); }
h1, h2, h3 { font-family: var(--head); font-weight: 700; letter-spacing: -0.025em; line-height: 1.12; margin: 0; color: var(--ink); }
h1 { font-size: clamp(34px, 6.4vw, 54px); margin-bottom: 12px; letter-spacing: -0.035em; }
h2 { font-size: clamp(25px, 3.6vw, 34px); margin: 52px 0 14px; }
h3 { font-size: 20px; margin: 26px 0 8px; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0 0 16px; }
ul, ol { margin: 0 0 16px; padding-left: 1.4em; }
li { margin-bottom: 8px; }
.meta { color: var(--muted); font-size: 14px; margin: 0 0 24px; }
.summary { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 18px 20px 6px; margin: 0 0 10px; }
.summary .label { display: inline-block; margin-bottom: 8px; padding: 4px 11px; border-radius: 999px; background: var(--sunk); color: var(--muted); font-family: var(--head); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.summary p { font-size: 18px; line-height: 1.6; }

ol.steps { padding-left: 0; list-style: none; counter-reset: step; }
ol.steps > li { counter-increment: step; position: relative; padding-left: 50px; margin-bottom: 18px; }
ol.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 34px; height: 34px; border-radius: 11px; background: var(--lime); color: #15122b; font-family: var(--head); font-weight: 700; display: grid; place-items: center; transform: rotate(-4deg); }
ol.steps > li > strong:first-child { font-family: var(--head); font-weight: 600; }

/* tables: a card on wide screens, stacked rows on phones so nothing scrolls sideways */
.table-wrap, .tbl { margin: 8px 0 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.5; }
caption { caption-side: top; text-align: left; font-family: var(--head); font-weight: 700; font-size: 16px; padding: 14px 16px 6px; }
th, td { text-align: left; vertical-align: top; padding: 10px 16px; border-bottom: 1px solid var(--line); }
thead th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; white-space: nowrap; }
tbody th[scope="row"] { font-weight: 700; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.total td, tr.total th { font-weight: 700; }
.table-note { color: var(--muted); font-size: 14px; margin: -12px 0 24px; }
@media (max-width: 720px) {
  .table-wrap, .tbl { overflow: visible; border-radius: 16px; }
  table, thead, tbody, tr, th, td, caption { display: block; }
  table { min-width: 0 !important; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tbody tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  tbody tr:last-child { border-bottom: 0; }
  th, td { border: 0 !important; padding: 3px 0; text-align: left !important; white-space: normal !important; }
  tbody th[scope="row"] { font-family: var(--head); font-size: 17px; padding-bottom: 5px; }
  td[data-label] { display: block; text-align: left !important; padding: 5px 0; }
  td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 1px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
  td.num[data-label] { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; text-align: right !important; padding: 3px 0; }
  td.num[data-label]::before { margin: 0; flex: 0 0 46%; text-align: left; text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; }
}

.faq h3 { margin-top: 22px; font-size: 19px; }
.faq p { margin-top: 4px; }
.note-box { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin: 16px 0 24px; font-size: 15px; }
.note-box p:last-child { margin-bottom: 0; }
.btn { display: inline-block; background: var(--cobalt); color: #fff; font-family: var(--head); font-weight: 700; text-decoration: none; padding: 12px 22px; border-radius: 999px; }

/* the guides hub */
.guide-cards { list-style: none; padding: 0; margin: 20px 0 8px; display: grid; gap: 12px; grid-template-columns: 1fr; }
.guide-cards li { margin: 0; }
.guide-card { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 18px 18px 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.guide-card b { font-family: var(--head); font-size: 19px; line-height: 1.25; letter-spacing: -0.01em; }
.guide-card span { color: var(--muted); font-size: 15px; line-height: 1.5; }
.guide-card:hover { border-color: var(--link); }
@media (min-width: 720px) { .guide-cards { grid-template-columns: 1fr 1fr; } }
/* the hub has no contents column, so it stays one wide column on desktop */
.sx-layout.sx-layout--hub { display: block; max-width: 1040px; margin: 0 auto; }
.sx-layout--hub .sx-article { max-width: none; }
.sx-layout--hub .sx-article > p, .sx-layout--hub .sx-article > h1 { max-width: 740px; }
@media (min-width: 1000px) { .sx-layout--hub .guide-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* related guides as simple link cards */
.related ul { list-style: none; padding: 0; display: grid; gap: 10px; grid-template-columns: 1fr; }
.related li { margin: 0; }
.related a { display: block; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; line-height: 1.4; }
.related a:hover { border-color: var(--link); }
.related a::after { content: " \2192"; color: var(--link); }
@media (min-width: 720px) { .related ul { grid-template-columns: 1fr 1fr; } }
.byline { margin: 36px 0 0; font-size: 13px; color: var(--muted); }
.byline a { color: var(--muted); }

/* footer: the same as the landing page */
.sx-foot { background: var(--panel); color: #fff; box-shadow: inset 0 1px 0 var(--panel-edge); }
.sx-foot-in { max-width: 1180px; margin: 0 auto; padding: 56px 20px 32px; }
.sx-foot-top { display: flex; flex-wrap: wrap; gap: 18px 28px; align-items: center; justify-content: space-between; }
.sx-foot-brand { display: inline-flex; align-items: center; gap: 9px; color: #fff; text-decoration: none; }
.sx-foot-brand svg { width: 28px; height: 28px; }
.sx-foot-brand .m1 { fill: #fff; }
.sx-foot-brand .m3 { fill: #d7ff3a; }
.sx-foot-brand .sx-word { color: #fff; font-size: 26px; }
.sx-foot-tag { margin: 6px 0 0; font-size: 15px; color: rgba(255, 255, 255, 0.7); }
.sx-social { display: flex; gap: 8px; }
.sx-social a { width: 36px; height: 36px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); display: grid; place-items: center; color: #fff; }
.sx-social a:hover { background: #d7ff3a; color: #15122b; }
.sx-social svg { width: 16px; height: 16px; }
.sx-cols { margin-top: 36px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 30px 24px; }
.sx-col { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.sx-col h3 { margin: 0 0 4px; font-family: var(--head); font-weight: 600; font-size: 17px; color: #fff; letter-spacing: 0; }
.sx-col a { color: rgba(255, 255, 255, 0.72); text-decoration: none; font-size: 15px; font-weight: 500; line-height: 1.4; }
.sx-col a:hover { color: #fff; text-decoration: underline; }
.sx-copy { margin: 44px 0 0; text-align: center; font-size: 14px; color: rgba(255, 255, 255, 0.6); }
@media (max-width: 820px) { .sx-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media (max-width: 480px) { body { font-size: 16px; } .summary p { font-size: 17px; } ol.steps > li { padding-left: 44px; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } body { transition: none; } }
@media print { .sx-head, .sx-foot, .toc { display: none; } body { background: #fff; color: #000; } }
