:root {
  color-scheme: light;
  --paper: #fdfcfb;
  --ink: #221d31;
  --body: #474054;
  --muted: #645d73;
  --accent: #5b3cc4;
  --soft-accent: #f0ebff;
  --line: #e9e4ee;
  --header-height: 69px;
  --radius: 12px;
  --icon-fill: var(--paper);
  font: 16px/1.55 system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  scroll-padding-top: calc(var(--header-height) + 20px);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button, a { -webkit-tap-highlight-color: transparent; }
svg { flex: none; vertical-align: middle; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.sr-only, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link:focus { position: fixed; z-index: 5; top: 12px; left: 16px; padding: 8px 12px; background: white; }

.site-header {
  position: sticky;
  z-index: 2;
  top: 0;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  max-width: 1440px;
  min-height: calc(var(--header-height) - 1px);
  padding: 0 32px;
  margin: 0 auto;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 760; letter-spacing: -.045em; font-size: 20px; }
.brand-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: white; background: #2e234d; }
.brand-accent { color: var(--accent); }
.tool-nav { display: flex; align-items: center; border-left: 1px solid var(--line); padding-left: 20px; }
.tool-nav a { display: block; border-radius: 8px; background: var(--soft-accent); color: var(--accent); padding: 5px 13px; font-size: 14px; font-weight: 700; }
.tool-nav a:hover { background: #e7dfff; }
.search-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 266px;
  min-height: 40px;
  margin-left: auto;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8f6fa;
  color: var(--muted);
  font-size: 13px;
}
.search-trigger:hover { background: var(--soft-accent); border-color: #d8cafb; }
.search-trigger kbd { margin-left: auto; border: 1px solid #e1dbe9; border-radius: 5px; padding: 1px 5px; background: white; font-size: 11px; white-space: nowrap; }

.layout {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr) 218px;
  max-width: 1440px;
  min-height: calc(100vh - var(--header-height));
  margin: 0 auto;
}
.sidebar {
  position: sticky;
  align-self: start;
  top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
  padding: 33px 18px 24px 26px;
  border-right: 1px solid var(--line);
  background: #faf8fb;
  --icon-fill: #faf8fb;
}
.sidebar-toggle { display: none; }
.sidebar-label { margin: 0 0 14px 10px; color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .12em; }
.sidebar summary, .sidebar a { display: flex; align-items: center; gap: 10px; border-radius: 8px; }
.sidebar summary { padding: 8px; cursor: pointer; font-size: 14px; font-weight: 700; list-style: none; }
.sidebar summary::-webkit-details-marker { display: none; }
.sidebar summary > svg:last-child { margin-left: auto; color: var(--muted); }
.sidebar details:not([open]) summary > svg:last-child { transform: rotate(-90deg); }
.nav-terminal { display: grid; width: 26px; height: 26px; place-items: center; border: 1px solid #e0d8f0; border-radius: 7px; color: var(--accent); background: white; }
.nav-terminal svg, .sidebar a svg { width: 16px; height: 16px; }
.sidebar ul { list-style: none; margin: 4px 0 0 20px; padding: 0 0 0 10px; border-left: 1px solid #e4ddeb; }
.sidebar li + li { margin-top: 2px; }
.sidebar a { padding: 8px 10px; color: var(--body); font-size: 14px; }
.sidebar summary:hover, .sidebar a:hover { background: #f2edf6; }
.sidebar a[aria-current] { color: var(--accent); background: var(--soft-accent); font-weight: 700; --icon-fill: var(--soft-accent); }

main { width: 100%; max-width: 876px; min-width: 0; margin: 0 auto; padding: 32px clamp(30px, 4.5vw, 72px) 0; }
.breadcrumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.breadcrumbs svg { width: 14px; height: 14px; color: #92879f; }
.breadcrumbs span { color: var(--ink); font-weight: 600; }
.breadcrumbs a:hover, .toc a:hover, .back-link a:hover { color: var(--accent); text-decoration: underline; }
.article-intro { margin: 30px 0 27px; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; color: var(--accent); font-size: 11px; font-weight: 760; text-transform: uppercase; letter-spacing: .14em; }
.eyebrow span { width: 14px; height: 1px; background: currentColor; }
h1 { margin: 0; font-size: clamp(36px, 5vw, 65px); line-height: 1.08; font-weight: 760; letter-spacing: -.062em; overflow-wrap: anywhere; }
.lead { margin: 12px 0 0; color: var(--body); font-size: clamp(16px, 1.8vw, 20px); }

.welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  min-height: 192px;
  padding: 18px 20px 18px 25px;
  border: 1px solid #e4daf8;
  border-radius: 16px;
  background: linear-gradient(105deg, #f8f4ff 28%, #efe9ff);
}
.welcome-copy { padding-block: 5px; }
.badge { display: inline-flex; align-items: center; gap: 7px; padding: 3px 9px; border: 1px solid #e3d8fb; border-radius: 999px; background: #f4eeff; color: #5639a8; font-size: 11px; font-weight: 650; white-space: nowrap; }
.badge > span { width: 6px; height: 6px; border-radius: 50%; background: #8968db; }
h2 { margin: 0; font-size: 23px; line-height: 1.25; font-weight: 730; letter-spacing: -.035em; }
.welcome h2 { margin: 12px 0 7px; }
.welcome p { max-width: 365px; margin: 0; color: var(--body); font-size: 14px; }
.terminal-art { width: min(36%, 216px); height: auto; }

.directory { margin-top: 29px; }
.section-list { display: grid; gap: 9px; margin: 14px 0 0; padding: 0; list-style: none; }
.section-card, .topic {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 66px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}
.section-card:hover { border-color: #cbbcf0; background: #fcfaff; }
.card-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 9px; color: var(--accent); background: var(--soft-accent); --icon-fill: var(--soft-accent); }
.card-copy { display: grid; gap: 1px; }
.card-copy strong { font-size: 15px; }
.card-copy > span { color: var(--muted); font-size: 13px; }
.card-arrow { margin-left: auto; color: var(--accent); }
.topic { justify-content: space-between; font-size: 15px; font-weight: 600; }
.back-link { margin-top: 24px; font-size: 14px; font-weight: 650; color: var(--accent); }
.back-link svg { width: 16px; margin-right: 3px; transform: rotate(180deg); }
.article-footer { margin-top: 33px; padding: 17px 0 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.article-footer span { margin: 0 4px; }

.toc { position: sticky; top: calc(var(--header-height) + 40px); align-self: start; margin-top: 40px; padding-right: 26px; }
.toc p { display: flex; align-items: center; gap: 7px; margin: 0 0 12px; color: var(--ink); font-size: 13px; font-weight: 720; }
.toc p svg { color: var(--accent); width: 16px; height: 16px; }
.toc ul { list-style: none; margin: 0 0 0 7px; padding: 0 0 0 14px; border-left: 1px solid #e5deec; }
.toc li { margin: 7px 0; color: var(--muted); font-size: 13px; }

.search-dialog {
  width: min(540px, calc(100% - 32px));
  max-height: 75vh;
  margin: min(14vh, 110px) auto auto;
  padding: 0;
  border: 1px solid #e1d8eb;
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 22px 72px #2418393d;
}
.search-dialog::backdrop { background: #20173377; }
.search-form { display: flex; align-items: center; gap: 10px; padding: 12px 15px; border-bottom: 1px solid var(--line); color: var(--accent); }
.search-form input { min-width: 0; flex: 1; padding: 5px; border: 0; border-radius: 4px; background: transparent; color: var(--ink); }
.close-search { display: grid; place-items: center; flex: none; width: 35px; height: 35px; border: 0; border-radius: 7px; background: var(--soft-accent); color: var(--accent); }
.search-status { margin: 0; padding: 12px 16px 0; color: var(--muted); font-size: 13px; }
.search-results { display: grid; gap: 4px; list-style: none; padding: 8px 10px 12px; margin: 0; }
.search-results a { display: grid; gap: 2px; padding: 9px 11px; border-radius: 7px; font-size: 14px; font-weight: 650; }
.search-results a span { color: var(--muted); font-size: 13px; font-weight: 400; }
.search-results a:hover, .search-results a:focus-visible { background: var(--soft-accent); }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 226px minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 720px) {
  :root { --header-height: 61px; }
  .header-inner { gap: 13px; padding: 0 16px; }
  .brand { font-size: 17px; gap: 7px; }
  .brand-icon { width: 32px; height: 32px; }
  .tool-nav { padding-left: 10px; }
  .tool-nav a { padding-inline: 9px; font-size: 13px; }
  .search-trigger { justify-content: center; width: 42px; padding: 0; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .layout { display: block; }
  .sidebar { position: static; min-height: 0; padding: 0 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-toggle { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 46px; padding: 0; border: 0; background: transparent; font-size: 14px; font-weight: 650; }
  .sidebar-toggle svg { color: var(--accent); width: 17px; height: 17px; }
  .sidebar-toggle svg:last-child { margin-left: auto; }
  .sidebar-toggle[aria-expanded="true"] svg:last-child { transform: rotate(180deg); }
  .sidebar-toggle[aria-expanded="false"]:not([hidden]) + nav { display: none; }
  .sidebar nav { padding: 4px 0 12px; }
  .sidebar-label { display: none; }
  main { padding: 23px 20px 0; }
  .article-intro { margin: 23px 0; }
  .welcome { min-height: 158px; padding: 16px; }
  .terminal-art { width: min(29%, 150px); }
}

@media (max-width: 420px) {
  .terminal-art { display: none; }
  .topic { gap: 6px; padding-inline: 10px; }
}
