/* Sqrted manual: documentation layout on top of the site's brand tokens. */

.brand-sub {
  font-weight: 500;
  font-size: .82rem;
  color: var(--muted);
  border-left: 1px solid var(--line);
  padding-left: 10px;
  margin-left: 2px;
}

.manual-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
  padding-top: 44px;
  padding-bottom: 90px;
}

/* ---------------- Contents rail ---------------- */
.toc {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 8px;
}
.toc-title {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--subtle);
  margin: 0 0 12px;
}
.toc nav { display: flex; flex-direction: column; gap: 1px; }
.toc a {
  color: var(--muted);
  text-decoration: none;
  font-size: .875rem;
  padding: 5px 10px;
  border-radius: 7px;
  border-left: 2px solid transparent;
  transition: color .14s ease, background .14s ease, border-color .14s ease;
}
.toc a:hover { color: var(--brand); background: var(--brand-tint); }
.toc a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------------- Manual body ---------------- */
.manual { min-width: 0; }

.manual-head {
  padding-bottom: 30px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.manual-head h1 {
  font-size: clamp(1.9rem, 3.6vw, 2.6rem);
  margin: 6px 0 16px;
}
.manual-head .lede { margin-top: 0; max-width: 60ch; }

.manual section {
  padding-top: 44px;
  scroll-margin-top: 82px;
}
.manual section + section { border-top: 1px solid var(--line); }

.manual h2 {
  font-size: 1.55rem;
  margin-bottom: 16px;
}
.manual h3 {
  font-size: 1.05rem;
  font-weight: 650;
  margin: 30px 0 10px;
}
.manual p { margin-bottom: 15px; max-width: 68ch; color: var(--ink); }
.manual p + ul, .manual p + ol { margin-top: -4px; }
.manual ul, .manual ol { margin: 0 0 16px; padding-left: 22px; max-width: 68ch; }
.manual li { margin-bottom: 7px; }
.manual li::marker { color: var(--subtle); }
.manual a { color: var(--brand); }

.steps-list { counter-reset: none; }
.steps-list li { padding-left: 2px; }

/* ---------------- Figures ---------------- */
.manual figure {
  margin: 22px 0 26px;
  padding: 0;
}
.manual figure img {
  display: block;
  /* width:auto so a dialog captured at 700px is never upscaled into softness;
     max-width still shrinks the wide window shots to fit the column. */
  width: auto;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  background: var(--surface);
}
.manual figure.narrow { max-width: 480px; }
.manual figcaption {
  margin-top: 11px;
  font-size: .85rem;
  color: var(--muted);
  max-width: 62ch;
}

/* ---------------- Tables ---------------- */
.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 6px 0 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: .9rem;
}
.tbl th, .tbl td {
  text-align: left;
  padding: 11px 16px;
  vertical-align: top;
}
.tbl thead th {
  background: var(--canvas);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--subtle);
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl tbody tr + tr td { border-top: 1px solid var(--line); }
.tbl td.k { font-weight: 650; white-space: nowrap; color: var(--ink); }
.tbl td { color: var(--muted); }
.tbl code { white-space: nowrap; }

/* Status pills used inside tables */
.pill {
  display: inline-block;
  font-size: .74rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.pill.ok { background: #dcfce7; color: #15803d; }
.pill.warn { background: #fef3c7; color: #b45309; }
.pill.err { background: #fee2e2; color: #dc2626; }

/* ---------------- Code ---------------- */
.manual .code {
  display: block;
  background: var(--ink);
  color: #e2e8f0;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: .84rem;
  line-height: 1.65;
  padding: 15px 18px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 4px 0 20px;
  white-space: pre;
  max-width: 100%;
}
.manual .code code { background: none; padding: 0; color: inherit; }

/* ---------------- Notes ---------------- */
.note {
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  background: var(--surface);
  border-radius: 0 10px 10px 0;
  padding: 14px 18px;
  margin: 4px 0 22px;
  max-width: 68ch;
}
.note p { margin: 0; font-size: .9rem; color: var(--muted); }
.note strong { color: var(--ink); }
.note.ok { border-left-color: var(--ok); }

/* ---------------- FAQ ---------------- */
.faq {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  padding: 18px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.faq h3 { margin: 0 0 8px; font-size: .98rem; }
.faq p { margin: 0; font-size: .9rem; color: var(--muted); }

.manual-foot {
  margin-top: 44px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.manual-foot p { font-size: .9rem; color: var(--muted); }

/* ---------------- Responsive ---------------- */
@media (max-width: 940px) {
  .manual-layout { grid-template-columns: 1fr; gap: 0; padding-top: 28px; }
  .toc {
    position: static;
    max-height: none;
    overflow: visible;
    border-bottom: 1px solid var(--line);
    padding-bottom: 18px;
    margin-bottom: 8px;
  }
  .toc nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .toc a { border-left: none; background: var(--canvas); font-size: .82rem; }
  .manual section { padding-top: 34px; }
}

@media (max-width: 620px) {
  .tbl { display: block; overflow-x: auto; white-space: nowrap; }
  .tbl td.k { white-space: nowrap; }
}
