html { scroll-padding-top: 16px; }
body { padding-bottom: 42px; font-size: 15px; line-height: 1.5; }

.site-header,
.landing-shell,
.doc-shell { width: min(1120px, calc(100% - 44px)); margin-inline: auto; }

.site-header nav { flex-wrap: wrap; justify-content: flex-end; }
.site-header nav a:hover { color: var(--blue); }

/* Landing page */
.minimal-home { max-width: 820px; padding-top: 25px; }
.minimal-home h1 { margin: 0; font-size: 25px; font-weight: 500; line-height: 1.2; }
.home-intro { max-width: 680px; margin: 7px 0 22px; color: var(--muted-strong); }
.resource-list { margin: 0; padding: 0; border-top: 1px solid var(--line-strong); list-style: none; }
.resource-list li { display: grid; grid-template-columns: 190px minmax(0, 1fr) 86px; gap: 18px; align-items: baseline; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.resource-list li > a:first-child { font-weight: 600; }
.resource-list p { margin: 0; color: var(--muted); font-size: 13px; }
.raw-source { color: var(--faint); font: 10px/1.4 var(--mono); text-align: right; }

/* Rendered documents */
.doc-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 26px; padding: 28px 0 18px; border-bottom: 1px solid var(--line); }
.doc-hero h1 { margin: 0; font-size: 31px; font-weight: 500; letter-spacing: -.015em; line-height: 1.15; }
.doc-summary { max-width: 730px; margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.doc-actions { display: flex; align-items: center; gap: 8px; }
.raw-link { padding: 5px 8px; border: 1px solid var(--line-strong); font-size: 11px; text-decoration: none; }
.raw-link:hover { border-color: var(--blue); }
.toc-toggle { display: none; padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: 0; background: var(--paper); font-size: 12px; font-variant: small-caps; letter-spacing: .3px; }

.doc-layout { display: grid; grid-template-columns: 210px minmax(0, 800px); gap: 32px; align-items: start; justify-content: center; padding-top: 20px; }
.doc-toc { position: sticky; top: 14px; max-height: calc(100vh - 28px); overflow-y: auto; padding: 0 14px 14px 0; border-right: 1px solid var(--line); scrollbar-width: thin; }
.doc-toc h2 { margin: 0 0 7px; color: var(--muted); font-size: 10px; font-variant: small-caps; font-weight: 600; letter-spacing: .45px; }
.doc-toc ol { margin: 0; padding: 0; list-style: none; }
.doc-toc li { margin: 0; }
.doc-toc a { display: block; padding: 3px 6px; border-left: 2px solid transparent; color: var(--muted); font-size: 11px; line-height: 1.25; text-decoration: none; }
.doc-toc a:hover { color: var(--blue); }
.doc-toc a.is-active { border-left-color: var(--blue); background: var(--surface-blue); color: var(--blue-dark); }

.doc-content { min-width: 0; padding-bottom: 30px; font-size: 15px; line-height: 1.6; }
.doc-preamble { margin-bottom: 15px; padding: 10px 13px; border-left: 2px solid var(--blue); background: var(--surface-blue); }
.doc-preamble > :first-child { margin-top: 0; }
.doc-preamble > :last-child { margin-bottom: 0; }
.doc-section { padding: 3px 0 22px; border-bottom: 1px solid var(--line); }
.doc-section:last-child { border-bottom: 0; }
.doc-section h2 { margin: 20px 0 9px; font-size: 22px; font-weight: 500; letter-spacing: -.01em; line-height: 1.25; }
.doc-section h3 { margin: 21px 0 6px; font-size: 17px; font-weight: 600; line-height: 1.3; }
.doc-section h4 { margin: 17px 0 5px; font-size: 14px; font-variant: small-caps; letter-spacing: .25px; }
.doc-content p { margin: 7px 0 10px; }
.doc-content ul, .doc-content ol { margin: 7px 0 12px; padding-left: 22px; }
.doc-content li { margin: 3px 0; }
.doc-content blockquote { margin: 11px 0; padding: 7px 11px; border-left: 2px solid var(--line-strong); background: var(--surface); color: var(--muted-strong); }
.doc-content blockquote p { margin: 0; }
.doc-content code { padding: 1px 3px; background: var(--surface-blue); color: var(--ink); font: .82em/1.45 var(--mono); }
.doc-content pre { position: relative; max-width: 100%; margin: 11px 0 15px; overflow-x: auto; border: 1px solid var(--line); background: var(--surface); }
.doc-content pre code { display: block; min-width: max-content; padding: 12px 14px; background: none; font-size: 11px; line-height: 1.5; }
.copy-code { position: absolute; top: 5px; right: 5px; padding: 2px 6px; border: 1px solid var(--line-strong); background: var(--paper); color: var(--muted); font-size: 9px; font-variant: small-caps; letter-spacing: .3px; }
.copy-code:hover { color: var(--blue); border-color: var(--blue); }
.doc-content table { display: block; width: max-content; max-width: 100%; margin: 11px 0 16px; overflow-x: auto; border-collapse: collapse; font-size: 12px; line-height: 1.4; }
.doc-content th { background: var(--surface); color: var(--muted-strong); font-variant: small-caps; letter-spacing: .25px; }
.doc-content th, .doc-content td { padding: 6px 8px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.doc-content strong { font-weight: 600; }
.doc-content hr { margin: 20px 0; border: 0; border-top: 1px solid var(--line); }
.toc-backdrop { position: fixed; inset: 0; z-index: 40; background: rgb(0 0 0 / .2); }
.code-shell { max-width: 900px; }
.code-document { padding-top: 9px; }
.code-document pre { margin-top: 0; }

@media (max-width: 820px) {
  .doc-layout { grid-template-columns: 185px minmax(0, 1fr); gap: 24px; }
}

@media (max-width: 650px) {
  .site-header, .landing-shell, .doc-shell { width: min(100% - 28px, 1120px); }
  .site-header { padding-top: 14px; }
  .site-title { font-size: 20px; }
  .site-header nav { gap: 8px 11px; }
  .minimal-home { padding-top: 20px; }
  .resource-list li { grid-template-columns: 1fr auto; gap: 3px 12px; }
  .resource-list p { grid-column: 1 / -1; grid-row: 2; }
  .raw-source { grid-column: 2; grid-row: 1; }
  .doc-hero { padding-top: 22px; }
  .doc-hero h1 { font-size: 26px; }
  .doc-summary { font-size: 12px; }
  .raw-link { align-self: start; }
  .toc-toggle { display: inline-block; }
  .doc-layout { display: block; padding-top: 14px; }
  .doc-toc { position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(300px, 88vw); max-height: none; padding: 18px 16px 26px; border: 0; background: var(--paper); box-shadow: 4px 0 18px rgb(0 0 0 / .14); transform: translateX(-105%); transition: transform .18s ease; }
  .doc-toc.is-open { transform: translateX(0); }
  .doc-content { font-size: 14px; }
  .doc-section h2 { font-size: 20px; }
  .doc-content table { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .doc-toc { transition: none; }
}

@media print {
  body { padding: 0; font-size: 10pt; }
  .site-header, .doc-actions, .doc-toc, .copy-code { display: none !important; }
  .doc-shell { width: 100%; }
  .doc-layout { display: block; padding: 0; }
  .doc-hero { padding-top: 0; }
  .doc-section { break-inside: avoid-page; }
  a { color: inherit; }
}
