/*!
 * Sumimi documentation site — one stylesheet for every page.
 *
 * Rules of the house:
 *   - no external fonts, no external images, no CDN, no webfont: the pages must work
 *     fully offline and must not make a single outbound request;
 *   - light and dark via `prefers-color-scheme`, no JS toggle (no JS at all);
 *   - system font stacks only;
 *   - the cat/paw motif is drawn with inline SVG in the markup, never with images.
 */

:root {
  --bg: #fbfaf7;
  --bg-soft: #f3f1ea;
  --bg-card: #ffffff;
  --fg: #221f1c;
  --fg-soft: #57514a;
  --fg-faint: #7c756b;
  --accent: #b4531f;
  --accent-soft: #f3e2d6;
  --accent-fg: #8c3d13;
  --line: #e2ddd2;
  --line-strong: #cec7b8;
  --code-bg: #f6f4ee;
  --code-fg: #2c2723;
  --shadow: 0 1px 2px rgba(34, 31, 28, 0.05), 0 6px 20px rgba(34, 31, 28, 0.05);
  --radius: 10px;
  --measure: 74ch;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", "Courier New", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17150f;
    --bg-soft: #1e1b14;
    --bg-card: #221f18;
    --fg: #ece7dc;
    --fg-soft: #b8b1a3;
    --fg-faint: #8d8677;
    --accent: #e08b53;
    --accent-soft: #33261a;
    --accent-fg: #f0a877;
    --line: #35301f;
    --line-strong: #4a4430;
    --code-bg: #1c1913;
    --code-fg: #e6e0d3;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.3);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- skip link */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: 0 0 var(--radius) 0;
}

.skip-link:focus {
  left: 0;
}

/* ------------------------------------------------------------------ layout */

.wrap {
  width: 100%;
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

main {
  padding: 2.5rem 0 4rem;
}

/* ------------------------------------------------------------------ header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.4) blur(8px);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1.06rem;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover {
  color: var(--accent-fg);
}

.brand .brand-cn {
  color: var(--fg-faint);
  font-weight: 500;
  font-size: 0.9em;
}

.brand svg {
  display: block;
  width: 1.6rem;
  height: 1.6rem;
  flex: none;
}

.site-nav {
  margin-left: auto;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: inline-block;
  padding: 0.32rem 0.6rem;
  border-radius: 6px;
  color: var(--fg-soft);
  text-decoration: none;
  font-size: 0.94rem;
  white-space: nowrap;
}

.site-nav a:hover {
  background: var(--bg-soft);
  color: var(--fg);
}

.site-nav a[aria-current="page"] {
  color: var(--accent-fg);
  background: var(--accent-soft);
  font-weight: 600;
}

@media (max-width: 40rem) {
  .site-nav {
    margin-left: 0;
    width: 100%;
  }
  .site-nav a {
    padding: 0.3rem 0.5rem;
    font-size: 0.9rem;
  }
}

/* -------------------------------------------------------------------- hero */

.hero {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2.5rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: center;
}

@media (max-width: 48rem) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.75rem;
  }
  .hero {
    padding-top: 2rem;
  }
}

.hero h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.hero .tagline {
  margin: 0 0 0.35rem;
  color: var(--accent-fg);
  font-size: 1.12rem;
  font-weight: 600;
}

.hero .tagline-cn {
  margin: 0 0 1rem;
  color: var(--fg-faint);
  font-size: 1rem;
}

.hero .lede {
  margin: 0 0 1.5rem;
  max-width: 58ch;
  color: var(--fg-soft);
  font-size: 1.04rem;
}

.hero-art {
  display: flex;
  justify-content: center;
}

.hero-art svg {
  width: 100%;
  max-width: 15rem;
  height: auto;
  display: block;
}

/* ------------------------------------------------------------------ badges */

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.badges li {
  font-size: 0.82rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--fg-soft);
  background: var(--bg-card);
  white-space: nowrap;
}

.badges li strong {
  color: var(--fg);
  font-weight: 600;
}

/* ------------------------------------------------------------------ buttons */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.5rem 0 0;
}

.button {
  display: inline-block;
  padding: 0.6rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.98rem;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.35;
}

.button-primary {
  background: var(--accent);
  color: #fff;
}

.button-primary:hover {
  background: var(--accent-fg);
  color: #fff;
}

.button-secondary {
  background: var(--bg-card);
  border-color: var(--line-strong);
  color: var(--fg);
}

.button-secondary:hover {
  border-color: var(--accent);
  color: var(--accent-fg);
}

/* ------------------------------------------------------------------ headings */

h1,
h2,
h3,
h4 {
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--fg);
}

.page-title {
  margin: 0 0 0.4rem;
  font-size: clamp(1.75rem, 4.5vw, 2.4rem);
}

.page-lede {
  margin: 0 0 2rem;
  color: var(--fg-soft);
  font-size: 1.05rem;
  max-width: var(--measure);
}

h2 {
  margin: 2.75rem 0 0.9rem;
  padding-top: 0.5rem;
  font-size: 1.5rem;
  border-top: 1px solid var(--line);
}

h2:first-of-type {
  border-top: 0;
  padding-top: 0;
}

h3 {
  margin: 2rem 0 0.7rem;
  font-size: 1.16rem;
}

h4 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.02rem;
}

p,
ul,
ol,
dl {
  max-width: var(--measure);
}

p {
  margin: 0 0 1rem;
}

ul,
ol {
  margin: 0 0 1rem;
  padding-left: 1.35rem;
}

li {
  margin-bottom: 0.35rem;
}

li > ul,
li > ol {
  margin-top: 0.35rem;
  margin-bottom: 0.5rem;
}

a {
  color: var(--accent-fg);
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-color: currentColor;
}

strong {
  font-weight: 650;
}

/* --------------------------------------------------------------------- code */

code {
  font-family: var(--font-mono);
  font-size: 0.885em;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.1em 0.36em;
  word-break: break-word;
}

pre {
  margin: 0 0 1.25rem;
  padding: 1rem 1.1rem;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.87rem;
  line-height: 1.55;
  max-width: 100%;
}

pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  white-space: pre;
}

pre.shell code {
  color: var(--code-fg);
}

pre .cmt {
  color: var(--fg-faint);
  font-style: italic;
}

/* ------------------------------------------------------------------- tables */

.table-wrap {
  margin: 0 0 1.5rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.93rem;
}

th,
td {
  text-align: left;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

thead th {
  background: var(--bg-soft);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-soft);
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td code {
  white-space: nowrap;
}

/* ------------------------------------------------------------------- cards */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.card-grid > li {
  margin: 0;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.card-grid h3 {
  margin: 0 0 0.4rem;
  font-size: 1.02rem;
}

.card-grid p {
  margin: 0;
  color: var(--fg-soft);
  font-size: 0.95rem;
}

.card-grid .card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-grid .card-title svg {
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
}

/* ------------------------------------------------------------------ callout */

.callout {
  margin: 0 0 1.5rem;
  padding: 0.95rem 1.15rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg-card);
}

.callout > :last-child {
  margin-bottom: 0;
}

.callout-title {
  font-weight: 700;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.callout-title svg {
  width: 1.05rem;
  height: 1.05rem;
  flex: none;
}

.callout.tip {
  border-left-color: #3f8f5f;
}

.callout.warn {
  border-left-color: #b4531f;
}

/* -------------------------------------------------------------- definition */

dl.terms dt {
  font-weight: 650;
  margin-top: 0.9rem;
}

dl.terms dd {
  margin: 0.2rem 0 0;
  color: var(--fg-soft);
}

/* ------------------------------------------------------------------ footer */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 2rem 0 2.5rem;
  font-size: 0.92rem;
  color: var(--fg-soft);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: baseline;
}

.site-footer p {
  margin: 0;
  max-width: none;
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer li {
  margin: 0;
}

.footer-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 650;
  color: var(--fg);
}

.footer-mark svg {
  width: 1.15rem;
  height: 1.15rem;
}

/* ------------------------------------------------------------- quick start */

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  max-width: var(--measure);
}

.steps > li {
  position: relative;
  counter-increment: step;
  padding-left: 2.6rem;
  margin-bottom: 1.5rem;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--bg-card);
  color: var(--accent-fg);
  font-weight: 700;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.steps h3 {
  margin: 0 0 0.45rem;
  font-size: 1.08rem;
}

.steps p {
  margin-bottom: 0.6rem;
}

.steps > li > :last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------- endpoint */

.endpoint {
  margin: 0 0 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
  overflow: hidden;
}

.endpoint > summary {
  padding: 0.7rem 1rem;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  list-style: none;
}

.endpoint > summary::-webkit-details-marker {
  display: none;
}

.endpoint > summary::after {
  content: "";
  margin-left: auto;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--fg-faint);
  border-bottom: 2px solid var(--fg-faint);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.15s ease;
}

.endpoint[open] > summary::after {
  transform: rotate(-135deg) translate(-3px, -3px);
}

.endpoint-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--line);
}

.endpoint-body > :last-child {
  margin-bottom: 0;
}

.method {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.16rem 0.45rem;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent-fg);
  white-space: nowrap;
}

.method.get {
  background: #e2efe6;
  color: #2c6b45;
}

.method.post {
  background: var(--accent-soft);
  color: var(--accent-fg);
}

.method.put {
  background: #e7ecf6;
  color: #35518c;
}

.method.delete {
  background: #f6e5e5;
  color: #9b3535;
}

@media (prefers-color-scheme: dark) {
  .method.get {
    background: #21352a;
    color: #7fc39a;
  }
  .method.put {
    background: #232c3d;
    color: #93aee0;
  }
  .method.delete {
    background: #3a2424;
    color: #e09a9a;
  }
}

.endpoint-path {
  font-family: var(--font-mono);
  font-size: 0.92rem;
}

/* ------------------------------------------------------------------ misc */

.footnote {
  font-size: 0.88rem;
  color: var(--fg-faint);
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.pill {
  display: inline-block;
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--fg-soft);
  white-space: nowrap;
}

.pill.yes {
  background: #e2efe6;
  border-color: transparent;
  color: #2c6b45;
}

.pill.no {
  background: #f6e5e5;
  border-color: transparent;
  color: #9b3535;
}

@media (prefers-color-scheme: dark) {
  .pill.yes {
    background: #21352a;
    color: #7fc39a;
  }
  .pill.no {
    background: #3a2424;
    color: #e09a9a;
  }
}

.nowrap {
  white-space: nowrap;
}

.center {
  text-align: center;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

@media print {
  .site-header,
  .site-footer,
  .hero-art {
    display: none;
  }
  body {
    font-size: 12pt;
  }
}

/* ------------------------------------------------------------------ the docs
 *
 * The documentation is a two-column layout: the list of articles on the left,
 * the article on the right. The rail is sticky, and on a narrow screen it
 * stacks above the article.
 */

.wrap-wide {
  max-width: 78rem;
}

.docs-layout {
  display: grid;
  grid-template-columns: 13.5rem minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}

@media (max-width: 62rem) {
  .docs-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
  }
}

.docs-rail {
  position: sticky;
  top: 5.5rem;
  font-size: 0.93rem;
}

@media (max-width: 62rem) {
  .docs-rail {
    position: static;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--line);
  }
}

.rail-title {
  margin: 0 0 0.75rem;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--fg-faint);
}

.rail-group {
  margin: 1.15rem 0 0.3rem;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fg-faint);
}

.rail-group:first-child {
  margin-top: 0;
}

.rail-nav a {
  display: block;
  margin-left: -0.55rem;
  padding: 0.26rem 0.55rem;
  border-radius: 6px;
  color: var(--fg-soft);
  text-decoration: none;
  line-height: 1.4;
}

.rail-nav a:hover {
  background: var(--bg-soft);
  color: var(--fg);
}

.rail-nav a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent-fg);
  font-weight: 600;
}

.docs-body > :first-child {
  margin-top: 0;
}

/* --------------------------------------------------------------- the story
 *
 * The homepage tells a story: a short sequence of beats, each with a label.
 * It is a card so it reads as one piece, not as a list of features.
 */

.story {
  margin: 0 0 2rem;
  padding: 1.6rem 1.75rem 1.4rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.story .steps {
  margin-bottom: 0;
}

.story .steps > li {
  margin-bottom: 1.35rem;
}

.story .steps > li:last-child {
  margin-bottom: 0;
}

.story-label {
  margin: 0 0 0.35rem;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--accent-fg);
}

.story p {
  margin-bottom: 0.6rem;
}

.story p:last-child {
  margin-bottom: 0;
}

/* ------------------------------------------------------------------- stats */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.9rem;
  margin: 0 0 1.75rem;
  padding: 0;
  list-style: none;
}

.stats li {
  margin: 0;
  padding: 0.95rem 1.05rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stat-value {
  display: block;
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--accent-fg);
}

.stat-label {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.87rem;
  color: var(--fg-soft);
}

/* ------------------------------------------------------------------- blog */

.post-list {
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
  max-width: var(--measure);
}

.post-item {
  padding: 1.35rem 0;
  border-bottom: 1px solid var(--line);
}

.post-item:first-child {
  padding-top: 0;
}

.post-item h3 {
  margin: 0 0 0.3rem;
  font-size: 1.22rem;
}

.post-item h3 a {
  color: var(--fg);
  text-decoration: none;
}

.post-item h3 a:hover {
  color: var(--accent-fg);
}

.post-item p {
  margin: 0.3rem 0 0;
  color: var(--fg-soft);
  font-size: 0.97rem;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.85rem;
  margin: 0 0 0.5rem;
  font-size: 0.84rem;
  color: var(--fg-faint);
}

.post-head {
  margin: 0 0 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.post-head .page-title {
  margin-bottom: 0.5rem;
}

.post-head .post-meta {
  margin-bottom: 0;
}

.post-body {
  max-width: 46rem;
}

.post-body h2 {
  margin-top: 2.5rem;
}

.post-foot {
  margin: 3rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.93rem;
  color: var(--fg-soft);
}

