:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-soft: #eeece7;
  --surface-blue: #f1f5ff;
  --surface-green: #edfce9;
  --text: #212121;
  --muted: #93939f;
  --slate: #75758a;
  --line: #d9d9dd;
  --border-light: #e5e7eb;
  --card-border: #f2f2f2;
  --black: #000000;
  --near-black: #17171c;
  --deep-green: #003c33;
  --dark-navy: #071829;
  --action-blue: #1863dc;
  --coral: #ff7759;
  --soft-coral: #ffad9b;
  --focus-blue: #4c6ee6;
  --accent: var(--action-blue);
  --accent-strong: var(--near-black);
  --accent-soft: #f1f5ff;
  --paper: #eeece7;
  --warning: #b30000;
  --radius: 8px;
  --media-radius: 22px;
  --shadow: none;
  --container-max: 1520px;
  --container-gutter: 48px;
  --article-measure: 920px;
  --font-dev:
    "JetBrains Mono", "Fira Code", "Cascadia Code", "SFMono-Regular",
    Menlo, Consolas, "Noto Sans Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-dev);
  line-height: 1.6;
}

a {
  color: var(--action-blue);
  text-decoration: none;
}

a:hover {
  color: var(--near-black);
  text-decoration: underline;
}

.site-shell {
  min-height: 100vh;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.site-header-inner,
.portal {
  width: min(var(--container-max), calc(100% - var(--container-gutter)));
  margin: 0 auto;
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  gap: 20px;
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--black);
  color: white;
  font-weight: 700;
}

.site-nav {
  display: flex;
  gap: 14px;
  align-items: center;
}

.header-link {
  font-size: 14px;
  font-weight: 500;
}

.portal {
  padding: 64px 0 80px;
}

.portal-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 64px;
  align-items: stretch;
  margin-bottom: 56px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--coral);
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 88px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
}

.lead {
  max-width: 900px;
  margin: 24px 0 0;
  color: var(--slate);
  font-size: 18px;
  line-height: 1.45;
}

.hero-panel {
  display: grid;
  align-content: end;
  gap: 16px;
  min-height: 280px;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--media-radius);
  background: var(--deep-green);
  color: #ffffff;
}

.hero-panel strong {
  font-size: 24px;
  font-weight: 400;
  line-height: 1.2;
}

.hero-panel span {
  color: #d9ebe6;
  font-size: 14px;
}

.notice-strip {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 52px;
  padding: 0 18px;
  margin: 0 0 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.notice-strip strong {
  color: var(--near-black);
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin: 28px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.search-input {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.search-input:focus,
.book-search input:focus {
  border-color: var(--focus-blue);
  outline: 2px solid rgba(76, 110, 230, 0.18);
  outline-offset: 0;
}

.book-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.sort-label {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--near-black);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.book-count {
  color: var(--muted);
  white-space: nowrap;
}

.book-list {
  display: grid;
  gap: 0;
  margin-top: 16px;
  border-top: 1px solid var(--line);
}

.book-row {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 32px;
  align-items: center;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.book-row:hover {
  border-color: var(--line);
}

.book-cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid var(--card-border);
  border-radius: var(--media-radius);
  background: var(--surface-soft);
  color: var(--near-black);
}

.book-cover:hover {
  text-decoration: none;
}

.book-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-cover.is-fallback {
  display: grid;
  place-items: center;
  font-weight: 700;
}

.book-cover.is-fallback span {
  font-size: 36px;
}

.book-summary {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.book-title {
  margin: 0;
  font-size: 32px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
}

.book-description {
  margin: 0;
  color: var(--slate);
  font-size: 16px;
  line-height: 1.5;
}

.meta-row,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.meta-row {
  color: var(--muted);
  font-size: 14px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
}

.status {
  color: var(--warning);
}

.toc-button {
  display: none;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.gitbook-shell {
  min-height: 100vh;
  background: #ffffff;
}

.gitbook-reader {
  min-height: 100vh;
  background: #ffffff;
  color: var(--text);
}

.gitbook-summary {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: 320px;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #fafafa;
}

.summary-home {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.summary-home a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--near-black);
  font-size: 14px;
  font-weight: 500;
}

.summary-home a:hover {
  border-color: var(--near-black);
  text-decoration: none;
}

.book-search {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.book-search input {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
}

.gitbook-summary nav {
  flex: 1 1 auto;
  overflow-y: auto;
}

.summary {
  display: block;
  margin: 0;
  padding: 12px 0 24px;
  list-style: none;
}

.summary li {
  margin: 0;
}

.summary a {
  display: block;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.summary a:hover {
  color: var(--action-blue);
  text-decoration: none;
}

.summary-title a {
  padding: 10px 16px;
  color: var(--near-black);
  font-weight: 700;
}

.summary .divider {
  height: 1px;
  margin: 7px 0;
  background: var(--line);
}

.toc-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  min-height: 38px;
}

.toc-row a {
  min-width: 0;
  padding: 9px 12px 9px 0;
  overflow-wrap: anywhere;
}

.toc-collapse-button,
.toc-collapse-spacer {
  width: 24px;
  height: 24px;
}

.toc-collapse-spacer {
  display: block;
}

.toc-collapse-button {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--slate);
  cursor: pointer;
  font: inherit;
  line-height: 1;
}

.toc-collapse-button:hover {
  background: var(--surface-green);
  color: var(--near-black);
}

.chapter.is-active .toc-row a {
  color: var(--action-blue);
  font-weight: 700;
}

.chapter.is-active .toc-row {
  background: #ffffff;
  box-shadow: inset 3px 0 0 var(--action-blue);
}

.gitbook-toc-depth-2 .toc-row {
  padding-left: 18px;
}

.gitbook-toc-depth-3 .toc-row {
  padding-left: 36px;
}

.gitbook-body {
  min-height: 100vh;
  margin-left: 320px;
  background: #ffffff;
}

.body-inner {
  min-height: 100vh;
}

.book-header {
  display: flex;
  min-height: 50px;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.book-header h1 {
  flex: 1;
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  text-align: center;
}

.book-header h1 a {
  color: var(--slate);
}

.page-wrapper {
  outline: none;
}

.page-inner {
  width: min(100%, 800px);
  margin: 0 auto;
  padding: 42px 56px 88px;
}

.markdown-section {
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
}

.markdown-section h1 {
  margin: 0 0 24px;
  font-size: 34px;
  font-weight: 400;
  line-height: 1.25;
}

.markdown-section h2 {
  margin: 36px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 26px;
  font-weight: 400;
  line-height: 1.3;
}

.markdown-section h3,
.markdown-section h4 {
  margin: 28px 0 12px;
  font-weight: 500;
  line-height: 1.35;
}

.markdown-section p,
.markdown-section li {
  overflow-wrap: anywhere;
}

.markdown-section a {
  color: var(--action-blue);
}

.markdown-section code {
  padding: 2px 4px;
  border-radius: 3px;
  background: var(--surface-blue);
  color: var(--near-black);
  font-family: var(--font-dev);
  font-size: 0.9em;
}

.markdown-section pre {
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--near-black);
  color: #ffffff;
}

.markdown-section pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.markdown-section blockquote {
  margin: 20px 0;
  padding: 0 0 0 16px;
  border-left: 4px solid var(--coral);
  color: var(--slate);
}

.markdown-section img {
  max-width: 100%;
  border-radius: 4px;
}

.markdown-section table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.markdown-section th,
.markdown-section td {
  padding: 8px 13px;
  border: 1px solid var(--line);
}

.markdown-section tr:nth-child(2n) {
  background: #fafafa;
}

.navigation {
  position: fixed;
  top: 50%;
  z-index: 10;
  display: grid;
  width: 48px;
  height: 88px;
  place-items: center;
  color: var(--muted);
  font-size: 48px;
  line-height: 1;
  text-decoration: none;
  transform: translateY(-50%);
}

.navigation:hover {
  background: #fafafa;
  color: var(--near-black);
  text-decoration: none;
}

.navigation-prev {
  left: 320px;
}

.navigation-next {
  right: 0;
}

.button-primary,
.editor-export-actions button,
.editor-doc-actions button,
.editor-asset-row button,
.editor-result-link {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--near-black);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
}

.editor-result-link {
  display: inline-flex;
  align-items: center;
}

.button-primary,
.editor-export-actions .button-primary {
  border-color: var(--near-black);
  background: var(--near-black);
  color: #ffffff;
}

.button-primary:hover,
.editor-export-actions button:hover,
.editor-doc-actions button:hover,
.editor-asset-row button:hover,
.editor-result-link:hover {
  border-color: var(--near-black);
  text-decoration: none;
}

.editor-export-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.editor-page {
  width: min(1680px, calc(100% - var(--container-gutter)));
  margin: 0 auto;
  padding: 64px 0 88px;
}

.editor-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 64px;
  align-items: stretch;
  margin-bottom: 36px;
}

.editor-hero-panel {
  min-height: 240px;
}

.editor-message {
  min-height: 44px;
  padding: 10px 14px;
  margin: 0 0 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-green);
  color: var(--near-black);
}

.editor-message.is-error {
  border-color: var(--warning);
  background: #fff5f5;
  color: var(--warning);
}

.editor-workspace {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr) minmax(340px, 440px);
  gap: 24px;
  align-items: start;
}

.editor-panel {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.editor-project-panel,
.editor-assets-panel,
.editor-export-panel {
  grid-column: 1;
}

.editor-docs-panel,
.editor-preview-panel {
  grid-column: 2 / 4;
}

.editor-panel-heading {
  margin-bottom: 20px;
}

.editor-panel-heading h2 {
  margin: 0;
  color: var(--near-black);
  font-size: 28px;
  font-weight: 400;
  line-height: 1.2;
}

.editor-panel-heading-row {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.editor-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.editor-form-grid label,
.editor-markdown-field,
.editor-import-draft {
  display: grid;
  gap: 7px;
}

.editor-form-grid span,
.editor-markdown-field span,
.editor-import-draft span,
.editor-label {
  color: var(--slate);
  font-size: 13px;
}

.editor-span-2 {
  grid-column: 1 / -1;
}

.editor-input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.editor-input:focus {
  border-color: var(--focus-blue);
  outline: 2px solid rgba(76, 110, 230, 0.18);
  outline-offset: 0;
}

textarea.editor-input {
  resize: vertical;
}

.editor-cover {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 18px;
  align-items: start;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.editor-cover input,
.editor-assets-panel input,
.editor-import-draft input {
  max-width: 100%;
  color: var(--slate);
  font: inherit;
  font-size: 13px;
}

.editor-cover-preview {
  margin: 0;
}

.editor-cover-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.editor-cover-preview figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.editor-doc-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
}

.editor-doc-list {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: 720px;
  overflow: auto;
  padding-right: 4px;
}

.editor-doc-item {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 64px;
  padding: 10px 12px 10px calc(12px + (var(--doc-depth) * 18px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.editor-doc-item.is-active {
  border-color: var(--action-blue);
  box-shadow: inset 3px 0 0 var(--action-blue);
}

.editor-doc-item strong {
  font-weight: 500;
}

.editor-doc-item span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.editor-doc-editor {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.editor-doc-actions,
.editor-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.editor-markdown-input {
  min-height: 520px;
  font-size: 14px;
  line-height: 1.6;
}

.editor-assets-panel,
.editor-export-panel {
  display: grid;
  gap: 16px;
}

.editor-asset-list {
  display: grid;
  gap: 8px;
}

.editor-asset-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.editor-asset-row span {
  color: var(--slate);
  font-size: 13px;
  overflow-wrap: anywhere;
}

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

.editor-file-tree {
  min-height: 160px;
  margin: 0;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--near-black);
  color: #ffffff;
  font-family: var(--font-dev);
  font-size: 13px;
  line-height: 1.55;
}

.editor-preview {
  min-height: 420px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

@media (max-width: 1100px) {
  :root {
    --container-gutter: 32px;
  }

  .portal-hero {
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 32px;
  }

  .gitbook-summary {
    width: 280px;
  }

  .gitbook-body {
    margin-left: 280px;
  }

  .navigation-prev {
    left: 280px;
  }

  .editor-hero,
  .editor-workspace {
    grid-template-columns: 1fr;
  }

  .editor-project-panel,
  .editor-docs-panel,
  .editor-assets-panel,
  .editor-export-panel,
  .editor-preview-panel {
    grid-column: 1;
  }
}

@media (max-width: 820px) {
  :root {
    --container-gutter: 24px;
  }

  .site-header-inner,
  .portal {
    width: min(var(--container-max), calc(100% - var(--container-gutter)));
  }

  h1 {
    font-size: 36px;
  }

  .portal-hero,
  .search-row {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    order: -1;
  }

  .toc-button {
    display: inline-flex;
    align-items: center;
  }

  .book-row {
    grid-template-columns: 1fr;
  }

  .book-toolbar {
    justify-content: flex-start;
  }

  .gitbook-summary {
    display: none;
    width: min(320px, calc(100% - 64px));
    border-right: 1px solid var(--line);
  }

  .gitbook-reader.is-toc-open .gitbook-summary {
    display: flex;
  }

  .gitbook-body {
    margin-left: 0;
  }

  .book-header h1 {
    text-align: left;
  }

  .page-inner {
    width: 100%;
    padding: 30px 24px 64px;
  }

  .markdown-section h1 {
    font-size: 32px;
  }

  .markdown-section h2 {
    font-size: 24px;
  }

  .navigation {
    display: none;
  }

  .editor-page {
    padding: 36px 0 64px;
  }

  .editor-doc-layout,
  .editor-form-grid,
  .editor-cover {
    grid-template-columns: 1fr;
  }

  .editor-panel-heading-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .editor-asset-row {
    grid-template-columns: 1fr;
  }
}
