:root {
  --blue: #1a6cff;
  --blue-dark: #0f54d4;
  --blue-soft: #e8f0ff;
  --ink: #1c2433;
  --muted: #5c6578;
  --card: #ffffff;
  --line: rgba(28, 36, 51, 0.1);
  --sidebar-w: 280px;
  --top-h: 56px;
  --content-max: none;
  --code-bg: #f4f7fc;
  --ok: #0d7a4f;
  --warn: #9a6700;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Nunito", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse 900px 520px at 8% -10%, rgba(26, 108, 255, 0.14), transparent 55%),
    radial-gradient(ellipse 700px 480px at 100% 0%, rgba(56, 189, 248, 0.12), transparent 50%),
    linear-gradient(120deg, #e8f2ff 0%, #f7fbff 45%, #eef8f3 100%);
}

a {
  color: var(--blue-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover { color: var(--blue); }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--blue);
  color: #fff;
  padding: 8px 12px;
  z-index: 100;
}

.skip:focus { left: 8px; top: 8px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.menu-btn {
  display: none;
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 18px;
  color: var(--ink);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  min-width: 0;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(28, 36, 51, 0.08);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-text strong {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.brand-text span {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.search-wrap {
  flex: 1;
  max-width: 420px;
  margin-left: auto;
  position: relative;
}

.search-wrap input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px 0 36px;
  font: inherit;
  font-weight: 600;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b7385' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='M11 11l3.5 3.5'/%3E%3C/svg%3E") 12px 50% no-repeat;
  color: var(--ink);
}

.search-wrap input:focus {
  outline: 2px solid rgba(26, 108, 255, 0.35);
  border-color: var(--blue);
}

.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(28, 36, 51, 0.12);
  max-height: 360px;
  overflow: auto;
  z-index: 50;
}

.search-results.open { display: block; }

.search-results a {
  display: block;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

.search-results a:last-child { border-bottom: none; }

.search-results a:hover,
.search-results a:focus {
  background: var(--blue-soft);
  outline: none;
}

.search-results .title {
  font-weight: 800;
  font-size: 14px;
}

.search-results .desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.top-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-links a {
  font-weight: 800;
  font-size: 13px;
  text-decoration: none;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 10px;
}

.top-links a:hover {
  color: var(--ink);
  background: rgba(26, 108, 255, 0.08);
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: calc(100vh - var(--top-h));
}

.sidebar {
  position: sticky;
  top: var(--top-h);
  height: calc(100vh - var(--top-h));
  overflow: auto;
  padding: 18px 14px 32px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.nav-section {
  margin-bottom: 18px;
}

.nav-section h2 {
  margin: 0 0 8px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-section a {
  display: block;
  padding: 7px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 13.5px;
  line-height: 1.35;
}

.nav-section a:hover { background: rgba(26, 108, 255, 0.08); }

.nav-section a.active {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.main {
  min-width: 0;
  padding: 0;
}

.article {
  max-width: none;
  width: 100%;
  margin: 0;
  min-height: calc(100vh - var(--top-h));
  background: #fff;
  border: none;
  border-left: 1px solid var(--line);
  border-radius: 0;
  padding: 28px 32px 48px;
  box-shadow: none;
}

.article > h1:first-child {
  margin-top: 0;
}

.article h1 {
  font-size: clamp(1.7rem, 2.4vw, 2.15rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 0 0 12px;
}

.article h2 {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 2rem 0 0.7rem;
  letter-spacing: -0.02em;
  scroll-margin-top: calc(var(--top-h) + 12px);
}

.article h3 {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 1.5rem 0 0.55rem;
  scroll-margin-top: calc(var(--top-h) + 12px);
}

.article p,
.article li {
  font-size: 1rem;
  line-height: 1.65;
  font-weight: 600;
  color: #2a3344;
}

.article p { margin: 0.75rem 0; }

.article ul,
.article ol {
  margin: 0.6rem 0 1rem;
  padding-left: 1.3rem;
}

.article li + li { margin-top: 0.35rem; }

.article blockquote {
  margin: 1rem 0;
  padding: 12px 16px;
  border-left: 4px solid var(--blue);
  background: var(--blue-soft);
  border-radius: 0 12px 12px 0;
  color: var(--ink);
}

.article blockquote p { margin: 0; }

.article hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 1.6rem 0;
}

.article table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.25rem;
  font-size: 0.92rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: block;
  overflow-x: auto;
}

.article thead,
.article tbody,
.article tr {
  width: 100%;
}

.article th,
.article td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-weight: 600;
}

.article th {
  background: #f3f7ff;
  font-weight: 800;
  white-space: nowrap;
}

.article tr:last-child td { border-bottom: none; }

.article code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.12em 0.4em;
  border-radius: 6px;
  font-weight: 600;
}

.article pre {
  background: #121826;
  color: #e8eefc;
  padding: 14px 16px;
  border-radius: 14px;
  overflow-x: auto;
  margin: 1rem 0;
}

.article pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.55;
}

.article img {
  max-width: 100%;
  height: auto;
  border-radius: 0;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: none;
}

.article a[href$=".pdf"] {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  padding: 10px 14px;
  border-radius: 0;
  background: var(--blue);
  color: #fff !important;
  text-decoration: none;
  margin: 4px 0 12px;
  box-shadow: none;
}

.article a[href$=".pdf"]:hover {
  background: var(--blue-dark);
  color: #fff !important;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.pill {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.desc {
  margin: -4px 0 18px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.98rem;
  line-height: 1.5;
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  max-width: none;
  width: 100%;
  margin: 0;
  border-top: 1px solid var(--line);
  background: #fff;
}

.pager a {
  display: block;
  text-decoration: none;
  background: #fff;
  border: none;
  border-radius: 0;
  padding: 16px 32px;
  color: var(--ink);
  box-shadow: none;
}

.pager a:hover { background: rgba(26, 108, 255, 0.06); border-color: transparent; }

.pager .next { text-align: right; border-left: 1px solid var(--line); }

.pager .label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.pager .title {
  font-weight: 800;
  font-size: 14px;
}

.pager .next { text-align: right; }

.footer-note {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 16px 32px 28px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  background: #fff;
  border-top: 1px solid var(--line);
  box-shadow: none;
}

.backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.35);
  z-index: 30;
}

@media (max-width: 920px) {
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; }

  .shell { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    left: 0;
    top: var(--top-h);
    width: min(86vw, 320px);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    z-index: 35;
    background: #fff;
    box-shadow: 12px 0 40px rgba(28, 36, 51, 0.12);
  }

  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .backdrop { display: block; }

  .search-wrap { max-width: none; }
  .top-links .hide-sm { display: none; }

  .main { padding: 0; }
  .article {
    padding: 20px 16px 28px;
    border-radius: 0;
    border-left: none;
    box-shadow: none;
    min-height: auto;
  }
  .pager { grid-template-columns: 1fr; }
  .pager .next { text-align: left; border-left: none; border-top: 1px solid var(--line); }
  .footer-note { padding: 14px 16px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sidebar { transition: none; }
}
