@font-face {
  font-family:"JetBrains Mono";
  src:url("/static/jetbrains-mono-regular.woff2") format("woff2");
  font-style:normal;
  font-weight:400;
  font-display:swap;
}

:root {
  --bg:#1c1d1f;
  --surf:#232426;
  --surf2:#2a2b2e;
  --bd:#35373a;
  --tx:#c8c9cc;
  --mut:#8b8d92;
  --hd:#e6e6e8;
  --vt-black:#000000;
  --vt-red:#aa0000;
  --vt-green:#00aa00;
  --vt-brown:#aa5500;
  --vt-blue:#0000aa;
  --vt-magenta:#aa00aa;
  --vt-cyan:#00aaaa;
  --vt-gray:#aaaaaa;
  --vt-dgray:#555555;
  --vt-bred:#ff5555;
  --vt-bgreen:#55ff55;
  --vt-yellow:#ffff55;
  --vt-bblue:#5555ff;
  --vt-bmagenta:#ff55ff;
  --vt-bcyan:#55ffff;
  --vt-white:#ffffff;
  --ac:var(--vt-bcyan);
  --ok:var(--vt-bgreen);
  --bad:var(--vt-bred);
  --warn:var(--vt-yellow);
  --mag:var(--vt-bmagenta);
  --ac-fg:#14181b;
  --sel:color-mix(in srgb,var(--ac) 30%,transparent);
color-scheme:dark}

* {
box-sizing:border-box}

html {
  min-height:100%;
  background-color:var(--bg);
  background-size:cover;
  background-position:bottom;
  background-repeat:no-repeat;
  background-attachment:fixed}

body {
  margin:0;
  color:var(--tx);
font:17px/1.7 "JetBrains Mono",ui-monospace,monospace;
}

a {
  color:var(--ac);
text-decoration:none}

a:hover {
text-decoration:underline}

a:focus-visible,button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,summary:focus-visible {
  outline:2px solid var(--ac);
outline-offset:2px}

[hidden] {
display:none!important}

html {
scroll-behavior:smooth}

.sprite {
  position:absolute;
  width:0;
  height:0;
overflow:hidden}

.ic {
  width:1.05em;
  height:1.05em;
  fill:none;
  stroke:currentColor;
  stroke-width:2;
  stroke-linecap:round;
  stroke-linejoin:round;
  vertical-align:-.15em;
  margin-right:.4em;
flex:none}

.top,main,footer .fwrap {
  max-width:46rem;
  margin:0 auto;
padding:1rem 1.25rem}

.error-404 {
  display:block;
  width:100%;
  height:auto;
}

.top {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:1rem;
  flex-wrap:wrap;
border-bottom:1px solid var(--bd)}

.brand {
  display:flex;
  align-items:center;
  gap:.6rem;
  color:var(--hd);
  font-weight:600;
font-size:1.1rem}

.brand:hover {
text-decoration:none}

.logo {
  height:1.8rem;
  width:auto;
  max-width:9rem;
object-fit:contain}

.top nav {
  display:flex;
  gap:1rem;
  align-items:center;
font-size:.9rem}

.top nav input[type=search] {
height:2.5rem}

.top form {
margin:0}

footer {
  border-top:1px solid var(--bd);
  margin-top:3rem;
  color:var(--mut);
font-size:.9rem}

footer p {
margin:.2rem 0}

h1,h2,h3 {
  color:var(--hd);
  line-height:1.25;
font-weight:600}

h2 {
  font-size:1.3rem;
margin:.1rem 0}

h3 {
  font-size:1.1rem;
margin:.1rem 0}

.muted {
color:var(--mut)}

.small {
font-size:.85rem}

.nowrap {
white-space:nowrap}

.item {
  padding:1.2rem 0;
border-bottom:1px solid var(--bd)}

.item p {
margin:.3rem 0}

.edit-link {
  display:inline-flex;
align-items:center}

.prose img,.featured {
  max-width:100%;
  height:auto;
}

.featured {
  display:block;
  width:100%;
  max-height:24rem;
  object-fit:cover;
margin-bottom:1.2rem}

.prose pre {
  background:var(--surf);
  border:1px solid var(--bd);
  padding:1rem;
  overflow-x:auto;
font-size:.88rem}

.prose code {
  font-family:"JetBrains Mono",ui-monospace,monospace;
font-size:.9em}

.prose :not(pre)>code {
  background:var(--surf);
padding:.1em .3em}

.prose blockquote {
  margin:1rem 0;
  padding:.4rem 1.1rem;
  background:color-mix(in srgb,var(--ac) 7%,var(--surf));
color:var(--mut)}

.prose blockquote>:first-child {
margin-top:.4rem}

.prose blockquote>:last-child {
margin-bottom:.4rem}

.prose table {
  border-collapse:collapse;
  display:block;
overflow-x:auto}

.prose hr {
  border:0;
border-top:1px solid var(--bd)}

th,td {
  border:1px solid var(--bd);
  padding:.4rem .7rem;
text-align:left}

table {
  border-collapse:collapse;
  width:100%;
font-size:.9rem}

.scroll {
overflow-x:auto}

.video {
  position:relative;
  aspect-ratio:16/9;
  margin:1.2rem 0;
background:#000}

.video iframe {
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
border:0}

.avatar {
  width:72px;
  height:72px;
  object-fit:cover;
  border-radius:50%;
  background:var(--surf2);
flex:none}

.avatar.xl {
  width:112px;
height:112px}

.avatar.sm {
  width:28px;
height:28px}

.avatar.xs {
  width:1.3em;
  height:1.3em;
  vertical-align:-.25em;
  margin-right:.3em;
display:inline-block}

.avatar.ph {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color:var(--hd);
  font-weight:600;
border:1px solid var(--bd)}

.avatar.xl.ph {
font-size:2.4rem}

.avatar.sm.ph {
font-size:.9rem}

.notice {
  border:1px solid var(--bd);
  background:var(--surf);
  padding:.5rem 1rem;
  color:var(--mut);}

.pager {
  display:flex;
  justify-content:space-between;
margin-top:2rem}

input,textarea,select,button {
  font:inherit;
  font-size:.9rem;
  color:var(--tx);
  background:var(--surf);
  border:1px solid var(--bd);
  padding:.45rem .65rem;
}

input::placeholder,textarea::placeholder {
color:var(--mut)}

button {
cursor:pointer}

button:hover {
border-color:var(--mut)}

button:disabled {
  opacity:.55;
cursor:progress}

button.link {
  border:0;
  background:none;
  color:var(--ac);
padding:0}

button.danger,.danger {
color:var(--bad)}

.btn {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:0;
  padding:.45rem .85rem;
  border:1px solid var(--bd);
  background:var(--surf);
  color:var(--tx);
  font-size:.9rem;
  line-height:1.3;
cursor:pointer}

.btn:hover {
  border-color:var(--mut);
text-decoration:none}

.btn.primary {
  background:var(--ac);
  border-color:var(--ac);
  color:var(--ac-fg);
font-weight:600}

.btn.primary:hover {
filter:brightness(1.08)}

.btn.sm {
  padding:.25rem .65rem;
font-size:.82rem}

.btn.icon {
padding:.4rem .5rem}

.btn.icon .ic {
margin:0}

.btn.busy::after {
  content:"";
  width:.9em;
  height:.9em;
  margin-left:.5rem;
  border:2px solid currentColor;
  border-right-color:transparent;
  border-radius:50%;
animation:spin .7s linear infinite}

@keyframes spin {
  to {
  transform:rotate(360deg)}

}

.stack {
  display:grid;
gap:.9rem}

.narrow {
max-width:34rem}

label,.field>label {
  display:grid;
  gap:.25rem;
  font-size:.85rem;
color:var(--mut)}

.lbl {
  display:inline-flex;
align-items:center}

fieldset {
  border:1px solid var(--bd);
  min-width:0;
padding:.6rem .8rem}

legend {
  font-size:.85rem;
  color:var(--mut);
padding:0 .3rem}

.chk {
  display:flex;
  align-items:flex-start;
  gap:.55rem;
  margin:.25rem 0;
color:var(--tx)}

.chk input {
  flex:0 0 1rem;
  width:1rem;
  height:1rem;
  margin:.28rem 0 0;
padding:0}

.chk span {
  min-width:0;
  overflow-wrap:anywhere;
line-height:1.4}

.actions {
  display:flex;
  gap:.6rem;
  align-items:center;
flex-wrap:wrap}

.menu {
position:relative}

.menu summary {
  list-style:none;
  display:flex;
  align-items:center;
  gap:.5rem;
  cursor:pointer;
  height:2.5rem;
  padding:0 .8rem 0 .5rem;
  border:1px solid var(--bd);
background:var(--surf)}

.menu summary::-webkit-details-marker {
display:none}

.menu summary:hover,.menu[open] summary {
border-color:var(--mut)}

.menu summary .ic {
  margin:0;
transition:transform .15s}

.menu[open] summary .ic {
transform:rotate(180deg)}

.uname {
  max-width:9rem;
  overflow:hidden;
  text-overflow:ellipsis;
white-space:nowrap}

.dropdown {
  position:absolute;
  right:0;
  top:calc(100% + .4rem);
  min-width:13rem;
  background:var(--surf);
  border:1px solid var(--bd);
  padding:.3rem;
  z-index:20;
box-shadow:0 8px 24px rgba(0,0,0,.35)}

.dropdown a,.dropdown button {
  display:flex;
  align-items:center;
  width:100%;
  padding:.5rem .7rem;
  border:0;
  background:none;
  color:var(--tx);
  text-align:left;
font-size:.9rem}

.dropdown a:hover,.dropdown button:hover {
  background:var(--surf2);
text-decoration:none}

.profile {
  display:flex;
  gap:1.5rem;
  align-items:flex-start;
  padding:1.5rem;
  margin:1rem 0;
  background:var(--surf);
  border:1px solid var(--bd);
}

.profile h1 {
margin:0}

.handle {
margin:0 0 .6rem}

.bio {
  margin:.3rem 0 .8rem;
white-space:pre-line}

.pf-body {
min-width:0}

.links {
  list-style:none;
  display:flex;
  flex-wrap:wrap;
  gap:.4rem 1.2rem;
  padding:0;
  margin:0;
font-size:.9rem}

.links li {
  display:flex;
  align-items:center;
overflow-wrap:anywhere}

.sect {
margin-top:2rem}

.about {
  margin:1rem 0 2rem;
  padding:1rem 1.2rem;
  border:1px solid color-mix(in srgb,var(--ac) 40%,var(--bd));
background:color-mix(in srgb,var(--ac) 7%,var(--surf))}

.about>:first-child {
margin-top:0}

.about>:last-child {
margin-bottom:0}

.share {
  display:flex;
  flex-wrap:wrap;
  gap:.4rem;
  align-items:center;
margin:.8rem 0 1.4rem}

.share .muted {
margin-right:.3rem}

.byline {
margin-top:.2rem}

.related {
  margin-top:3rem;
  padding-top:1rem;
border-top:1px solid var(--bd)}

#toast {
  position:fixed;
  left:50%;
  bottom:1.5rem;
  transform:translate(-50%,2rem);
  opacity:0;
  pointer-events:none;
  background:var(--surf2);
  border:1px solid color-mix(in srgb,var(--ok) 55%,var(--bd));
  color:var(--hd);
  padding:.6rem 1rem;
  transition:.25s;
  z-index:60;
max-width:90vw}

#toast.show {
  opacity:1;
transform:translate(-50%,0)}

#toast.bad {
  border-color:color-mix(in srgb,var(--bad) 60%,var(--bd));
background:color-mix(in srgb,var(--bad) 14%,var(--surf2))}

.avrow {
  display:flex;
  gap:1rem;
align-items:center}

.assets {
  display:grid;
gap:1rem}

.asset {
  display:grid;
gap:.4rem}

.preview-logo {
  max-height:3rem;
  max-width:12rem;
object-fit:contain}

.preview-fav {
  width:32px;
  height:32px;
object-fit:contain}

.preview-background {
  max-width:12rem;
  max-height:6rem;
object-fit:contain}

.frow {
  display:grid;
  grid-template-columns:1fr 2fr auto;
  gap:.4rem;
margin-bottom:.4rem}

.frow input {
min-width:0}

.pick {
  display:flex;
gap:.4rem}

.pick input {
  flex:1;
min-width:0}

.pill {
  padding:.15rem .7rem;
  border:1px solid var(--bd);
  border-radius:999px;
  font-size:.8rem;
color:var(--mut)}

.spacer {
flex:1}

body:has(.editor) main {
max-width:none}

body:has(.gallery) main {
max-width:72rem}

.editor {
  display:grid;
  grid-template-columns:20rem minmax(0,1fr);
  gap:1.2rem;
align-items:start}

.side {
  position:sticky;
  top:.5rem;
  max-height:calc(100vh - 1rem);
  overflow-y:auto;
padding-right:.4rem}

.side input:not([type=checkbox]),.side textarea,.side select {
width:100%}

.main-col {
  display:grid;
  gap:.8rem;
min-width:0}

.topbar {
  display:flex;
  align-items:center;
  gap:.5rem;
  flex-wrap:wrap;
  position:sticky;
  top:0;
  z-index:10;
  background:var(--bg);
padding:.4rem 0}

.featured-box {
  display:flex;
  gap:1rem;
  align-items:center;
  padding:.7rem;
  border:1px solid var(--bd);
background:var(--surf)}

.featured-box img {
  width:96px;
  height:64px;
  object-fit:cover;}

.fb-body {
  flex:1;
  display:grid;
  gap:.4rem;
min-width:0}

.mdwrap {
min-width:0}

.EasyMDEContainer .CodeMirror {
  background:var(--surf);
  color:var(--tx);
  border:1px solid var(--bd);
  border-radius:0 0 4px 4px;
font-size:.95rem}

.EasyMDEContainer .CodeMirror div.CodeMirror-cursor {
  border:0;
  width:2px;
background:var(--hd)}

.EasyMDEContainer .CodeMirror-selected {
background:var(--sel)}

.EasyMDEContainer .CodeMirror-focused .CodeMirror-selected {
background:color-mix(in srgb,var(--ac) 45%,transparent)}

.EasyMDEContainer .editor-toolbar {
  position:sticky;
  top:var(--topbar-h,3rem);
  z-index:9;
  box-shadow:0 1px 0 var(--bd);
  background:var(--surf2);
  border:1px solid var(--bd);
  border-bottom:0;
  border-radius:4px 4px 0 0;
  opacity:1;
  display:flex;
flex-wrap:wrap}

.EasyMDEContainer .editor-toolbar button {
  color:var(--tx);
  border:1px solid transparent;
  background:none;
  padding:0;
  width:30px;
height:30px}

.EasyMDEContainer .editor-toolbar button:hover,.EasyMDEContainer .editor-toolbar button.active {
  background:var(--surf);
  border-color:var(--bd);
color:var(--hd)}

.EasyMDEContainer .editor-toolbar i.separator {
  border:0;
  width:1px;
  height:1.3rem;
  margin:0 .4rem;
  background:var(--bd);
text-indent:-10px}

.EasyMDEContainer .editor-preview,.EasyMDEContainer .editor-preview-side {
  background:var(--surf);
color:var(--tx)}

.cm-s-easymde .cm-header,.cm-s-easymde .cm-strong {
color:var(--hd)}

.cm-s-easymde .cm-link,.cm-s-easymde .cm-url {
color:var(--ac)}

.cm-s-easymde .cm-comment {
  color:var(--warn);
background:none}

.cm-s-easymde .cm-quote {
color:var(--mut)}

.CodeMirror-gutters {
  background:var(--surf);
border-color:var(--bd)}

.CodeMirror-linenumber {
color:var(--mut)}

.ts-wrapper .ts-control,.ts-dropdown {
  background:var(--surf);
  color:var(--tx);
  border-color:var(--bd);
box-shadow:none}

.ts-control input {
color:var(--tx)!important}

.ts-wrapper.multi .ts-control>div {
  background:var(--surf2);
  color:var(--tx);
border:1px solid var(--bd)}

.ts-dropdown .active {
  background:var(--surf2);
color:var(--hd)}

.ts-dropdown .create {
color:var(--ac)}

.ts-wrapper.focus .ts-control {
border-color:var(--ac)}

.flatpickr-calendar {
  background:var(--surf);
  border:1px solid var(--bd);
box-shadow:0 8px 24px rgba(0,0,0,.4)}

.flatpickr-calendar * {
color:var(--tx)}

.flatpickr-day.selected,.flatpickr-day.selected:hover {
  background:var(--ac);
border-color:var(--ac)}

.flatpickr-day.selected {
color:var(--ac-fg)}

.flatpickr-input.alt,input.flatpickr-input {
width:100%}

@media(max-width:900px) {
  .editor {
  grid-template-columns:minmax(0,1fr)}

  .side {
    position:static;
    max-height:none;
  overflow:visible}

  .topbar {
  top:0}

  .profile {
  flex-direction:column}

  .frow {
  grid-template-columns:1fr auto}

  .frow input[name=footer_url] {
    grid-column:1/-1;
  grid-row:2}

  .uname {
  display:none}

  .featured-box {
  flex-wrap:wrap}

}

@media(prefers-reduced-motion:reduce) {
  * {
    transition:none!important;
  animation:none!important}

}

.codewrap {
  position:relative;
margin:1rem 0}

.codewrap pre {
  margin:0;
padding-top:2.2rem}

.copybtn {
  position:absolute;
  top:.4rem;
  right:.4rem;
  display:inline-flex;
  align-items:center;
  gap:0;
  padding:.2rem .55rem;
  font-size:.78rem;
  background:var(--surf2);
  border:1px solid var(--bd);
  color:var(--mut);
  opacity:.75;
transition:opacity .15s,color .15s,border-color .15s}

.copybtn .ic {
  width:.95em;
height:.95em}

.codewrap:hover .copybtn,.copybtn:focus-visible,.copybtn.done {
opacity:1}

.copybtn:hover {
color:var(--hd)}

.copybtn.done {
  color:var(--ok);
border-color:var(--ok)}

#progress {
  position:fixed;
  top:0;
  left:0;
  right:0;
  height:3px;
  background:var(--ac);
  transform:scaleX(0);
  transform-origin:0 50%;
z-index:70}

#totop {
  position:fixed;
  right:1.2rem;
  bottom:1.2rem;
  width:2.7rem;
  height:2.7rem;
  padding:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--surf2);
  z-index:50;
box-shadow:0 4px 14px rgba(0,0,0,.35)}

#totop .ic {
  margin:0;
  width:1.2em;
height:1.2em}

#totop:hover {
  color:var(--hd);
border-color:var(--ac)}

.toc {
  margin:1rem 0;
  padding:.6rem 1rem;
  border:1px solid var(--bd);
  background:var(--surf);
font-size:.88rem}

.toc summary {
  cursor:pointer;
  color:var(--hd);
font-weight:600}

.toc ol {
  list-style:none;
  margin:.4rem 0 0;
padding:0}

.toc li {
  margin:.15rem 0;
line-height:1.35}

.toc a {
  display:block;
  padding:.2rem .6rem;
color:var(--mut)}

.toc a:hover {
  color:var(--hd);
text-decoration:none}

.toc a.active {
  color:var(--ac);
  background:var(--surf2);
font-weight:600}

.toc .l3 a {
padding-left:1.3rem}

.toc .l4 a {
padding-left:2rem}

.prose [id^="sec-"] {
scroll-margin-top:1.2rem}

@media(min-width:1300px) {
  .toc {
    position:fixed;
    top:6rem;
    right:calc(50% + 24rem);
    width:15rem;
    max-height:calc(100vh - 8rem);
    overflow-y:auto;
    margin:0;
    border:0;
    background:none;
  padding:0}

  .toc summary {
  display:none}

}

.repo {
  display:flex;
  align-items:center;
  gap:.8rem;
  margin:0;
  padding:.7rem 1rem;
  border:1px solid var(--bd);
  background:var(--surf);
color:var(--tx)}

.cards {
  display:grid;
  gap:.6rem;
margin:0 0 1.2rem}

.repo:hover {
  border-color:var(--ac);
text-decoration:none}

.repo .ic {
  width:1.5em;
  height:1.5em;
  margin:0;
color:var(--ac)}

.repo span {
  display:grid;
  line-height:1.3;
min-width:0}

.repo small {
  color:var(--mut);
overflow-wrap:anywhere}

.dropzone {
  display:flex;
  gap:1rem;
  align-items:center;
  flex-wrap:wrap;
  padding:1.2rem;
  margin:1rem 0;
  border:2px dashed var(--bd);
background:var(--surf)}

.dropzone.over {
border-color:var(--ac)}

.grid {
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(200px,1fr));
gap:1rem}

.ph {
  margin:0;
  border:1px solid var(--bd);
  overflow:hidden;
  background:var(--surf);
  display:flex;
flex-direction:column}

.ph img {
  width:100%;
  aspect-ratio:4/3;
  object-fit:cover;
  display:block;
background:var(--surf2)}

.ph figcaption {
  display:grid;
  gap:.2rem;
  padding:.6rem .7rem;
min-width:0}

.pname {
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:var(--hd);
font-size:.88rem}

.ph .row {
  display:flex;
  gap:.3rem;
  flex-wrap:wrap;
margin-top:.3rem}

.ph form {
margin:0 0 0 auto}

dialog {
  background:var(--bg);
  color:var(--tx);
  border:1px solid var(--bd);
  width:min(60rem,94vw);
  max-height:86vh;
padding:1rem}

dialog::backdrop {
background:rgba(0,0,0,.65)}

.gh {
  display:flex;
  gap:.6rem;
  align-items:center;
margin-bottom:.8rem}

.gh h2 {
  flex:1;
margin:0}

.ggrid {
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(130px,1fr));
  gap:.6rem;
  overflow-y:auto;
max-height:64vh}

.gitem {
  padding:0;
  border:2px solid transparent;
  overflow:hidden;
  background:var(--surf2);
line-height:0}

.gitem:hover,.gitem:focus-visible {
border-color:var(--ac)}

.gitem img {
  width:100%;
  aspect-ratio:1;
object-fit:cover}

.video-js.blog-video {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  max-height: 80vh;
  margin: 1.2rem 0;
  background: #000;
  overflow: hidden;
}

.video-js.blog-video .vjs-tech {
  object-fit: contain;
}

.video-js.blog-video .vjs-big-play-button {
  top: 50%;
  left: 50%;
  margin: -1.1em 0 0 -1.7em;
}

.ph .video-js.blog-video {
  margin: 0;
  border-radius: 0;
  aspect-ratio: 4/3;
  max-height: none;
}

.gitem {
  position: relative;
  display: block;
  aspect-ratio: 1;
  cursor: pointer;
}

.gitem img,
.gitem video {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  pointer-events: none;
}

.gitem.is-video::after {
  content: "";
  position: absolute;
  right: .4rem;
  bottom: .4rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: rgba(0, 0, 0, .65);
  pointer-events: none;
}

.gitem.is-video::before {
  content: "";
  position: absolute;
  right: calc(.4rem + .5rem);
  bottom: calc(.4rem + .4rem);
  z-index: 1;
  border-style: solid;
  border-width: .35rem 0 .35rem .6rem;
  border-color: transparent transparent transparent #fff;
  pointer-events: none;
}

.ggrid .muted {
  grid-column: 1 / -1;
}

.cm-ctag {
  opacity: .4;
}

.pcr-app {
  z-index: 10000;
}

.color-anchor {
  position: relative;
  display: inline-block;
  width: 0;
  height: 30px;
  overflow: visible;
}

.color-anchor .pickr {
  position: absolute !important;
  top: 0;
  right: 0;
  visibility: hidden !important;
  pointer-events: none !important;
}

.color-anchor .pickr .pcr-button {
  width: 30px !important;
  height: 30px !important;
  opacity: 0 !important;
}

.EasyMDEContainer .editor-toolbar button.fa-palette {
  box-shadow: inset 0 -3px 0 var(--cur, transparent);
}

.accents {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: .5rem;
}

.swatch {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: .6rem;
  align-items: center;
  padding: .5rem .6rem;
  border: 1px solid var(--bd);
  background: var(--surf);
  cursor: pointer;
}

.swatch:hover {
  border-color: var(--mut);
}

.swatch input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.swatch .chip {
  grid-row: 1 / 3;
  width: 1.8rem;
  height: 1.8rem;
  border: 1px solid var(--bd);
  background: var(--sw);
}

.swatch .nm {
  color: var(--hd);
  font-size: .85rem;
}

.swatch small {
  color: var(--mut);
  font-size: .72rem;
}

.swatch:has(input:checked) {
  border-color: var(--ac);
  box-shadow: 0 0 0 1px var(--ac);
}

.swatch:has(input:focus-visible) {
  outline: 2px solid var(--ac);
  outline-offset: 2px;
}

.swatch .low {
  color: var(--warn);
}
.swatch.s-black { --sw: var(--vt-black); }
.swatch.s-red { --sw: var(--vt-red); }
.swatch.s-green { --sw: var(--vt-green); }
.swatch.s-brown { --sw: var(--vt-brown); }
.swatch.s-blue { --sw: var(--vt-blue); }
.swatch.s-magenta { --sw: var(--vt-magenta); }
.swatch.s-cyan { --sw: var(--vt-cyan); }
.swatch.s-gray { --sw: var(--vt-gray); }
.swatch.s-dgray { --sw: var(--vt-dgray); }
.swatch.s-bred { --sw: var(--vt-bred); }
.swatch.s-bgreen { --sw: var(--vt-bgreen); }
.swatch.s-yellow { --sw: var(--vt-yellow); }
.swatch.s-bblue { --sw: var(--vt-bblue); }
.swatch.s-bmagenta { --sw: var(--vt-bmagenta); }
.swatch.s-bcyan { --sw: var(--vt-bcyan); }
.swatch.s-white { --sw: var(--vt-white); }

a.chip {
  display: inline-block;
  padding: 0 .45em;
  line-height: 1.55;
  font-size: .92em;
  white-space: nowrap;
  border: 1px solid color-mix(in srgb, currentColor 45%, var(--bd));
  background: color-mix(in srgb, currentColor 10%, var(--surf));
  color: var(--ac);
}

.md-color a.chip {
  color: inherit;
}

a.chip:hover {
  text-decoration: none;
  border-color: currentColor;
  background: color-mix(in srgb, currentColor 18%, var(--surf));
}

.cm-chip {
  outline: 1px solid color-mix(in srgb, currentColor 45%, var(--bd));
  background: color-mix(in srgb, currentColor 10%, transparent);
  color: var(--ac);
}

.topbar select {
  height: 2.2rem;
}

dialog.small {
  width: min(26rem, 94vw);
}

dialog.small h2 {
  margin-bottom: .3rem;
}

.notice.bad {
  border-color: color-mix(in srgb, var(--bad) 60%, var(--bd));
  color: var(--bad);
}

.locked {
  padding-top: 2rem;
}

/* Tom Select (tags/categories): full dark theme, incl. active/selected states */ /* 'body ' prefix: vendor tom-select.min.css loads after style.css and would win on equal specificity */
body .ts-wrapper .ts-control,
body .ts-wrapper.single .ts-control,
body .ts-wrapper.single.input-active .ts-control,
body .ts-wrapper.multi.has-items .ts-control,
body .ts-wrapper.focus .ts-control,
body .ts-dropdown,
body .ts-dropdown.form-control {
  background: var(--surf);
  color: var(--tx);
  border-color: var(--bd);
  box-shadow: none;
}
body .ts-wrapper.focus .ts-control {
  border-color: var(--ac);
}
body .ts-wrapper.multi .ts-control > div,
body .ts-wrapper.multi.disabled .ts-control > div {
  background: var(--surf2);
  color: var(--tx);
  border: 1px solid var(--bd);
}
body .ts-wrapper.multi .ts-control > div.active {
  background: color-mix(in srgb, var(--ac) 22%, var(--surf2));
  color: var(--hd);
  border-color: var(--ac);
}
body .ts-wrapper.plugin-remove_button .item .remove {
  color: inherit;
  border-left: 1px solid var(--bd);
}
body .ts-wrapper.plugin-remove_button .item .remove:hover,
body .ts-wrapper.plugin-remove_button .active .remove {
  background: color-mix(in srgb, var(--ac) 25%, transparent);
}
body .ts-dropdown .option,
body .ts-dropdown .no-results,
body .ts-dropdown .optgroup-header,
body .ts-dropdown .create {
  color: var(--tx);
  background: transparent;
}
body .ts-dropdown .active,
body .ts-dropdown .option:hover {
  background: var(--surf2);
  color: var(--hd);
}
body .ts-dropdown .active.create,
body .ts-dropdown .create:hover {
  color: var(--ac);
}
body .ts-dropdown .optgroup-header {
  background: var(--surf2);
}
body .ts-control input::placeholder {
  color: var(--mut);
}

/* Autocomplete popup (@users, #tags, /commands) */
.md-pop {
  position: absolute;
  z-index: 9000;
  min-width: 15rem;
  max-width: min(26rem, 94vw);
  max-height: 18rem;
  overflow-y: auto;
  background: var(--surf);
  border: 1px solid var(--ac);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  font-size: .9rem;
}

.md-pop-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .3rem .6rem;
  cursor: pointer;
  color: var(--tx);
}

.md-pop-item[aria-selected="true"] {
  background: color-mix(in srgb, var(--ac) 22%, var(--surf2));
  color: var(--hd);
}

.md-pop-item i {
  width: 1.1rem;
  text-align: center;
  color: var(--ac);
  flex: none;
}

.md-pop-item .t {
  white-space: nowrap;
}

.md-pop-item .d {
  margin-left: auto;
  color: var(--mut);
  font-size: .8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.md-pop-hint {
  padding: .25rem .6rem;
  border-top: 1px solid var(--bd);
  color: var(--mut);
  font-size: .75rem;
  position: sticky;
  bottom: 0;
  background: var(--surf);
}

/* Table editor overlay */
.mdt-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  z-index: 8;
  pointer-events: none;
}

.mdt-layer > * {
  position: absolute;
}

.mdt-btn {
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  transform: translate(-50%, -50%);
  background: var(--surf2);
  color: var(--tx);
  border: 1px solid var(--bd);
  font-size: .7rem;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
}

.mdt-btn:hover {
  background: var(--ac);
  border-color: var(--ac);
  color: var(--bg);
}

.mdt-btn.danger:hover {
  background: var(--bad);
  border-color: var(--bad);
}

.mdt-pill {
  display: flex;
  gap: 2px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.mdt-pill .mdt-btn {
  position: static;
  transform: none;
}

.mdt-line {
  background: var(--ac);
  opacity: .85;
  pointer-events: auto;
  cursor: pointer;
}

.mdt-line.h {
  height: 2px;
  transform: translateY(-1px);
}

.mdt-line.v {
  width: 2px;
  transform: translateX(-1px);
}

.mdt-hl {
  background: color-mix(in srgb, var(--ac) 10%, transparent);
  outline: 1px solid color-mix(in srgb, var(--ac) 35%, transparent);
}

.mdt-line::after {
  content: "";
  position: absolute;
  inset: -5px;
}

/* ===== page-level polish ===== */
footer {
  border-top: 0;
}

/* Cross-document view transitions keep the previous page (and its background image) on screen until the next one is
   ready, so the background no longer flashes between pages. */
@view-transition {
  navigation: auto;
}

::view-transition-group(root) {
  animation-duration: .12s;
}

/* ===== search results ===== */
mark {
  background: color-mix(in srgb, var(--ac) 28%, transparent);
  color: var(--hd);
  padding: 0 .1em;
}

.snip {
  margin: .25rem 0;
  color: var(--mut);
  font-size: .9rem;
}

.found {
  margin-bottom: 1.2rem;
}

.people {
  list-style: none;
  padding: 0;
  margin: .4rem 0;
  display: grid;
  gap: .5rem;
}

.people a {
  display: flex;
  align-items: center;
  gap: .7rem;
}

.chiprow {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

/* ===== pinned posts ===== */
.pinbadge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  color: var(--ac);
  font-weight: 600;
}

.pinbadge .ic {
  margin-right: 0;
}

.item.pinned {
  box-shadow: inset 2px 0 0 var(--ac);
  padding-left: .9rem;
}

.pinned-panel {
  border: 1px solid var(--bd);
  background: var(--surf);
  padding: .8rem 1rem;
  margin: 0 0 1.2rem;
}

.pinned-panel h2 {
  margin: 0;
}

.pinned-panel ol {
  list-style: none;
  padding: 0;
  margin: .6rem 0 0;
  display: grid;
  gap: .4rem;
}

.pinned-panel li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .4rem .6rem;
  border: 1px solid var(--bd);
  background: var(--surf2);
}

.pinned-panel .ptitle {
  min-width: 0;
  overflow-wrap: anywhere;
}

.pinctl {
  display: flex;
  gap: .3rem;
  flex: none;
}

.pinctl form {
  margin: 0;
}

.updated {
  margin-top: 1.4rem;
}

/* ===== audit log: stacked cards on small screens (desktop table untouched) ===== */
@media (max-width: 700px) {
  table.audit,
  table.audit tbody {
    display: block;
  }

  table.audit thead {
    display: none;
  }

  table.audit tbody {
    display: grid;
    gap: .6rem;
  }

  table.audit tr {
    display: block;
    border: 1px solid var(--bd);
    background: var(--surf);
    padding: .4rem .7rem;
  }

  table.audit td {
    display: grid;
    grid-template-columns: 6rem minmax(0, 1fr);
    gap: .6rem;
    border: 0;
    padding: .2rem 0;
    overflow-wrap: anywhere;
  }

  table.audit td::before {
    content: attr(data-label);
    color: var(--mut);
    font-size: .8rem;
  }
}

/* ===== settings ===== */
.hexrow {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-top: .8rem;
  flex-wrap: wrap;
}

.hexrow label {
  color: var(--mut);
  font-size: .9rem;
}

.hexrow input[type=color] {
  width: 2.8rem;
  height: 2.4rem;
  padding: 0;
  border: 1px solid var(--bd);
  background: var(--surf);
}

.hexrow input[name=accent_custom] {
  width: 8rem;
  font-family: ui-monospace, monospace;
}

fieldset .chk {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  margin: .3rem 0;
}

/* ===== busy indicator ===== */
#busy {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%);
  z-index: 9600;
  display: flex;
  align-items: center;
  gap: .7rem;
  max-width: 94vw;
  padding: .6rem 1rem;
  background: var(--surf);
  border: 1px solid var(--ac);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}

.spin {
  flex: none;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--bd);
  border-top-color: var(--ac);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== gallery ===== */
.gstats {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem 1.4rem;
  margin: -.4rem 0 1rem;
  font-size: .9rem;
}

.gstats strong {
  color: var(--hd);
}

figure.ph {
  position: relative;
}

.sizebadge {
  position: absolute;
  top: .4rem;
  left: .4rem;
  z-index: 3;
  padding: .05rem .4rem;
  background: rgba(0, 0, 0, .72);
  color: #fff;
  font-size: .7rem;
  line-height: 1.5;
  pointer-events: none;
}

.gitem .sizebadge {
  top: auto;
  bottom: .3rem;
  left: .3rem;
}

.fsbtn {
  position: absolute;
  top: .4rem;
  right: .4rem;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  background: rgba(0, 0, 0, .72);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .25);
}

.fsbtn .ic {
  margin: 0;
}

.fsbtn:hover {
  background: var(--ac);
  color: var(--ac-fg);
}

.gsum {
  margin: 0 0 .5rem;
  font-size: .85rem;
}

.gitem.pending {
  display: grid;
  place-items: center;
  gap: .3rem;
  align-content: center;
  padding: .4rem;
  text-align: center;
  font-size: .75rem;
  line-height: 1.25;
  color: var(--mut);
  cursor: progress;
}

/* ===== editor: sidebar toggle, topbar menu ===== */
.editor.side-closed {
  grid-template-columns: minmax(0, 1fr);
}

.editor.side-closed .side {
  display: none;
}

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--bd);
}

#sidetoggle[aria-expanded=true] {
  border-color: var(--ac);
  color: var(--hd);
}

.menu.more summary {
  padding: 0 .6rem;
  height: 2.2rem;
}

.dropdown .danger {
  color: var(--bad);
}

/* ===== editor: toolbar right group, maximize, preview ===== */
.EasyMDEContainer .editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.editor-toolbar .mdx-first-right {
  margin-left: auto;
}

.editor-toolbar button.active-toggle {
  background: color-mix(in srgb, var(--ac) 25%, transparent);
  border-color: var(--ac);
}

.mdpreview {
  min-height: 60vh;
  padding: 1.2rem 1.5rem;
  border: 1px solid var(--bd);
  border-top: 0;
  background: var(--surf);
}

.mdpreview h1 {
  margin-top: 0;
}

.mdpreview .loading {
  color: var(--mut);
}

body.editor-max {
  overflow: hidden;
}

.mdwrap.max {
  position: fixed;
  inset: 0;
  z-index: 8000;
  overflow: auto;
  background: var(--bg);
}

.mdwrap.max .EasyMDEContainer {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.mdwrap.max .EasyMDEContainer .editor-toolbar {
  top: 0;
}

.mdwrap.max .EasyMDEContainer .CodeMirror {
  flex: 1;
  min-height: calc(100vh - 3.2rem);
  border-radius: 0;
  border-left: 0;
  border-right: 0;
}

.mdwrap.max .mdpreview {
  flex: 1;
  width: 100%;
  max-width: 52rem;
  margin: 0 auto;
  border: 0;
  background: transparent;
}

body.editor-max .mdt-layer {
  z-index: 8100;
}

/* ===== editor: image hover preview ===== */
.md-imgtip {
  position: fixed;
  z-index: 9100;
  pointer-events: none;
  padding: .25rem;
  background: var(--surf);
  border: 1px solid var(--ac);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}

.md-imgtip img {
  display: block;
  max-width: 240px;
  max-height: 180px;
}

.md-imgtip small {
  display: block;
  margin-top: .2rem;
  color: var(--mut);
  font-size: .7rem;
}

/* ===== custom find (Ctrl+F) ===== */
.findbar {
  position: fixed;
  top: .6rem;
  right: .8rem;
  z-index: 9500;
  display: grid;
  gap: .35rem;
  grid-template-columns: minmax(0, 1fr);
  width: min(28rem, 94vw);
  padding: .5rem;
  background: var(--surf);
  border: 1px solid var(--ac);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
  font-size: .85rem;
}

.findbar .frow2 {
  display: flex;
  align-items: center;
  gap: .3rem;
}

.findbar input[type=text] {
  flex: 1 1 5rem;
  width: auto;
  min-width: 0;
  height: 2rem;
}

.findbar .cnt {
  min-width: 3.6rem;
  text-align: center;
  color: var(--mut);
  font-size: .8rem;
}

.findbar button {
  flex: none;
  min-width: 1.9rem;
  height: 2rem;
  padding: 0 .35rem;
}

.findbar button[aria-pressed=true] {
  border-color: var(--ac);
  background: color-mix(in srgb, var(--ac) 25%, var(--surf2));
}

.findbar.bad input[type=text] {
  border-color: var(--bad);
}

mark.find-hit {
  background: rgba(255, 255, 85, .38);
  color: inherit;
}

mark.find-hit.current {
  background: var(--ac);
  color: var(--ac-fg);
}

.cm-find {
  background: rgba(255, 255, 85, .3);
}

.cm-find-cur {
  background: var(--ac);
  color: var(--ac-fg);
}

.video-js.blog-video.vjs-fullscreen,
.video-js.blog-video:fullscreen {
  max-height: none;
  aspect-ratio: auto;
  margin: 0;
}

.ph .video-js.blog-video .vjs-fullscreen-control {
  display: flex !important;
}

.mdwrap.max .EasyMDEContainer .CodeMirror pre.CodeMirror-line,
.mdwrap.max .EasyMDEContainer .CodeMirror pre.CodeMirror-line-like {
  padding: 0 clamp(1rem, calc((100vw - 56rem) / 2), 30vw);
}

/* ===== same width as the header on every page (gallery and settings used to be wider) ===== */
body:has(.gallery) main {
  max-width: 46rem;
}

main {
  min-width: 0;
}

fieldset {
  min-width: 0;
}

/* ===== task lists ===== */
.prose ul.contains-task-list,
.prose ol.contains-task-list {
  list-style: none;
  padding-left: .3rem;
}

.prose .task-list-item {
  margin: .3rem 0;
}

.prose .task-check {
  width: 1rem;
  height: 1rem;
  margin: 0 .55rem 0 0;
  vertical-align: -.15em;
  accent-color: var(--ac);
}

/* ===== math (KaTeX renders into these) ===== */
.math.display {
  display: block;
  margin: 1rem 0;
  overflow-x: auto;
  overflow-y: hidden;
  text-align: center;
}

.math:not(.rendered) {
  font-family: ui-monospace, monospace;
  color: var(--mut);
}

.math.math-error {
  color: var(--bad);
}

.katex {
  font-size: 1.08em;
}

/* ===== preview: index sits in the flow (like small screens), floats at the side only when maximized ===== */
@media (min-width: 1300px) {
  .mdpreview .toc {
    position: static;
    width: auto;
    max-height: none;
    margin: 1rem 0;
    padding: .6rem 1rem;
    border: 1px solid var(--bd);
    background: var(--surf);
  }

  .mdpreview .toc summary {
    display: list-item;
  }

  .mdwrap.max .mdpreview .toc {
    position: fixed;
    top: 5rem;
    right: calc(50% + 27rem);
    width: 15rem;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
  }

  .mdwrap.max .mdpreview .toc summary {
    display: none;
  }
}

/* ===== hover previews in the editor ===== */
.md-imgtip video {
  display: block;
  max-width: 280px;
  max-height: 180px;
}

/* ===== diagram editor dialog ===== */
dialog.diagram {
  width: min(97vw, 1300px);
  height: min(94vh, 860px);
  padding: 0;
  overflow: hidden;
}

dialog.diagram[open] {
  display: flex;
  flex-direction: column;
}

dialog.diagram .dlg-head {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .5rem .8rem;
  border-bottom: 1px solid var(--bd);
  background: var(--surf2);
}

dialog.diagram .dlg-head .grow {
  flex: 1;
}

dialog.diagram iframe {
  flex: 1;
  width: 100%;
  border: 0;
  background: #1c1d1f;
}

.fieldnote {
  margin: .2rem 0 0;
  color: var(--mut);
  font-size: .78rem;
}

/* ===================== editor v2: one editor bar, options drawer over the text, floating menu ===================== */
#toast {
  z-index: 9700;
}

.editor {
  display: block;
}

.mdwrap {
  position: relative;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.edbar {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .45rem;
  padding: .45rem .6rem;
  background: var(--surf2);
  border: 1px solid var(--bd);
  border-radius: 4px 4px 0 0;
  box-shadow: 0 1px 0 var(--bd);
}

.edgroup {
  display: inline-flex;
  gap: .2rem;
}

.edbar .pill {
  white-space: nowrap;
}

.titlefield {
  flex: 1 1 16rem;
  min-width: 11rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0;
  padding: .05rem .6rem;
  border: 1px solid transparent;
  border-bottom-color: var(--bd);
  color: var(--mut);
  cursor: text;
}

.titlefield:hover,
.titlefield:focus-within {
  border-color: var(--ac);
  background: var(--surf);
  color: var(--ac);
}

.titlefield .ic {
  margin: 0;
  flex: none;
}

.edbar .titlefield input {
  width: 100%;
  padding: .35rem 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--hd);
  font-size: 1.1rem;
  font-weight: 700;
}

.edbar .titlefield input:focus {
  outline: 0;
}

.edbar .titlefield input::placeholder {
  color: var(--mut);
  font-weight: 400;
}

.edbar .btn[disabled] {
  opacity: .4;
  cursor: default;
}

.EasyMDEContainer .CodeMirror {
  border-top: 0;
  border-radius: 0 0 4px 4px;
}

/* options drawer: sticks right under the bar and slides over the left part of the text */
.sidewrap {
  position: sticky;
  top: var(--edbar-h, 3.4rem);
  height: 0;
  z-index: 11;
}

.sidewrap .side {
  position: absolute;
  left: 0;
  top: 0;
  width: min(23rem, 92vw);
  max-height: calc(100vh - var(--edbar-h, 3.4rem) - 1rem);
  overflow: auto;
  padding: .9rem;
  background: var(--bg);
  border: 1px solid var(--bd);
  border-top: 0;
  box-shadow: 10px 10px 30px rgba(0, 0, 0, .55);
}

.sidewrap .side[hidden] {
  display: none;
}

.side .featured img {
  width: 100%;
  max-height: 9rem;
  object-fit: cover;
  margin: .3rem 0;
}

.side .pick {
  margin-top: .3rem;
}

.edhint {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem 1.2rem;
  margin: .6rem 0 0;
  color: var(--mut);
  font-size: .8rem;
}

.edhint kbd {
  display: inline-block;
  min-width: 1.5em;
  margin-right: .35em;
  padding: 0 .35em;
  text-align: center;
  border: 1px solid var(--bd);
  background: var(--surf2);
  color: var(--hd);
  font-family: inherit;
  font-size: .9em;
}

.mdwrap.is-previewing .edhint {
  display: none;
}

.mdwrap.max .edbar {
  border-radius: 0;
}

.mdwrap.max .EasyMDEContainer .CodeMirror {
  min-height: calc(100vh - var(--edbar-h, 3.4rem) - 2.4rem);
}

.mdwrap.max .edhint {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin: 0;
  padding: .35rem 1rem;
  background: var(--bg);
  border-top: 1px solid var(--bd);
}

/* floating formatting menu (select text) */
.mdfloat {
  position: fixed;
  z-index: 9050;
  display: flex;
  align-items: center;
  gap: .1rem;
  padding: .25rem;
  background: var(--surf2);
  border: 1px solid var(--ac);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .55);
}

.mdfloat[hidden] {
  display: none;
}

.mdf-btn {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border: 1px solid transparent;
  background: none;
  color: var(--tx);
  cursor: pointer;
}

.mdf-btn:hover {
  background: var(--surf);
  border-color: var(--bd);
  color: var(--hd);
}

.mdf-sep {
  width: 1px;
  height: 1.2rem;
  margin: 0 .25rem;
  background: var(--bd);
}

.mdf-pop {
  position: absolute;
  z-index: 1;
  min-width: 11rem;
  padding: .25rem;
  background: var(--surf2);
  border: 1px solid var(--ac);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .55);
}

.mdf-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  padding: .35rem .6rem;
  border: 0;
  background: none;
  color: var(--tx);
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.mdf-item:hover {
  background: color-mix(in srgb, var(--ac) 22%, var(--surf));
  color: var(--hd);
}

.mdf-item i {
  width: 1rem;
  text-align: center;
  color: var(--ac);
}

.mdf-pop.palette {
  width: 14rem;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: .25rem;
  padding: .25rem;
}

.swatches .sw {
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--bd);
  cursor: pointer;
}

.swatches .sw:hover {
  outline: 2px solid var(--ac);
}

.hexrow2 {
  display: flex;
  gap: .3rem;
  padding: .25rem;
}

.hexrow2 input {
  flex: 1;
  min-width: 0;
  height: 1.9rem;
  font-family: ui-monospace, monospace;
}

.hexrow2 input.bad {
  border-color: var(--bad);
}

.mdf-item.small {
  width: auto;
  padding: .2rem .6rem;
  border: 1px solid var(--bd);
}

/* diagrams inside the editor */
.md-edit {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin-right: .55rem;
  padding: 0 .55rem;
  border: 1px solid var(--ac);
  background: color-mix(in srgb, var(--ac) 12%, transparent);
  color: var(--ac);
  font-size: .8rem;
  line-height: 1.5;
  text-decoration: none;
  cursor: pointer;
}

.md-edit:hover {
  background: var(--ac);
  color: var(--ac-fg);
  text-decoration: none;
}

.md-edit .ic {
  width: .85em;
  height: .85em;
  margin: 0;
}

.md-diagram {
  padding: .4rem 0 .7rem;
}

.md-diagram img {
  display: block;
  max-width: 100%;
  max-height: 340px;
  background: #fff;
  border: 1px solid var(--bd);
}

/* publish dialog */
dialog.pub {
  width: min(32rem, 94vw);
}

dialog.pub fieldset.vis {
  border: 0;
  padding: 0;
  margin: 0;
}

dialog.pub legend {
  padding: 0;
  margin-bottom: .3rem;
  color: var(--mut);
  font-size: .85rem;
}

.vopt {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  margin: .35rem 0;
  padding: .6rem .7rem;
  border: 1px solid var(--bd);
  cursor: pointer;
}

.vopt:has(input:checked) {
  border-color: var(--ac);
  background: color-mix(in srgb, var(--ac) 10%, var(--surf));
}

.vopt input {
  margin-top: .3rem;
  accent-color: var(--ac);
}

.vopt strong {
  display: block;
  color: var(--hd);
}

.vopt small {
  color: var(--mut);
}

dialog.pub .actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}

dialog.pub .pick .flatpickr-wrapper {
  flex: 1;
  min-width: 0;
}

dialog.pub .pick .flatpickr-wrapper input {
  width: 100%;
}

/* ===================== editor v3: bar order, drawer inside the editor, responsive labels ===================== */
body:has(.editor) main {
  max-width: 46rem;
}

.edbar {
  container-type: inline-size;
  container-name: edbar;
}

.edbar .spacer {
  flex: 1 1 0;
  min-width: 0;
}

.titlefield {
  flex: 0 1 auto;
  min-width: 7rem;
  max-width: 100%;
  gap: .5rem;
}

.edbar .titlefield input {
  width: auto;
  max-width: 100%;
  min-width: 0;
  flex: 0 1 auto;
  padding-right: 0;
}

.titlefield .pill {
  flex: none;
  margin-left: .3rem;
  white-space: nowrap;
}

/* little room: icons only (Publish always keeps its text) */
@container edbar (max-width: 52rem) {
  .edbar .lbl {
    display: none;
  }
}

.edbody {
  display: grid;
}

.edbody > .EasyMDEContainer,
.edbody > .side {
  grid-area: 1 / 1;
}

.edbody > .EasyMDEContainer {
  min-width: 0;
}

/* the drawer sticks right under the bar, runs down to the bottom of the screen and never leaves the editor */
.edbody > .side {
  position: sticky;
  top: var(--edbar-h, 3.4rem);
  align-self: start;
  justify-self: start;
  z-index: 11;
  width: min(23rem, 92vw);
  height: min(calc(100vh - var(--edbar-h, 3.4rem)), 100%);
  max-height: none;
  overflow: auto;
  padding: .9rem;
  background: var(--bg);
  border: 1px solid var(--bd);
  border-top: 0;
  box-shadow: 10px 0 30px rgba(0, 0, 0, .5);
}

.edbody > .side[hidden] {
  display: none;
}

/* maximized: the text moves aside instead of sitting behind the drawer */
@media (min-width: 60rem) {
  .mdwrap.max.side-open .EasyMDEContainer {
    margin-left: 23rem;
  }
}

/* one row whenever possible: the title is what shrinks; very narrow bars wrap with the title on its own row */
.edbar {
  flex-wrap: nowrap;
}

.titlefield {
  gap: 0;
  min-width: 4rem;
  overflow: hidden;
}

.titlefield .ic {
  margin-right: .5rem;
}

.titlefield .pill {
  margin-left: .25rem;
}

.edbar .titlefield input {
  text-overflow: ellipsis;
}

.edbar > * {
  flex-shrink: 0;
}

.edbar > .titlefield {
  flex-shrink: 1;
}

@container edbar (max-width: 34rem) {
  .edbar {
    flex-wrap: wrap;
  }

  .edbar > .titlefield {
    order: 9;
    flex: 1 1 100%;
  }

  .edbar > .spacer {
    display: none;
  }
}

/* the drawer must not make the editor taller: it contributes no height of its own, only a min-height that is capped
   by the editor and by the screen, so it can never stick out below the editor */
.edbody > .side {
  height: 0;
  min-height: min(100%, calc(100vh - var(--edbar-h, 3.4rem)));
}

@container edbar (max-width: 52rem) {
  .edbar .titlefield input {
    font-size: 1rem;
  }

  .titlefield .pill {
    padding: 0 .5rem;
    font-size: .72rem;
  }

  .titlefield .ic {
    margin-right: .35rem;
  }
}
