:root {
  color-scheme: light dark;
  --primary: #72539a;
  --primary-strong: #2a153f;
  --primary-soft: #ecddff;
  --accent: #52657c;
  --background: #fcf9fe;
  --surface: #f0f4f9;
  --surface-raised: #e8eef5;
  --text: #1d1a20;
  --muted: #68626c;
  --border: #c8d0da;
  --code: #e8eef5;
  --success-soft: #d0f1df;
  --shadow: 0 18px 60px rgb(60 42 76 / 9%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.72;
  text-rendering: optimizeLegibility;
}
a { color: var(--primary); text-underline-offset: 3px; }
a:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 4px; border-radius: 4px; }

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--background) 94%, transparent);
  backdrop-filter: blur(16px);
}
.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  color: var(--text);
  font-weight: 760;
  text-decoration: none;
}
.brand img { flex: 0 0 auto; border-radius: 9px; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
nav { display: flex; align-items: center; gap: 20px; }
nav a { color: var(--muted); font-size: 14px; font-weight: 650; text-decoration: none; }
nav a:hover, nav a[aria-current="page"] { color: var(--primary); }

.landing { width: min(1080px, calc(100% - 40px)); margin: 72px auto 92px; }
.hero { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: center; gap: 32px; }
.app-icon { width: 120px; height: 120px; border-radius: 28px; box-shadow: 0 18px 46px rgb(82 50 120 / 21%); }
.eyebrow { margin: 0 0 8px; color: var(--primary); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.landing h1 { margin: 0; font-size: clamp(2.35rem, 6vw, 4.2rem); line-height: 1.08; letter-spacing: -.035em; }
.lead { max-width: 720px; margin: 16px 0 0; color: var(--muted); font-size: 1.12rem; }
.capability-strip { display: flex; flex-wrap: wrap; gap: 9px; margin: 28px 0 0; padding: 0; list-style: none; }
.capability-strip li { padding: 7px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-strong); font-size: 13px; font-weight: 700; }
.document-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 54px; }
.document-card {
  position: relative;
  display: grid;
  min-height: 224px;
  grid-template-rows: auto auto 1fr;
  gap: 10px;
  padding: 25px;
  border-radius: 20px;
  background: var(--surface);
  color: var(--muted);
  text-decoration: none;
  box-shadow: 0 1px 0 var(--border);
  transition: box-shadow .18s ease, transform .18s ease;
}
.document-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.document-card strong { color: var(--text); font-size: 1.18rem; }
.document-card b { position: absolute; right: 24px; bottom: 20px; color: var(--primary); font-size: 22px; }
.card-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; background: var(--primary-soft); color: var(--primary-strong); font-size: 18px; font-weight: 850; }
.document-card:nth-child(2) .card-icon { background: var(--success-soft); color: var(--accent); }
.local-note { margin: 36px 0 0; padding: 19px 21px; border-radius: 14px; background: var(--primary-soft); color: var(--primary-strong); }

.document-layout { display: grid; width: min(1180px, calc(100% - 40px)); grid-template-columns: 244px minmax(0, 1fr); gap: 28px; align-items: start; margin: 36px auto 84px; }
.toc { position: sticky; top: 92px; max-height: calc(100vh - 118px); overflow-y: auto; padding: 10px 6px 18px; }
.toc strong { display: block; margin: 0 10px 10px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.toc a { display: block; padding: 7px 10px; border-radius: 8px; color: var(--muted); font-size: 14px; text-decoration: none; }
.toc a:hover { background: var(--primary-soft); color: var(--primary-strong); }
.document { min-width: 0; padding: 48px 56px 64px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.document > h1:first-child { margin-top: 0; font-size: clamp(2rem, 5vw, 2.8rem); letter-spacing: -.025em; }
.document-meta { margin: -8px 0 32px; color: var(--muted); }
h1, h2, h3, h4 { line-height: 1.3; scroll-margin-top: 88px; }
h2 { margin-top: 2.7em; padding-bottom: .42em; border-bottom: 1px solid var(--border); font-size: 1.55rem; }
h3 { margin-top: 2em; font-size: 1.22rem; }
h4 { margin-top: 1.7em; color: var(--primary-strong); }
p, li, td { overflow-wrap: anywhere; }
li + li { margin-top: .36em; }
.callout { margin: 1.4em 0; padding: 15px 18px; border-radius: 12px; background: var(--primary-soft); color: var(--primary-strong); }
.callout.warning { background: #fff0d9; color: #6a4300; }
code { padding: .15em .38em; border-radius: 5px; background: var(--code); font-size: .9em; }
pre { overflow-x: auto; padding: 18px; border-radius: 12px; background: #1b1720; color: #f7f0ff; }
pre code { padding: 0; background: transparent; color: inherit; }
table { display: block; overflow-x: auto; width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: var(--surface-raised); }
hr { margin: 3em 0; border: 0; border-top: 1px solid var(--border); }

.not-found { width: min(700px, calc(100% - 40px)); min-height: calc(100vh - 170px); margin: 0 auto; padding: 100px 0; text-align: center; }
.error-code { margin: 0; color: var(--primary); font-size: 5rem; font-weight: 850; line-height: 1; }
.not-found p { color: var(--muted); }
.home-link { display: inline-block; margin-top: 18px; font-weight: 700; }
footer { display: flex; justify-content: center; gap: 18px; padding: 28px 20px 40px; color: var(--muted); font-size: 14px; }

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #ddb9ff;
    --primary-strong: #f0dbff;
    --primary-soft: #583770;
    --accent: #bac9df;
    --background: #141117;
    --surface: #211e24;
    --surface-raised: #2b272e;
    --text: #eae4eb;
    --muted: #bdb5c0;
    --border: #4b454f;
    --code: #2b272e;
    --success-soft: #194d38;
    --shadow: none;
  }
  .callout.warning { background: #45351d; color: #ffdda0; }
}

@media (max-width: 860px) {
  .document-layout { width: 100%; display: block; margin: 0; }
  .toc { position: static; max-height: none; padding: 18px 20px; border-bottom: 1px solid var(--border); }
  .toc a { display: inline-block; margin: 2px; background: var(--surface-raised); }
  .document { border-radius: 0; padding: 36px 24px 60px; box-shadow: none; }
}
@media (max-width: 980px) and (min-width: 701px) {
  .document-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .site-header { min-height: 58px; padding: 0 15px; }
  .brand span { max-width: 155px; }
  nav { gap: 12px; }
  nav a { font-size: 12px; }
  .landing { width: min(100% - 30px, 1080px); margin: 48px auto 68px; }
  .hero { grid-template-columns: 78px minmax(0, 1fr); gap: 18px; align-items: start; }
  .app-icon { width: 78px; height: 78px; border-radius: 19px; }
  .landing h1 { font-size: 2.15rem; }
  .document-grid { grid-template-columns: 1fr; margin-top: 38px; }
  .document-card { min-height: 170px; }
  footer { flex-direction: column; align-items: center; gap: 5px; }
}
@media (max-width: 470px) {
  .brand span { display: none; }
  nav { flex: 1; justify-content: flex-end; }
  .hero { grid-template-columns: 1fr; }
}
@media print {
  .site-header, .toc, footer { display: none; }
  .document-layout { display: block; width: 100%; margin: 0; }
  .document { padding: 0; box-shadow: none; }
}
