/* Template "ribbon" (study B): a calm documentation look. The title bar stays neutral; the wiki
   colour is a ribbon along the top edge, a tab hanging from it, and the accent of every active
   state. Linked by main.php as it is, past DokuWiki's LESS compiler (style.ini). */

/* Self-hosted webfonts (latin subsets, woff2), served by the wiki itself; the OFL texts sit
   next to the files. DM Sans is a variable slice: its optical-size axis (opsz 9-40) follows the
   font size, so headings pick up the display cut on their own. */
@font-face {
  font-family: "DM Sans";
  src: url("../fonts/dmsans-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DM Sans";
  src: url("../fonts/dmsans-bolditalic.woff2") format("woff2");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "DM Mono";
  src: url("../fonts/dmmono-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* --- Tokens: Catppuccin Latte (light) and Mocha (dark), used after its style guide
   (github.com/catppuccin/catppuccin, docs/style-guide.md) -------------------------------------- */

:root {
  color-scheme: light;

  --cat-rosewater: #dc8a78;
  --cat-flamingo: #dd7878;
  --cat-pink: #ea76cb;
  --cat-mauve: #8839ef;
  --cat-red: #d20f39;
  --cat-maroon: #e64553;
  --cat-peach: #fe640b;
  --cat-yellow: #df8e1d;
  --cat-green: #40a02b;
  --cat-teal: #179299;
  --cat-sky: #04a5e5;
  --cat-sapphire: #209fb5;
  --cat-blue: #1e66f5;
  --cat-lavender: #7287fd;
  --cat-text: #4c4f69;
  --cat-subtext1: #5c5f77;
  --cat-subtext0: #6c6f85;
  --cat-overlay2: #7c7f93;
  --cat-overlay1: #8c8fa1;
  --cat-overlay0: #9ca0b0;
  --cat-surface2: #acb0be;
  --cat-surface1: #bcc0cc;
  --cat-surface0: #ccd0da;
  --cat-base: #eff1f5;
  --cat-mantle: #e6e9ef;
  --cat-crust: #dce0e8;

  --font-ui: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "DM Sans", var(--font-ui);
  --font-mono: "DM Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --bg: var(--cat-base);
  --bg-subtle: var(--cat-mantle);
  --bg-neutral: var(--cat-crust);
  --bg-hover: var(--cat-surface0);
  --text: var(--cat-text);
  --text-muted: var(--cat-subtext1);
  --text-faint: var(--cat-subtext0);
  --line: var(--cat-crust);
  --line-strong: var(--cat-surface1);
  --code-bg: var(--cat-mantle);
  /* the ground of thumbnails and previews: pictures are mostly drawn for paper */
  --media-bg: #fff;
  --topbar-bg: color-mix(in srgb, var(--cat-mantle) 90%, transparent);
  --menu-bg: var(--cat-base);
  --selection: color-mix(in srgb, var(--cat-blue) 25%, transparent);
  --missing: var(--cat-red);
  --highlight: color-mix(in srgb, var(--cat-yellow) 35%, transparent);
  --scrim: color-mix(in srgb, var(--cat-text) 40%, transparent);
  --shadow: 0 12px 32px -18px color-mix(in srgb, var(--cat-text) 45%, transparent);
  --shadow-menu: 0 18px 40px -16px color-mix(in srgb, var(--cat-text) 35%, transparent),
    0 0 0 1px var(--cat-surface0);

  --link: var(--wiki-accent-base);
  --link-tint: color-mix(in srgb, var(--wiki-accent-base) 25%, transparent);

  --success: var(--cat-green);
  --warning: var(--cat-yellow);
  --danger: var(--cat-red);
  --info: var(--cat-teal);

  --ribbon: 4px;
  --topbar-h: 64px;
  --sidebar-w: 17rem;
  --toc-w: 14rem;
  --palette-w: 26rem;
  --gutter: clamp(1.25rem, 2.4vw, 3.25rem);
  --radius: 10px;
  --ease: cubic-bezier(.22, 1, .36, 1);

  /* The wayz plugin's boxes (its colours are custom properties, so the plugin stays untouched):
     tint and edge in the box's accent, title and icon in the accent lifted to AA contrast; the
     box text itself stays Text (.wayz-text below). */
  --box-tint: 10%;
  --box-edge: 40%;
  --box-ink: 50%;
  --wayz-heading-size: 16px;
  --wayz-abbrev-size: 14px;
  --wayz-icon-size: 20px;
  --wayz-box-margin: 14px;
  --wayz-plain-color: var(--cat-subtext1);
  --wayz-plain-background-color: var(--cat-mantle);
  --wayz-plain-border-color: var(--cat-surface1);
  --wayz-see-color: var(--cat-subtext1);
  --wayz-see-background-color: var(--cat-mantle);
  --wayz-see-border-color: var(--cat-surface1);
  --wayz-rule-color: color-mix(in oklab, var(--cat-lavender) var(--box-ink), var(--cat-text));
  --wayz-rule-background-color: color-mix(in srgb, var(--cat-lavender) var(--box-tint), transparent);
  --wayz-rule-border-color: color-mix(in srgb, var(--cat-lavender) var(--box-edge), transparent);
  --wayz-definition-color: var(--wayz-rule-color);
  --wayz-definition-background-color: var(--wayz-rule-background-color);
  --wayz-definition-border-color: var(--wayz-rule-border-color);
  --wayz-example-color: color-mix(in oklab, var(--cat-teal) var(--box-ink), var(--cat-text));
  --wayz-example-background-color: color-mix(in srgb, var(--cat-teal) var(--box-tint), transparent);
  --wayz-example-border-color: color-mix(in srgb, var(--cat-teal) var(--box-edge), transparent);
  --wayz-info-color: color-mix(in oklab, var(--cat-sky) var(--box-ink), var(--cat-text));
  --wayz-info-background-color: color-mix(in srgb, var(--cat-sky) var(--box-tint), transparent);
  --wayz-info-border-color: color-mix(in srgb, var(--cat-sky) var(--box-edge), transparent);
  --wayz-note-color: color-mix(in oklab, var(--cat-sky) var(--box-ink), var(--cat-text));
  --wayz-note-background-color: color-mix(in srgb, var(--cat-sky) var(--box-tint), transparent);
  --wayz-note-border-color: color-mix(in srgb, var(--cat-sky) var(--box-edge), transparent);
  --wayz-todo-color: color-mix(in oklab, var(--cat-red) var(--box-ink), var(--cat-text));
  --wayz-todo-background: color-mix(in srgb, var(--cat-red) var(--box-tint), transparent);
  --wayz-todo-border-color: color-mix(in srgb, var(--cat-red) var(--box-edge), transparent);
}

:root[data-scheme="dark"] {
  color-scheme: dark;

  --cat-rosewater: #f5e0dc;
  --cat-flamingo: #f2cdcd;
  --cat-pink: #f5c2e7;
  --cat-mauve: #cba6f7;
  --cat-red: #f38ba8;
  --cat-maroon: #eba0ac;
  --cat-peach: #fab387;
  --cat-yellow: #f9e2af;
  --cat-green: #a6e3a1;
  --cat-teal: #94e2d5;
  --cat-sky: #89dceb;
  --cat-sapphire: #74c7ec;
  --cat-blue: #89b4fa;
  --cat-lavender: #b4befe;
  --cat-text: #cdd6f4;
  --cat-subtext1: #bac2de;
  --cat-subtext0: #a6adc8;
  --cat-overlay2: #9399b2;
  --cat-overlay1: #7f849c;
  --cat-overlay0: #6c7086;
  --cat-surface2: #585b70;
  --cat-surface1: #45475a;
  --cat-surface0: #313244;
  --cat-base: #1e1e2e;
  --cat-mantle: #181825;
  --cat-crust: #11111b;

  --line: var(--cat-surface0);
  --menu-bg: var(--cat-mantle);
  --media-bg: var(--cat-base);
  --selection: color-mix(in srgb, var(--wiki-accent) 25%, transparent);
  --missing: var(--cat-peach);
  --highlight: color-mix(in srgb, var(--wiki-accent) 25%, transparent);
  --scrim: color-mix(in srgb, var(--cat-crust) 60%, transparent);
  --shadow: 0 16px 36px -18px var(--cat-crust);
  --shadow-menu: 0 18px 40px -16px var(--cat-crust), 0 0 0 1px var(--cat-surface0);

  --box-tint: 12%;
  --box-edge: 24%;
  --box-ink: 100%;
  --wayz-todo-color: color-mix(in oklab, var(--cat-pink) var(--box-ink), var(--cat-text));
  --wayz-todo-background: color-mix(in srgb, var(--cat-pink) var(--box-tint), transparent);
  --wayz-todo-border-color: color-mix(in srgb, var(--cat-pink) var(--box-edge), transparent);
}

/* --- Wiki colours: a Catppuccin accent per wiki, the same name in Latte and Mocha. A wiki sets
   --wiki (and --wiki-accent-base, --wiki-ink or --wiki-ribbon where they differ); every other
   shade derives from it. Text on the wiki colour is Base, as the style guide has it. --------- */

:root {
  --wiki: var(--cat-blue);
  --wiki-accent-base: var(--wiki);
  --wiki-ink: var(--cat-base);
  --wiki-ribbon: var(--wiki);

  --wiki-deep: oklch(from var(--wiki) calc(l - .08) c h);
  --wiki-deeper: oklch(from var(--wiki) calc(l - .18) c h);
  --wiki-accent: oklch(from var(--wiki-accent-base) min(l, .52) c h);
  --wiki-soft: oklch(from var(--wiki-accent-base) l c h / .16);
  --wiki-faint: oklch(from var(--wiki-accent-base) l c h / .07);

  /* buttons: the accent, with text in Base */
  --action: var(--wiki-accent);
  --action-ink: var(--cat-base);
  --action-hover: oklch(from var(--wiki-accent) calc(l - .06) c h);
}

:root[data-scheme="dark"] {
  --wiki-accent: oklch(from var(--wiki-accent-base) max(l, .76) c h);
  --wiki-soft: oklch(from var(--wiki-accent-base) l c h / .2);
  --wiki-faint: oklch(from var(--wiki-accent-base) l c h / .08);
}

/* The main wiki: a tab tinted in its accent, Blue, for the dark (Latte) or light (Mocha) logo; the
   ribbon runs from the accent into the text colour. */
:root[data-wiki="thewayz"] {
  --wiki-accent-base: var(--cat-blue);
  --wiki: oklch(from var(--wiki-accent-base) l c h / .2);
  --wiki-ink: var(--cat-text);
  --wiki-ribbon: linear-gradient(90deg, var(--wiki-accent-base), var(--wiki-ink));
}

:root[data-wiki="archive"] {
  --wiki: var(--cat-peach);
}

:root[data-wiki="thalvarin"] {
  --wiki: var(--cat-teal);
}

:root[data-wiki="essmann"] {
  --wiki: var(--cat-green);
}

/* --- Base -------------------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + 1.25rem);
}

/* !important: blink's userstyle.css pushes the body below bootstrap3's fixed navbar */
body {
  margin: 0 !important;
  font: 400 1rem/1.7 var(--font-ui);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* DokuWiki's housekeeping image (tpl_indexerWebBug) loads without a line of its own below the
   window-high layout, which would make every page scroll */
body > div.no {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

::selection {
  color: inherit;
  background: var(--selection);
}

/* blink's userstyle.css greys the selection of an inactive window; a rule of its own, as Firefox,
   which does not know :window-inactive, would drop a selector list with it */
::selection:window-inactive {
  background: var(--selection);
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--wiki-accent);
  outline-offset: 2px;
  border-radius: 6px;
}

a {
  color: var(--link);
}

/* the template's icons; DokuWiki's img.icon (a change's file type) keeps its own size */
:where(svg).icon {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip {
  position: fixed;
  z-index: 100;
  top: -100px;
  left: 1rem;
  padding: .5rem .9rem;
  color: var(--wiki-ink);
  background: var(--wiki);
  border-radius: 0 0 8px 8px;
}

.skip:focus {
  top: 0;
}

.dokuwiki .a11y {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- Title bar --------------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  z-index: 40;
  top: 0;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  height: var(--topbar-h);
  padding: var(--ribbon) var(--gutter) 0;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: var(--ribbon);
  background: var(--wiki-ribbon);
  box-shadow: inset 0 -1px 0 var(--wiki-deep);
}

:root[data-scheme="dark"] .topbar::before {
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .08);
}

.wiki-tab {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: .6rem;
  align-self: flex-start;
  height: calc(var(--topbar-h) - var(--ribbon) - 8px);
  padding: 0 1rem 0 .7rem;
  color: var(--wiki-ink);
  text-decoration: none;
  background: var(--wiki);
  border-radius: 0 0 12px 12px;
  box-shadow: inset 0 -1px 0 var(--wiki-deep), 0 8px 18px -12px var(--wiki-deeper);
  transition: padding-top .25s var(--ease);
}

.wiki-tab:hover {
  padding-top: 3px;
}

:root[data-scheme="dark"] .wiki-tab {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), 0 8px 22px -12px #000;
}

.wiki-tab__logo {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: contain;
}

:root[data-scheme="dark"] [data-scheme-only="light"],
:root:not([data-scheme="dark"]) [data-scheme-only="dark"] {
  display: none;
}

.wiki-tab__name {
  font: 400 1.125rem/1 var(--font-display);
  letter-spacing: -.01em;
  white-space: nowrap;
}

.wiki-tab__readonly {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin-left: .15rem;
  padding: .2rem .5rem .2rem .4rem;
  font: 600 .6875rem/1 var(--font-ui);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  background: color-mix(in oklab, var(--wiki-ink) 16%, transparent);
  border-radius: 999px;
}

.wiki-tab__readonly .icon {
  width: 12px;
  height: 12px;
  stroke-width: 2.2;
}

/* The main menu: the wiki's navbar page, a list whose entries with a sublist open as drop-downs */

.topnav {
  flex: 1 1 0;
  align-self: stretch;
  display: flex;
  min-width: 0;
  container-type: inline-size;
}

.topnav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.topnav > ul {
  display: flex;
  gap: .25rem;
}

.topnav > ul > li {
  position: relative;
  display: flex;
}

/* DokuWiki's script wraps the link to the current page in span.curid */
.topnav div.li,
.topnav span.curid {
  display: contents;
}

.topnav > ul > li > div.li a,
.topnav__group {
  position: relative;
  display: flex;
  align-items: center;
  gap: .3rem;
  padding: 0 .7rem;
  font: 500 .875rem/1 var(--font-ui);
  color: var(--text-muted);
  text-decoration: none;
  background: none;
  border: 0;
  cursor: pointer;
  transition: color .15s ease;
}

.topnav__group::before {
  content: "";
  order: 1;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 .2rem;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  opacity: .6;
}

.topnav > ul > li > div.li a:hover,
.topnav__group:hover,
.topnav .is-open > .topnav__group,
.topnav > ul > li > div.li a[aria-current],
.topnav > ul > li:has(a[aria-current]) > .topnav__group {
  color: var(--text);
}

/* level with the wiki tab's lower edge, which ends 8px above the bar's border */
.topnav > ul > li > div.li a::after,
.topnav__group::after {
  content: "";
  position: absolute;
  left: .7rem;
  right: .7rem;
  bottom: 7px;
  height: 2px;
  background: var(--wiki-accent);
  border-radius: 2px;
  transform: scaleX(0);
  transition: transform .25s var(--ease);
}

.topnav > ul > li > div.li a:hover::after,
.topnav__group:hover::after,
.topnav .is-open > .topnav__group::after {
  background: var(--cat-overlay0);
  transform: none;
}

.topnav > ul > li > div.li a[aria-current]::after,
.topnav > ul > li:has(a[aria-current]) > .topnav__group::after {
  background: var(--wiki-accent);
  transform: none;
}

.topnav > ul > li > ul {
  position: absolute;
  z-index: 50;
  top: calc(100% + 1px);
  left: 0;
  display: none;
  min-width: 13rem;
  padding: .35rem;
  background: var(--menu-bg);
  border-radius: 0 0 12px 12px;
  box-shadow: var(--shadow-menu);
}

.topnav > ul > li.is-open > ul {
  display: block;
}

@media (hover: hover) {
  .topnav > ul > li:hover > ul {
    display: block;
  }
}

/* div.li outweighs DokuWiki's room for its link icons (.dokuwiki a.interwiki) */
.topnav li li div.li a {
  display: block;
  padding: .45rem .75rem;
  font-size: .875rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 7px;
}

.topnav li li a:hover {
  background: var(--bg-hover);
}

.topnav li li a[aria-current] {
  font-weight: 600;
  color: var(--wiki-accent);
  background: var(--wiki-soft);
}

/* A link to another wiki or site is an entry like any other, without DokuWiki's link icon */
.topnav a:is(.urlextern, .interwiki, .mail, .windows) {
  background-image: none;
}

/* A menu of one group ("Books") shows the group's entries in the bar where they fit */
@container (min-width: 40rem) {
  .topnav > ul > li:only-child {
    display: contents;
  }

  .topnav > ul > li:only-child > .topnav__group {
    display: none;
  }

  .topnav > ul > li:only-child > ul {
    position: static;
    display: flex;
    gap: .25rem;
    min-width: 0;
    padding: 0;
    background: none;
    border-radius: 0;
    box-shadow: none;
  }

  .topnav > ul > li:only-child > ul > li {
    display: flex;
  }

  .topnav > ul > li:only-child > ul > li > div.li a {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0 .7rem;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border-radius: 0;
  }

  .topnav > ul > li:only-child > ul > li > div.li a:hover,
  .topnav > ul > li:only-child > ul > li > div.li a[aria-current] {
    color: var(--text);
    background: none;
  }

  .topnav > ul > li:only-child > ul > li > div.li a::after {
    content: "";
    position: absolute;
    left: .7rem;
    right: .7rem;
    bottom: 7px;
    height: 2px;
    background: var(--wiki-accent);
    border-radius: 2px;
    transform: scaleX(0);
    transition: transform .25s var(--ease);
  }

  .topnav > ul > li:only-child > ul > li > div.li a:hover::after {
    background: var(--cat-overlay0);
    transform: none;
  }

  .topnav > ul > li:only-child > ul > li > div.li a[aria-current]::after {
    background: var(--wiki-accent);
    transform: none;
  }
}

/* Tools: search, scheme, user */

.topbar__tools {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-left: auto;
}

.topbar__search {
  position: relative;
  display: flex;
  align-items: center;
  gap: .5rem;
  width: clamp(14rem, 18vw, 22rem);
  height: 38px;
  padding: 0 .5rem 0 .7rem;
  color: var(--text-faint);
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: text;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.topbar__search:hover {
  border-color: var(--line-strong);
}

.topbar__search:focus-within {
  border-color: var(--wiki-accent);
  box-shadow: 0 0 0 3px var(--wiki-soft);
}

.topbar__search .icon {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
}

.topbar__search form.search,
.topbar__search form.search div.no {
  display: contents;
}

.topbar__search #qsearch__in {
  flex: 1;
  min-width: 0;
  padding: 0;
  font: inherit;
  font-size: .875rem;
  color: var(--text);
  background: none;
  border: 0;
  border-radius: 0;
  outline: none;
  box-shadow: none;
}

.topbar__search #qsearch__in::placeholder {
  color: var(--text-faint);
}

.topbar__search button[type="submit"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  border: 0;
}

.topbar__search kbd {
  padding: .1rem .35rem;
  font: 500 .6875rem/1.4 var(--font-ui);
  color: var(--text-faint);
  white-space: nowrap;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
}

.topbar__search #qsearch__out {
  position: absolute;
  z-index: 50;
  top: calc(100% + 6px);
  right: 0;
  width: max(100%, 22rem);
  max-height: 70vh;
  overflow: auto;
  padding: .5rem;
  font-size: .875rem;
  color: var(--text);
  background: var(--menu-bg);
  border: 0;
  border-radius: 12px;
  box-shadow: var(--shadow-menu);
}

.topbar__search #qsearch__out:empty,
.topbar__search #qsearch__out[style*="none"] {
  display: none;
}

.topbar__search #qsearch__out strong {
  display: block;
  padding: .25rem .5rem;
  font-size: .75rem;
  color: var(--text-faint);
}

.topbar__search #qsearch__out ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.topbar__search #qsearch__out a {
  display: block;
  padding: .35rem .5rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 7px;
}

.topbar__search #qsearch__out a:hover {
  color: var(--wiki-accent);
  background: var(--bg-hover);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--text-muted);
  background: none;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  transition: color .15s ease, background-color .15s ease;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.icon--sun,
:root[data-scheme="dark"] .icon--moon {
  display: none;
}

:root[data-scheme="dark"] .icon--sun {
  display: block;
}

.topbar__menu {
  display: none;
  margin-left: -.4rem;
}

/* Drop-down menus (<details>): the page tools and the user menu */

.menu {
  position: relative;
}

.menu__button {
  display: flex;
  align-items: center;
  gap: .4rem;
  color: var(--text-muted);
  list-style: none;
  cursor: pointer;
  border-radius: 8px;
}

.menu__button::-webkit-details-marker {
  display: none;
}

.menu__button:hover,
.menu[open] > .menu__button {
  color: var(--text);
  background: var(--bg-hover);
}

.menu__button > .icon {
  width: 18px;
  height: 18px;
}

.menu__list {
  position: absolute;
  z-index: 50;
  top: calc(100% + 6px);
  left: 0;
  min-width: 14rem;
  margin: 0;
  padding: .35rem;
  list-style: none;
  background: var(--menu-bg);
  border-radius: 12px;
  box-shadow: var(--shadow-menu);
}

.menu--end .menu__list {
  right: 0;
  left: auto;
}

.menu__item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .45rem .7rem;
  font-size: .875rem;
  line-height: 1.3;
  color: var(--text);
  white-space: nowrap;
  text-decoration: none;
  border-radius: 7px;
}

.menu__item:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.menu__item svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: var(--text-muted);
}

.menu__separator {
  height: 1px;
  margin: .35rem .5rem;
  background: var(--line);
}

button.menu__item {
  width: 100%;
  font-family: inherit;
  font-weight: inherit;
  text-align: start;
  background: none;
  border: 0;
  cursor: pointer;
}

.user .menu__button {
  margin-left: .25rem;
  padding: .2rem;
  border-radius: 999px;
}

.user__avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--wiki-accent);
  background: var(--wiki-soft);
  border-radius: 50%;
}

.page-edit svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.page-tools > .menu__button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
}

.login-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .45rem .8rem;
  font-size: .8125rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--action-ink);
  text-decoration: none;
  background: var(--action);
  border-radius: 7px;
}

.login-btn:hover {
  background: var(--action-hover);
}

.login-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* --- Layout and sidebar ------------------------------------------------------------------------ */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: calc(100vh - var(--topbar-h));
}

.layout.has-sidebar {
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 1.5rem 1rem 3rem;
  background: var(--bg-subtle);
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
}

/* The index: the wiki's sidebar page, usually the wayz plugin's list that draws its own fold */

.sidebar__tree ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sidebar__tree ul ul {
  margin: .15rem 0 .4rem .9rem;
  padding-left: .55rem;
  border-left: 1px solid var(--line-strong);
}

.sidebar__tree li {
  margin: 0;
}

.sidebar__tree div.li {
  position: relative;
  display: block;
}

.sidebar__tree span.curid {
  display: contents;
}

.sidebar__tree a {
  position: relative;
  display: block;
  margin: 1px 0;
  padding: .32rem .6rem;
  font-size: .875rem;
  line-height: 1.45;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 7px;
  transition: color .15s ease, background-color .15s ease;
}

.sidebar__tree a:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.sidebar__tree li:has(> ul) > div.li a {
  padding-right: 2rem;
  font-weight: 600;
  color: var(--text);
}

.sidebar__tree div.li a[aria-current="page"] {
  font-weight: 600;
  color: var(--wiki-accent);
  background: var(--wiki-soft);
}

.sidebar__tree ul ul div.li a[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: .3rem;
  bottom: .3rem;
  left: calc(-.55rem - 1px);
  width: 2px;
  background: var(--wiki-accent);
  border-radius: 2px;
}

/* The wayz plugin's toggle (it draws the fold): the chevron over the end of the namespace's link */
.sidebar__tree button.wayz-index-toggle {
  position: absolute;
  top: 50%;
  right: .2rem;
  width: 1.6rem;
  height: 1.6rem;
  color: var(--text-faint);
  border-radius: 6px;
  opacity: 1;
  transform: translateY(-50%);
}

.sidebar__tree button.wayz-index-toggle:hover {
  color: var(--text);
  background: var(--bg-hover);
}

/* The wayz plugin's search field above the index, in the look of the title bar's search, beside it
   the buttons that close and open the whole index */
.sidebar__tree .wayz-index-bar {
  align-items: center;
  gap: 0;
  margin: 0 0 .75rem;
}

.sidebar__tree button.wayz-index-all {
  width: 26px;
  height: 28px;
  color: var(--text-faint);
  background: none;
  border: 0;
  border-radius: 6px;
  opacity: 1;
  transition: color .15s ease, background-color .15s ease;
}

.sidebar__tree button.wayz-index-all[data-open="false"] {
  margin-left: .25rem;
}

.sidebar__tree button.wayz-index-all:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.sidebar__tree button.wayz-index-all::before,
.sidebar__tree button.wayz-index-all::after {
  width: 10px;
  height: 1.5px;
  border-radius: 1px;
}

.sidebar__tree .wayz-index-search {
  height: 36px;
  margin: 0;
  padding: 0 .7rem;
  font: inherit;
  font-size: .875rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.sidebar__tree .wayz-index-search::placeholder {
  color: var(--text-faint);
}

.sidebar__tree .wayz-index-search:focus {
  border-color: var(--wiki-accent);
  box-shadow: 0 0 0 3px var(--wiki-soft);
}

.sidebar__tree .wayz-index-nomatch {
  margin: .3rem .6rem;
  font-size: .875rem;
  color: var(--text-faint);
}

/* --- Main column: breadcrumbs and actions, the page, the table of contents beside it ------------ */

.main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "doc";
  align-content: start;
  column-gap: clamp(2rem, 3vw, 4rem);
  padding: 1.5rem var(--gutter) 6rem;
}

.main:has(> .toc-col) {
  grid-template-columns: minmax(0, 1fr) var(--toc-w);
  grid-template-rows: auto 1fr;
  grid-template-areas: "head toc" "doc toc";
}

.doc__head {
  grid-area: head;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.25rem;
  margin-bottom: .75rem;
}

.doc {
  grid-area: doc;
  min-width: 0;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.crumbs__item + .crumbs__item::before {
  content: "/";
  margin: 0 .5rem;
  color: var(--text-faint);
}

.crumbs a {
  color: var(--wiki-accent);
  text-decoration: none;
}

.crumbs a.wikilink2 {
  color: var(--text-faint);
}

.crumbs a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.doc__actions {
  display: flex;
  align-items: center;
  gap: .25rem;
  margin-left: auto;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .6rem;
  font-size: .8125rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 7px;
  transition: color .15s ease, background-color .15s ease;
}

.ghost-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.ghost-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* --- Page content (DokuWiki's markup) ---------------------------------------------------------- */

.page {
  overflow-wrap: break-word;
}

/* indexmenu's sort number of the page, shown to editors */
.page > div.info:first-child {
  float: right;
  margin: .9rem 0 0 1rem;
  padding: 0;
  font-size: .75rem;
  color: var(--text-faint);
  background: none !important;
  border: 0;
}

.page h1,
.page h2,
.page h3,
.page h4,
.page h5 {
  color: var(--text);
  text-wrap: balance;
}

.page h1 {
  margin: 0 0 1.1rem;
  font: 400 2.6rem/1.1 var(--font-display);
  letter-spacing: -.025em;
}

.page h2 {
  margin: 3rem 0 .9rem;
  font: 400 1.7rem/1.2 var(--font-display);
  letter-spacing: -.015em;
}

.page h3 {
  margin: 2.25rem 0 .6rem;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -.005em;
}

.page h4,
.page h5 {
  margin: 1.75rem 0 .5rem;
  font-size: 1rem;
  font-weight: 600;
}

.page p {
  margin: 0 0 1.1rem;
}

.page .level1 > p:first-child {
  font-size: 1.1rem;
  line-height: 1.65;
  color: var(--text-muted);
}

.page ul,
.page ol {
  margin: 0 0 1.2rem;
  padding-left: 1.3rem;
}

.page li {
  margin: .3rem 0;
}

.page li::marker {
  color: var(--text-faint);
}

.page hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.page blockquote {
  margin: 1.25rem 0;
  padding: .25rem 0 .25rem 1rem;
  color: var(--text-muted);
  border-left: 3px solid var(--wiki-soft);
}

/* Links in Blue, underlined; hover tints them and draws the line in full */
.page a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: color-mix(in oklab, var(--link) 40%, transparent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  border-radius: 3px;
  transition: background-color .15s ease, text-decoration-color .15s ease;
}

.page a:hover {
  text-decoration-color: currentColor;
  background-color: var(--link-tint);
}

.page a.wikilink2 {
  color: var(--missing);
  text-decoration-style: dashed;
  text-decoration-color: color-mix(in oklab, var(--missing) 60%, transparent);
}

.page a.wikilink2:hover {
  text-decoration-color: currentColor;
  background-color: color-mix(in srgb, var(--missing) 12%, transparent);
}

.page a.media {
  text-decoration: none;
}

/* DokuWiki's own link icons (background images) give way to the theme's */
.page a:is(.urlextern, .interwiki, .mail, .windows) {
  padding-left: 0;
  background-image: none;
}

.page a.urlextern::after,
.page a.interwiki::before {
  content: "";
  display: inline-block;
  width: .8em;
  height: .8em;
  background-color: currentColor;
  opacity: .6;
  -webkit-mask: var(--icon) no-repeat center / contain;
  mask: var(--icon) no-repeat center / contain;
}

.page a.urlextern::after {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M9 7h8v8'/%3E%3C/svg%3E");
  margin-left: .15em;
}

.page a.interwiki::before {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='5' rx='1'/%3E%3Cpath d='M5 9v10h14V9M10 13h4'/%3E%3C/svg%3E");
  margin-right: .25em;
  vertical-align: -.05em;
}

.page abbr[title] {
  color: inherit;
  text-decoration: underline dotted;
  text-decoration-color: var(--wiki-accent);
  text-underline-offset: 3px;
  cursor: help;
}

.page code {
  padding: .12em .4em;
  font: 500 .875em/1 var(--font-mono);
  color: var(--text);
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 5px;
}

.page pre {
  margin: 1.25rem 0;
  padding: .9rem 1.1rem;
  overflow: auto;
  font: 400 .85rem/1.55 var(--font-mono);
  color: var(--text);
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
}

.page dl.code dt,
.page dl.file dt {
  font-size: .8125rem;
}

.page dl.code dd,
.page dl.file dd {
  margin: 0;
}

.page img.media,
.page img.medialeft,
.page img.mediaright,
.page img.mediacenter {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.page img.mediaright {
  float: right;
  margin: 0 0 1rem 1.5rem;
}

.page img.medialeft {
  float: left;
  margin: 0 1.5rem 1rem 0;
}

.page img.mediacenter {
  display: block;
  margin: 1rem auto;
}

.page .level1::after,
.page .level2::after,
.page .level3::after {
  content: "";
  display: table;
  clear: both;
}

.page em.u {
  font-style: normal;
  text-decoration: underline;
}

.page .search_hit,
.page .search_snippet strong {
  color: var(--text);
  background: var(--highlight);
}

/* Tables */

.page div.table {
  margin: 1.5rem 0 1.75rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.page table.inline {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-size: .9rem;
  line-height: 1.5;
  background: none;
}

.page table.inline th,
.page table.inline td {
  padding: .6rem .9rem;
  text-align: left;
  vertical-align: top;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.page table.inline th {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-subtle);
}

.page table.inline tr:last-child td {
  border-bottom: 0;
}

.page table.inline tr:hover td {
  background: color-mix(in srgb, var(--cat-surface0) 55%, transparent);
}

.page table.inline .centeralign {
  text-align: center;
}

.page table.inline .rightalign {
  text-align: right;
}

/* blink's userstyle.css separates column groups of the wayz tables with grey lines */
.page table[class*="wayz-table-border"] :is(th, td) {
  border-right-color: var(--line-strong) !important;
}

.page div.plugin_wayz_table,
.page div.plugin_wayz_figure {
  margin-bottom: 1.5rem;
}

.page div.plugin_wayz_caption {
  margin-top: .5rem;
  padding-left: 0;
  font-size: .8125rem;
  color: var(--text-muted);
  border-left: 0;
}

.page div.plugin_wayz_table div.plugin_wayz_caption {
  margin-top: -.85rem;
}

.page span.plugin_wayz_caption_number {
  font-weight: 600;
  color: var(--text);
}

/* The wayz plugin's boxes */

.page .wayz {
  margin: 1.5rem 0;
  padding: .95rem 1.15rem 1rem;
  border-width: 1px;
  border-radius: 12px;
}

.page .wayz-heading {
  align-items: center;
}

.page .wayz-heading .wayz-title {
  font-weight: 600;
  letter-spacing: -.005em;
}

.page .wayz-heading .wayz-abbr {
  align-self: center;
  font-weight: 500;
  opacity: .75;
}

.page .wayz-text {
  margin-top: .45rem;
  font-size: .95rem;
}

.page .wayz:not(.wayz-todo) .wayz-text {
  color: var(--text);
}

.page .wayz-text.wayz-notitle {
  margin-top: 0;
}

.page .wayz-wrapper {
  align-items: center;
}

.page .wayz p:last-child,
.page .wayz ul:last-child {
  margin-bottom: 0;
}

/* The bootswrapper plugin's alerts (<alert>), without Bootstrap */

.page .alert {
  --alert: var(--info);
  margin: 1.25rem 0;
  padding: .85rem 1.1rem;
  color: var(--text);
  background: color-mix(in oklab, var(--alert) 9%, transparent);
  border: 1px solid color-mix(in oklab, var(--alert) 32%, transparent);
  border-radius: 12px;
}

.page .alert-success {
  --alert: var(--success);
}

.page .alert-warning {
  --alert: var(--warning);
}

.page .alert-danger {
  --alert: var(--danger);
}

.page .alert > :last-child {
  margin-bottom: 0;
}

.page .alert > svg {
  float: left;
  width: 1.1em;
  height: 1.1em;
  margin: .3em .5em 0 0;
  color: var(--alert);
}

.page .alert .close {
  float: right;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text-muted);
  background: none;
  border: 0;
  cursor: pointer;
}

/* Section editing */

.page div.secedit {
  float: right;
  margin-top: -.5rem;
}

.page .secedit button,
.page .secedit input.button {
  width: auto !important;
  height: auto !important;
  padding: .15rem .55rem;
  font-size: .75rem !important;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  opacity: .7;
}

.page .secedit button:hover {
  color: var(--text);
  opacity: 1;
}

.page div.section_highlight {
  margin: 0 -1rem;
  padding: 0 1rem;
  background: var(--wiki-faint);
  border: 0;
  border-radius: 0 8px 8px 0;
  /* a shadow rather than a border, which would push the section's text aside */
  box-shadow: inset 3px 0 0 var(--wiki-accent);
}

/* Footnotes */

.page div.footnotes {
  margin-top: 3rem;
  padding-top: 1rem;
  font-size: .875rem;
  color: var(--text-muted);
  border-top: 1px solid var(--line);
}

/* --- Page info --------------------------------------------------------------------------------- */

.pageinfo {
  margin-top: 3rem;
  padding-top: 1.1rem;
  font-size: .8125rem;
  color: var(--text-faint);
  border-top: 1px solid var(--line);
}

.pageinfo bdi:first-child {
  font-family: var(--font-mono);
  font-size: .78rem;
}

/* --- Table of contents (DokuWiki's #dw__toc) --------------------------------------------------- */

.toc-col {
  grid-area: toc;
  min-width: 0;
}

.toc-col #dw__toc {
  position: sticky;
  top: calc(var(--topbar-h) + 1.5rem);
  float: none;
  width: auto;
  max-height: calc(100vh - var(--topbar-h) - 3rem);
  margin: 0;
  overflow-y: auto;
  font-size: inherit;
  background: none;
  border: 0;
  scrollbar-width: thin;
}

.toc-col #dw__toc h3 {
  margin: 0 0 .7rem;
  padding: 0;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: none;
  cursor: default;
}

.toc-col #dw__toc h3 strong {
  display: none;
}

.toc-col #dw__toc > div {
  display: block;
}

.toc-col ul.toc {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--line);
}

.toc-col ul.toc ul.toc {
  border-left: 0;
}

.toc-col ul.toc li {
  margin: 0;
  padding: 0;
  background: none;
}

.toc-col ul.toc div.li {
  display: block;
}

.toc-col ul.toc a {
  display: block;
  margin-left: -1px;
  padding: .3rem 0 .3rem .9rem;
  font-size: .84rem;
  line-height: 1.4;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
}

/* script.js marks the section in view; the first mark is set before the fades are switched on */
.toc-col #dw__toc.is-settled ul.toc a {
  transition: color .15s ease, border-color .15s ease;
}

.toc-col ul.toc li.level2 a {
  padding-left: 1.7rem;
}

.toc-col ul.toc a:hover {
  color: var(--text);
}

.toc-col ul.toc a.is-active {
  font-weight: 500;
  color: var(--wiki-accent);
  border-left-color: var(--wiki-accent);
}

/* --- DokuWiki's interface: messages, forms, buttons, login ------------------------------------- */

div.error,
div.info,
div.success,
div.notify {
  --alert: var(--info);
  margin: 0 0 1rem;
  padding: .7rem 1rem .7rem 2.6rem;
  font-size: .875rem;
  color: var(--text);
  background-color: color-mix(in oklab, var(--alert) 10%, var(--bg)) !important;
  background-position: .85rem .85rem;
  border: 1px solid color-mix(in oklab, var(--alert) 32%, transparent);
  border-radius: 10px;
}

div.error {
  --alert: var(--danger);
}

div.success {
  --alert: var(--success);
}

div.notify {
  --alert: var(--warning);
}

/* zero specificity: the template's own controls and DokuWiki's special ones override these */
:where(.dokuwiki) :where(input:not([type="checkbox"], [type="radio"], [type="image"], [type="submit"], [type="button"], [type="reset"]), select, textarea) {
  padding: .45rem .65rem;
  font: inherit;
  font-size: .9375rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: none;
}

.dokuwiki :where(input, select, textarea):focus {
  border-color: var(--wiki-accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--wiki-soft);
}

:where(.dokuwiki) :where(button, input[type="submit"], input[type="button"], input[type="reset"]) {
  padding: .45rem .9rem;
  font: 500 .875rem/1.2 var(--font-ui);
  color: var(--text);
  background: var(--bg-subtle);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  cursor: pointer;
}

:where(.dokuwiki) :where(button, input[type="submit"], input[type="button"], input[type="reset"]):hover {
  background: var(--bg-neutral);
}

:where(.dokuwiki) :where(button[type="submit"], input[type="submit"]) {
  color: var(--action-ink);
  background: var(--action);
  border-color: var(--action-hover);
}

:where(.dokuwiki) :where(button[type="submit"], input[type="submit"]):hover {
  background: var(--action-hover);
}

/* Recent changes, old revisions and a media file's history (form.changes): a row per change, the
   pictures of diff and history drawn as icons over DokuWiki's, which stay for their titles */

.dokuwiki form.changes ul {
  margin: 0 0 1.25rem;
  padding: 0;
}

.dokuwiki form.changes ul li {
  margin: 0;
  border-bottom: 1px solid var(--line);
}

.dokuwiki form.changes ul li:hover {
  background: var(--bg-hover);
}

.dokuwiki form.changes ul li div.li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem .6rem;
  padding: .5rem .6rem;
  font-size: .875rem;
}

.dokuwiki form.changes li span.date {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.dokuwiki form.changes li span.sum {
  font-weight: 400;
  color: var(--text-muted);
}

.dokuwiki form.changes li span.user {
  color: var(--text-faint);
}

.dokuwiki form.changes li div.li > img[src$="/blank.gif"] {
  width: 1.5rem;
  height: 1px;
}

.dokuwiki form.changes li :is(a.diff_link, a.revisions_link) {
  position: relative;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  color: var(--text-faint);
  border-radius: 6px;
}

.dokuwiki form.changes li :is(a.diff_link, a.revisions_link):hover {
  color: var(--text);
  background: var(--bg-neutral);
}

.dokuwiki form.changes li :is(a.diff_link, a.revisions_link) img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
}

.dokuwiki form.changes li :is(a.diff_link, a.revisions_link)::before {
  content: "";
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: var(--icon) no-repeat center / contain;
  mask: var(--icon) no-repeat center / contain;
}

.dokuwiki form.changes li a.diff_link::before {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z'/%3E%3Cpath d='M9 10h6M12 7v6M9 17h6'/%3E%3C/svg%3E");
}

.dokuwiki form.changes li a.revisions_link::before {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8'/%3E%3Cpath d='M3 3v5h5M12 7v5l4 2'/%3E%3C/svg%3E");
}

.dokuwiki form.changes li .sizechange {
  padding: .1rem .4rem;
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  background-color: var(--bg-neutral);
  border-radius: 5px;
}

.dokuwiki form.changes li .sizechange.positive {
  color: var(--success);
  background-color: color-mix(in oklab, var(--success) 14%, transparent);
}

.dokuwiki form.changes li .sizechange.negative {
  color: var(--danger);
  background-color: color-mix(in oklab, var(--danger) 14%, transparent);
}

/* The editor (page, section and table): script.js lets the text field or edittable's grid fill
   the window. DokuWiki's standard intro ("Edit the page and hit Save ...", the only one linking the
   syntax page) costs space; the warnings for an old revision or a read-only page stay. */

.mode_edit .page > p:has(a[data-wiki-id="wiki:syntax"]):has(+ .editBox),
.mode_edit .pageinfo {
  display: none;
}

.mode_edit .main {
  padding-bottom: 1.25rem;
}

/* the field reads like the markup it holds, as pre/code and the diff view do; DokuWiki's generic
   control rule would give it the UI font */
#wiki__text {
  resize: none;
  font-family: var(--font-mono);
}

/* the window decides the size, not DokuWiki's larger/smaller buttons */
#size__ctl button:has(img[src$="larger.svg"], img[src$="smaller.svg"]) {
  display: none;
}

/* DokuWiki's toolbar icons are dark pictures */
#tool__bar {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
}

#tool__bar button.toolbutton {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 .4rem;
  background: var(--bg-subtle);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
}

#tool__bar button.toolbutton:hover {
  background: var(--bg-hover);
  border-color: var(--cat-overlay0);
}

:root[data-scheme="dark"] #tool__bar img {
  filter: invert(.88) hue-rotate(180deg);
}

#wiki__editbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1.5rem;
}

#wiki__editbar #size__ctl {
  order: 1;
  margin-left: auto;
}

#wiki__editbar .editButtons {
  display: flex;
  gap: .5rem;
  margin: 0;
}

/* Save is the action; preview and cancel are plain buttons */
#wiki__editbar .editButtons button:not(#edbtn__save) {
  color: var(--text);
  background: var(--bg-subtle);
  border-color: var(--line-strong);
}

#wiki__editbar .editButtons button:not(#edbtn__save):hover {
  background: var(--bg-hover);
}

#wiki__editbar .summary {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1.25rem;
}

#wiki__editbar .summary label[for="edit__summary"] {
  display: flex;
  flex: 1;
  align-items: center;
  gap: .6rem;
  min-width: min(100%, 18rem);
}

#wiki__editbar .summary label[for="edit__minoredit"] {
  display: flex;
  align-items: center;
  gap: .4rem;
}

/* the summary in the look of the title bar's search; DokuWiki marks it while it is empty */
#edit__summary {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 .7rem;
  color: var(--text);
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: 9px;
}

#edit__summary:hover {
  border-color: var(--line-strong);
}

#edit__summary.missing {
  color: var(--text);
  background: var(--bg-subtle);
  border-color: color-mix(in srgb, var(--warning) 55%, transparent);
}

#edit__summary:focus {
  border-color: var(--wiki-accent);
  box-shadow: 0 0 0 3px var(--wiki-soft);
}

.dokuwiki fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.dokuwiki legend {
  padding: 0 .4rem;
  font-weight: 600;
}

/* The search above the results: field, button and the toggle of the search tools in one row, the
   tools below (search.js puts the toggle first). DokuWiki's intro above it goes. */

.mode_search .page > h1 + .level1:has(+ .search-results-form) {
  display: none;
}

.dokuwiki .search-results-form fieldset.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  width: auto;
  margin: 1rem 0 1.5rem;
  padding: .75rem;
  text-align: left;
}

.dokuwiki .search-results-form fieldset.search-form input[name="q"] {
  flex: 1 1 14rem;
  width: auto;
}

.dokuwiki .search-results-form fieldset.search-form button.toggleAssistant {
  order: 1;
  float: none;
}

.dokuwiki .search-results-form fieldset.search-form .advancedOptions {
  flex-basis: 100%;
  order: 2;
  padding: .25rem 0 0;
}

/* The login page of anonymous readers (tpl_login.php): the wiki's logo and name on a band in the
   wiki colour, DokuWiki's form on a card overlapping it; the reset of a password alike */

.login {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  justify-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-subtle);
}

.login .scheme-toggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: var(--wiki-ink);
}

.login .scheme-toggle:hover {
  color: var(--wiki-ink);
  background: color-mix(in srgb, var(--wiki-ink) 14%, transparent);
}

.login__band {
  display: grid;
  justify-items: center;
  width: 100%;
  padding: clamp(2.5rem, 7vh, 4.5rem) 1.5rem 7.5rem;
  text-align: center;
  color: var(--wiki-ink);
  background: linear-gradient(180deg, var(--wiki), var(--wiki-deep));
}

.login__logo {
  display: block;
  width: 7.5rem;
  height: 7.5rem;
  margin-bottom: 1rem;
  object-fit: contain;
}

.login__name {
  margin: 0;
  font: 400 clamp(2.5rem, 5vw, 3.25rem)/1.05 var(--font-display);
  letter-spacing: -.01em;
  color: inherit;
}

.login__readonly {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin: .75rem 0 0;
  padding: .15rem .6rem;
  font-size: .75rem;
  font-weight: 600;
  background: color-mix(in srgb, currentColor 16%, transparent);
  border-radius: 999px;
}

.login__readonly .icon {
  width: 12px;
  height: 12px;
  stroke-width: 2.2;
}

.login__card {
  align-self: start;
  width: min(100% - 2rem, 24rem);
  margin: -5rem 0 3rem;
  padding: 1.75rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

/* DokuWiki's headings and intro texts of the denied, login and reset views give way to the form */
.login__form > :not(.centeralign) {
  display: none;
}

.login__form > .centeralign {
  text-align: left;
}

:is(#dw__login, #dw__resendpwd) {
  display: block;
  width: 100%;
  margin: 0;
  text-align: left;
}

:is(#dw__login, #dw__resendpwd) fieldset {
  width: auto;
  margin: 0;
  padding: 0;
  text-align: left;
  border: 0;
}

#dw__login legend,
.login__title {
  margin: 0 0 1.25rem;
  padding: 0;
  font: 400 1.5rem/1.2 var(--font-display);
  text-align: center;
}

/* the page's title names the reset; DokuWiki's legend stays for screen readers */
#dw__resendpwd legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.login__steps {
  display: grid;
  gap: .6rem;
  margin: 0 0 1.5rem;
  padding: 0;
  font-size: .875rem;
  line-height: 1.45;
  color: var(--text-muted);
  list-style: none;
  counter-reset: step;
}

.login__steps li {
  display: grid;
  grid-template-columns: 1.5rem 1fr;
  gap: .65rem;
  margin: 0;
  counter-increment: step;
}

.login__steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--wiki-accent);
  background: var(--wiki-soft);
  border-radius: 999px;
}

:is(#dw__login, #dw__resendpwd) br {
  display: none;
}

:is(#dw__login, #dw__resendpwd) label.block {
  display: block;
  margin-bottom: 1rem;
  text-align: left;
}

:is(#dw__login, #dw__resendpwd) label.block span {
  display: block;
  margin-bottom: .3rem;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text-muted);
}

:is(#dw__login, #dw__resendpwd) label.block input {
  display: block;
  width: 100%;
  height: 2.75rem;
  font-size: 1rem;
}

/* DokuWiki indents it by half the form (margin-left: 50%) */
#dw__login label[for="remember__me"] {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin: 0 0 1.25rem;
  font-size: .875rem;
  color: var(--text-muted);
}

#dw__login input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--wiki-accent);
}

:is(#dw__login, #dw__resendpwd) button[type="submit"] {
  display: block;
  width: 100%;
  height: 2.75rem;
  margin: 0;
  font-size: .9375rem;
  font-weight: 600;
  border-radius: 10px;
}

/* DokuWiki's own line for a new password: the card links to the reset below the form */
#dw__login > p {
  display: none;
}

.login__switch {
  display: block;
  margin-top: 1.25rem;
  font-size: .875rem;
  text-align: center;
}

/* DokuWiki's tabs (media manager, admin): the current one underlined in the accent */

.dokuwiki ul.tabs,
.dokuwiki .tabs > ul {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  margin: 0 0 .75rem;
  overflow: visible;
  border-bottom: 1px solid var(--line);
}

.dokuwiki ul.tabs::after,
.dokuwiki .tabs > ul::after {
  content: none;
}

.dokuwiki ul.tabs li,
.dokuwiki .tabs > ul li {
  float: none;
}

.dokuwiki ul.tabs li a,
.dokuwiki ul.tabs li strong,
.dokuwiki .tabs > ul li a,
#mediamanager__page .namespaces h2 {
  display: block;
  margin: 0 0 -1px;
  padding: .45rem .75rem;
  font: 500 .875rem/1.5 var(--font-ui);
  color: var(--text-muted);
  text-decoration: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
}

.dokuwiki ul.tabs li a:hover,
.dokuwiki .tabs > ul li a:hover {
  color: var(--text);
  background: none;
  border-bottom-color: var(--line-strong);
}

.dokuwiki ul.tabs li strong,
.dokuwiki ul.tabs li.active a,
.dokuwiki .tabs > ul li .curid a,
.dokuwiki .tabs > ul .active a {
  font-weight: 600;
  color: var(--text);
  background: none;
  border-bottom-color: var(--wiki-accent);
}

/* The media manager (?do=media): namespaces, files and the chosen file side by side in a grid,
   which replaces DokuWiki's floats and its resizing of the panels */

#mediamanager__page {
  display: grid;
  grid-template-columns: minmax(10rem, 14rem) minmax(0, 1fr) minmax(15rem, 22rem);
  column-gap: 1.5rem;
  min-width: 0;
}

#mediamanager__page:not(:has(.file .panelHeader)) {
  grid-template-columns: minmax(10rem, 14rem) minmax(0, 1fr);
}

#mediamanager__page > h1 {
  grid-column: 1 / -1;
}

/* !important: jQuery UI's resizable sets the panels' widths and shows its handles inline */
#mediamanager__page .panel {
  float: none;
  width: auto !important;
  min-width: 0;
}

#mediamanager__page .ui-resizable-handle {
  display: none !important;
}

#mediamanager__page dd {
  margin: 0;
}

#mediamanager__page .namespaces h2 {
  position: static;
  margin: 0 0 .75rem;
  padding-bottom: calc(.45rem + 1px);
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}

#mediamanager__page .panelHeader {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1rem;
  min-height: 0;
  margin: 0 0 .75rem;
  padding: .5rem .75rem;
  font-size: .875rem;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

#mediamanager__page .panelHeader h3 {
  float: none;
  margin: 0;
  font: 400 .875rem/1.5 var(--font-ui);
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

#mediamanager__page .panelHeader h3 strong {
  font-weight: 600;
  color: var(--text);
}

#mediamanager__page .panelContent {
  margin: 0;
}

/* the namespaces: DokuWiki's plus and minus pictures give way to a chevron */

#mediamanager__page #media__tree ul {
  margin: 0;
  padding: 0;
}

#mediamanager__page #media__tree li {
  display: grid;
  grid-template-columns: 1.25rem minmax(0, 1fr);
  align-items: center;
  margin: 0;
}

#mediamanager__page #media__tree li > ul {
  grid-column: 2;
}

#mediamanager__page #media__tree li > img {
  box-sizing: content-box;
  width: 0;
  height: 0;
  padding: .5rem;
  background: var(--text-faint);
  cursor: pointer;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m10 7 5 5-5 5'/%3E%3C/svg%3E") no-repeat center / 14px;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m10 7 5 5-5 5'/%3E%3C/svg%3E") no-repeat center / 14px;
  transition: transform .15s ease;
}

#mediamanager__page #media__tree li.open > img {
  transform: rotate(90deg);
}

#mediamanager__page #media__tree div.li a {
  display: block;
  margin: 1px 0;
  padding: .25rem .5rem;
  font-size: .875rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 7px;
}

#mediamanager__page #media__tree div.li a:hover {
  color: var(--text);
  background: var(--bg-hover);
}

#mediamanager__page #media__tree div.li a.selected {
  font-weight: 600;
  color: var(--wiki-accent);
  background: var(--wiki-soft);
}

/* the options of the file list: jQuery UI's buttons as segmented controls */

#mediamanager__page .panelHeader form.options {
  float: none;
  margin: 0;
}

#mediamanager__page .panelHeader form.options ul {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

#mediamanager__page .panelHeader form.options li {
  float: none;
  margin: 0;
  padding: 0;
  background: none;
}

#mediamanager__page .panelHeader form.options li label.ui-checkboxradio-label {
  margin: 0 0 0 -1px;
  padding: .3rem .65rem;
  font: 500 .8125rem/1.2 var(--font-ui);
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 0;
}

#mediamanager__page .panelHeader form.options li label.ui-checkboxradio-label:first-of-type {
  margin-left: 0;
  border-radius: 7px 0 0 7px;
}

#mediamanager__page .panelHeader form.options li label.ui-checkboxradio-label:last-of-type {
  border-radius: 0 7px 7px 0;
}

#mediamanager__page .panelHeader form.options li label.ui-checkboxradio-label:hover {
  color: var(--text);
  background: var(--bg-hover);
}

#mediamanager__page .panelHeader form.options li label.ui-checkboxradio-checked {
  position: relative;
  font-weight: 600;
  color: var(--wiki-accent);
  background: var(--wiki-soft);
}

/* the file list as thumbnails and as rows */

#mediamanager__page .filelist ul.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: .75rem;
  margin: 0;
}

#mediamanager__page .filelist .thumbs li {
  width: auto;
  min-height: 0;
  margin: 0;
  padding: .45rem;
  text-align: left;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

#mediamanager__page .filelist .panelContent ul li:hover {
  background: var(--bg-hover);
}

#mediamanager__page .filelist .thumbs li dt a {
  display: grid;
  place-items: center;
  width: auto;
  height: 6.5rem;
  background: var(--media-bg);
  border-radius: 6px;
}

#mediamanager__page .filelist .thumbs li dt a img {
  max-width: calc(100% - .5rem);
}

#mediamanager__page .filelist .thumbs li :is(.name, .size, .filesize, .date) {
  width: auto;
}

#mediamanager__page .filelist .thumbs li .name {
  padding: .4rem 0 .1rem;
}

#mediamanager__page .filelist li .name a {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

#mediamanager__page .filelist :is(.thumbs, .rows) li :is(.size, .filesize, .date) {
  font-size: .75rem;
  font-style: normal;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

#mediamanager__page .filelist .thumbs li .date {
  white-space: nowrap;
}

#mediamanager__page .filelist .rows li {
  max-height: none;
  margin: 0;
  padding: .35rem .5rem;
  background: none;
  border-bottom: 1px solid var(--line);
}

#mediamanager__page .filelist .rows li:nth-child(2n+1) {
  background-color: transparent;
}

#mediamanager__page .filelist .rows li dl {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) 5.5rem 8.5rem 4.5rem;
  align-items: center;
  gap: .75rem;
  margin: 0;
}

#mediamanager__page .filelist .rows li dt {
  float: none;
  width: auto;
  height: auto;
}

#mediamanager__page .filelist .rows li dt a {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  background: var(--media-bg);
  border-radius: 5px;
}

#mediamanager__page .filelist .rows li dt a img {
  max-width: 2.25rem;
  max-height: 2.25rem;
}

#mediamanager__page .filelist .rows li :is(.name, .size, .filesize, .date) {
  float: none;
  width: auto;
  margin: 0;
}

/* upload and search */

#mediamanager__page div.upload > p,
#mediamanager__page p.maxsize {
  font-size: .875rem;
  color: var(--text-muted);
}

#mediamanager__page .qq-upload-drop-area {
  background: var(--wiki-faint);
  border: 2px dashed var(--wiki-accent);
  border-radius: var(--radius);
}

#mediamanager__page .qq-upload-drop-area-active {
  background: var(--wiki-soft);
}

#mediamanager__page :is(div.search, #dw__upload) label:not(.check) span {
  display: block;
  margin-bottom: .3rem;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text-muted);
}

#mediamanager__page .qq-upload-button {
  display: inline-flex;
  margin: 0 0 .75rem;
  padding: .45rem .9rem;
  font: 500 .875rem/1.2 var(--font-ui);
  color: var(--text);
  background: var(--bg-subtle);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

#mediamanager__page .qq-upload-button-hover {
  background: var(--bg-hover);
}

#mediamanager__page .qq-action-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1rem;
}

#mediamanager__page .qq-overwrite-check {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .875rem;
}

/* the chosen file: actions, preview, details and history */

#mediamanager__page .file ul.actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 0 0 .75rem;
}

#mediamanager__page .file ul.actions button {
  color: var(--text);
  background: var(--bg-subtle);
  border-color: var(--line-strong);
}

#mediamanager__page .file ul.actions button:hover {
  background: var(--bg-hover);
}

#mediamanager__page #mediamanager__btn_delete button {
  color: var(--danger);
}

#mediamanager__page .file div.image {
  margin-bottom: .75rem;
  padding: .5rem;
  background: var(--media-bg);
  border-radius: var(--radius);
}

#mediamanager__page .file div.image img {
  display: block;
  height: auto;
}

#mediamanager__page .file dl {
  margin: 0 0 .75rem;
  font-size: .875rem;
}

#mediamanager__page .file dl dt {
  margin-top: .5rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-faint);
  background: none;
}

#mediamanager__page .file dl dd {
  color: var(--text);
  background: none;
  overflow-wrap: anywhere;
}

#mediamanager__page form.changes ul {
  margin: 0 0 .75rem;
}

#mediamanager__page form.changes ul li div.li > div {
  flex-basis: 100%;
  padding: 0;
  font-size: .8125rem;
}

/* --- Palette panel (admins): the colour tokens of the active flavour, filled by script.js ------ */

.palette {
  position: fixed;
  z-index: 35;
  top: var(--topbar-h);
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(var(--palette-w), 100vw);
  background: var(--menu-bg);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.palette[hidden],
.palette__row[hidden] {
  display: none;
}

.is-palette-open .layout {
  margin-right: var(--palette-w);
}

.palette__head {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .75rem .75rem .6rem 1.25rem;
}

.palette__title {
  flex: 1 1 auto;
  margin: 0;
  font: 400 1.125rem/1.2 var(--font-display);
  color: var(--text);
}

.palette__head button:not(.icon-btn) {
  padding: .35rem .7rem;
  font-size: .8125rem;
}

.palette__head button:disabled {
  opacity: .45;
  pointer-events: none;
}

.palette__copy:not(.is-copied) .palette__copied,
.palette__copy.is-copied .palette__copy-label,
:root[data-scheme="dark"] .palette__flavour--light,
:root:not([data-scheme="dark"]) .palette__flavour--dark {
  display: none;
}

.dokuwiki .palette__filter {
  margin: 0 1.25rem .5rem;
  font-size: .875rem;
}

.palette__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0 1.25rem 2rem;
  scrollbar-width: thin;
}

.palette__body summary {
  padding: .75rem 0 .35rem;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-faint);
  cursor: pointer;
}

.palette__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.palette__row {
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr) auto;
  grid-template-areas: "swatch name value" "swatch input input";
  gap: .2rem .65rem;
  margin: 0 -.5rem;
  padding: .4rem .5rem;
  border-radius: 8px;
}

.palette__group--compact .palette__row {
  grid-template-columns: 1.75rem minmax(0, 1fr) auto 6.5rem;
  grid-template-areas: "swatch name value input";
  align-items: center;
  padding-block: .25rem;
}

.palette__group--compact .palette__swatch {
  margin-top: 0;
}

.palette__row.is-changed {
  background: var(--wiki-soft);
}

/* the token over the page background, as the page shows it */
.palette__swatch {
  grid-area: swatch;
  width: 1.75rem;
  height: 1.75rem;
  margin-top: .15rem;
  background: var(--swatch, none), var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.palette__row:not([data-kind]) .palette__swatch {
  visibility: hidden;
}

.palette__name {
  grid-area: name;
  min-width: 0;
  font: 500 .8125rem/1.5 var(--font-mono);
  color: var(--text);
  overflow-wrap: anywhere;
}

.palette__value {
  grid-area: value;
  font: .75rem/1.6 var(--font-mono);
  color: var(--text-faint);
  white-space: nowrap;
}

/* the declaration grows with its text where the browser has field-sizing */
.dokuwiki .palette__input {
  grid-area: input;
  width: 100%;
  min-height: 0;
  padding: .2rem .45rem;
  font: .75rem/1.5 var(--font-mono);
  overflow-wrap: anywhere;
  resize: none;
  border-radius: 6px;
  field-sizing: content;
}

.dokuwiki .palette__input[aria-invalid="true"] {
  border-color: var(--danger);
}

.palette__changes pre {
  margin: 0;
  padding: .7rem .85rem;
  font: .75rem/1.6 var(--font-mono);
  color: var(--text);
  white-space: pre-wrap;
  background: var(--code-bg);
  border-radius: 8px;
}

/* --- Responsive -------------------------------------------------------------------------------- */

.scrim {
  display: none;
}

@media (min-width: 1800px) {
  :root {
    --sidebar-w: 19rem;
    --toc-w: 16rem;
  }

  html {
    font-size: 17px;
  }
}

@media (max-width: 1180px) {
  .main:has(> .toc-col) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-template-areas: "head" "toc" "doc";
  }

  .toc-col #dw__toc {
    position: static;
    max-height: none;
    margin-bottom: 1.5rem;
    padding: .7rem 1rem;
    background: var(--bg-subtle);
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }

  .toc-col #dw__toc h3 {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    cursor: pointer;
  }

  .toc-col #dw__toc h3 strong {
    display: inline;
  }

  .toc-col #dw__toc > div {
    margin-top: .6rem;
  }

  .toc-col #dw__toc > div[style*="none"] {
    display: none;
  }
}

@media (max-width: 1080px) {
  .topnav {
    display: none;
  }

  #mediamanager__page,
  #mediamanager__page:not(:has(.file .panelHeader)) {
    grid-template-columns: minmax(9rem, 12rem) minmax(0, 1fr);
  }

  #mediamanager__page .file {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .topbar__menu {
    display: grid;
  }

  .layout.has-sidebar {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    z-index: 35;
    top: var(--topbar-h);
    left: 0;
    width: min(20rem, 86vw);
    background: var(--bg);
    box-shadow: var(--shadow);
    transform: translateX(-102%);
    transition: transform .3s var(--ease);
  }

  .sidebar::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--bg-subtle);
  }

  .is-sidebar-open .sidebar {
    transform: none;
  }

  .scrim {
    position: fixed;
    z-index: 30;
    inset: var(--topbar-h) 0 0;
    display: block;
    background: var(--scrim);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
  }

  .is-palette-open .layout {
    margin-right: 0;
  }

  .is-sidebar-open .scrim {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 640px) {
  :root {
    --topbar-h: 58px;
    --gutter: 1rem;
  }

  .topbar {
    gap: .6rem;
  }

  .topbar__tools {
    gap: .15rem;
  }

  .topbar__search {
    justify-content: center;
    width: 38px;
    padding: 0;
    background: none;
    border-color: transparent;
  }

  .topbar__search:focus-within {
    position: absolute;
    z-index: 2;
    right: var(--gutter);
    left: var(--gutter);
    width: auto;
    padding: 0 .7rem;
    background: var(--bg);
  }

  .topbar__search #qsearch__in {
    position: absolute;
    inset: 0;
    width: 100%;
    padding: 0 .7rem 0 2.4rem;
    opacity: 0;
  }

  .topbar__search:focus-within #qsearch__in {
    opacity: 1;
  }

  .topbar__search:focus-within > .icon {
    position: absolute;
    left: .7rem;
  }

  .topbar__search kbd {
    display: none;
  }

  .wiki-tab {
    gap: .45rem;
    padding: 0 .75rem 0 .55rem;
  }

  .wiki-tab__logo {
    width: 26px;
    height: 26px;
  }

  .wiki-tab__name {
    font-size: 1rem;
  }

  .wiki-tab__readonly {
    padding: .25rem;
  }

  .wiki-tab__readonly > span {
    display: none;
  }

  .page h1 {
    font-size: 2.1rem;
  }

  .page h2 {
    font-size: 1.45rem;
  }

  .page .level1 > p:first-child {
    font-size: 1.03rem;
  }

  #mediamanager__page,
  #mediamanager__page:not(:has(.file .panelHeader)) {
    grid-template-columns: minmax(0, 1fr);
  }

  /* media.js gives every panel 60% of the window's height */
  #mediamanager__page .panelContent {
    height: auto !important;
  }

  #mediamanager__page .namespaces .panelContent {
    max-height: 12rem;
  }

  #mediamanager__page .filelist .rows li dl {
    grid-template-columns: 2.5rem minmax(0, 1fr) 4.5rem;
  }

  #mediamanager__page .filelist .rows li :is(.size, .date) {
    display: none;
  }
}

@media print {
  .topbar,
  .sidebar,
  .toc-col,
  .doc__head,
  .scrim,
  .palette {
    display: none !important;
  }

  .layout,
  .main {
    display: block;
    padding: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: .001ms !important;
    animation-duration: .001ms !important;
  }
}
