/* SOTT 文档站：参考 SS 的「顶栏 + 侧栏 + 内容卡」节奏，配色与组件形态独立 */

:root {
  --sott-header-h: 56px;
  --sott-sidebar-w: 268px;
  --sott-page-max: 1080px;

  --ink: #1c2330;
  --muted: #5c6578;
  --line: #e2e6ef;
  --paper: #ffffff;
  --canvas: #f3f5f9;

  --header-bg0: #1e2433;
  --header-bg1: #2a2235;
  --accent: #c9783a;
  --accent-soft: rgba(201, 120, 58, 0.14);
  --accent-2: #3d8f9e;

  --radius-lg: 14px;
  --shadow-card: 0 1px 3px rgba(28, 35, 48, 0.08), 0 8px 28px rgba(28, 35, 48, 0.06);
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

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

html {
  scroll-behavior: smooth;
}

body.docs-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--canvas);
  color: var(--ink);
  line-height: 1.65;
}

a {
  color: var(--accent-2);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--accent);
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: #eef1f7;
  border: 1px solid var(--line);
  padding: 0.1em 0.35em;
  border-radius: 6px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: 0 0 8px 8px;
  z-index: 2000;
  text-decoration: none;
}

.skip-link:focus {
  left: 1rem;
}

/* ----- Top header (fixed) ----- */
.top-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--sott-header-h);
  z-index: 1200;
  background: linear-gradient(120deg, var(--header-bg0), var(--header-bg1));
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.18);
}

.top-header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px 0 14px;
}

.sidebar-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.sidebar-toggle-bar {
  display: block;
  height: 2px;
  width: 20px;
  margin: 0 auto;
  background: #f0f2f8;
  border-radius: 1px;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #f5f7ff;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--accent), #e0a060);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.04em;
}

.brand-sub {
  font-size: 11px;
  color: rgba(245, 247, 255, 0.62);
}

.top-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.top-link {
  color: rgba(245, 247, 255, 0.82);
  text-decoration: none;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 999px;
}

.top-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.top-link.is-active {
  background: rgba(201, 120, 58, 0.28);
  color: #fff;
}

/* ----- Layout ----- */
.layout-shell {
  display: flex;
  min-height: 100vh;
  padding-top: var(--sott-header-h);
}

.sidebar {
  position: fixed;
  top: var(--sott-header-h);
  left: 0;
  width: var(--sott-sidebar-w);
  height: calc(100vh - var(--sott-header-h));
  overflow-y: auto;
  background: var(--paper);
  border-right: 1px solid var(--line);
  z-index: 1100;
  padding: 14px 0 24px;
}

.sidebar-brand {
  padding: 6px 20px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}

.sidebar-section-label {
  padding: 14px 20px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding-bottom: 4px;
}

.sidebar-link {
  display: block;
  padding: 9px 20px;
  font-size: 13px;
  color: var(--ink);
  text-decoration: none;
  border-left: 3px solid transparent;
}

.sidebar-link:hover {
  background: #f6f8fc;
  color: var(--accent-2);
}

.sidebar-link.is-active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 600;
  color: #6a3f22;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px 0;
  font-size: 11px;
  line-height: 1.5;
}

.main-column {
  flex: 1;
  margin-left: var(--sott-sidebar-w);
  min-width: 0;
}

.main-area {
  max-width: var(--sott-page-max);
  margin: 0 auto;
  padding: 28px 32px 40px;
  min-height: calc(100vh - var(--sott-header-h));
  display: flex;
  flex-direction: column;
}

.content-card {
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--line);
  padding: clamp(1.1rem, 2.5vw, 2rem);
  flex: 1;
}

.page-footer {
  margin-top: 20px;
  font-size: 12px;
}

.muted {
  color: var(--muted);
}

/* ----- Home & lists ----- */
.hero {
  margin-bottom: 1.25rem;
}

.hero h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.lead {
  margin: 0 0 1rem;
  color: var(--muted);
  max-width: 62ch;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  border: 1px solid transparent;
}

.btn.primary {
  background: linear-gradient(120deg, var(--accent), #d4915c);
  color: #fff;
}

.btn.ghost {
  border-color: var(--line);
  color: var(--ink);
  background: #fafbff;
}

.home-two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin: 1.75rem 0 1.5rem;
}

.home-col {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  background: linear-gradient(180deg, #fafbff 0%, #fff 40%);
}

.home-col-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.home-col-desc {
  margin: 0 0 0.85rem;
  font-size: 0.92rem;
}

.home-link-list {
  margin: 0;
  padding-left: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.95rem;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  background: #fafbff;
}

.card h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.page-head h1 {
  margin: 0 0 0.25rem;
}

.doc-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doc-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbff;
}

/* ----- Markdown body ----- */
.prose .md {
  max-width: 78ch;
}

.prose .md :is(h1, h2, h3) {
  margin-top: 1.4em;
  line-height: 1.25;
}

.prose .md h1:first-child {
  margin-top: 0;
}

.prose .md pre {
  overflow: auto;
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f6f8fc;
}

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

.prose .md th,
.prose .md td {
  border: 1px solid var(--line);
  padding: 0.45rem 0.55rem;
}

/* ----- Mobile ----- */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  top: var(--sott-header-h);
  background: rgba(20, 24, 32, 0.45);
  z-index: 1050;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.sidebar-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 959px) {
  .sidebar-toggle {
    display: inline-flex;
  }

  .top-links {
    display: none;
  }

  .sidebar {
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.12);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .main-column {
    margin-left: 0;
  }

  .main-area {
    padding: 18px 16px 32px;
  }
}

body.sidebar-open {
  overflow: hidden;
}
