/* Documentation reading layout on the website identity.
   Every docs page loads assets/site.css first and renders as
   <body class="storefront docs-site">, so colours, fonts, focus rings, the
   masthead (.site-header) and footer (.site-footer) come from the storefront
   tokens there. This file adds only what documentation needs: the guide
   tree, the article column and the reading components. The docs navigation
   swaps article content without replacing <head>, so every swap-capable page
   must load exactly these two stylesheets. */

.docs-site {
  --doc-pad: 20px;
  --doc-tree: 248px;
  --doc-ink: #494949;
  --doc-faint: #767676;
  --doc-border: #c8c8c8;
  --doc-code-bg: #222222;
  --doc-code-line: #616161;
  --doc-code-text: #e7e7e7;
  --doc-focus: #5e5e5e;
}
/* The masthead is exactly the website's (.site-header in site.css); the docs
   content below it shares its width, so the guide tree lines up with the brand. */
.docs-site .doc-main { display: block; min-width: 0; }
.docs-site .doc { display: grid; grid-template-columns: minmax(0, 1fr); max-width: calc(var(--site-width) + 2 * var(--doc-pad)); margin-inline: auto; padding: 0 var(--doc-pad); }

/* Breadcrumbs and edition label */
.docs-site .doc-topline { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 24px; padding: 16px 0 12px; border-bottom: 1px solid var(--site-line); font-size: 11px; font-weight: 600; line-height: 1.6; letter-spacing: .08em; color: var(--site-muted); }
.docs-site .doc-topline .crumbs { min-width: 0; overflow-wrap: anywhere; }
.docs-site .doc-topline .crumbs span { margin: 0 7px; color: var(--doc-faint); font-weight: 400; }
.docs-site .doc-topline a { color: var(--site-link); text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; }
.docs-site .doc-topline a:hover { text-decoration-color: currentColor; }
.docs-site .doc-tag { min-width: 0; overflow-wrap: anywhere; }

/* The guide tree. Narrow screens get it behind a native disclosure, which
   works without JavaScript; docs-nav.js opens it on wide screens. */
.docs-site .toc-box { margin: 14px 0 0; border: 1px solid var(--site-line); border-radius: 3px; background: var(--site-panel); }
.docs-site .toc-box > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 0 14px; cursor: pointer; list-style: none; font-size: 14px; font-weight: 600; color: var(--site-text); }
.docs-site .toc-box > summary::-webkit-details-marker { display: none; }
.docs-site .toc-box > summary::after { content: ""; flex: 0 0 auto; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.docs-site .toc-box[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
.docs-site .toc-box[open] > summary { border-bottom: 1px solid var(--site-line); }
.docs-site .toc-box > summary:focus-visible { outline: 2px solid var(--doc-focus); outline-offset: 2px; }
.docs-site .toc { max-height: min(70vh, 640px); overflow-y: auto; overscroll-behavior: contain; padding: 14px 10px 18px 14px; background: #fff; border-radius: 0 0 3px 3px; }
.docs-site .toc .k { margin: 0 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .1em; color: var(--site-muted); }
.docs-site .toc .g { margin: 20px 0 4px; font-size: 11px; font-weight: 600; line-height: 1.5; letter-spacing: .08em; color: var(--site-muted); }
.docs-site .toc .row { display: flex; align-items: stretch; }
.docs-site .toc .row a { flex: 1 1 auto; min-width: 0; }
.docs-site .toc a { display: block; padding: 5px 8px 5px 12px; border-left: 1px solid var(--site-line); font-size: 13.5px; line-height: 1.4; color: var(--doc-ink); text-decoration: none; overflow-wrap: anywhere; transition: color .15s, border-color .15s, background-color .15s; }
.docs-site .toc a.l1 { padding-left: 22px; }
.docs-site .toc a.l2 { padding-left: 34px; font-size: 13px; }
.docs-site .toc a:hover { color: var(--site-text); border-left-color: #999999; text-decoration: underline; text-decoration-color: #999999; }
.docs-site .toc a:focus-visible, .docs-site .toc .tg:focus-visible { outline: 2px solid var(--doc-focus); outline-offset: -2px; }
.docs-site .toc a[aria-current] { color: var(--site-text); font-weight: 600; background: var(--site-panel); border-left: 3px solid var(--site-red); }
.docs-site .toc a.l0[aria-current] { padding-left: 10px; }
.docs-site .toc a.l1[aria-current] { padding-left: 20px; }
.docs-site .toc a.l2[aria-current] { padding-left: 32px; }
.docs-site .toc .tg { position: relative; flex: 0 0 auto; width: 32px; min-height: 30px; margin: 0; padding: 0; border: 0; background: none; cursor: pointer; color: var(--site-muted); }
.docs-site .toc .tg::before { content: ""; position: absolute; left: 12px; top: 50%; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-70%) rotate(-45deg); transition: transform .25s; }
.docs-site .toc .tg[aria-expanded="true"]::before { transform: translateY(-70%) rotate(45deg); }
.docs-site .toc .tg:hover { color: var(--site-text); }
.docs-site .toc .secs, .docs-site .toc .sub { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .28s cubic-bezier(.4, 0, .2, 1); }
.docs-site .toc .secs[data-open], .docs-site .toc .sub[data-open] { grid-template-rows: 1fr; }
.docs-site .toc .secs > div, .docs-site .toc .sub > div { overflow: hidden; min-height: 0; }
/* Folded links leave the tab order once the fold has finished. */
.docs-site .toc .secs:not([data-open]) > div, .docs-site .toc .sub:not([data-open]) > div { visibility: hidden; transition: visibility 0s linear .28s; }
.docs-site .toc .secs[data-open] > div { padding: 2px 0 4px; }
.docs-site .toc a.s { padding-top: 3px; padding-bottom: 3px; font-size: 12.5px; color: var(--site-muted); }
.docs-site .toc a.s::before { content: ""; display: inline-block; width: 6px; height: 1px; margin: 0 6px 4px 0; background: var(--doc-faint); transition: background-color .15s, width .15s; }
.docs-site .toc a.s.active { color: var(--site-text); font-weight: 600; }
.docs-site .toc a.s.active::before { width: 10px; height: 2px; background: var(--site-red); }
.docs-site .toc a.s1 { padding-left: 34px; }
.docs-site .toc a.s2 { padding-left: 46px; }
.docs-site .toc a.s3 { padding-left: 58px; }
.docs-site .toc .experimental-badge { display: inline-block; margin-left: 6px; padding: 1px 5px; border: 1px solid #b0b0b0; border-radius: 2px; background: #f2f2f2; color: var(--site-link); font-size: 10px; font-weight: 600; line-height: 1.4; letter-spacing: .02em; vertical-align: middle; }

/* Article column */
.docs-site .article { min-width: 0; }
.docs-site .article:focus { outline: none; }
.docs-site .body { min-width: 0; max-width: 1040px; padding-top: 28px; transition: opacity .18s ease; }
.docs-site .body.leaving { opacity: 0; }
.docs-site .body .eyebrow { margin: 0 0 10px; }
.docs-site .body h1 { margin: 0 0 14px; max-width: 30ch; font-size: clamp(30px, 3vw, 38px); line-height: 1.2; overflow-wrap: break-word; }
.docs-site .body h1:focus { outline: none; }
.docs-site .body .rule { width: 32px; height: 2px; margin: 0 0 20px; background: var(--site-red); }
.docs-site .body .lede { max-width: 68ch; margin: 0 0 14px; font-size: 17px; line-height: 1.65; color: #4c4c4c; text-wrap: pretty; }
.docs-site .body .lede + .lede { font-size: 15.5px; color: var(--site-muted); }
.docs-site .body h2 { max-width: 40ch; margin: 52px 0 12px; font-size: clamp(24px, 2.3vw, 28px); overflow-wrap: break-word; }
.docs-site .body h3 { margin: 30px 0 8px; font-size: 18px; overflow-wrap: break-word; }
.docs-site .body h4 { margin: 24px 0 6px; font-family: var(--site-mono); font-size: 14px; font-weight: 600; letter-spacing: 0; overflow-wrap: anywhere; }
.docs-site .body p, .docs-site .body li { font-size: 15.5px; line-height: 1.7; overflow-wrap: break-word; }
.docs-site .body p { max-width: 72ch; margin: 0 0 14px; text-wrap: pretty; }
.docs-site .body ul, .docs-site .body ol { max-width: 72ch; margin: 0 0 16px; padding-left: 24px; }
.docs-site .body li { margin: 4px 0; }
.docs-site .body li ul, .docs-site .body li ol { margin: 4px 0 0; }
.docs-site .body li::marker { color: var(--doc-faint); }
.docs-site .body strong { font-weight: 600; color: var(--site-text); }
.docs-site .body a { color: var(--site-link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.docs-site .body a:hover { color: #343434; text-decoration-thickness: 2px; }

/* Code */
.docs-site .body code, .docs-site .body kbd { font-family: var(--site-mono); font-size: .88em; }
.docs-site .body code { padding: .08em .35em; border: 1px solid var(--site-line); border-radius: 2px; background: #f1f1f1; color: #2b2b2b; overflow-wrap: anywhere; }
.docs-site .body kbd { padding: .1em .45em; border: 1px solid #bfbfbf; border-bottom-width: 2px; border-radius: 3px; background: #fff; color: var(--site-text); white-space: nowrap; }
.docs-site .body pre { margin: 0 0 18px; padding: 14px 16px; overflow-x: auto; border: 1px solid var(--doc-code-line); border-radius: 3px; background: var(--doc-code-bg); color: var(--doc-code-text); font-family: var(--site-mono); font-size: 13px; line-height: 1.6; tab-size: 4; scrollbar-width: thin; scrollbar-color: var(--doc-code-line) transparent; }
.docs-site .body pre code { padding: 0; border: 0; background: none; color: inherit; font-size: inherit; white-space: pre; overflow-wrap: normal; }
.docs-site .body pre .c { color: #b0b0b0; font-style: italic; }
.docs-site .body pre .s { color: #c7c7c7; }
.docs-site .body pre .k { color: #b9b9b9; }
.docs-site .body pre .t { color: #c5c5c5; }
.docs-site .body pre .n { color: #b6b6b6; }
.docs-site .body pre .p { color: #b2b2b2; }
.docs-site .body pre .f { color: #f3f3f3; }
.docs-site .body pre:focus-visible, .docs-site .body .scroll:focus-visible { outline: 2px solid var(--doc-focus); outline-offset: 2px; }

/* Figures keep their pixels and aspect ratio; only the frame is themed. */
.docs-site .body figure { margin: 20px 0 28px; }
.docs-site .body figure img, .docs-site .body figure video { display: block; width: 100%; height: auto; border: 1px solid var(--doc-border); border-radius: 3px; background: #1c1c1c; }
.docs-site .body figure.narrow { max-width: 520px; }
.docs-site .body figure.narrow img { width: auto; max-width: 100%; }
.docs-site .body figure.tall { max-width: 300px; }
.docs-site .body .pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), max-content)); gap: 24px; margin: 20px 0 28px; align-items: start; }
.docs-site .body .pair figure { margin: 0; }
.docs-site .body figcaption { margin-top: 8px; font-size: 11.5px; line-height: 1.6; letter-spacing: .04em; color: var(--site-muted); }

/* Tables scroll inside their own frame. */
.docs-site .body .scroll { margin: 14px 0 24px; overflow-x: auto; border: 1px solid var(--site-line); border-radius: 3px; scrollbar-width: thin; scrollbar-color: #bfbfbf transparent; }
.docs-site .body .table { width: 100%; margin: 0; border-collapse: collapse; font-size: 14px; }
.docs-site .body .table th { padding: 9px 14px; border-bottom: 1px solid var(--site-line); background: var(--site-panel); color: var(--doc-ink); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-align: left; vertical-align: bottom; }
.docs-site .body .table td { padding: 10px 14px; border-bottom: 1px solid var(--site-line); color: var(--site-text); line-height: 1.55; vertical-align: top; }
.docs-site .body .table tr:last-child td { border-bottom: 0; }
.docs-site .body .table td:first-child { min-width: 9em; font-weight: 500; }
.docs-site .body .table code { white-space: nowrap; overflow-wrap: normal; }
/* Long DWARF paths and hashes must stay within the reference-table scroller. */
.docs-site .body .trace-domain-table td code { white-space: normal; overflow-wrap: anywhere; }

/* Notes keep their Check / Needs / Note / Warning labels from the text. */
.docs-site .body .note { max-width: 72ch; margin: 20px 0 24px; padding: 12px 16px; border: 1px solid var(--site-line); border-left: 3px solid var(--site-link); border-radius: 0 3px 3px 0; background: var(--site-panel); }
.docs-site .body .note p { margin: 0; }
.docs-site .body .note p + p { margin-top: 8px; }
.docs-site .body .steps { counter-reset: s; max-width: 72ch; margin: 0 0 18px; padding: 0; list-style: none; }
.docs-site .body .steps li { counter-increment: s; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; margin: 0; padding: 8px 0; border-top: 1px solid var(--site-line); }
.docs-site .body .steps li::before { content: counter(s); padding-top: 3px; font-family: var(--site-mono); font-size: 12px; color: var(--site-red); }

/* Next steps at the end of an article */
.docs-site .body .next { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--site-line); }
.docs-site .body .next a { display: inline-flex; align-items: center; min-height: 44px; padding: 10px 16px; border: 1px solid #b5b5b5; border-radius: 3px; background: #fff; color: #414141; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-decoration: none; transition: background-color .16s, border-color .16s; }
.docs-site .body .next a:hover { background: #ececec; border-color: #838383; color: #383838; }
.docs-site .body .next a.primary { background: #474747; border-color: #474747; color: #fff; }
.docs-site .body .next a.primary:hover { background: #343434; border-color: #343434; }

/* Guide chooser (docs/index.html) */
.docs-site .body .guide-heading { margin: 40px 0 14px; font-size: 22px; }
.docs-site .body .guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.docs-site .body a.guide-card { display: flex; flex-direction: column; min-width: 0; padding: 22px; border: 1px solid var(--site-line); border-radius: 3px; background: #fff; color: var(--site-text); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.docs-site .body a.guide-card:hover { border-color: #999999; box-shadow: inset 0 -2px 0 #999999; color: var(--site-text); }
.docs-site .body a.guide-card:hover h3 { text-decoration: underline; text-underline-offset: 4px; }
.docs-site .body a.guide-card:focus-visible { outline: 2px solid var(--doc-focus); outline-offset: 3px; }
.docs-site .body .guide-card .guide-kind { font-size: 11px; font-weight: 600; line-height: 1.5; letter-spacing: .08em; text-transform: uppercase; color: var(--site-muted); }
.docs-site .body .guide-card h3 { margin: 8px 0; font-size: 20px; color: var(--site-text); }
.docs-site .body .guide-card p { margin: 0 0 18px; font-size: 14.5px; line-height: 1.6; color: var(--site-muted); }
.docs-site .body .guide-card .guide-open { display: flex; justify-content: space-between; gap: 12px; margin-top: auto; font-size: 13px; font-weight: 600; color: var(--site-link); }

/* Footer: the shared site footer, at the end of the article. */
.docs-site .article > .site-footer { margin: 80px calc(var(--doc-pad) * -1) 0; width: auto; }
.docs-site .site-footer .footer-legal { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.docs-site .site-footer .footer-legal a { font-size: 11px; }

/* Wide screens: the tree and the article scroll separately below the masthead. */
@media (min-width: 1100px) {
  /* The page itself does not scroll here (the article does), so keep the
     page scrollbar's gutter: the masthead then centres in the same width as
     on the website's scrolling pages. */
  html:has(> body.docs-site) { scrollbar-gutter: stable; }
  .docs-site { --doc-pad: 40px; display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
  .docs-site > .site-header { flex: 0 0 auto; }
  .docs-site > .doc-main { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
  .docs-site .doc { flex: 1 1 auto; min-height: 0; width: 100%; grid-template-columns: var(--doc-tree) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); column-gap: 48px; padding: 0 0 0 var(--doc-pad); }
  .docs-site .doc-topline { grid-column: 1 / -1; grid-row: 1; margin-right: var(--doc-pad); }
  .docs-site .toc-box { grid-column: 1; grid-row: 2; min-height: 0; margin: 0; padding: 24px 4px 32px 0; overflow-y: auto; overscroll-behavior: contain; border: 0; border-radius: 0; background: none; scrollbar-width: thin; scrollbar-color: #bfbfbf transparent; }
  .docs-site .toc-box[open] > summary { display: none; }
  .docs-site .toc { max-height: none; overflow: visible; padding: 0; background: none; border-radius: 0; }
  .docs-site .article { grid-column: 2; grid-row: 2; min-height: 0; padding-right: var(--doc-pad); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #bfbfbf transparent; }
  .docs-site .article > .site-footer { margin-left: 0; }
}
/* Browsers that can style the disclosure show the tree on wide screens even
   before (or without) JavaScript. */
@supports selector(::details-content) {
  @media (min-width: 1100px) {
    .docs-site .toc-box > summary { display: none; }
    .docs-site .toc-box::details-content { content-visibility: visible; }
  }
}
@media (max-width: 720px) {
  .docs-site .body .guide-grid { grid-template-columns: minmax(0, 1fr); }
  .docs-site .body a.guide-card { padding: 20px; }
  .docs-site .body h2 { margin-top: 44px; }
  /* Keep register names and explanations readable inside the existing scroller. */
  .docs-site .body .trace-domain-table { min-width: 560px; }
}
@media (prefers-reduced-motion: reduce) {
  .docs-site .toc .secs, .docs-site .toc .sub, .docs-site .toc .tg::before, .docs-site .toc a, .docs-site .body, .docs-site .body a.guide-card { transition: none; }
  .docs-site .toc .secs:not([data-open]) > div, .docs-site .toc .sub:not([data-open]) > div { transition: none; }
}
