@import url("../_ebi/syntax.css");

:root {
  color-scheme: light dark;
  --page: light-dark(#fff, #222226);
  --surface: light-dark(#f3f3f5, #2e2e32);
  --text: light-dark(rgb(0 0 6 / 80%), #fff);
  --muted: light-dark(#5e5c64, #c0bfbc);
  --border: light-dark(rgb(0 0 6 / 7%), rgb(255 255 255 / 15%));
  --link: light-dark(#1a5fb4, #99c1f1);
  --selection: color-mix(in srgb, var(--link) 20%, transparent);
  --button-radius: 9px;
  --control-motion: 160ms;
  --drawer-motion: 220ms;
  font-family: Inter, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--page);
  color: var(--text);
}

@media (min-width: 700px) { :root { font-size: 18px; } }
@media (prefers-reduced-motion: reduce) {
  :root { --control-motion: 0s; --drawer-motion: 0s; }
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--link); text-underline-offset: .15em; }
a:hover { text-decoration-thickness: .14em; }
main :where(p, li, td) a:visited { color: light-dark(#613583, #dc8add); }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
:target { scroll-margin-top: max(4.5rem, calc(var(--header-height, 0px) + .5rem)); }
::selection { background: var(--selection); }
img { max-width: 100%; height: auto; }
button, input { font: inherit; }

button { border: 0; cursor: pointer; }

:where(button, .action-link, .site-brand, .site-header nav a, .site-nav a, .site-nav summary,
  .edit-link, .toc summary, .install-panel > a, .landing-card, .related a, .installation label) {
  --control-fill: color-mix(in srgb, currentColor 10%, transparent);
  --control-hover: color-mix(in srgb, currentColor 15%, transparent);
  --control-pressed: color-mix(in srgb, currentColor 30%, transparent);
  background-color: var(--control-fill);
  border-radius: var(--button-radius);
  transition: background-color var(--control-motion) ease;
  &:hover { background-color: var(--control-hover); }
  &:active { background-color: var(--control-pressed); }
  &:focus-visible { outline-offset: -2px; }
}
:where(.site-brand, .site-header nav a, .site-nav a, .site-nav summary, .edit-link, .toc summary,
  #nav-toggle, #search-toggle, .installation label) {
  --control-fill: transparent;
  --control-hover: color-mix(in srgb, currentColor 7%, transparent);
  --control-pressed: color-mix(in srgb, currentColor 16%, transparent);
}
:where(.site-header nav [aria-current], .site-nav [aria-current], #nav-toggle[aria-expanded="true"],
  #search-toggle[aria-expanded="true"]) {
  --control-fill: color-mix(in srgb, currentColor 10%, transparent);
  --control-hover: color-mix(in srgb, currentColor 13%, transparent);
}
.action-link, .install-panel > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 34px;
  padding: .3rem .95rem;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}
.install-panel > a { font-size: .85rem; }

.skip-link {
  position: fixed;
  top: .5rem;
  left: .5rem;
  transform: translateY(-150%);
  z-index: 4;
  padding: .4rem .65rem;
  background: var(--page);
}
.skip-link:focus { transform: none; }

.site {
  --sidebar-width: 15rem;
  --content-width: 46rem;
  --gutter: 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "header" "sidebar" "toolbar" "toc" "main";
  grid-template-rows: auto auto auto auto 1fr;
  min-height: 100dvh;
}
#page-content { display: contents; }

:is(body, .site) {
  --header-visible: calc(var(--header-height, 0px) - var(--header-offset, 0px));
}
:is(body, .site):has(> .site-header :focus-visible) {
  --header-visible: var(--header-height, 0px);
}
.site-header {
  --header-shadow: 0 2px 5px light-dark(rgb(0 0 6 / 12%), rgb(0 0 6 / 36%));
  --header-inset: .5rem;
  --control-height: 2.45rem;
  grid-area: header;
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  padding: var(--header-inset) .75rem var(--header-inset) var(--header-inset);
  background-color: var(--page);
  transition: background-color var(--control-motion) ease, box-shadow var(--control-motion) ease;
  font-size: .9rem;
  font-weight: 750;
}
.site-header[data-scrollable] {
  position: sticky;
  inset-block-start: calc(var(--header-visible) - var(--header-height, 0px));
}
.site > .site-header, .site-header[data-scrolled] {
  background-color: var(--surface);
  box-shadow: var(--header-shadow);
}
.site-header[data-hidden]:not(:has(:focus-visible)) { box-shadow: none; }
.site-header a { color: var(--text); text-decoration: none; }
.site-brand, .site-header nav, .site-header nav a { display: flex; align-items: center; gap: .4rem; }
.site-brand {
  --brand-icon-size: 1.8rem;
  min-height: var(--control-height);
  padding-inline: calc((var(--control-height) - var(--brand-icon-size)) / 2);
}
.site-brand .icon { width: var(--brand-icon-size); height: var(--brand-icon-size); }
.site-header nav { margin-inline-start: auto; }
.site-header nav a { min-height: var(--control-height); padding-inline: .65rem; }
#nav-toggle, #search-toggle {
  display: grid;
  place-items: center;
  width: var(--control-height);
  height: var(--control-height);
  padding: 0;
  color: var(--text);
}
#search-toggle, .sidebar-scrim { display: none; }
@media (width < 63rem) {
  .site-header:has(#nav-toggle[aria-expanded="true"]) {
    inset-block-start: 0;
  }
  body:has(#nav-toggle[aria-expanded="true"]) { overflow: hidden; }
  .site:has(> .site-header #nav-toggle:not([hidden])) > :is(.sidebar, .sidebar-scrim) {
    position: fixed;
    inset-block: var(--header-height) 0;
    visibility: hidden;
    pointer-events: none;
  }
  .site:has(> .site-header #nav-toggle:not([hidden])) > .sidebar {
    inset-inline-start: 0;
    width: min(20rem, calc(100% - 2rem));
    z-index: 2;
    transform: translateX(-100%);
    transition-property: transform, visibility;
    overflow: auto;
    overscroll-behavior: contain;
  }
  .site:has(> .site-header #nav-toggle:not([hidden])) > .sidebar:dir(rtl) { transform: translateX(100%); }
  .site:has(> .site-header #nav-toggle:not([hidden])) > .sidebar-scrim {
    display: block;
    inset-inline: 0;
    z-index: 1;
    background: rgb(0 0 6 / 35%);
    opacity: 0;
    transition-property: opacity, visibility;
  }
  .site:has(> .site-header #nav-toggle[data-interacted]) > :is(.sidebar, .sidebar-scrim) {
    transition-duration: var(--drawer-motion);
  }
  .site:has(> .site-header #nav-toggle[aria-expanded="true"]) > :is(.sidebar, .sidebar-scrim) {
    visibility: visible;
    pointer-events: auto;
  }
  .site:has(> .site-header #nav-toggle[aria-expanded="true"]) > .sidebar {
    transform: none;
    box-shadow: 0 3px 14px rgb(0 0 6 / 25%);
  }
  .site:has(> .site-header #nav-toggle[aria-expanded="true"]) > .sidebar-scrim { opacity: 1; }
}

.sidebar {
  grid-area: sidebar;
  min-width: 0;
  background: var(--surface);
  font-size: .85rem;
}
.sidebar-content { padding: 1rem; }
.site-nav ul, .toc ul { margin: 0; padding: 0; list-style: none; }
.site-nav li { margin: .08rem 0; }
.site-nav ul ul { margin-inline-start: .75rem; padding-inline-start: .45rem; border-inline-start: 1px solid var(--border); }
.site-nav .branch { position: relative; }
.site-nav .branch > a { padding-inline-end: 2.1rem; }
.site-nav summary {
  position: absolute;
  inset-block-start: 0;
  inset-inline-end: 0;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2.05rem;
  list-style: none;
  color: light-dark(#1a5fb4, #62a0ea);
  cursor: pointer;
}
.icon {
  display: block;
  width: 1rem;
  height: 1rem;
}
.icon svg { display: block; width: 100%; height: 100%; }
.icon path:not([fill="none"]) { fill: currentColor; }
.icon path[stroke]:not([stroke="none"]) { stroke: currentColor; }
.site-nav summary .icon { rotate: 90deg; }
.site-nav details[open] > summary .icon { rotate: -90deg; }
.site-nav a {
  display: block;
  padding: .4rem .45rem;
  text-decoration: none;
}
.site-nav [aria-current="page"] { font-weight: 650; }
.nav-caption {
  margin: 1.85rem 0 .52rem;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 720;
  text-transform: uppercase;
}

.nav-caption:first-child { margin-block-start: 0; }

.header-search {
  position: relative;
  flex: 0 1 12rem;
  min-width: 9rem;
}
.header-search .icon {
  position: absolute;
  inset-inline-start: calc(var(--search-inset, 0px) + .75rem);
  top: 50%;
  translate: 0 -50%;
  color: var(--muted);
  pointer-events: none;
}
.header-search input {
  width: 100%;
  height: var(--control-height);
  padding-inline: 2.25rem .75rem;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
  color: var(--text);
  font-weight: 400;
}
.header-search input:focus { outline: 2px solid var(--link); outline-offset: -2px; }
@media (width < 38rem) {
  #search-toggle { display: grid; }
  .site-header:not([data-scrollable]) .header-search { flex-basis: 100%; }
  .site-header[data-scrollable] .header-search {
    --search-inset: .45rem;
    position: absolute;
    inset: calc(100% + .35rem) .5rem auto;
    padding: var(--search-inset);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--header-shadow);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-.3rem);
  }
  #search-toggle[data-interacted] + .header-search {
    transition: opacity var(--control-motion) ease, transform var(--control-motion) ease,
      visibility 0s linear var(--control-motion);
  }
  #search-toggle[aria-expanded="true"] + .header-search {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    transition-delay: 0s;
  }
}
@media (width < 31rem) {
  .site-header nav a { width: var(--control-height); justify-content: center; padding: 0; }
  .site-header nav a > span:not(.icon) { display: none; }
}
@media (width < 21rem) {
  .brand-label { display: none; }
}
#search-results { padding-inline-start: 1.5rem; }
#search-results p { margin-top: .25rem; color: var(--muted); }

.toolbar {
  grid-area: toolbar;
  display: flex;
  justify-content: end;
  align-items: center;
  justify-self: start;
  width: 100%;
  max-width: var(--content-width);
  margin-block-start: .6rem;
  padding-inline: var(--gutter);
  color: var(--muted);
}
.edit-link {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  color: var(--text);
}
.edit-link .icon { width: 1.12rem; height: 1.12rem; }
.toc {
  grid-area: toc;
  padding: .25rem var(--gutter) 0;
  font-size: .8rem;
}
.toc summary {
  display: flex;
  align-items: center;
  gap: .35rem;
  list-style: none;
  font-weight: 700;
  cursor: pointer;
}
.site-nav summary::-webkit-details-marker,
.toc summary::-webkit-details-marker { display: none; }
.toc details[open] > summary .icon { rotate: 90deg; }
.toc li { margin-block: .25rem; }
.toc li[data-level="3"] { padding-inline-start: .65rem; }
.toc li[data-level="4"] { padding-inline-start: 1.3rem; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--link); text-decoration: underline; }
.toc a[aria-current="location"] { color: var(--link); font-weight: 650; }

main {
  grid-area: main;
  justify-self: start;
  width: 100%;
  min-width: 0;
  max-width: var(--content-width);
  padding: .25rem var(--gutter) 3rem;
  overflow-wrap: anywhere;
}
h1, h2, h3, h4 { line-height: 1.2; text-wrap: balance; }
h1 { margin: .15rem 0 1.25rem; font-size: 1.78rem; font-weight: 800; }
h2 { margin: 1.48em 0 .38em; font-size: 1.26rem; }
h3 { margin: 1.5em 0 .55em; font-size: 1.15rem; }
h2, h3, h4 { color: var(--muted); }
main :is(h2, h3) + p { margin-block-start: .4em; }
main li + li { margin-top: .3em; }
main > ul { list-style-type: circle; margin-block-end: 2.8rem; padding-inline-start: 2.2rem; }
main > ul > li + li { margin-block-start: .9rem; }
main > ul > li::marker { color: var(--muted); font-weight: 800; }
.action-link {
  min-height: 2.65rem;
  padding: .55rem .95rem;
  border-radius: 999px;
}
.action-link.primary {
  --control-fill: light-dark(#1a5fb4, #1c64c5);
  --control-hover: color-mix(in srgb, white 10%, var(--control-fill));
  --control-pressed: color-mix(in srgb, #000006 20%, var(--control-fill));
  color: white;
}

body:has(> .landing) { display: flex; flex-direction: column; min-height: 100dvh; }
.landing, .landing-footer nav {
  max-width: 79rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 3rem);
}
.landing {
  --card-accent-weight: 32%;
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  padding-block: clamp(1.25rem, 3vw, 2.5rem) 4rem;
  font-family: "Adwaita Sans", Cantarell, system-ui, sans-serif;
}
.landing-hero {
  --hero-inset: clamp(1.4rem, 3.2vw, 3rem);
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  align-items: center;
  gap: clamp(.75rem, 1.5vw, 1.5rem);
  overflow: hidden;
  border-radius: 1rem;
  background: var(--surface);
}
.hero-intro { padding: var(--hero-inset); }
.hero-heading { display: flex; align-items: center; gap: .75rem; }
.landing-hero h1 {
  margin: 0;
  padding: 0;
  font-size: clamp(1.75rem, 2.5vw, 2.65rem);
  line-height: 1.06;
  letter-spacing: -.035em;
}
.landing-hero h1 span {
  display: block;
  color: light-dark(#c64600, #ffa348);
  font-weight: 400;
}
.landing-hero p { max-width: 37ch; margin: .85rem 0 1.2rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .65rem; }
.hero-icon {
  display: block;
  flex: none;
  width: clamp(2.5rem, 8vw, 6rem);
}
.hero-preview {
  position: relative;
  align-self: stretch;
  margin-block-start: var(--hero-inset);
  margin-inline-end: clamp(0px, calc(100% - 36rem), var(--hero-inset));
  overflow: hidden;
}
.landing-screenshot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: calc(100% + 1.5rem);
  object-fit: cover;
  object-position: left top;
}
@keyframes screenshot-parallax {
  to { translate: 0 1rem; }
}
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: scroll(root)) {
    .landing-screenshot {
      animation: screenshot-parallax 1ms linear both;
      animation-timeline: scroll(root);
      animation-range: 0px 24rem;
    }
  }
}
.landing-install { scroll-margin-top: 1rem; }
.landing-install h2 { margin: 0; color: var(--text); font-size: 1.55rem; }
.landing-install > p { margin: .35rem 0 1rem; color: var(--muted); }
.installation {
  --switcher-height: 2.65rem;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(5, minmax(min-content, 1fr));
  row-gap: .7rem;
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.installation::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  z-index: -1;
  height: var(--switcher-height);
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
}
.installation input {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
}
.installation label {
  display: grid;
  grid-row: 1;
  place-items: center;
  min-height: calc(var(--switcher-height) - .4rem);
  margin: .2rem;
  padding-inline: .2rem;
  border-radius: 999px;
  font-size: clamp(.7rem, 2.5vw, .95rem);
  font-weight: 700;
  cursor: pointer;
}
.installation input:checked + label {
  --control-fill: light-dark(#fff, rgb(255 255 255 / 20%));
  --control-hover: color-mix(in srgb, currentColor 7%, var(--control-fill));
  --control-pressed: color-mix(in srgb, currentColor 16%, var(--control-fill));
  box-shadow: 0 1px 3px 1px rgb(0 0 6 / 7%), 0 2px 6px 2px rgb(0 0 6 / 3%);
}
.installation input:focus-visible + label { outline: 2px solid var(--link); outline-offset: -2px; }
.install-panel {
  display: none;
  grid-area: 2 / 1 / 3 / -1;
  gap: .8rem;
  padding: 1rem;
  border-radius: 12px;
  background: var(--surface);
}
.installation input:checked + label + .install-panel { display: grid; }
.install-panel :is(p, pre) { margin: 0; }
.install-panel pre { background: var(--page); white-space: pre-wrap; overflow-wrap: anywhere; }
.install-panel > a { justify-self: start; }
.landing-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.landing-card:any-link {
  --card-color: light-dark(#dc8add, #613583);
  --control-fill: color-mix(in srgb, var(--surface), var(--card-color) var(--card-accent-weight));
  --control-hover: color-mix(in srgb, var(--control-fill), var(--card-color) 18%);
  --control-pressed: color-mix(in srgb, var(--control-fill), var(--card-color) 28%);
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 6rem;
  padding: clamp(.9rem, 2vw, 1.4rem);
  border-radius: 12px;
  color: var(--text);
  font-size: clamp(1.05rem, 1.75vw, 1.25rem);
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}
.landing-card + .landing-card { --card-color: light-dark(#99c1f1, #1a5fb4); }
.landing-card .icon {
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  margin-inline-start: auto;
}
.landing-footer {
  margin-block-start: auto;
  background: var(--surface);
}
.landing-footer nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
  gap: 1.5rem;
  padding-block: clamp(2rem, 4vw, 3rem);
  font-size: .9rem;
}
.landing-footer h2 { margin: 0 0 .55rem; color: var(--text); font-size: 1rem; }
.landing-footer ul { display: grid; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.landing-footer a { color: var(--muted); text-decoration: none; }
.landing-footer a:hover { text-decoration: underline; }
@media (prefers-color-scheme: light) {
  .landing { --card-accent-weight: 20%; }
  .site .ebi-editor { --ebi-view: var(--surface); }
}
@media (width < 56rem) {
  .landing-hero { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .hero-preview { aspect-ratio: 12 / 5; margin: 0 var(--hero-inset); }
  .landing-screenshot { height: auto; }
}
@media (width < 40rem) {
  .landing-links { grid-template-columns: minmax(0, 1fr); }
}

.action-icon { width: 1em; height: 1em; vertical-align: -.12em; }
@media (prefers-color-scheme: dark) {
  .action-icon { filter: invert(1); }
}

pre {
  overflow: auto;
  padding: .85rem 1rem;
  border-radius: 12px;
  background: var(--surface);
  font-size: .85em;
  tab-size: 4;
}
.code-block {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
  margin-block: .85rem;
  border-radius: 12px;
  background: var(--surface);
}
.code-block > pre { margin: 0; padding-inline-end: .5rem; background: transparent; }
.install-panel > .code-block, .code-comparison figure > .code-block { margin: 0; }
.install-panel > .code-block { background: var(--page); }
.copy-code {
  position: relative;
  z-index: 1;
}
.code-block > .copy-code {
  position: static;
  align-self: start;
  margin: .45rem;
  margin-inline-start: 0;
}
.code-block[data-single-line] > .copy-code { align-self: center; }
.ebi-editor > .copy-code {
  position: absolute;
  inset-block-start: .45rem;
  inset-inline-end: 1rem;
}
.copy-code button {
  --control-fill: light-dark(#e9e9ed, #45454b);
  --control-hover: color-mix(in srgb, currentColor 9%, var(--control-fill));
  --control-pressed: color-mix(in srgb, currentColor 18%, var(--control-fill));
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  color: var(--text);
}
.copy-code-status {
  position: absolute;
  inset-block-end: calc(100% + .3rem);
  inset-inline-end: 0;
  padding: .25rem .55rem;
  border-radius: var(--button-radius);
  background: light-dark(#fff, #36363a);
  color: var(--text);
  box-shadow: 0 2px 5px rgb(0 0 6 / 15%);
  font-size: .75rem;
  white-space: nowrap;
  pointer-events: none;
}
.code-block > .copy-code .copy-code-status { inset-inline-end: .45rem; }
.copy-code-status:empty { opacity: 0; }
.syntax-prompt::before {
  content: "$ ";
  color: var(--muted);
  user-select: none;
}
code { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
:not(pre) > code, kbd, .guilabel {
  border-radius: 6px;
  padding: .1em .35em;
  background: color-mix(in srgb, currentColor 8%, transparent);
  font-size: .88em;
}
kbd, .guilabel { display: inline-block; font-family: inherit; font-weight: 650; line-height: 1.35; }
.guilabel { border-radius: 8px; padding-inline: .48em; }

.table-scroll { margin: 1rem 0; }
td img:not(.action-icon) { max-width: none; }
[data-page="editor/kdenlive-import"] table:has(th:nth-child(3)) :is(th, td):nth-child(2) { white-space: nowrap; }

.code-comparison {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 1rem;
  margin-block: 1rem;
}
.code-comparison figure {
  display: grid;
  grid-template-rows: auto 1fr;
  min-inline-size: 0;
  margin: 0;
}
.code-comparison figcaption {
  margin-block-end: .35rem;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 650;
}
.code-comparison pre { min-inline-size: 0; margin: 0; }

.related { display: flex; gap: .75rem; margin-top: 2.5rem; }
.related a {
  display: flex;
  flex: 0 1 calc((100% - .75rem) / 2);
  align-items: center;
  gap: .55rem;
  padding: .65rem 1rem;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}
.related .icon { flex: none; color: var(--muted); }
.related a[rel="prev"] .icon { rotate: 180deg; }
.related a[rel="next"] { flex-direction: row-reverse; margin-inline-start: auto; text-align: end; }
.related small { display: block; color: var(--muted); font-weight: 550; }

@media (min-width: 63rem) {
  .site {
    grid-template-columns: max(var(--sidebar-width), calc(50% - 18.5rem)) minmax(0, 1fr);
    grid-template-areas: "header header" "sidebar toolbar" "sidebar toc" "sidebar main";
    grid-template-rows: auto auto auto 1fr;
  }
  #nav-toggle { display: none; }
  .sidebar {
    position: sticky;
    top: var(--header-visible);
    contain: size;
    max-height: calc(100dvh - var(--header-visible));
    overflow: auto;
  }
  .sidebar-content {
    width: var(--sidebar-width);
    max-width: 100%;
    margin-inline-start: auto;
  }
}

@media (min-width: 82rem) {
  .site {
    --gutter: 3rem;
    grid-template-columns: max(var(--sidebar-width), calc(50% - 26rem)) minmax(0, var(--content-width)) minmax(0, 1fr);
    grid-template-areas: "header header header" "sidebar main toc";
    grid-template-rows: auto 1fr;
  }
  main { padding-block-start: 1.55rem; }
  h1 { padding-inline-end: 2.25rem; }
  .toolbar { grid-area: main; align-self: start; margin-block-start: .8rem; pointer-events: none; z-index: 1; }
  .toolbar .edit-link { pointer-events: auto; }
  .toc {
    position: sticky;
    top: calc(var(--header-visible) + 1rem);
    max-height: calc(100dvh - var(--header-visible) - 1rem);
    overflow: auto;
    align-self: start;
    margin: 1.7rem 0 0;
    padding: 0;
    max-width: var(--sidebar-width);
  }
  .toc summary { padding-inline-start: 1.5rem; font-size: .65rem; color: var(--muted); text-transform: uppercase; font-weight: 500; }
  .toc nav { margin-block-start: .45rem; padding-inline-start: 1.5rem; border-inline-start: 1px solid var(--border); }
}
