:root {
  --focus-inner: var(--text);
  --rail-width: 280px;
  --gutter: clamp(16px, 6vw, 96px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html[data-smooth-scroll] {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg {
  max-width: 100%;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--focus-inner);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

code,
kbd,
pre,
samp {
  font-family: var(--font-mono);
}

:not(pre) > code {
  padding: 0.08em 0.35em;
  background: var(--surface);
  font-size: 0.86em;
  overflow-wrap: anywhere;
}

button {
  font: inherit;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 8px;
  z-index: 50;
  padding: 8px 12px;
  background: var(--page);
  color: var(--text);
}

.skip-link:focus {
  top: 8px;
}

.docs-frame {
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  --focus-inner: var(--rail);
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100vh;
  overflow-y: auto;
  padding: 28px 20px 24px;
  background: var(--rail);
  color: var(--rail-text);
}

.rail-brand {
  display: block;
  flex: none;
  width: 130px;
}

.rail-brand img {
  display: block;
  width: 100%;
  height: auto;
}

.rail-nav {
  display: grid;
  gap: 2px;
}

.rail-nav a {
  display: block;
  padding: 7px 12px;
  color: var(--rail-text-soft);
  font-weight: 500;
  text-decoration: none;
}

.rail-nav a:hover {
  color: var(--accent);
}

.rail-nav a[aria-current="page"] {
  background: var(--rail-active);
  color: var(--accent);
}

.toc-label {
  margin: 0 0 10px;
  padding-left: 12px;
  color: var(--rail-text-soft);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.toc-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc-list a {
  display: block;
  padding: 5px 0 5px 12px;
  border-left: 2px solid transparent;
  font-size: 0.94rem;
  text-decoration: none;
}

.rail .toc-list a {
  color: var(--rail-text-soft);
}

.rail .toc-list a:hover {
  color: var(--rail-text);
}

.rail .toc-list a[aria-current="location"] {
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.rail-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--rail-line);
  color: var(--rail-text-soft);
  font-size: 0.82rem;
}

.mode-switch {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--rail-line);
  background: transparent;
  color: var(--rail-text);
  cursor: pointer;
}

.mode-switch:hover {
  color: var(--accent);
}

.mode-switch svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mode-switch .icon-moon {
  display: var(--show-moon);
}

.mode-switch .icon-sun {
  display: var(--show-sun);
}

.docs-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.docs-main {
  flex: 1 0 auto;
  min-width: 0;
  padding: 48px var(--gutter) 96px;
}

.site-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 24px var(--gutter);
  border-top: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 0.85rem;
}

.site-foot p {
  margin: 0;
}

.site-foot a {
  color: var(--text-soft);
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border: 0;
  background: var(--button);
  color: var(--button-text);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  color: var(--button-text-hover);
}

.button svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.copy-button {
  padding: 2px 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-soft);
  font-size: 0.75rem;
  cursor: pointer;
}

.copy-button:hover {
  border-color: var(--text);
  color: var(--text);
}

.prose {
  max-width: 780px;
}

.prose > * {
  margin-top: 0;
  margin-bottom: 0;
}

.prose > * + * {
  margin-top: 16px;
}

.prose h1 {
  font-size: clamp(2.1rem, 4.2vw, 2.9rem);
}

.prose h2 {
  margin-top: 56px;
  font-size: 1.75rem;
  scroll-margin-top: 24px;
}

.prose h3 {
  margin-top: 32px;
  font-size: 1.15rem;
  scroll-margin-top: 24px;
}

.prose p,
.prose li {
  max-width: 68ch;
}

.prose ul,
.prose ol {
  padding-left: 1.25em;
}

.prose li + li {
  margin-top: 6px;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
}

.note {
  max-width: 68ch;
  padding: 12px 16px;
  background: var(--note);
  color: var(--text);
}

.note > * {
  margin: 0;
}

.note > * + * {
  margin-top: 8px;
}

.table-wrap {
  overflow-x: auto;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}

.prose th {
  padding: 8px 14px 8px 0;
  border-bottom: 1px solid var(--text);
  color: var(--text-soft);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.prose td {
  padding: 10px 14px 10px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.toc-mobile {
  display: none;
  padding: 10px 14px;
  border: 1px solid var(--line);
}

.toc-mobile summary {
  font-weight: 700;
  cursor: pointer;
}

.toc-mobile .toc-list {
  margin-top: 10px;
}

.toc-mobile .toc-list a {
  color: var(--text-soft);
}

.toc-mobile .toc-list a:hover {
  color: var(--text);
}

.toc-mobile .toc-list a[aria-current="location"] {
  border-left-color: var(--accent);
  color: var(--text);
  font-weight: 700;
}

pre {
  margin: 0;
  padding: 14px;
  overflow-x: auto;
  border: 1px solid var(--code-line);
  background: var(--code);
  color: var(--code-text);
  font-size: 0.84rem;
  line-height: 1.55;
  tab-size: 2;
}

.code-block {
  --focus-inner: var(--code);
  min-width: 0;
  border: 1px solid var(--code-line);
  background: var(--code);
  color: var(--code-text);
}

.code-block > pre {
  border: 0;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 8px 6px 14px;
  border-bottom: 1px solid var(--code-line);
}

.code-label {
  color: var(--code-text-soft);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.code-head .copy-button {
  border-color: var(--code-line);
  color: var(--code-text-soft);
}

.code-head .copy-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.landing {
  max-width: 980px;
}

.landing p {
  margin: 0;
}

.hero {
  display: grid;
  gap: 18px;
  padding: 32px 0 48px;
}

.hero h1 {
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  letter-spacing: -0.02em;
}

.hero-mark {
  box-shadow: inset 0 -0.16em 0 var(--accent);
}

.lead {
  max-width: 62ch;
  color: var(--text-soft);
  font-size: 1.2rem;
}

.door {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 32px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

.door:last-child {
  border-bottom: 1px solid var(--line);
}

.door:hover {
  border-color: var(--text);
  text-decoration: none;
}

.door:hover .button {
  color: var(--button-text-hover);
}

.door h2 {
  grid-column: 1;
  font-size: 2rem;
}

.door p {
  grid-column: 1;
  color: var(--text-soft);
}

.door .button {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.extras {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  padding-top: 32px;
}

.extra {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.extra h2 {
  font-size: 1rem;
}

.extra p {
  color: var(--text-soft);
  font-size: 0.95rem;
}

.agent-url {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.agent-url code {
  color: var(--text);
  font-size: 0.9rem;
}

@media (max-width: 960px) {
  .hero {
    padding: 16px 0 32px;
  }

  .extras {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .door {
    grid-template-columns: minmax(0, 1fr);
  }

  .door h2 {
    font-size: 1.5rem;
  }

  .door .button {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }
}

@media (max-width: 960px) {
  .docs-frame {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .rail {
    position: static;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "brand nav foot";
    align-items: center;
    gap: 12px 20px;
    height: auto;
    overflow: visible;
    padding: 12px 16px;
  }

  .rail-brand {
    grid-area: brand;
    width: 105px;
  }

  .rail-nav {
    display: flex;
    flex-wrap: wrap;
    grid-area: nav;
    justify-self: end;
    gap: 4px;
  }

  .rail-nav a {
    padding: 4px 8px;
  }

  .rail-toc,
  .rail-note {
    display: none;
  }

  .rail-foot {
    grid-area: foot;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .toc-mobile {
    display: block;
  }

  .docs-main {
    padding: 32px 16px 64px;
  }

  .site-foot {
    padding: 24px 16px;
  }
}

@media (max-width: 640px) {
  .rail {
    grid-template-areas:
      "brand . foot"
      "nav nav nav";
  }

  .rail-nav {
    justify-self: start;
    margin-left: -8px;
  }
}
