:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  --accent: #2563eb;
  --accent-contrast: #ffffff;
  --bg: #f8fafc;
  --border-subtle: #d8dee8;
  --border-strong: #aab4c3;
  --code-bg: #eef2f7;
  --danger: #b42318;
  --focus: #d97706;
  --get: #047857;
  --muted-bg: #eef2f7;
  --panel: #ffffff;
  --post: #1d4ed8;
  --put: #7c3aed;
  --text: #111827;
  --text-muted: #5b6472;
  --warning: #b45309;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --accent: #7dd3fc;
  --accent-contrast: #0f172a;
  --bg: #101419;
  --border-subtle: #303845;
  --border-strong: #546173;
  --code-bg: #171c23;
  --danger: #f87171;
  --focus: #fbbf24;
  --get: #34d399;
  --muted-bg: #171c23;
  --panel: #151a21;
  --post: #93c5fd;
  --put: #c4b5fd;
  --text: #edf2f7;
  --text-muted: #aab4c3;
  --warning: #fcd34d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.docs-shell {
  max-width: 96rem;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 4rem;
}

.docs-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 1rem;
}

.docs-header h1,
.docs-content h2,
.docs-content h3,
.docs-content h4,
.docs-content h5 {
  margin: 0;
}

.docs-header h1 {
  font-size: 2.25rem;
  line-height: 1.1;
}

.docs-kicker {
  margin: 0 0 0.25rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.source-links,
.header-actions,
.nav-section-links,
.nav-tag-operations {
  display: flex;
  gap: 0.5rem;
}

.header-actions,
.source-links {
  flex-wrap: wrap;
  align-items: center;
}

a {
  color: var(--accent);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.source-links a,
.icon-button {
  min-height: 2.25rem;
  border: 1px solid var(--border-subtle);
  border-radius: 0.375rem;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  text-decoration: none;
}

.source-links a {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.625rem;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  padding: 0.45rem 0.625rem;
}

.icon-button:hover,
.source-links a:hover {
  border-color: var(--border-strong);
}

.icon-button:focus-visible,
a:focus-visible,
.search-input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.nav-toggle {
  display: none;
}

.docs-layout {
  display: grid;
  grid-template-columns: minmax(16rem, 20rem) minmax(0, 1fr);
  gap: 2rem;
  padding-top: 1.5rem;
}

.docs-sidebar {
  align-self: start;
  max-height: calc(100vh - 2rem);
  overflow: auto;
  position: sticky;
  top: 1rem;
}

.search-label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.375rem;
}

.search-input {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 0.375rem;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  padding: 0.625rem 0.75rem;
}

.docs-navigation {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.nav-section,
.search-results {
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  background: var(--panel);
}

.nav-section {
  padding: 0.75rem;
}

.nav-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.nav-section-links,
.nav-tag-operations {
  flex-direction: column;
}

.nav-link,
.search-result {
  border-radius: 0.35rem;
  color: var(--text);
  text-decoration: none;
}

.nav-link {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.35rem 0.45rem;
}

.nav-link:hover,
.search-result:hover,
.nav-link[aria-current="page"] {
  background: var(--muted-bg);
}

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

.nav-link-label,
.nav-link-detail,
.search-result-title,
.search-result-detail {
  min-width: 0;
  overflow-wrap: anywhere;
}

.nav-link-detail {
  flex: 0 0 auto;
  white-space: nowrap;
}

.nav-link-detail,
.search-result-kind,
.search-result-detail {
  color: var(--text-muted);
}

.nav-link-detail,
.search-result-kind {
  font-size: 0.78rem;
}

.nav-tag-group {
  display: grid;
  gap: 0.35rem;
}

.nav-tag-operations {
  margin-left: 0.75rem;
  padding-left: 0.5rem;
  border-left: 1px solid var(--border-subtle);
}

.nav-operation {
  font-size: 0.875rem;
}

.search-results {
  display: none;
  margin-top: 0.75rem;
  max-height: 22rem;
  overflow: auto;
  padding: 0.5rem;
}

.search-results[data-active="true"] {
  display: grid;
  gap: 0.35rem;
}

.search-result {
  display: grid;
  gap: 0.2rem;
  padding: 0.5rem;
}

.search-result-title {
  font-weight: 700;
}

.search-result mark {
  border-radius: 0.2rem;
  background: color-mix(in srgb, var(--warning) 26%, transparent);
  color: inherit;
  padding: 0 0.1rem;
}

.docs-content {
  min-width: 0;
}

.docs-content:focus {
  outline: none;
}

.route-view {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}

.route-heading {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}

.route-heading h2 {
  font-size: 2.5rem;
  line-height: 1.1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.operation-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  max-width: 100%;
  min-width: 0;
}

.operation-title h2 {
  flex: 1 1 16rem;
}

.method-badge,
.schema-badge,
.required-badge,
.deprecated-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1;
  padding: 0.25rem 0.375rem;
  text-transform: uppercase;
}

.method-badge {
  min-width: 3.5rem;
  justify-content: center;
}

.method-get {
  color: var(--get);
}

.method-post,
.method-put,
.method-patch {
  color: var(--post);
}

.method-put,
.method-patch {
  color: var(--put);
}

.method-delete {
  color: var(--danger);
}

.schema-badge,
.required-badge,
.deprecated-badge {
  color: var(--text-muted);
  text-transform: none;
}

.content-section,
.schema-block,
.property-block,
.response-block,
.media-block,
.example-block {
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  background: var(--panel);
  min-width: 0;
  padding: 1rem;
}

.content-section {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
}

.content-section > header,
.response-block > header,
.media-block > header,
.property-block > header,
.schema-block > header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
}

.content-section h3,
.response-block h4,
.media-block h4,
.property-block h5,
.schema-block h4 {
  font-size: 1rem;
}

.markdown > :first-child,
.content-section > :first-child,
.schema-block > :first-child {
  margin-top: 0;
}

.markdown > :last-child,
.content-section > :last-child,
.schema-block > :last-child {
  margin-bottom: 0;
}

.markdown p,
.schema-block p,
.property-block p {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.markdown pre,
.json-block {
  overflow-x: auto;
  border-radius: 0.375rem;
  background: var(--code-bg);
  padding: 0.875rem;
}

code,
pre,
.path-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.path-text {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.docs-list,
.operation-list,
.schema-list,
.metadata-list {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding-left: 1.25rem;
}

.operation-card {
  display: grid;
  gap: 0.25rem;
}

.operation-link {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
}

.metadata-list {
  list-style: none;
  padding-left: 0;
}

.metadata-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.parameter-table {
  border-collapse: collapse;
  min-width: 42rem;
  width: 100%;
}

.parameter-table-wrapper {
  max-width: 100%;
  overflow-x: auto;
}

.parameter-table th,
.parameter-table td {
  border-bottom: 1px solid var(--border-subtle);
  overflow-wrap: normal;
  padding: 0.625rem;
  text-align: left;
  vertical-align: top;
}

.parameter-table th {
  color: var(--text-muted);
  font-size: 0.8125rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.parameter-table th:nth-child(1),
.parameter-table td:nth-child(1) {
  min-width: 7rem;
}

.parameter-table th:nth-child(2),
.parameter-table td:nth-child(2) {
  min-width: 5rem;
}

.parameter-table th:nth-child(3),
.parameter-table td:nth-child(3) {
  min-width: 6rem;
}

.parameter-table th:nth-child(4),
.parameter-table td:nth-child(4) {
  min-width: 18rem;
  overflow-wrap: anywhere;
}

.schema-block,
.property-block,
.response-block,
.media-block,
.example-block {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(0, 1fr);
}

.schema-children,
.response-list,
.media-list,
.examples-list {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}

.schema-children {
  margin-top: 0.25rem;
}

.muted,
.empty-state {
  color: var(--text-muted);
}

.not-found {
  border: 1px solid var(--border-strong);
  border-radius: 0.5rem;
  background: var(--panel);
  padding: 1rem;
}

.route-placeholder[hidden] {
  display: none;
}

@media (max-width: 900px) {
  .docs-shell {
    padding-inline: 1rem;
  }

  .docs-layout {
    grid-template-columns: 1fr;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .docs-sidebar {
    max-height: none;
    position: static;
  }

  .docs-sidebar[data-open="false"] {
    display: none;
  }

  .docs-sidebar[data-open="true"] {
    display: block;
  }
}

@media (max-width: 520px) {
  .docs-shell {
    padding: 1rem 0.75rem 3rem;
  }

  .docs-header {
    gap: 0.75rem;
  }

  .header-actions {
    width: 100%;
  }

  .source-links {
    width: 100%;
  }

  .source-links a,
  .icon-button {
    justify-content: center;
  }

  .route-heading h2 {
    font-size: 1.65rem;
  }

  .docs-header h1 {
    font-size: 1.75rem;
  }

  .content-section,
  .schema-block,
  .property-block,
  .response-block,
  .media-block,
  .example-block {
    padding: 0.625rem;
  }

  .parameter-table-wrapper {
    overflow-x: visible;
  }

  .parameter-table {
    min-width: 0;
  }

  .parameter-table,
  .parameter-table tbody,
  .parameter-table tr,
  .parameter-table td {
    display: block;
    width: 100%;
  }

  .parameter-table thead {
    display: none;
  }

  .parameter-table tr {
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.75rem 0;
  }

  .parameter-table td {
    border-bottom: 0;
    display: grid;
    gap: 0.25rem;
    min-width: 0;
    overflow-wrap: anywhere;
    padding: 0.35rem 0;
  }

  .parameter-table td::before {
    color: var(--text-muted);
    content: "";
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
  }

  .parameter-table td:nth-child(1)::before {
    content: "Name";
  }

  .parameter-table td:nth-child(2)::before {
    content: "In";
  }

  .parameter-table td:nth-child(3)::before {
    content: "Required";
  }

  .parameter-table td:nth-child(4)::before {
    content: "Details";
  }
}
