/* ============================================================================
   Docs, legal and support pages

   Loaded after base.css, which supplies the tokens, type, buttons, the pill
   nav and the footer, so these pages are the home page's system and not a
   lookalike of it. This file only adds the reading layout.

   Three columns on a wide screen, two when the contents rail will not fit,
   one on a phone where the navigation becomes a strip you swipe. Still no
   JavaScript anywhere: every hover, the reading progress and the jump-to
   highlight are CSS, so nothing here breaks the day the Content-Security-
   Policy tightens.
   ========================================================================== */

.docs { background: var(--ground); }
html:has(.docs) { scroll-padding-top: calc(var(--nav-h) + 32px); }
@media (prefers-reduced-motion: no-preference) {
  html:has(.docs) { scroll-behavior: smooth; }
}

/* ── reading progress, driven by the scroll itself ─────────────────────── */
/* A line along the bottom of the nav pill that fills as you read. Scroll-
   driven animation, not a listener: browsers without it simply show no line. */
.nav__progress { display: none; }
@supports (animation-timeline: scroll()) {
  .nav__progress {
    display: block; position: absolute; left: 22px; right: 22px; bottom: -1px; height: 2px;
    border-radius: 2px; background: var(--ink); opacity: .75;
    transform-origin: 0 50%; scale: 0 1;
    animation: read-progress linear both;
    animation-timeline: scroll(root);
  }
  @keyframes read-progress { to { scale: 1 1; } }
}
.nav--solid .nav__bar { position: relative; }

/* ── the shell ─────────────────────────────────────────────────────────── */
.docshell {
  display: grid;
  grid-template-columns: 15.5rem minmax(0, 1fr) 13.5rem;
  gap: clamp(1.5rem, 4vw, 4rem);
  max-width: 86rem;
  margin-inline: auto;
  padding: calc(var(--nav-h) + clamp(40px, 6vw, 72px)) var(--gut) clamp(80px, 9vw, 130px);
  align-items: start;
}

.docnav, .toc {
  position: sticky;
  top: calc(var(--nav-h) + 36px);
  max-height: calc(100vh - var(--nav-h) - 60px);
  overflow-y: auto;
  scrollbar-width: none;
  font-size: .9rem;
}
.docnav::-webkit-scrollbar, .toc::-webkit-scrollbar { display: none; }

/* sidebar */
.docnav__group + .docnav__group { margin-top: 1.7rem; }
.docnav__title, .toc__title {
  display: flex; align-items: center; gap: .6em;
  margin: 0 0 .6rem;
  font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3);
}
.docnav__title::before, .toc__title::before {
  content: ""; width: 1.1em; height: 2px; border-radius: 2px; background: currentColor; opacity: .55;
}
.docnav ul, .toc ul { list-style: none; margin: 0; padding: 0; }
.docnav li + li { margin-top: 2px; }
.docnav a {
  position: relative;
  display: block;
  padding: .42rem .75rem;
  margin-left: -.75rem;
  border-radius: 12px;
  color: var(--text-2);
  line-height: 1.35;
  transition: background-color .2s, color .2s, translate .35s var(--expo);
}
.docnav a:hover { background: color-mix(in oklab, var(--ink) 4.5%, transparent); color: var(--ink); translate: 2px 0; }
.docnav a.is-current {
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-1);
  translate: 0 0;
}
.docnav a.is-current::after {
  content: ""; position: absolute; right: .75rem; top: 50%; translate: 0 -50%;
  width: 6px; height: 6px; border-radius: 50%; background: var(--ink);
}

/* on this page: a track with a marker that follows the pointer */
.toc ul { position: relative; padding-left: 14px; }
.toc ul::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 1px; background: var(--line-2); }
.toc a {
  position: relative;
  display: block;
  padding: .3rem 0;
  color: var(--text-3);
  line-height: 1.35;
  transition: color .2s;
}
.toc a::before {
  content: ""; position: absolute; left: -14px; top: 50%; width: 1px; height: 0;
  background: var(--ink); translate: 0 -50%;
  transition: height .35s var(--expo);
}
.toc a:hover { color: var(--ink); }
.toc a:hover::before { height: 70%; }

/* ── the page ──────────────────────────────────────────────────────────── */
.prose {
  min-width: 0;
  max-width: 46rem;
  font-size: 1.03rem;
  line-height: 1.72;
  color: var(--ink);
}
.prose__eyebrow {
  display: inline-flex; align-items: center; gap: .7em;
  margin: 0 0 1.1rem;
  font-size: .76rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-3);
}
.prose__eyebrow::before { content: ""; width: 1.4em; height: 2px; border-radius: 2px; background: currentColor; opacity: .6; }
.prose h1 {
  font-family: var(--display);
  font-size: clamp(2.5rem, 5vw, 3.9rem);
  font-weight: 800;
  letter-spacing: -.048em;
  line-height: .98;
  margin: 0 0 1rem;
  text-wrap: balance;
}
.prose__lede {
  margin: 0 0 2.8rem;
  font-size: clamp(1.1rem, .4vw + 1rem, 1.25rem);
  line-height: 1.55;
  color: var(--text-2);
  text-wrap: pretty;
}

.prose h2, .prose h3 { position: relative; scroll-margin-top: calc(var(--nav-h) + 32px); }
.prose h2 {
  font-family: var(--display);
  font-size: clamp(1.45rem, 1.2vw + 1.1rem, 1.85rem);
  font-weight: 750;
  letter-spacing: -.035em;
  line-height: 1.15;
  margin: 3.2rem 0 .9rem;
}
.prose h3 {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 2.2rem 0 .6rem;
}
.prose h4 { font-size: 1rem; margin: 1.6rem 0 .5rem; }

/* A # appears beside a heading on hover: the link to that exact spot. */
.h-anchor {
  position: absolute; left: -1.1em; top: 0;
  padding-right: .3em;
  color: var(--line-2);
  font-weight: 600;
  text-decoration: none !important;
  opacity: 0;
  transition: opacity .2s, color .2s;
}
.prose h2:hover .h-anchor, .prose h3:hover .h-anchor, .h-anchor:focus-visible { opacity: 1; }
.h-anchor:hover { color: var(--ink); }

/* Arriving at a heading from a link lights it briefly, so the eye lands. */
.prose :is(h2, h3):target { animation: arrive 1.8s var(--expo); border-radius: 10px; }
@keyframes arrive {
  from { box-shadow: 0 0 0 10px color-mix(in oklab, var(--ink) 8%, transparent); background: color-mix(in oklab, var(--ink) 8%, transparent); }
  to { box-shadow: 0 0 0 10px transparent; background: transparent; }
}

.prose p { margin: 0 0 1.15rem; }
.prose ul, .prose ol { margin: 0 0 1.3rem; padding-left: 1.25rem; }
/* base.css resets lists for the navigation; prose wants its markers back. */
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin-bottom: .45rem; padding-left: .2rem; }
.prose ul li::marker { color: var(--line-2); }
.prose ol li::marker { color: var(--text-3); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Links in ink with a quiet underline that darkens: the orange is kept for
   the one filled button, as on the home page. */
.prose a {
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-2);
  transition: text-decoration-color .2s;
}
.prose a:hover { text-decoration-color: var(--ink); }
.prose strong, .prose b { font-weight: 650; color: var(--ink); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.6rem 0; }

.prose code {
  font-family: var(--mono);
  font-size: .86em;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .1em .36em;
}
.prose pre {
  position: relative;
  margin: 0 0 1.5rem;
  padding: 1.1rem 1.25rem;
  border-radius: var(--r);
  background: var(--ink);
  color: #E9E9EF;
  overflow-x: auto;
  line-height: 1.6;
  box-shadow: var(--shadow-1);
}
.prose pre code { background: none; border: 0; padding: 0; font-size: .85rem; color: inherit; }
.prose pre.lang-text::before, .prose pre.lang-bash::before, .prose pre.lang-powershell::before, .prose pre.lang-json::before {
  position: absolute; right: .9rem; top: .55rem;
  font-family: var(--sans); font-size: .66rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: rgb(255 255 255 / .4);
}
.prose pre.lang-text::before { content: "text"; }
.prose pre.lang-bash::before { content: "bash"; }
.prose pre.lang-powershell::before { content: "powershell"; }
.prose pre.lang-json::before { content: "json"; }

/* Wide content scrolls inside itself. The page never scrolls sideways. */
.tablewrap {
  overflow-x: auto;
  margin: 0 0 1.6rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--paper);
  box-shadow: var(--shadow-1);
}
.prose table { border-collapse: collapse; width: 100%; font-size: .93rem; line-height: 1.5; }
.prose th, .prose td { text-align: left; padding: .7rem .95rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th {
  background: color-mix(in oklab, var(--ground) 60%, var(--paper));
  font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-3); white-space: nowrap;
}
.prose tbody tr { transition: background-color .15s; }
.prose tbody tr:hover { background: color-mix(in oklab, var(--ground) 45%, var(--paper)); }
.prose tbody tr:last-child td { border-bottom: 0; }

.shot { margin: 1.8rem 0 2rem; }
.shot img, .shot video {
  display: block; width: 100%; height: auto;
  border-radius: var(--r);
  border: 1px solid rgb(22 22 26 / .08);
  box-shadow: var(--shadow-2);
  background: var(--paper);
}
.shot figcaption { margin-top: .75rem; font-size: .86rem; line-height: 1.5; color: var(--text-3); }

.callout {
  position: relative;
  margin: 0 0 1.5rem;
  padding: 1rem 1.2rem 1rem 2.6rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--paper);
  box-shadow: var(--shadow-1);
}
.callout::before {
  content: ""; position: absolute; left: 1.15rem; top: 1.5rem;
  width: 8px; height: 8px; border-radius: 50%; background: var(--ink);
}
.callout p { margin: 0; font-size: .96rem; }
/* Status colour, used as status: the one place red belongs in a docs page. */
.callout--warn {
  border-color: color-mix(in oklab, var(--danger) 28%, var(--line));
  background: color-mix(in oklab, var(--danger) 4%, var(--paper));
}
.callout--warn::before { background: var(--danger); box-shadow: 0 0 0 4px color-mix(in oklab, var(--danger) 16%, transparent); }

/* ── previous and next ─────────────────────────────────────────────────── */
.pager {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: .9rem;
  max-width: 46rem;
  margin-top: 4rem;
}
.pager__link {
  position: relative;
  display: block;
  padding: 1.05rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  transition: border-color .25s, box-shadow .35s var(--expo), translate .35s var(--expo);
}
.pager__link:hover { border-color: var(--line-2); box-shadow: var(--shadow-2); translate: 0 -2px; }
.pager__link--next { text-align: right; }
.pager__dir {
  display: inline-flex; align-items: center; gap: .45em;
  font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3);
}
.pager__link--prev .pager__dir::before, .pager__link--next .pager__dir::after {
  display: inline-block; transition: translate .35s var(--expo);
}
.pager__link--prev .pager__dir::before { content: "\2190"; }
.pager__link--next .pager__dir::after { content: "\2192"; }
.pager__link--prev:hover .pager__dir::before { translate: -3px 0; }
.pager__link--next:hover .pager__dir::after { translate: 3px 0; }
.pager__name { display: block; margin-top: .2rem; font-family: var(--display); font-size: 1.08rem; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }

/* The footer sits on paper under a ground-coloured page, so the change of
   tone is the separation, as on the home page. */
.docs .foot { background: var(--paper); }
.docs .foot__word { color: color-mix(in oklab, var(--ink) 5%, var(--paper)); }

/* ── narrower ──────────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .docshell { grid-template-columns: 14rem minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 860px) {
  .docshell { grid-template-columns: minmax(0, 1fr); gap: 1.6rem; }
  /* The sidebar becomes a strip above the page. A disclosure widget would
     need script to stay open on desktop and closed on a phone; a row that
     scrolls sideways needs nothing and is one gesture from any page. */
  .docnav {
    position: static; max-height: none;
    display: flex; gap: 1.6rem; overflow-x: auto;
    margin-inline: calc(var(--gut) * -1); padding: 0 var(--gut) .4rem;
    mask-image: linear-gradient(90deg, #000 85%, transparent);
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
  }
  .docnav__group + .docnav__group { margin-top: 0; }
  .docnav__group { flex: 0 0 auto; }
  .docnav ul { display: flex; gap: .3rem; }
  .docnav li + li { margin-top: 0; }
  .docnav a { white-space: nowrap; margin-left: 0; }
  .docnav a.is-current::after { display: none; }
  .h-anchor { display: none; }
}
