/* The documentation at /docs/ (scripts/docs.ts): a menu of pages beside the
   page on a wide screen, above it on a phone, in the landing page's colours
   and type (landing.css holds the tokens, the bar and the footer). */

.docs-home{margin-right:auto;font:800 16px/1 var(--round);color:var(--ink-2);text-decoration:none}
.docs-home:hover{color:var(--ink)}
.bar .docs-home:focus-visible{outline:3px solid var(--cyan);outline-offset:4px;border-radius:8px}

.docs{display:grid;grid-template-columns:240px minmax(0,1fr);gap:clamp(24px,4vw,56px);
  width:min(1180px,calc(100% - 2 * clamp(16px,4vw,40px)));margin:clamp(12px,3vh,32px) auto 72px;align-items:start}

/* The menu. */
.docs-nav{position:sticky;top:84px;max-height:calc(100vh - 100px);overflow:auto;padding:4px 4px 16px 0}
.docs-nav ul{list-style:none}
.docs-nav > ul > li + li{margin-top:22px}
.docs-nav .part{margin-bottom:6px;font:800 13px/1.2 var(--round);letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
:lang(ja) .docs-nav .part{letter-spacing:.02em}
.docs-nav a{display:block;padding:6px 10px;border-radius:10px;color:var(--ink-2);text-decoration:none;font:600 15.5px/1.35 var(--round)}
.docs-nav a:hover{background:var(--panel);color:var(--ink)}
.docs-nav a[aria-current="page"]{background:var(--panel);color:var(--yellow);box-shadow:inset 3px 0 0 var(--yellow)}
.docs-menu{display:none}

/* The page. */
/* landing.css centres a <main>'s children as a column; the page is a block. */
.docs-main{display:block;min-width:0;max-width:780px}
.doc h1{font:900 clamp(34px,5vw,52px)/1.04 var(--display);letter-spacing:-.02em;text-shadow:0 .07em 0 var(--drop)}
.doc h1 + p,.doc .lead{margin-top:14px;font-size:18.5px;color:var(--ink)}
.doc h2{margin-top:44px;font:800 24px/1.2 var(--round);color:var(--yellow);scroll-margin-top:88px}
.doc h3{margin-top:28px;font:800 18px/1.3 var(--round);color:var(--ink);scroll-margin-top:88px}
.doc h4{margin-top:20px;font:700 16px/1.3 var(--round);color:var(--ink-2)}
.doc .anchor{float:left;width:1.1em;margin-left:-1.1em;color:var(--muted);text-decoration:none;opacity:0;transition:opacity .12s}
.doc :is(h2,h3):hover .anchor,.doc .anchor:focus-visible{opacity:1}
.doc p,.doc li{margin-top:12px;color:var(--ink-2)}
.doc li > p{margin-top:6px}
.doc ul,.doc ol{padding-left:1.35em}
.doc li::marker{color:var(--muted)}
.doc strong,.doc b{color:var(--ink);font-weight:600}
.doc a{color:var(--cyan);text-underline-offset:.2em}
.doc a:hover{color:var(--ink)}
.doc :not(pre) > code{padding:.1em .38em;border-radius:6px;background:var(--panel);font:500 .86em/1.4 var(--mono);color:var(--ink);overflow-wrap:anywhere}
.doc blockquote{margin-top:16px;padding:12px 16px;border-left:3px solid var(--lilac);border-radius:0 12px 12px 0;background:rgba(35,27,59,.6)}
.doc blockquote p:first-child{margin-top:0}
.doc hr{margin:36px 0;border:0;border-top:2px dashed rgba(169,139,255,.3)}

/* Code, with the copy button docs.js shows. */
.code{position:relative;margin-top:14px}
.code pre{overflow:auto;padding:14px 16px;border:2px solid var(--out);border-radius:14px;background:var(--shade);box-shadow:0 4px 0 var(--drop)}
.code code{font:500 14px/1.6 var(--mono);color:var(--ink);white-space:pre}
/* A prompt or a command's output wraps; a command to type and JSON keep their lines. */
.code code.language-text{white-space:pre-wrap;overflow-wrap:anywhere}
.code .copy{position:absolute;top:8px;right:8px;height:30px;padding:0 12px;border:2px solid var(--out);border-radius:999px;
  background:var(--panel);color:var(--ink-2);font:700 13px/1 var(--round);cursor:pointer;opacity:.85}
.code .copy:hover,.code .copy:focus-visible{opacity:1;color:var(--ink)}
.code .copy:focus-visible{outline:3px solid var(--cyan);outline-offset:2px}
/* The button never covers the command it copies. */
.code:has(.copy:not([hidden])) pre{padding-right:88px}

/* Tables scroll inside their box on a narrow screen. */
.table{margin-top:16px;overflow-x:auto;border:2px solid var(--out);border-radius:14px}
.table table{width:100%;border-collapse:collapse;font-size:15px}
.table th{background:var(--panel);color:var(--ink);font:700 14px/1.3 var(--round);text-align:left}
.table th,.table td{padding:9px 12px;vertical-align:top;border-top:1px solid rgba(169,139,255,.16);color:var(--ink-2)}
.table tr:first-child th{border-top:0}
.table td code{white-space:nowrap}
/* A column of words never narrows to a few characters: on a phone the table scrolls in its box instead. */
.table th:last-child,.table td:last-child{min-width:15em}

/* Previous and next. */
.pager{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:56px}
.pager a{display:block;padding:14px 16px;border:2px solid var(--out);border-radius:14px;background:var(--panel);text-decoration:none;
  font:700 16px/1.35 var(--round);color:var(--ink);box-shadow:0 4px 0 var(--drop)}
.pager a:hover{transform:translateY(-1px)}
.pager span{display:block;margin-bottom:4px;font:600 13px/1 var(--round);color:var(--muted)}
.pager .next{grid-column:2;text-align:right}

/* The install guide inside the documentation. */
.doc .guide-index{display:flex;flex-wrap:wrap;gap:6px 22px;margin-top:20px;font:600 16px/1.4 var(--round)}
.doc .device{scroll-margin-top:88px}
.doc .device h2 a{color:inherit;text-decoration:none}
.doc .device ol{padding-left:1.4em}

@media (max-width:860px){
  .docs{grid-template-columns:minmax(0,1fr);gap:18px}
  .docs-menu{display:inline-flex;align-items:center;gap:8px;justify-self:start;height:40px;padding:0 16px;border:2px solid var(--out);
    border-radius:999px;background:var(--panel);color:var(--ink);font:800 15px/1 var(--round);box-shadow:0 4px 0 var(--drop);cursor:pointer}
  .docs-menu::before{content:"";width:16px;height:12px;background:
    linear-gradient(var(--ink),var(--ink)) 0 0/100% 2px no-repeat,
    linear-gradient(var(--ink),var(--ink)) 0 5px/100% 2px no-repeat,
    linear-gradient(var(--ink),var(--ink)) 0 10px/100% 2px no-repeat}
  .docs-menu[hidden]{display:none}
  .docs-nav{position:static;max-height:none;padding:14px;border:2px solid var(--out);border-radius:16px;background:rgba(35,27,59,.92)}
  .docs.folded .docs-nav{display:none}
  .pager{grid-template-columns:1fr}
  .pager .next{grid-column:1}
}
/* On a phone a row is a block: the first cell, then the others under it. */
@media (max-width:640px){
  .table{overflow:visible}
  .table thead{display:none}
  .table table,.table tbody,.table tr,.table td{display:block;width:auto;min-width:0}
  .table tr{padding:10px 12px;border-top:1px solid rgba(169,139,255,.16)}
  .table tr:first-child{border-top:0}
  .table td{padding:0;border-top:0}
  .table td + td{margin-top:4px}
  .table td code{white-space:normal;overflow-wrap:anywhere}
}
@media (max-width:420px){
  .bar .docs-home{display:none}
  .doc h2{font-size:21px}
  .code code{font-size:13px}
}
