@import url("/shared/xiaoke-ui.css");

body { background: var(--bg); color: var(--text); }

.docs-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none; /* scroll rail must span the viewport; never float a mid-page scrollbar */
}

/* Shared content rail: use the viewport; do not float a narrow island. */
.docs-hero,
.layout {
  width: min(100%, 76rem);
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(1.25rem, 3vw, 2.5rem);
  padding-right: clamp(1.25rem, 3vw, 2.5rem);
  box-sizing: border-box;
}

.docs-hero {
  flex: 0 0 auto;
  padding-top: 2rem;
  padding-bottom: 0.65rem;
  text-align: left;
}
.docs-hero h1 {
  margin: 0;
  font-size: var(--font-page-title);
  font-weight: 650;
  letter-spacing: -.025em;
}
.layout {
  flex: 1 1 auto;
  display: grid;
  /* Nav column + flexible article; prose keeps its own measure below. */
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 1.75rem 2.5rem;
  justify-content: stretch;
  padding-top: 1rem;
  padding-bottom: 3.5rem;
}
.docs-guide {
  grid-template-columns: 13rem minmax(0, 1fr);
}

aside {
  display: flex; flex-direction: column; gap: 0.45rem;
  position: sticky; top: 1rem; align-self: start;
  padding: 0.45rem;
  background: var(--card-fill);
  border: 1px solid var(--surface-line);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
}
aside a {
  color: var(--muted); text-decoration: none; font-size: 14px;
  border-radius: var(--radius); padding: 10px 14px; outline: none; box-shadow: none;
}
aside a:hover { color: var(--ix-fg); background: var(--ix-bg); text-shadow: none; box-shadow: none; }
aside a:focus-visible { box-shadow: var(--focus-ring-on-light); color: var(--accent-on-surface); }
/* Use theme tokens for pill contrast on light and black. */
aside a[aria-current="page"] {
  color: var(--ix-fg);
  font-weight: 700;
  background: var(--ix-bg);
  border-left: 0;
  text-shadow: none;
  box-shadow: none;
}

.docs-step {
  display: grid;
  grid-template-columns: 2ch minmax(0, 1fr);
  align-items: baseline;
  gap: 0.6em;
  overflow-wrap: anywhere;
}
.docs-step-number {
  color: var(--accent-primary);
  font-size: 0.85em;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

article {
  min-width: 0;
  max-width: 48rem; /* reading measure; code still fits */
}
article h1, article h2, article h3 {
  margin-top: 1.75em;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  scroll-margin-top: 1rem;
}
article h1:first-child { margin-top: 0; }
article h3 {
  margin-top: 1.25em;
  font-size: 1rem;
  color: var(--muted);
}
article p, article li {
  color: var(--text);
  line-height: 1.65;
}
article .muted { color: var(--muted); }
article ul, article ol { padding-left: 1.3em; }
article table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 12px 0 20px;
  font-size: 0.9rem;
  border: 1px solid var(--surface-line);
  border-radius: var(--radius);
  overflow: hidden;
}
article th, article td {
  border: 0;
  border-bottom: 1px solid var(--surface-line);
  border-right: 1px solid var(--surface-line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
article tr:last-child th,
article tr:last-child td { border-bottom: 0; }
article th:last-child,
article td:last-child { border-right: 0; }
article th {
  background: var(--bg-hover);
  color: var(--muted);
  font-weight: 500;
}
article a {
  color: var(--accent); text-decoration: none;
  border-radius: var(--radius); outline: none;
}
article a:hover { color: var(--ix-fg); background: var(--ix-bg); text-decoration: none; text-shadow: none; }
article a:focus-visible { box-shadow: var(--focus-ring-on-light); }

pre {
  background: var(--input-bg);
  border: 1px solid var(--surface-line);
  padding: 14px;
  border-radius: var(--radius);
  overflow: auto;
  color: var(--accent-primary);
  font-size: 0.88rem;
  box-shadow: var(--surface-highlight);
}
code { font-family: ui-monospace, monospace; font-size: 0.88em; }
article code {
  background: var(--bg-hover);
  padding: 0.1em 0.35em;
  border-radius: var(--radius);
  color: var(--accent-primary);
}
pre code { background: transparent; padding: 0; border-radius: 0; }

@media (max-width: 800px) {
  .layout {
    grid-template-columns: 1fr;
  }
  article { max-width: none; }
  aside {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
  }
}
