/* capy.lifebar.app/docs. Same tokens as home.css: white paper and ink, the 等你 orange as the one accent. */
:root {
  --paper: #ffffff;
  --paper-raised: #f6f6f3;
  --paper-sunk: #ededea;
  --rule: #e6e6e1;
  --ink: #14161b;
  --ink-muted: #5d626d;
  --ink-faint: #8a8d95;
  --brand: #c2410c;
  --brand-soft: #fdebdd;
  --done: #1d6b45;
  --done-soft: #e3f1e8;
  --note: #2f5fb3;
  --note-soft: #e8eefa;
  --action: #14161b;
  --on-action: #ffffff;
  --bezel: #16171b;
  --shadow: 0 24px 48px -20px rgba(40, 30, 20, 0.22), 0 8px 18px -10px rgba(40, 30, 20, 0.14);
  --sans:
    -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei',
    'Helvetica Neue', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1013;
    --paper-raised: #1a1b1f;
    --paper-sunk: #24262b;
    --rule: #2a2c31;
    --ink: #ecedef;
    --ink-muted: #a8acb5;
    --ink-faint: #6e727b;
    --brand: #f28b4e;
    --brand-soft: #2d1d13;
    --done: #5cc48a;
    --done-soft: #15281d;
    --note: #8fb0ee;
    --note-soft: #172033;
    --action: #ecedef;
    --on-action: #0f1013;
    --bezel: #2a2b30;
    --shadow: 0 24px 48px -20px rgba(0, 0, 0, 0.7), 0 8px 18px -10px rgba(0, 0, 0, 0.5);
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 80px;
}
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img {
  display: block;
  max-width: 100%;
  height: auto;
}
a {
  color: var(--brand);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Header */
.hnav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--rule);
}
.hnav .in {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 600;
  font-size: 17px;
}
.brand img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}
.brand:hover,
.section:hover,
.hnav nav a:hover,
.side nav a:hover,
.toc a:hover,
.card:hover,
.pager a:hover {
  text-decoration: none;
}
.section {
  color: var(--ink-muted);
  font-size: 15px;
  padding-left: 14px;
  border-left: 1px solid var(--rule);
}
.hnav nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 14px;
}
.hnav nav a {
  color: var(--ink-muted);
}
.hnav nav a:hover {
  color: var(--ink);
}
.hnav nav a.lang {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  font-size: 12.5px;
  font-weight: 600;
}
.pill {
  background: var(--action);
  color: var(--on-action) !important;
  border-radius: 999px;
  font-weight: 600;
  padding: 7px 14px;
  font-size: 13px;
  white-space: nowrap;
}

/* Three columns: contents, the page, on this page */
.shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr) 200px;
  gap: 48px;
}
.side {
  position: sticky;
  top: 56px;
  align-self: start;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 28px 0 40px;
}
.side summary {
  display: none;
}
.side .grp {
  margin-bottom: 22px;
}
.side .grp p {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 6px 10px;
}
.side nav a {
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--ink-muted);
  font-size: 14.5px;
  line-height: 1.4;
}
.side nav a:hover {
  color: var(--ink);
  background: var(--paper-raised);
}
.side nav a[aria-current='page'] {
  color: var(--ink);
  background: var(--paper-sunk);
  font-weight: 600;
}

main {
  min-width: 0;
  padding: 40px 0 0;
}
.toc {
  position: sticky;
  top: 56px;
  align-self: start;
  padding: 40px 0;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
}
.toc p {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-faint);
  margin-bottom: 8px;
}
.toc a {
  display: block;
  font-size: 13px;
  color: var(--ink-muted);
  padding: 4px 0 4px 12px;
  border-left: 2px solid var(--rule);
  line-height: 1.45;
}
.toc a.on {
  color: var(--ink);
  border-left-color: var(--brand);
}

/* The page */
.doc {
  max-width: 760px;
  font-size: 16px;
}
.crumb {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  margin-bottom: 6px;
}
.doc h1 {
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.lede {
  font-size: 18px;
  color: var(--ink-muted);
  margin-top: 12px;
}
.doc h2 {
  font-size: 24px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 48px 0 12px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}
.doc h3 {
  font-size: 18px;
  margin: 30px 0 8px;
}
.doc h4 {
  font-size: 16px;
  margin: 22px 0 6px;
}
.doc h2,
.doc h3,
.doc h4 {
  position: relative;
}
.hash {
  position: absolute;
  left: -0.9em;
  color: var(--ink-faint);
  opacity: 0;
  font-weight: 400;
}
.doc h2:hover .hash,
.doc h3:hover .hash {
  opacity: 1;
  text-decoration: none;
}
.doc p,
.doc ul,
.doc ol,
.doc pre,
.doc .table {
  margin: 12px 0;
}
.doc ul,
.doc ol {
  padding-left: 1.4em;
}
.doc li {
  margin: 5px 0;
}
.doc li > ul,
.doc li > ol {
  margin: 4px 0;
}
.doc li::marker {
  color: var(--ink-faint);
}
.doc ol > li::marker {
  font-weight: 600;
}
.doc strong {
  font-weight: 600;
}
.doc code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--paper-sunk);
  border-radius: 5px;
  padding: 0.12em 0.38em;
}
.doc pre {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.55;
}
.doc pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}
.doc hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 32px 0;
}
.table {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 12px;
}
.doc table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14.5px;
}
.doc th,
.doc td {
  text-align: left;
  vertical-align: top;
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
}
.doc th {
  background: var(--paper-raised);
  font-weight: 600;
  white-space: nowrap;
}
.doc tr:last-child td {
  border-bottom: 0;
}

.callout {
  margin: 20px 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--note-soft);
  border-left: 3px solid var(--note);
  font-size: 15px;
}
.callout > b {
  display: block;
  color: var(--note);
  font-size: 13.5px;
  margin-bottom: 2px;
}
.callout p,
.callout ul,
.callout ol {
  margin: 4px 0;
}
.callout.tip {
  background: var(--done-soft);
  border-left-color: var(--done);
}
.callout.tip > b {
  color: var(--done);
}
.callout.warn {
  background: var(--brand-soft);
  border-left-color: var(--brand);
}
.callout.warn > b {
  color: var(--brand);
}

/* Screenshots */
.fig {
  margin: 28px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.fig figcaption {
  font-size: 13.5px;
  color: var(--ink-faint);
  text-align: center;
  max-width: 520px;
}
.phone {
  --w: 260px;
  width: var(--w);
  aspect-ratio: 780 / 1688;
  padding: calc(var(--w) * 0.032);
  border-radius: calc(var(--w) * 0.17);
  background: var(--bezel);
  box-shadow:
    var(--shadow),
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.08);
}
.phone .screen {
  width: 100%;
  height: 100%;
  border-radius: calc(var(--w) * 0.14);
  overflow: hidden;
  background: var(--paper);
}
.phone img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.window {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
  background: var(--paper-raised);
}
.window .bar {
  height: 26px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border-bottom: 1px solid var(--rule);
}
.window .bar i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--paper-sunk);
}

/* Docs home cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin: 18px 0 8px;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  color: var(--ink);
  transition:
    border-color 0.2s,
    transform 0.2s;
}
.card:hover {
  border-color: var(--ink-faint);
  transform: translateY(-1px);
}
.card strong {
  font-size: 15.5px;
}
.card span {
  font-size: 13.5px;
  color: var(--ink-muted);
  line-height: 1.5;
}

/* Previous / next and footer */
.pager {
  max-width: 760px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 56px 0 0;
}
.pager a {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
}
.pager a:hover {
  border-color: var(--ink-faint);
}
.pager small {
  font-weight: 400;
  font-size: 12.5px;
  color: var(--ink-faint);
}
.pager .next {
  text-align: right;
  grid-column: 2;
}
.foot {
  max-width: 760px;
  margin-top: 40px;
  padding: 24px 0 48px;
  border-top: 1px solid var(--rule);
  font-size: 12.5px;
  color: var(--ink-faint);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 40px;
  }
  .toc {
    display: none;
  }
}
@media (max-width: 899px) {
  .shell {
    display: block;
    padding: 0 16px;
  }
  .hnav .in {
    padding: 0 16px;
    gap: 10px;
  }
  .hnav nav {
    gap: 12px;
  }
  .hnav nav a.opt {
    display: none;
  }
  .side {
    position: sticky;
    top: 56px;
    z-index: 40;
    max-height: none;
    overflow: visible;
    padding: 0;
    margin: 0 -16px;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
  }
  .side summary {
    display: flex;
    align-items: center;
    gap: 10px;
    list-style: none;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
  }
  .side summary::-webkit-details-marker {
    display: none;
  }
  .side summary::after {
    content: '';
    margin-left: auto;
    width: 7px;
    height: 7px;
    border-right: 1.5px solid var(--ink-muted);
    border-bottom: 1.5px solid var(--ink-muted);
    transform: rotate(45deg);
    transition: transform 0.2s;
  }
  .side[open] summary::after {
    transform: rotate(-135deg);
  }
  .side summary span {
    font-weight: 400;
    color: var(--ink-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .side nav {
    max-height: 65vh;
    overflow-y: auto;
    padding: 4px 8px 16px;
    border-top: 1px solid var(--rule);
  }
  main {
    padding-top: 24px;
  }
  .doc h1 {
    font-size: 28px;
  }
  .lede {
    font-size: 16.5px;
  }
  .doc h2 {
    font-size: 21px;
    margin-top: 40px;
  }
  .hash {
    display: none;
  }
  .phone {
    --w: 230px;
  }
  .pager {
    grid-template-columns: 1fr;
  }
  .pager .next {
    grid-column: 1;
  }
}
