/* Miniworld storybook: a documentation layout, menu on the left, sections on the right. */
:root {
  --bg: #ffffff; --panel: #f6f8fa; --line: #d1d9e0; --text: #1f2328; --soft: #59636e; --link: #0969da;
  --mark: #fff8c5; --ground: #a6b470; --code: #eff1f3; --side: 264px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117; --panel: #151b23; --line: #3d444d; --text: #f0f6fc; --soft: #9198a1; --link: #4493f8;
    --mark: #3a3000; --ground: #7f8c55; --code: #1c232c;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1117; --panel: #151b23; --line: #3d444d; --text: #f0f6fc; --soft: #9198a1; --link: #4493f8;
  --mark: #3a3000; --ground: #7f8c55; --code: #1c232c;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font: 0.86em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--code); padding: 0.15em 0.4em; border-radius: 6px; overflow-wrap: anywhere; }

.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.bar .brand { font-weight: 600; color: var(--text); }
.bar .sub { color: var(--soft); font-size: 14px; }
.bar .lang { margin-left: auto; font-size: 14px; }
.bar .home { font-size: 14px; }
#menu { display: none; font-size: 20px; line-height: 1; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); cursor: pointer; }

.wrap { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); max-width: 1280px; margin: 0 auto; }
.side { position: sticky; top: 56px; align-self: start; height: calc(100vh - 56px); overflow-y: auto; padding: 24px 16px 24px 24px; border-right: 1px solid var(--line); font-size: 14px; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side > ul > li { margin-bottom: 10px; }
.side a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--text); }
.side a:hover { background: var(--panel); text-decoration: none; }
.side a.top { font-weight: 600; }
.side a[aria-current="page"] { background: var(--panel); box-shadow: inset 3px 0 0 var(--link); }
.side ul ul a { padding-left: 24px; color: var(--soft); }
.side ul ul a.here { color: var(--text); font-weight: 600; }
.side .foot { margin: 24px 10px 0; color: var(--soft); font-size: 12px; }

main { min-width: 0; padding: 32px 40px 96px; max-width: 980px; }
h1 { font-size: 2em; font-weight: 600; margin: 0 0 8px; padding-bottom: 0.3em; border-bottom: 1px solid var(--line); }
h2 { font-size: 1.5em; font-weight: 600; margin: 48px 0 16px; padding-bottom: 0.3em; border-bottom: 1px solid var(--line); }
h2 small { font-size: 0.6em; font-weight: 400; color: var(--soft); border: 1px solid var(--line); border-radius: 2em; padding: 0 0.6em; vertical-align: middle; }
h2 a { color: inherit; }
h3 { font-size: 1.25em; font-weight: 600; margin: 0 0 4px; }
h3.group { font-size: 1em; margin: 24px 0 10px; }
h3.group a { color: var(--soft); }
.lead { color: var(--soft); font-size: 1.1em; margin: 12px 0 0; max-width: 46em; }
.num { display: inline-block; min-width: 1.7em; text-align: center; font-size: 0.75em; color: var(--soft); border: 1px solid var(--line); border-radius: 2em; padding: 0 0.4em; vertical-align: 0.1em; }
.anchor { opacity: 0; margin-left: 4px; color: var(--soft); font-weight: 400; }
h3:hover .anchor, .anchor:focus { opacity: 1; }
.names { margin: 0 0 14px; color: var(--soft); }

.el { margin: 0 0 40px; padding: 24px 0 0; border-top: 1px solid var(--line); }
h2 + .el { border-top: 0; padding-top: 0; }
.el:target > h3 { background: var(--mark); box-shadow: 0 0 0 6px var(--mark); border-radius: 2px; }
figure { margin: 0 0 14px; }
figcaption { color: var(--soft); font-size: 13px; margin-top: 6px; }
.ground { background: var(--ground); border-radius: 6px; }
figure.ground { padding: 16px; overflow-x: auto; border: 1px solid var(--line); }
figure.ground img { display: block; max-width: none; height: auto; }
figure.ground figcaption { color: #1f2a12; }
.swatches { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.swatches img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; }
img.px { image-rendering: pixelated; }

dl { display: grid; grid-template-columns: 11em minmax(0, 1fr); gap: 8px 16px; margin: 0; }
dt { color: var(--soft); font-size: 14px; padding-top: 2px; }
dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.tablewrap { overflow-x: auto; margin: 0 0 14px; }
table { border-collapse: collapse; font-size: 14px; }
th, td { border: 1px solid var(--line); padding: 5px 10px; text-align: left; vertical-align: top; }
th { background: var(--code); font-weight: 600; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
ul.src { margin: 0; padding-left: 1.2em; }
ul.src li { margin-bottom: 4px; }
ul.src .more { font-size: 13px; white-space: nowrap; }
ul.src.cols { columns: 2 22em; column-gap: 32px; }
ul.src.cols li { break-inside: avoid; }
.none { color: var(--soft); margin: 0; }

.filter { margin: 24px 0 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter label { font-weight: 600; font-size: 14px; }
.filter input { font: inherit; padding: 5px 12px; width: min(22em, 100%); border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); }
#count { color: var(--soft); font-size: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; color: var(--text); background: var(--bg); }
.card:hover { border-color: var(--link); text-decoration: none; }
.card .thumb { display: flex; align-items: center; justify-content: center; height: 120px; border-radius: 0; overflow: hidden; }
.card .thumb img { max-width: 92%; max-height: 104px; width: auto; height: auto; }
.card .thumb:not(.ground) img { max-width: none; max-height: none; width: 100%; height: 100%; object-fit: cover; }
.card b { font-weight: 600; font-size: 14px; padding: 8px 10px 0; }
.card b:last-child { padding-bottom: 10px; }
.card i { font-style: normal; color: var(--soft); font-size: 13px; padding: 0 10px 10px; }
.card[hidden] { display: none; }
.empty { color: var(--soft); }

a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

@media (max-width: 820px) {
  #menu { display: block; }
  .bar .sub { display: none; }
  .wrap { display: block; }
  .side { display: none; position: fixed; top: 56px; left: 0; right: 0; height: auto; max-height: calc(100vh - 56px); z-index: 4; background: var(--bg); border-right: 0; border-bottom: 1px solid var(--line); padding: 16px; }
  .side.open { display: block; }
  main { padding: 24px 16px 72px; }
  dl { grid-template-columns: 1fr; gap: 2px; }
  dd { margin-bottom: 10px; }
}
