/* docs.cairnobs.org: the docs' own parts, on top of cairnobs.org's styles.css
   (copied, not changed). The masthead, the palette and the footer are the
   site's; this file lays out the contents column, the page, and the prose.
   Colours come only from the site's tokens, so both themes follow it. */

.docs-tag {
  margin-left: 10px; padding: 2px 7px; border: 1px solid var(--line-strong); border-radius: 4px;
  font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--trace-text);
}
.side-open { display: none; }
.side-open[popovertarget] .i { width: 16px; height: 16px; }

/* ---- the shell: contents beside the page ---- */
.docs-shell {
  display: grid; grid-template-columns: 272px minmax(0, 1fr);
  max-width: 1320px; margin: 0 auto; padding: 0 20px;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 48px 48px; background-position: -1px -1px;
}
.docs-body { min-width: 0; padding: 40px 0 72px 48px; }

/* The contents column. A popover that the wide layout shows in place. */
.sidebar {
  position: sticky; top: calc(var(--mast-h) + 1px); align-self: start;
  height: calc(100vh - var(--mast-h) - 1px); overflow-y: auto;
  padding: 28px 18px 28px 0; border-right: 1px solid var(--line);
  scrollbar-width: thin;
}
.sidebar[popover] { display: block; position: sticky; inset: auto; margin: 0; width: auto; border-width: 0 1px 0 0; background: transparent; color: inherit; }
.side-head { display: none; }
.side-label { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }
.side-group { margin: 0 0 6px; }
.side-group summary, .side-top {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius);
  font-weight: 700; font-size: 14.5px; color: var(--ink); cursor: pointer; list-style: none; text-decoration: none;
}
.side-group summary::-webkit-details-marker { display: none; }
.side-group summary:hover, .side-top:hover { background: var(--panel-2); }
.side-top.here { background: var(--tint); color: var(--trace-text); }
.side-glyph { display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--line); color: var(--trace-text); flex: none; }
.side-glyph .i { width: 14px; height: 14px; }
.side-group .chev { margin-left: auto; width: 14px; height: 14px; color: var(--ink-faint); transform: rotate(-90deg); transition: transform .15s; }
.side-group[open] .chev { transform: none; }
.side-group nav { display: flex; flex-direction: column; margin: 2px 0 8px 22px; padding-left: 14px; border-left: 1px solid var(--line); }
.side-item {
  position: relative; padding: 5px 10px; border-radius: 4px;
  font-size: 14px; line-height: 1.4; color: var(--ink-soft); text-decoration: none;
}
.side-item:hover { color: var(--ink); background: var(--panel-2); }
.side-item.here { color: var(--trace-text); font-weight: 700; background: var(--tint); }
.side-item.here::before { content: ""; position: absolute; left: -15px; top: 6px; bottom: 6px; width: 2px; background: var(--trace); border-radius: 1px; }
.side-foot { display: flex; flex-direction: column; gap: 4px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.side-foot a { display: flex; align-items: center; gap: 8px; padding: 5px 10px; font-size: 13.5px; color: var(--ink-soft); text-decoration: none; border-radius: 4px; }
.side-foot a:hover { color: var(--ink); background: var(--panel-2); }

/* ---- the page ---- */
.doc { max-width: 800px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-family: var(--mono); font-size: 12px; color: var(--ink-faint); margin-bottom: 14px; }
.crumbs a { color: var(--ink-soft); text-decoration: none; }
.crumbs a:hover { color: var(--trace-text); }
.doc-eyebrow { margin: 0 0 6px; font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--trace-text); }
.doc h1 { font-size: clamp(30px, 4vw, 42px); font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 14px; }
.doc-lead { font-size: 18.5px; line-height: 1.6; color: var(--ink-soft); margin: 0 0 14px; }
.doc-lead strong { color: var(--ink); }
.doc-who { margin: 0 0 12px; padding: 10px 14px; border-left: 2px solid var(--sig); background: var(--panel); border-radius: 0 var(--radius) var(--radius) 0; font-size: 14.5px; color: var(--ink-soft); }
.doc-who strong { color: var(--ink); }
.doc-meta { margin: 0 0 28px; font-family: var(--mono); font-size: 12px; color: var(--ink-faint); }
.release-note { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 18px; padding: 5px 12px 5px 6px; border: 1px solid var(--line-strong); border-radius: 999px; font-family: var(--mono); font-size: 12px; color: var(--ink-soft); background: var(--panel); }
.release-mark { width: 22px; height: 22px; }

/* Prose: what Markdown makes. */
.doc-prose { font-size: 16.5px; line-height: 1.75; color: var(--ink-soft); }
.doc-prose > :first-child { margin-top: 0; }
.doc-prose h2 { margin: 48px 0 14px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 25px; font-weight: 800; line-height: 1.2; letter-spacing: -0.01em; color: var(--ink); }
.doc-prose h3 { margin: 32px 0 10px; font-size: 19px; font-weight: 800; line-height: 1.3; color: var(--ink); }
.doc-prose h4 { margin: 24px 0 8px; font-size: 16px; font-weight: 800; color: var(--ink); }
.doc-prose p, .doc-prose ul, .doc-prose ol { margin: 0 0 16px; }
.doc-prose li { margin: 4px 0; }
.doc-prose li > p { margin: 0 0 6px; }
.doc-prose strong, .doc-prose b { color: var(--ink); font-weight: 700; }
.doc-prose a { color: var(--trace-text); text-underline-offset: 2px; }
.doc-prose a:hover { color: var(--trace-hot); }
.doc-prose hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
.doc-prose :not(pre) > code {
  padding: 1px 6px; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--ink); font-size: 0.86em; overflow-wrap: anywhere;
}
.doc-prose pre {
  position: relative; margin: 0 0 20px; padding: 16px 18px; overflow-x: auto;
  background: var(--chrome); border: 1px solid var(--line); border-left: 2px solid var(--trace); border-radius: var(--radius);
  font-size: 13.5px; line-height: 1.6; color: var(--ink);
}
.doc-prose pre code { font-size: inherit; }
.doc-prose blockquote { margin: 0 0 20px; padding: 12px 16px; border-left: 2px solid var(--sig); background: var(--panel); border-radius: 0 var(--radius) var(--radius) 0; }
.doc-prose blockquote > :last-child { margin-bottom: 0; }
.doc-prose table { width: 100%; margin: 0 0 22px; border-collapse: collapse; font-size: 14.5px; line-height: 1.55; display: block; overflow-x: auto; }
.doc-prose th { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-strong); font-family: var(--mono); font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); white-space: nowrap; }
.doc-prose td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc-prose td:first-child { color: var(--ink); }
.doc-prose td:first-child code { white-space: nowrap; }
@media (max-width: 640px) { .doc-prose td:first-child code { white-space: normal; overflow-wrap: anywhere; } }
.doc-prose tr:hover td { background: var(--tint); }
.doc-prose img { display: block; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.doc-prose figure { margin: 0 0 24px; }
.doc-prose figcaption { margin-top: 8px; font-family: var(--mono); font-size: 12px; color: var(--ink-faint); }
.doc-prose kbd { font-size: 0.8em; }

/* A note box: > **Note:** … renders as a blockquote; these classes are for
   the HTML ones. */
.callout { margin: 0 0 20px; padding: 12px 16px; border: 1px solid var(--line); border-left: 2px solid var(--trace); border-radius: var(--radius); background: var(--panel); }
.callout > :last-child { margin-bottom: 0; }

/* Previous and next. */
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 56px; }
.pn { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.pn:hover { border-color: var(--trace); box-shadow: 0 0 0 3px var(--tint); }
.pn.next { text-align: right; }
.pn .dir { font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); }
.pn strong { color: var(--ink); }
.pn small { font-size: 12.5px; color: var(--ink-faint); }

/* ---- the docs' front page ---- */
.doc-home { max-width: 960px; }
.map-head { margin: 48px 0 18px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 25px; font-weight: 800; }
.section-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.section-cards > li { padding: 16px 18px; border: 1px solid var(--line); border-top: 2px solid var(--trace); border-radius: var(--radius); background: var(--panel); }
.sc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 0 8px; font-weight: 800; color: var(--ink); }
.sc-head a { color: inherit; text-decoration: none; }
.sc-count { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--ink-faint); }
.section-cards ul { list-style: none; margin: 0; padding: 0; }
.section-cards ul a { display: block; padding: 3px 0; font-size: 14.5px; color: var(--ink-soft); text-decoration: none; }
.section-cards ul a:hover { color: var(--trace-text); }
.doors { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.doors li { margin: 0; }
.doors a { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); text-decoration: none; color: var(--ink-soft); transition: border-color .15s, box-shadow .15s; }
.doors a:hover { border-color: var(--trace); box-shadow: 0 0 0 3px var(--tint); }
.doors strong { color: var(--ink); font-size: 17px; }
.doors span { font-size: 14.5px; line-height: 1.55; }
.doors em { margin-top: auto; padding-top: 6px; font-style: normal; font-family: var(--mono); font-size: 12px; color: var(--trace-text); }

/* The footer's last line, which on the site is the cookie button. */
.foot-end { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); }

/* ---- the palette's text matches ---- */
.pl-lvl.doc { color: var(--sig); }
.pl-lvl.sect { color: var(--str); }
.palette-list mark { background: var(--tint); color: var(--trace-text); border-radius: 2px; padding: 0 1px; }

/* ---- narrow screens ---- */
@media (max-width: 1180px) {
  .btn-site { display: none; }
}
@media (max-width: 960px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); padding: 0 16px; }
  .docs-body { padding: 28px 0 56px; }
  .side-open { display: inline-flex; }
  .sidebar[popover] {
    display: none; position: fixed; inset: 0 auto 0 0; width: min(340px, 88vw); height: 100vh;
    padding: 18px; background: var(--chrome); border-right: 1px solid var(--line); box-shadow: var(--shadow-lg);
  }
  .sidebar[popover]:popover-open { display: block; }
  .sidebar::backdrop { background: var(--scrim); }
  .side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
  .side-close .i { width: 18px; height: 18px; }
  .doors { grid-template-columns: minmax(0, 1fr); }
  .prevnext { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .btn-demo span, .side-open span { display: none; }
  .docs-tag { display: none; }
  .doc-prose { font-size: 16px; }
}
