:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #fafafa;
  --surface-raised: #ffffff;
  --surface-hover: #f4f4f5;
  --text: #18181b;
  --text-soft: #52525b;
  --text-faint: #71717a;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --accent: #047857;
  --accent-soft: #ecfdf5;
  --accent-border: #a7f3d0;
  --code-bg: #18181b;
  --code-text: #f4f4f5;
  --header-height: 4rem;
  --sidebar-width: 16.25rem;
  --toc-width: 13.75rem;
  --content-width: 45rem;
  --shadow-dialog: 0 24px 70px rgb(0 0 0 / 0.18);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a0b;
  --surface: #111113;
  --surface-raised: #151517;
  --surface-hover: #202023;
  --text: #f4f4f5;
  --text-soft: #b8b8bf;
  --text-faint: #8b8b94;
  --border: #29292d;
  --border-strong: #3f3f46;
  --accent: #34d399;
  --accent-soft: #0b2d24;
  --accent-border: #145f49;
  --code-bg: #111113;
  --code-text: #f4f4f5;
  --shadow-dialog: 0 24px 70px rgb(0 0 0 / 0.55);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 2rem);
}

body {
  margin: 0;
  min-width: 20rem;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

button {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  transform: translateY(-200%);
  border-radius: 0.375rem;
  background: var(--text);
  color: var(--bg);
  padding: 0.55rem 0.8rem;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  z-index: 40;
  top: 0;
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
}

.header-inner {
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 0 1.5rem;
}

.brand {
  display: inline-flex;
  flex: 0 0 var(--sidebar-width);
  align-items: center;
  gap: 0.45rem;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  text-decoration: none;
}

.brand-mark {
  width: 2rem;
  height: 2rem;
  flex: none;
}

.brand-mark rect {
  fill: var(--text);
  stroke: var(--text);
}

.brand-mark path {
  fill: none;
  stroke: var(--bg);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.brand-divider,
.brand-docs {
  color: var(--text-faint);
  font-weight: 500;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.header-nav a {
  color: var(--text-soft);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
}

.header-nav a:hover,
.header-nav a[aria-current="page"] {
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.icon-button,
.search-trigger,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: var(--surface-raised);
  color: var(--text-soft);
  cursor: pointer;
}

.icon-button {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
}

.icon-button svg,
.search-trigger svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.icon-button:hover,
.search-trigger:hover,
.secondary-button:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  color: var(--text);
}

.search-trigger {
  min-width: 12rem;
  height: 2.25rem;
  justify-content: flex-start;
  gap: 0.55rem;
  padding: 0 0.55rem 0 0.7rem;
  font-size: 0.82rem;
}

.search-trigger kbd {
  margin-left: auto;
}

kbd {
  display: inline-flex;
  min-width: 1.5rem;
  height: 1.35rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  background: var(--surface);
  color: var(--text-faint);
  font-family: inherit;
  font-size: 0.7rem;
  line-height: 1;
}

.theme-icon-dark,
html[data-theme="dark"] .theme-icon-light {
  display: none;
}

html[data-theme="dark"] .theme-icon-dark {
  display: block;
}

.mobile-menu-button {
  display: none;
  margin-right: 0.5rem;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--toc-width);
  max-width: 100rem;
  min-height: calc(100vh - var(--header-height));
  margin: 0 auto;
}

.sidebar {
  border-right: 1px solid var(--border);
}

.sidebar-inner {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.5rem 1rem 3rem;
}

.guide-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
}

.guide-switcher button {
  min-height: 2rem;
  border: 0;
  border-radius: 0.35rem;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
}

.guide-switcher button[aria-pressed="true"] {
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.07);
}

.nav-group {
  margin: 0 0 1rem;
}

.nav-group summary {
  display: flex;
  align-items: center;
  min-height: 2rem;
  list-style: none;
  color: var(--text);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 650;
}

.nav-group summary::-webkit-details-marker {
  display: none;
}

.nav-group summary::after {
  width: 0.4rem;
  height: 0.4rem;
  margin-left: auto;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  content: "";
  transform: rotate(45deg) translateY(-2px);
}

.nav-group:not([open]) summary::after {
  transform: rotate(-45deg);
}

.nav-group ul {
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
}

.nav-group a {
  display: block;
  margin: 0.1rem 0;
  border-radius: 0.35rem;
  color: var(--text-faint);
  font-size: 0.82rem;
  line-height: 1.35;
  padding: 0.45rem 0.55rem;
  text-decoration: none;
}

.nav-group a:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-group a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.main-content {
  min-width: 0;
  padding: 4.25rem clamp(1.5rem, 5vw, 5rem) 5rem;
}

.article,
.home,
.error-state {
  width: min(100%, var(--content-width));
  margin: 0 auto;
}

.loading-state {
  display: flex;
  width: min(100%, var(--content-width));
  align-items: center;
  gap: 0.75rem;
  margin: 0 auto;
  color: var(--text-faint);
  font-size: 0.875rem;
}

.loading-bar {
  width: 2.5rem;
  height: 0.2rem;
  overflow: hidden;
  border-radius: 1rem;
  background: var(--border);
}

.loading-bar::after {
  display: block;
  width: 50%;
  height: 100%;
  background: var(--accent);
  content: "";
  animation: loading 1s ease-in-out infinite alternate;
}

@keyframes loading {
  to { transform: translateX(100%); }
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 1.25rem;
  color: var(--text-faint);
  font-size: 0.8rem;
}

.breadcrumb a {
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--text);
}

.breadcrumb span + span::before,
.breadcrumb a + span::before {
  margin-right: 0.4rem;
  color: var(--border-strong);
  content: "/";
}

.eyebrow {
  display: block;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-header h1,
.home-hero h1 {
  margin: 0.6rem 0 1rem;
  color: var(--text);
  font-size: clamp(2.15rem, 5vw, 2.375rem);
  font-weight: 720;
  letter-spacing: -0.035em;
  line-height: 1.13;
}

.article-description,
.home-intro {
  max-width: 41rem;
  margin: 0;
  color: var(--text-soft);
  font-size: 1.075rem;
  line-height: 1.75;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: 1.2rem 0 0;
  color: var(--text-faint);
  font-size: 0.78rem;
}

.article-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.75rem 0 2.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

.secondary-button {
  min-height: 2.25rem;
  gap: 0.45rem;
  padding: 0 0.75rem;
  font-size: 0.8rem;
  font-weight: 550;
  text-decoration: none;
}

.secondary-button svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.mobile-toc {
  display: none;
  margin: 0 0 2rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
}

.mobile-toc summary {
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 650;
}

.mobile-toc nav {
  padding: 0 1rem 0.8rem;
}

.doc-content {
  min-width: 0;
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.doc-content h2,
.doc-content h3,
.doc-content h4 {
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
  color: var(--text);
  font-weight: 680;
  letter-spacing: -0.025em;
  line-height: 1.3;
}

.doc-content h2 {
  margin: 3.5rem 0 1.1rem;
  padding-top: 0.5rem;
  font-size: 1.75rem;
}

.doc-content h3 {
  margin: 2.5rem 0 0.9rem;
  font-size: 1.3rem;
}

.doc-content h4 {
  margin: 2rem 0 0.75rem;
  font-size: 1.05rem;
}

.chapter-anchor {
  position: relative;
  top: calc(-1 * var(--header-height) - 1rem);
}

.heading-anchor {
  margin-left: 0.45rem;
  color: var(--text-faint) !important;
  font-size: 0.8em;
  font-weight: 500;
  opacity: 0;
  text-decoration: none !important;
}

.doc-content h2:hover .heading-anchor,
.doc-content h3:hover .heading-anchor,
.doc-content h4:hover .heading-anchor,
.heading-anchor:focus-visible {
  opacity: 1;
}

.external-link-mark {
  display: inline-block;
  margin-left: 0.18em;
  color: var(--text-faint);
  font-size: 0.72em;
  text-decoration: none;
  vertical-align: super;
}

.doc-content p,
.doc-content ul,
.doc-content ol,
.doc-content blockquote,
.doc-content .table-wrap,
.doc-content pre {
  margin-top: 0;
  margin-bottom: 1.35rem;
}

.doc-content ul,
.doc-content ol {
  padding-left: 1.4rem;
}

.doc-content li {
  margin: 0.35rem 0;
  padding-left: 0.2rem;
}

.doc-content strong {
  color: var(--text);
  font-weight: 650;
}

.doc-content a {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-underline-offset: 0.18em;
}

.doc-content a:hover {
  text-decoration-color: var(--accent);
}

.doc-content blockquote {
  margin-left: 0;
  border-left: 3px solid var(--accent-border);
  background: var(--accent-soft);
  color: var(--text-soft);
  padding: 0.8rem 1rem;
}

.doc-content blockquote > :last-child {
  margin-bottom: 0;
}

.doc-content :not(pre) > code,
.source-details code {
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  background: var(--surface);
  color: var(--text);
  padding: 0.12rem 0.32rem;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.86em;
}

.code-block {
  position: relative;
  margin-bottom: 1.35rem;
}

.doc-content pre {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: 0.55rem;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1rem;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.65;
  tab-size: 2;
}

.code-block pre {
  margin-bottom: 0;
  padding-right: 3.5rem;
}

.code-copy {
  position: absolute;
  z-index: 1;
  top: 0.6rem;
  right: 0.6rem;
  min-height: 1.8rem;
  border: 1px solid #3f3f46;
  border-radius: 0.35rem;
  background: #27272a;
  color: #d4d4d8;
  padding: 0 0.5rem;
  cursor: pointer;
  font-size: 0.7rem;
}

.code-copy:hover {
  background: #3f3f46;
  color: #fff;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
}

.doc-content table {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.55;
}

.doc-content th,
.doc-content td {
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 0.8rem;
  text-align: left;
  vertical-align: top;
}

.doc-content th {
  background: var(--surface);
  color: var(--text);
  font-weight: 650;
}

.doc-content tr:last-child td {
  border-bottom: 0;
}

.doc-content hr {
  height: 1px;
  margin: 3rem 0;
  border: 0;
  background: var(--border);
}

.architecture-map {
  margin: 1.75rem 0 2.5rem;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
}

.architecture-map strong,
.architecture-map span {
  display: block;
}

.architecture-users {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 0.8rem 1.2rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.75rem;
  text-align: center;
}

.architecture-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.85rem 1rem;
  color: var(--text-soft);
  text-align: center;
  font-size: 0.82rem;
}

.architecture-flow svg {
  width: 1.5rem;
  height: 1.75rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.architecture-boundary {
  padding: 1.25rem;
  border: 1px solid var(--accent-border);
  border-radius: 1rem;
  background: var(--accent-soft);
  color: var(--accent);
}

.architecture-host {
  margin-bottom: 1rem;
  text-align: center;
}

.architecture-host > span {
  margin-top: 0.25rem;
  font-size: 0.82rem;
}

.architecture-application {
  padding: 1rem;
  border: 1px solid var(--accent-border);
  border-radius: 0.75rem;
  background: var(--bg);
  color: var(--text);
  text-align: center;
}

.architecture-application > span,
.architecture-storage span {
  margin-top: 0.35rem;
  color: var(--text-soft);
  font-size: 0.82rem;
}

.architecture-boundary .architecture-flow {
  color: var(--accent);
}

.doc-content .architecture-storage {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--accent);
}

.architecture-storage li {
  margin: 0;
  padding: 0;
  min-width: 0;
}

.architecture-boundary .architecture-storage span {
  color: var(--accent);
}

.architecture-external {
  padding: 1rem 1.25rem;
  border: 1px dashed var(--border-strong);
  border-radius: 0.75rem;
  text-align: center;
}

.architecture-tag {
  width: fit-content;
  margin: 0 auto 0.5rem;
  padding: 0.15rem 0.6rem;
  background: var(--surface-hover);
  color: var(--text-soft);
  border-radius: 0.3rem;
  font-size: 0.75rem;
}

.architecture-external > span:last-child {
  margin-top: 0.4rem;
  color: var(--text-soft);
  font-size: 0.82rem;
}

.architecture-map figcaption {
  margin-top: 1rem;
  color: var(--text-soft);
  font-size: 0.82rem;
}

@media (max-width: 40rem) {
  .doc-content .architecture-storage {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .architecture-storage li + li {
    padding-top: 0.85rem;
    border-top: 1px solid var(--accent-border);
  }

  .architecture-boundary {
    padding: 1rem;
  }
}

@media print {
  .architecture-map {
    break-inside: avoid;
  }
}

.mermaid {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: var(--surface);
  color: var(--text);
  padding: 1rem;
  text-align: center;
}

.mermaid-diagram {
  margin: 1.75rem 0;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: var(--surface);
}

.diagram-render {
  max-width: 100%;
  overflow-x: auto;
  padding: 1.25rem;
  text-align: center;
}

.diagram-render svg {
  display: inline-block;
  max-width: 100%;
  height: auto;
}

.diagram-source {
  border-top: 1px solid var(--border);
}

.diagram-source summary {
  padding: 0.65rem 0.85rem;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
}

.diagram-source pre {
  margin: 0 0.85rem 0.85rem;
}

.diagram-error {
  display: block;
  margin-bottom: 0.75rem;
  color: var(--text-soft);
  font-family: Inter, ui-sans-serif, sans-serif;
  font-size: 0.8rem;
}

.article-pagination {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.pagination-link {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.85rem 1rem;
  text-decoration: none;
}

.pagination-link:last-child {
  align-items: flex-end;
  grid-column: 2;
  text-align: right;
}

.pagination-link:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}

.pagination-link small {
  color: var(--text-faint);
  font-size: 0.72rem;
}

.pagination-link strong {
  max-width: 100%;
  overflow: hidden;
  color: var(--text);
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.article-footer,
.site-footer {
  margin-top: 3.5rem;
  color: var(--text-faint);
  font-size: 0.75rem;
}

.article-footer a,
.site-footer a {
  text-underline-offset: 0.18em;
}

.page-toc {
  padding: 0 1rem;
}

.toc-inner {
  position: sticky;
  top: calc(var(--header-height) + 2rem);
  max-height: calc(100vh - var(--header-height) - 4rem);
  overflow-y: auto;
  padding: 2rem 0 3rem;
}

.toc-inner > p {
  margin: 0 0 0.8rem;
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 650;
}

.toc-inner nav,
.mobile-toc nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.toc-inner a,
.mobile-toc a {
  border-left: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.75rem;
  line-height: 1.4;
  padding: 0.35rem 0 0.35rem 0.75rem;
  text-decoration: none;
}

.toc-inner a[data-depth="3"],
.mobile-toc a[data-depth="3"] {
  padding-left: 1.35rem;
}

.toc-inner a:hover,
.toc-inner a[aria-current="location"],
.mobile-toc a:hover {
  border-color: var(--accent);
  color: var(--text);
}

.home {
  max-width: 58rem;
}

.home-hero {
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--border);
}

.home-hero h1 {
  max-width: 40rem;
  margin-top: 0;
  font-size: clamp(2.5rem, 7vw, 3.5rem);
}

.home-section {
  padding: 3rem 0;
  border-bottom: 1px solid var(--border);
}

.home-section h2 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.section-intro {
  max-width: 41rem;
  margin: 0 0 1.5rem;
  color: var(--text-soft);
}

.guide-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.guide-card {
  display: flex;
  min-height: 15rem;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: var(--surface-raised);
  padding: 1.5rem;
}

.guide-card:hover {
  border-color: var(--border-strong);
}

.guide-card .guide-index {
  color: var(--accent);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.72rem;
}

.guide-card h2 {
  margin: 1.1rem 0 0.65rem;
  font-size: 1.35rem;
}

.guide-card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.guide-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: auto;
  padding-top: 1.5rem;
}

.guide-card footer span {
  color: var(--text-faint);
  font-size: 0.75rem;
}

.text-link {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.profile-list,
.method-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.profile-list li,
.method-list li {
  padding: 0 1.25rem;
  border-left: 1px solid var(--border);
}

.profile-list li:first-child,
.method-list li:first-child {
  padding-left: 0;
  border-left: 0;
}

.profile-list strong,
.method-list strong {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--text);
  font-size: 0.9rem;
}

.profile-list p,
.method-list p {
  margin: 0 0 0.65rem;
  color: var(--text-soft);
  font-size: 0.82rem;
  line-height: 1.6;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 1rem;
  margin-top: 1.5rem;
}

.quick-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 0;
  text-decoration: none;
}

.quick-link span:first-child {
  min-width: 0;
  font-size: 0.875rem;
  font-weight: 550;
}

.quick-link span:last-child {
  color: var(--text-faint);
  font-size: 0.72rem;
}

.quick-link:hover span:first-child {
  color: var(--accent);
}

.error-state {
  padding-top: 3rem;
}

.error-state h1 {
  margin: 0.5rem 0 0.8rem;
  font-size: 2rem;
}

.error-state p {
  color: var(--text-soft);
}

dialog {
  width: calc(100% - 2rem);
  max-width: 42rem;
  max-height: min(44rem, calc(100vh - 2rem));
  overflow: visible;
  border: 1px solid var(--border-strong);
  border-radius: 0.75rem;
  background: var(--surface-raised);
  color: var(--text);
  padding: 0;
  box-shadow: var(--shadow-dialog);
}

dialog::backdrop {
  background: rgb(0 0 0 / 0.45);
  backdrop-filter: blur(2px);
}

.search-dialog {
  margin-top: 12vh;
}

.search-panel {
  overflow: hidden;
  border-radius: inherit;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 3.75rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border);
}

.search-field svg {
  width: 1.2rem;
  height: 1.2rem;
  flex: none;
  fill: none;
  stroke: var(--text-faint);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.search-field input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
}

.search-field input::placeholder {
  color: var(--text-faint);
}

.search-results {
  max-height: min(29rem, calc(100vh - 12rem));
  overflow-y: auto;
  padding: 0.5rem;
}

.search-result {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 0.45rem;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0.75rem;
  text-align: left;
}

.search-result:hover,
.search-result[aria-selected="true"] {
  background: var(--surface-hover);
}

.search-result-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.search-result strong {
  font-size: 0.88rem;
}

.search-result small {
  flex: none;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 650;
  text-transform: uppercase;
}

.search-result p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0.3rem 0 0;
  color: var(--text-faint);
  font-size: 0.78rem;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.search-result mark {
  background: transparent;
  color: var(--text);
  font-weight: 650;
}

.search-empty {
  padding: 3rem 1.5rem;
  color: var(--text-faint);
  text-align: center;
}

.search-empty strong {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--text);
}

.search-help {
  display: flex;
  gap: 1rem;
  padding: 0.55rem 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.68rem;
}

.search-help span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.source-dialog {
  max-width: 32rem;
}

.source-panel {
  position: relative;
  padding: 2rem;
}

.dialog-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.source-panel h2 {
  margin: 0.5rem 2.5rem 0.75rem 0;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.source-panel > p {
  color: var(--text-soft);
  font-size: 0.9rem;
}

.source-details {
  margin: 1.5rem 0;
}

.source-details div {
  margin-top: 1rem;
}

.source-details dt {
  margin-bottom: 0.35rem;
  color: var(--text-faint);
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
}

.source-details dd {
  margin: 0;
}

.source-details code {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  padding: 0.55rem 0.65rem;
  white-space: nowrap;
}

.toast {
  position: fixed;
  z-index: 90;
  right: 1rem;
  bottom: 1rem;
  max-width: calc(100% - 2rem);
  border: 1px solid var(--border-strong);
  border-radius: 0.45rem;
  background: var(--text);
  color: var(--bg);
  padding: 0.65rem 0.85rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.5rem);
  transition: opacity 150ms ease, transform 150ms ease;
  font-size: 0.78rem;
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.16);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.drawer-backdrop {
  display: none;
}

@media (max-width: 74rem) {
  .app-shell {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }

  .page-toc {
    display: none !important;
  }

  .mobile-toc {
    display: block;
  }
}

@media (max-width: 54rem) {
  .header-inner {
    padding: 0 1rem;
  }

  .brand {
    flex-basis: auto;
  }

  .header-nav {
    display: none;
  }

  .header-actions {
    gap: 0.35rem;
  }

  .search-trigger {
    min-width: 0;
    width: 2.25rem;
    padding: 0;
    justify-content: center;
  }

  .search-trigger span,
  .search-trigger kbd {
    display: none;
  }

  .mobile-menu-button {
    display: inline-flex;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    z-index: 60;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    width: min(19rem, calc(100vw - 3rem));
    border-right: 1px solid var(--border);
    background: var(--bg);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-inner {
    position: static;
    height: 100%;
  }

  .drawer-backdrop {
    position: fixed;
    z-index: 55;
    inset: var(--header-height) 0 0;
    display: block;
    background: rgb(0 0 0 / 0.35);
  }

  .main-content {
    padding: 2.5rem 1.25rem 4rem;
  }

  body.drawer-open {
    overflow: hidden;
  }
}

@media (max-width: 40rem) {
  .brand-divider,
  .brand-docs {
    display: none;
  }

  .article-header h1 {
    font-size: 2rem;
  }

  .guide-cards,
  .quick-links,
  .article-pagination {
    grid-template-columns: 1fr;
  }

  .pagination-link:last-child {
    grid-column: 1;
  }

  .profile-list,
  .method-list {
    grid-template-columns: 1fr;
  }

  .profile-list li,
  .method-list li,
  .profile-list li:first-child,
  .method-list li:first-child {
    margin-top: 1rem;
    padding: 0 0 1rem;
    border: 0;
    border-bottom: 1px solid var(--border);
  }

  .article-actions {
    align-items: stretch;
  }

  .article-actions .secondary-button {
    flex: 1 1 auto;
  }

  .search-dialog {
    width: calc(100% - 1rem);
    margin-top: 0.5rem;
  }

  .search-field {
    padding: 0 0.75rem;
  }

  .search-field > kbd,
  .search-help {
    display: none;
  }

  .source-panel {
    padding: 1.5rem;
  }
}

@media (hover: none) {
  .heading-anchor {
    opacity: 1;
  }
}

@media print {
  .site-header,
  .sidebar,
  .page-toc,
  .mobile-toc,
  .article-actions,
  .article-pagination,
  .toast {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .main-content {
    padding: 0;
  }

  .article {
    width: 100%;
  }

  .doc-content {
    color: #222;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
