html,
body {
  font-size: 16px;
  line-height: 1.5;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 0;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 48%, transparent);
  outline-offset: 3px;
}

.detail-brand {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  margin-bottom: clamp(var(--space-6), 5vw, var(--space-7));
  border-radius: var(--radius-sm);
}

.detail-brand img {
  display: block;
  width: auto;
  height: clamp(2.375rem, 5vw, 3.25rem);
}

.detail-image {
  display: block;
  width: min(100%, 40rem);
  max-height: 30rem;
  margin-top: var(--space-5);
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.detail-shell {
  width: min(100%, var(--layout-max));
  margin: 0 auto;
  padding: clamp(var(--space-5), 6vw, var(--space-8)) var(--layout-gutter) var(--space-8);
}

.detail-header {
  max-width: 52rem;
  padding: 0 0 clamp(var(--space-6), 5vw, var(--space-8));
  border-bottom: 1px solid var(--border-strong);
}

.detail-header h1 {
  max-width: 20ch;
  margin: 0;
  font-size: clamp(2.25rem, 5vw, 4rem);
  font-weight: 750;
  line-height: 1.04;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.detail-lede {
  max-width: var(--layout-prose);
  margin: var(--space-5) 0 0;
  color: var(--text-muted);
  font-size: clamp(1.0625rem, 1.6vw, 1.1875rem);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, var(--layout-prose));
  gap: var(--space-7);
  padding-top: clamp(var(--space-6), 5vw, var(--space-8));
}

.detail-content,
.article-body {
  min-width: 0;
}

.article-body {
  color: var(--text);
  font-size: clamp(1rem, 1.1vw, 1.125rem);
  line-height: 1.72;
}

.article-body + .article-body {
  margin-top: var(--space-5);
}

.article-body > :first-child {
  margin-top: 0;
}

.article-body > :last-child {
  margin-bottom: 0;
}

.article-body > * + * {
  margin-top: 1.45em;
}

.article-body h2,
.article-body h3,
.article-body h4,
.article-body h5,
.article-body h6 {
  color: var(--text);
  font-weight: 720;
  line-height: 1.18;
  letter-spacing: -0.022em;
  overflow-wrap: anywhere;
  text-wrap: balance;
  scroll-margin-top: var(--space-6);
}

.article-body h2 {
  margin-top: 2.8em;
  font-size: clamp(1.55rem, 2.7vw, 2rem);
}

.article-body h3 {
  margin-top: 2.35em;
  font-size: clamp(1.25rem, 2.1vw, 1.5rem);
}

.article-body h4 {
  margin-top: 2em;
  font-size: 1.125rem;
}

.article-body h5,
.article-body h6 {
  margin-top: 1.8em;
  font-size: 1rem;
}

.article-body p {
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

.article-body a {
  color: var(--primary);
  font-weight: 650;
  text-decoration-line: underline;
  text-decoration-color: color-mix(in srgb, var(--primary) 48%, transparent);
  text-decoration-thickness: 0.09em;
  text-underline-offset: 0.16em;
  overflow-wrap: anywhere;
}

.article-body a:hover {
  color: var(--primary-hover);
  text-decoration-color: currentColor;
}

.article-body ul,
.article-body ol {
  padding-left: 1.35em;
}

.article-body li {
  padding-left: 0.25em;
}

.article-body li + li,
.article-body li > ul,
.article-body li > ol {
  margin-top: 0.5em;
}

.article-body blockquote {
  margin-right: 0;
  margin-left: 0;
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  color: var(--text-muted);
}

.article-body blockquote > :first-child {
  margin-top: 0;
}

.article-body blockquote > :last-child {
  margin-bottom: 0;
}

.article-body code {
  padding: 0.12em 0.32em;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.87em;
  overflow-wrap: anywhere;
}

.article-body pre {
  max-width: 100%;
  margin-right: 0;
  margin-left: 0;
  padding: var(--space-4);
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: #18231c;
  color: #f4f6f2;
  font-size: 0.875rem;
  line-height: 1.6;
  tab-size: 2;
}

.article-body pre code {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  overflow-wrap: normal;
}

.article-body hr {
  height: 1px;
  margin: 2.5em 0;
  border: 0;
  background: var(--border-strong);
}

.article-body figure {
  margin: 2.25em 0;
}

.article-body img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.article-body figcaption {
  margin-top: var(--space-2);
  color: var(--text-subtle);
  font-size: 0.875rem;
  line-height: 1.5;
}

.article-table {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  -webkit-overflow-scrolling: touch;
}

.article-body table {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.45;
}

.article-body th,
.article-body td {
  padding: 0.75rem var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.article-body th {
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 750;
}

.article-body tr:last-child td {
  border-bottom: 0;
}

.article-embed {
  display: flex;
  margin: 1.75em 0;
}

.article-embed a {
  display: inline-flex;
  min-height: 2.5rem;
  align-items: center;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-decoration: none;
}

.article-toc {
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  align-self: start;
  min-width: 0;
  padding: var(--space-5);
  border-top: 2px solid var(--primary);
  background: var(--surface-subtle);
}

.article-toc h2 {
  margin: 0;
  color: var(--text-subtle);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.4;
}

.article-toc ol {
  margin: var(--space-3) 0 0;
  padding: 0;
  list-style: none;
}

.article-toc li + li {
  margin-top: var(--space-2);
}

.article-toc li[class*="level-3"] {
  padding-left: var(--space-3);
}

.article-toc li[class*="level-4"] {
  padding-left: var(--space-5);
}

.article-toc a {
  display: block;
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.4;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.article-toc a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.article-toc li.is-active > a {
  font-weight: 700;
}

@media (min-width: 64rem) {
  .detail-layout:has(.article-toc) {
    grid-template-columns: minmax(0, var(--layout-prose)) minmax(12rem, 15rem);
    align-items: start;
    justify-content: space-between;
  }

  .article-toc {
    position: sticky;
    top: var(--space-6);
  }
}

@media (max-width: 63.99rem) {
  .article-toc {
    order: -1;
  }
}

@media (max-width: 40rem) {
  .detail-shell {
    padding-top: var(--space-6);
    padding-bottom: var(--space-7);
  }

  .detail-header {
    padding-bottom: var(--space-6);
  }

  .detail-layout {
    gap: var(--space-6);
    padding-top: var(--space-6);
  }

  .article-body blockquote {
    padding: var(--space-4);
  }

  .article-body pre {
    margin-right: calc(-1 * var(--space-2));
    margin-left: calc(-1 * var(--space-2));
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .article-toc {
    padding: var(--space-4);
  }
}

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