/* Document pages: Quick Start and FAQ */

.doc-page {
  /* Spacing by content relationship: inline, related, group, transition, section. */
  --doc-space-tight: 8px;
  --doc-space-related: 16px;
  --doc-space-group: 24px;
  --doc-space-transition: 32px;
  --doc-space-section: 40px;
  flex: 1;
  overflow-y: auto;
  padding: 0;
  background:
    linear-gradient(90deg, oklch(0.9 0.012 250 / 0.28) 1px, transparent 1px) 50% 0 / 96px 96px,
    linear-gradient(180deg, var(--bg) 0%, oklch(0.966 0.009 250) 100%);
}

.doc-shell {
  width: min(940px, 100%);
  margin: 0 auto;
  padding: var(--doc-space-section) clamp(16px, 4vw, 40px) 80px;
}

.doc-copy,
.doc-note,
.doc-steps,
.feature-steps,
.qa-answer p,
.qa-answer li {
  min-width: 0;
  max-width: 72ch;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.72;
}

.doc-section {
  min-width: 0;
  padding: var(--doc-space-section) 0;
  border-top: 1px solid var(--border-subtle);
}

.doc-section:first-child {
  padding-top: 0;
  border-top: none;
}

.doc-heading {
  color: var(--text);
  font-size: 27px;
  font-weight: 680;
  line-height: 1.22;
  letter-spacing: 0;
  margin-bottom: var(--doc-space-related);
}

.doc-copy a,
.doc-steps a,
.qa-answer a {
  color: var(--accent);
  overflow-wrap: anywhere;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.doc-note {
  margin-top: var(--doc-space-group);
  padding: var(--doc-space-related);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: oklch(0.99 0.006 250 / 0.72);
  font-size: 15px;
}

.doc-note a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.doc-steps,
.feature-steps {
  margin-top: var(--doc-space-related);
  padding-left: 25px;
}

.doc-steps > li,
.feature-steps > li {
  padding-left: 5px;
  margin-bottom: var(--doc-space-group);
}

.doc-steps > li::marker,
.feature-steps > li::marker {
  color: var(--accent);
  font-weight: 750;
}

.doc-steps > li:last-child,
.feature-steps > li:last-child {
  margin-bottom: 0;
}

.feature-steps {
  max-width: none;
  color: var(--text-secondary);
}

.feature-steps > li {
  padding-bottom: var(--doc-space-group);
  border-bottom: 1px solid var(--border-subtle);
}

.feature-steps > li:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.feature-steps h3 {
  color: var(--text);
  font-size: 19px;
  font-weight: 680;
  line-height: 1.3;
  margin-bottom: var(--doc-space-tight);
}

.feature-steps .doc-copy {
  margin-bottom: var(--doc-space-tight);
}

.extensions-section > .doc-copy {
  max-width: 76ch;
}

.extension-figure {
  display: grid;
  place-items: center;
  width: min(100%, 560px);
  margin-top: var(--doc-space-related);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: oklch(0.96 0.008 250);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.extension-indicators {
  display: block;
  width: 100%;
  height: auto;
}

.extension-features {
  display: grid;
  gap: var(--doc-space-tight);
  max-width: 72ch;
  margin-top: var(--doc-space-related);
  padding-left: 21px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.62;
}

.extension-features li::marker {
  color: var(--accent);
  font-weight: 750;
}

.extension-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--doc-space-related);
  max-width: 520px;
  margin-top: var(--doc-space-related);
}

.extension-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  width: 100%;
  max-width: 100%;
  padding: 8px 13px;
  border: 1px solid oklch(0.82 0.07 255);
  border-radius: var(--radius);
  background: var(--accent-subtle);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-decoration: none;
  transition:
    color var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}

.extension-link:hover {
  color: var(--accent-hover);
  background: oklch(0.935 0.055 255);
  border-color: oklch(0.75 0.09 255);
}

.install-commands {
  display: grid;
  gap: var(--doc-space-related);
  max-width: 720px;
  margin-top: var(--doc-space-related);
}

.install-command {
  display: grid;
  gap: var(--doc-space-tight);
  min-width: 0;
}

.install-command h3 {
  color: var(--text);
  font-size: 15px;
  font-weight: 680;
  line-height: 1.3;
}

.install-command pre,
.qa-answer pre,
.standalone-code {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  margin: 0;
  padding: var(--doc-space-related) 72px var(--doc-space-related) var(--doc-space-related);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: oklch(0.985 0.006 250 / 0.92);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
}

.code-block {
  position: relative;
  max-width: 100%;
  min-width: 0;
  margin: 0;
}

.doc-section > .code-block {
  max-width: 720px;
  margin-top: var(--doc-space-related);
}

.install-command .code-block {
  max-width: 640px;
}

.code-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 26px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition:
    color var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}

.code-copy:hover {
  color: var(--accent);
  background: var(--accent-subtle);
  border-color: oklch(0.82 0.07 255);
}

.standalone-code {
  margin-top: var(--doc-space-related);
  max-width: none;
}

/* The wrapper owns spacing once the copy button is added. */
.code-block > pre { margin-top: 0; }

.doc-page code {
  font-family: var(--font-mono);
}

.doc-page :not(pre) > code {
  padding: 1px 5px;
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  background: oklch(0.985 0.006 250 / 0.82);
  color: var(--text);
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

.input-line {
  display: flex;
  align-items: center;
  gap: var(--doc-space-tight);
  min-width: 0;
  max-width: 72ch;
  margin-top: var(--doc-space-tight);
  flex-wrap: wrap;
}

.input-label {
  color: var(--text);
  font-size: 13px;
  font-weight: 680;
  line-height: 1.3;
  margin-right: 3px;
}

.move-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: oklch(0.995 0.004 250 / 0.84);
}

.move-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  table-layout: fixed;
}

.move-table-wrap.compact .move-table {
  min-width: 640px;
}

.move-table th,
.move-table td {
  padding: var(--doc-space-related);
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
  line-height: 1.6;
}

.move-table th {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  background: oklch(0.985 0.006 250 / 0.9);
  width: 120px;
}

.move-table td {
  color: var(--text-secondary);
}

.move-table td:first-child {
  width: 150px;
  color: var(--text);
  font-weight: 600;
}

.move-table td:nth-child(2) {
  width: 310px;
}

.brake-table {
  min-width: 720px;
}

.brake-table th:first-child,
.brake-table td:first-child {
  width: 155px;
}

.brake-table th:nth-child(2),
.brake-table td:nth-child(2) {
  width: 300px;
}

.brake-table th:nth-child(3),
.brake-table td:nth-child(3) {
  width: auto;
}

.move-table tr:last-child td {
  border-bottom: none;
}

.move-token {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin: 1px 2px 1px 0;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
  white-space: nowrap;
}

.token-wheel {
  color: var(--accent);
  border-color: oklch(0.82 0.07 255);
  background: var(--accent-subtle);
}

.token-reverse {
  color: var(--speed-off);
  border-color: oklch(0.78 0.06 42);
  background: oklch(0.955 0.026 42);
}

.token-left,
.token-middle,
.token-right {
  color: var(--feature-ink-soft, oklch(0.36 0.017 250));
  border-color: var(--border);
  background: oklch(0.985 0.006 250);
}

.token-move {
  color: oklch(0.48 0.1 185);
  border-color: oklch(0.8 0.055 185);
  background: oklch(0.955 0.03 185);
}

.token-key {
  color: oklch(0.46 0.095 300);
  border-color: oklch(0.8 0.055 300);
  background: oklch(0.955 0.03 300);
}

.move-arrow {
  display: inline-flex;
  align-items: center;
  margin: 0 5px;
  color: var(--text-muted);
  font-size: 12px;
}

.faq-list {
  display: grid;
  gap: 0;
  min-width: 0;
  max-width: 860px;
}

.qa-item {
  min-width: 0;
  padding: 34px 0 36px;
  border-top: 1px solid var(--border-subtle);
}

.qa-item:first-child {
  padding-top: 0;
  border-top: none;
}

.qa-item:last-child {
  padding-bottom: 0;
}

.qa-question {
  max-width: 72ch;
  color: var(--text);
  font-size: 21px;
  font-weight: 680;
  line-height: 1.3;
  letter-spacing: 0;
  margin-bottom: 14px;
}

.qa-answer {
  min-width: 0;
  width: 100%;
  max-width: 72ch;
}

.qa-answer p + p,
.qa-answer p + pre,
.qa-answer pre + p {
  margin-top: 13px;
}

.faq-steps {
  margin-top: 10px;
  padding-left: 24px;
}

.faq-steps > li {
  padding-left: 3px;
  margin-bottom: 7px;
}

.faq-steps > li::marker {
  color: var(--accent);
  font-weight: 750;
}

.faq-steps > li:last-child {
  margin-bottom: 0;
}

.faq-steps + p {
  margin-top: 13px;
}

.qa-answer .code-block {
  max-width: 720px;
  margin-top: 14px;
}

.lang-block[hidden] {
  display: none !important;
}

@media (max-width: 768px) {
  .doc-page {
    --doc-space-section: 32px;
    background: linear-gradient(180deg, var(--bg) 0%, oklch(0.966 0.009 250) 100%);
  }

  .doc-shell {
    padding: var(--doc-space-section) var(--doc-space-related) 64px;
  }

  .doc-section {
    padding: var(--doc-space-section) 0;
  }

  .doc-heading {
    font-size: 24px;
  }

  .extension-actions {
    grid-template-columns: 1fr;
  }

  .move-table th,
  .move-table td {
    padding: 11px 12px;
  }

  .qa-question {
    font-size: 20px;
  }
}

@media (max-width: 600px) {
  .doc-shell {
    padding: var(--doc-space-group) var(--doc-space-related) 64px;
  }

  .doc-heading {
    font-size: 23px;
  }

  .extension-link {
    width: 100%;
  }

  .doc-copy,
  .doc-note,
  .doc-steps,
  .feature-steps,
  .qa-answer p,
  .qa-answer li {
    font-size: 15px;
    line-height: 1.68;
  }

  .doc-steps,
  .feature-steps {
    padding-left: 22px;
  }

  .doc-steps > li,
  .feature-steps > li {
    padding-left: 2px;
  }

  .install-command pre,
  .qa-answer pre,
  .standalone-code {
    padding: 38px 13px 13px;
    font-size: 12px;
    line-height: 1.55;
  }

  .code-copy {
    top: 7px;
    right: 7px;
    min-height: 24px;
    padding: 3px 8px;
    font-size: 11px;
  }

  .move-table-wrap {
    overflow-x: visible;
  }

  .brake-table {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .brake-table thead {
    display: none;
  }

  .brake-table tbody,
  .brake-table tr,
  .brake-table td {
    display: block;
    width: auto;
  }

  .brake-table tr {
    padding: var(--doc-space-related);
    border-bottom: 1px solid var(--border-subtle);
  }

  .brake-table tr:last-child {
    border-bottom: none;
  }

  .brake-table td {
    padding: 0;
    border-bottom: none;
    font-size: 13px;
    line-height: 1.55;
  }

  .brake-table td:first-child,
  .brake-table td:nth-child(2),
  .brake-table td:nth-child(3) {
    width: auto;
  }

  .brake-table td:first-child {
    color: var(--text);
    font-weight: 680;
  }

  .brake-table td + td {
    margin-top: var(--doc-space-tight);
  }

  .brake-table td:nth-child(2)::before,
  .brake-table td:nth-child(3)::before {
    display: block;
    margin-bottom: 3px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
  }

  html[lang="en"] .brake-table td:nth-child(2)::before {
    content: "Action";
  }

  html[lang="en"] .brake-table td:nth-child(3)::before {
    content: "Note";
  }

  html[lang="zh"] .brake-table td:nth-child(2)::before {
    content: "输入顺序";
  }

  html[lang="zh"] .brake-table td:nth-child(3)::before {
    content: "备注";
  }
}
