:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: #ffffff;
  --page: #f5f8fa;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --teal-pale: #e6f4f1;
  --shadow: 0 12px 32px rgb(15 23 42 / 7%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--ink);
}

a {
  color: var(--teal-dark);
}

.topbar {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 24px;
  padding: 12px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 94%);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  min-width: 220px;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  background: var(--teal);
  color: white;
  font-size: 22px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
  letter-spacing: 0.02em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.search-box {
  display: flex;
  width: min(620px, 100%);
  height: 44px;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  color: var(--muted);
}

.search-box:focus-within {
  border-color: var(--teal);
  outline: 3px solid rgb(15 118 110 / 12%);
  background: white;
}

.search-icon {
  font-size: 25px;
  line-height: 1;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.search-box input::placeholder {
  color: #94a3b8;
}

kbd {
  flex: 0 0 auto;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: white;
  color: var(--muted);
  font: 11px ui-monospace, SFMono-Regular, Menlo, monospace;
}

.menu-toggle {
  display: none;
}

.page-layout {
  display: grid;
  max-width: 1600px;
  min-height: calc(100vh - 76px);
  grid-template-columns: 280px minmax(0, 1fr);
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: 76px;
  display: flex;
  height: calc(100vh - 76px);
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
  padding: 26px 16px 18px 22px;
  border-right: 1px solid var(--line);
  background: #fbfdfe;
}

.nav-group + .nav-group {
  margin-top: 28px;
}

.nav-heading {
  margin: 0 0 9px;
  padding: 0 10px;
  color: #8492a6;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  margin: 3px 0;
  padding: 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #475569;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  text-align: left;
  transition:
    color 120ms ease,
    background 120ms ease;
}

.nav-link:hover {
  background: #edf4f5;
  color: var(--teal-dark);
}

.nav-link[aria-current="page"] {
  background: var(--teal-pale);
  color: var(--teal-dark);
  font-weight: 700;
}

.nav-number {
  display: grid;
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #dce8e7;
  border-radius: 7px;
  background: white;
  color: #78908d;
  font-size: 10px;
  font-weight: 700;
}

.nav-link[aria-current="page"] .nav-number {
  border-color: #b7d9d4;
  color: var(--teal-dark);
}

.sidebar-foot {
  display: grid;
  gap: 8px;
  padding: 16px 10px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.sidebar-foot a {
  font-weight: 650;
  text-decoration: none;
}

.sidebar-foot a:hover {
  text-decoration: underline;
}

.main-content {
  width: 100%;
  max-width: 1120px;
  min-width: 0;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 64px);
}

.manual-content {
  min-height: 60vh;
  padding: clamp(24px, 5vw, 56px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.manual-page[hidden] {
  display: none;
}

.manual-content > h1:first-child {
  margin-top: 0;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  font-size: clamp(26px, 3vw, 38px);
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.manual-content h2 {
  margin: 38px 0 14px;
  color: #183a3b;
  font-size: 22px;
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.manual-content h3 {
  margin: 28px 0 10px;
  color: #264b4b;
  font-size: 17px;
}

.manual-content p,
.manual-content li {
  color: #3c4a59;
  font-size: 15px;
  line-height: 1.8;
}

.manual-content p {
  margin: 0 0 16px;
}

.manual-content ul,
.manual-content ol {
  margin: 0 0 22px;
  padding-left: 25px;
}

.manual-content li {
  padding-left: 4px;
}

.manual-content li + li {
  margin-top: 6px;
}

.manual-content strong {
  color: #203d3d;
}

.manual-content a {
  font-weight: 650;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.manual-content a:hover {
  color: #0f766e;
}

.manual-content code {
  padding: 2px 6px;
  border-radius: 5px;
  background: #f1f5f9;
  color: #334155;
  font-size: 0.9em;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.search-status {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.search-results {
  display: grid;
  gap: 8px;
  margin: 12px 0 22px;
}

.search-result {
  display: block;
  width: 100%;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.search-result:hover {
  border-color: #b7d9d4;
  background: #fbfefe;
}

.search-result strong,
.search-result span {
  display: block;
}

.search-result strong {
  margin-bottom: 4px;
  color: var(--teal-dark);
  font-size: 14px;
}

.search-result span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.empty-results,
.load-error {
  padding: 16px;
  border-radius: 10px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 14px;
  line-height: 1.6;
}

.loading-state {
  display: grid;
  min-height: 300px;
  place-content: center;
  justify-items: center;
  color: var(--muted);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #dbe8e7;
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.content-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 4px;
  color: var(--muted);
  font-size: 11px;
}

.content-footer a {
  color: var(--muted);
  text-decoration: none;
}

.content-footer a:hover {
  color: var(--teal-dark);
  text-decoration: underline;
}

.noscript-message {
  margin: 20px;
  padding: 14px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
}

@media (max-width: 820px) {
  .topbar {
    min-height: 68px;
    gap: 12px;
    padding: 10px 16px;
  }

  .menu-toggle {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
  }

  .brand {
    min-width: auto;
  }

  .brand small {
    display: none;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .search-box {
    height: 40px;
    gap: 6px;
  }

  .search-box input {
    font-size: 12px;
  }

  .search-box kbd {
    display: none;
  }

  .page-layout {
    display: block;
    min-height: calc(100vh - 68px);
  }

  .sidebar {
    position: fixed;
    z-index: 4;
    top: 68px;
    bottom: 0;
    left: 0;
    width: min(310px, 88vw);
    height: auto;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: var(--shadow);
  }

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

  body.nav-open::after {
    position: fixed;
    z-index: 3;
    inset: 68px 0 0;
    background: rgb(15 23 42 / 28%);
    content: "";
  }

  .main-content {
    padding: 24px 16px;
  }

  .manual-content {
    min-height: 70vh;
    padding: 24px 20px;
    border-radius: 13px;
  }
}

@media (max-width: 460px) {
  .topbar {
    flex-wrap: wrap;
  }

  .brand {
    flex: 1;
  }

  .search-box {
    order: 2;
    width: 100%;
  }

  .manual-content {
    padding: 22px 17px;
  }

  .manual-content p,
  .manual-content li {
    font-size: 14px;
  }
}

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