/* The wiki's page: the shell (header, sidebar, content), the views in it,
   and pages rendered from Markdown. Colours are tokens, redefined for a dark
   scheme. */
:root {
  color-scheme: light dark;
  --text: #1f2328;
  --background: #ffffff;
  --surface: #f6f8fa;
  --border: #d1d9e0;
  --muted: #59636e;
  --accent: #0969da;
  --danger: #cf222e;
  --code: #eff2f5;
  --note: #0969da;
  --tip: #1a7f37;
  --important: #8250df;
  --warning: #9a6700;
  --caution: #cf222e;
  --hl-keyword: #cf222e;
  --hl-string: #0a3069;
  --hl-title: #8250df;
  --hl-type: #953800;
  --hl-number: #0550ae;
  --hl-comment: #59636e;
  /* The palette of the editor's colours (the classes c-NAME and h-NAME):
     text colours of at least 4.9:1 on the background and on every
     highlight, highlights under which the page's text is at least 12:1. */
  --c-red: #b42228;
  --c-orange: #a3480a;
  --c-green: #17722f;
  --c-teal: #0a6d69;
  --c-blue: #075cc4;
  --c-purple: #7342cc;
  --c-pink: #a8317a;
  --c-grey: #525a64;
  --h-yellow: #fff5b8;
  --h-green: #d8f8de;
  --h-blue: #dbefff;
  --h-pink: #ffe2ef;
  --h-purple: #ece4ff;
  /* The colours a space's icon may be (Wiki.Core.Space.iconColours), each
     with white text of at least 4.5:1 on it, in both schemes. */
  --icon-blue: #0b5cad;
  --icon-teal: #0b6b66;
  --icon-green: #1d6b34;
  --icon-olive: #5c6416;
  --icon-orange: #9a4a0b;
  --icon-red: #b3262d;
  --icon-pink: #a3306f;
  --icon-purple: #6b3fbf;
  --icon-indigo: #3d4bb0;
  --icon-slate: #4b5563;
  /* The icons a kind of box may have (Wiki.Core.Markdown.Box.BoxIcon),
     masks drawn in the box's colour (.alert-icon). */
  --box-icon-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E");
  --box-icon-lightbulb: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18h6M10 21h4M12 3a6 6 0 0 0-4 10.5c.6.6 1 1.5 1 2.5h6c0-1 .4-1.9 1-2.5A6 6 0 0 0 12 3z'/%3E%3C/svg%3E");
  --box-icon-pencil: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20h4L19 9l-4-4L4 16v4zM14 6l4 4'/%3E%3C/svg%3E");
  --box-icon-question: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M9.5 9a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.7v.5M12 17h.01'/%3E%3C/svg%3E");
  --box-icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M8 12l3 3 5-6'/%3E%3C/svg%3E");
  --box-icon-star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l2.8 5.7 6.2.9-4.5 4.4 1.1 6.2L12 17.3l-5.6 2.9 1.1-6.2L3 9.6l6.2-.9z'/%3E%3C/svg%3E");
  --box-icon-book: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19V5a2 2 0 0 1 2-2h14v16H6a2 2 0 0 0-2 2zM8 7h8'/%3E%3C/svg%3E");
  --box-icon-flag: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 21V4M5 4h12l-2 4 2 4H5'/%3E%3C/svg%3E");
  /* A diff: a line taken out and one put in, and the words changed in it. */
  --diff-removed: #ffebe9;
  --diff-removed-word: #ffc1bc;
  --diff-added: #dafbe1;
  --diff-added-word: #aceebb;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e6edf3;
    --background: #0d1117;
    --surface: #151b23;
    --border: #3d444d;
    --muted: #9198a1;
    --accent: #4493f8;
    --danger: #f85149;
    --code: #1f262f;
    --note: #4493f8;
    --tip: #3fb950;
    --important: #ab7df8;
    --warning: #d29922;
    --caution: #f85149;
    --hl-keyword: #ff7b72;
    --hl-string: #a5d6ff;
    --hl-title: #d2a8ff;
    --hl-type: #ffa657;
    --hl-number: #79c0ff;
    --hl-comment: #9198a1;
    /* Light text colours and deep highlights: at least 5:1 for any
       pair, and 10:1 for the page's text on a highlight. */
    --c-red: #ff7b72;
    --c-orange: #ffa657;
    --c-green: #3fb950;
    --c-teal: #39c5bb;
    --c-blue: #79c0ff;
    --c-purple: #d2a8ff;
    --c-pink: #ff9bce;
    --c-grey: #a2aab3;
    --h-yellow: #3d3200;
    --h-green: #123a1c;
    --h-blue: #0b2e57;
    --h-pink: #4b1834;
    --h-purple: #30215a;
    --diff-removed: #3b1219;
    --diff-removed-word: #6e1d24;
    --diff-added: #12301c;
    --diff-added-word: #1e5a2d;
  }
}

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  color: var(--text);
  background: var(--background);
}

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

a:hover {
  text-decoration: underline;
}

/* ---- Controls ---------------------------------------------------------- */

button,
.button {
  display: inline-block;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
}

button:hover,
.button:hover {
  border-color: var(--accent);
  text-decoration: none;
}

button.primary {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

button.danger {
  color: #ffffff;
  background: var(--danger);
  border-color: var(--danger);
}

input,
select {
  font: inherit;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: var(--background);
}

/* ---- The frame ----------------------------------------------------------- */

.wiki {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* What sticks under the header (the page's bar of actions, the editor's
   toolbar, the comments' panel) is stacked with these heights, which the
   program measures as they change (wiki-app/jsbits/layout.js); these are
   the header's on a wide window, and a page without its bar, until then. */
:root {
  --header-height: 3.35rem;
  --page-actions-height: 0px;
}

.wiki-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.wiki-brand {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.92rem;
}

.breadcrumbs li + li::before {
  content: "/";
  margin-right: 0.3rem;
  color: var(--muted);
}

.breadcrumbs [aria-current="page"] {
  font-weight: 600;
}

/* The search box takes the room between the breadcrumbs and the switcher;
   its results hang under it (see "Search" below). */
.wiki-search {
  position: relative;
  flex: 1;
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}

.user-switcher {
  position: relative;
}

/* Who is signed in, where people do not switch (the server's wiki). */
.user-name {
  color: var(--muted);
  white-space: nowrap;
}

.user-switcher-toggle::after {
  content: " ▾";
  color: var(--muted);
}

.user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.3rem);
  min-width: 15rem;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--background);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.15);
}

.user-menu button {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
}

.user-menu button:hover {
  background: var(--surface);
}

.user-menu button[aria-pressed="true"] {
  font-weight: 600;
}

/* "Settings" in the menu, a link that looks as the menu's buttons do. */
.user-menu .settings-entry {
  display: block;
  padding: 0.3rem 0.8rem;
  font-size: 0.9rem;
  line-height: 1.4;
  border-radius: 6px;
  color: var(--text);
}

.user-menu .settings-entry:hover {
  text-decoration: none;
  background: var(--surface);
}

/* In the demo's menu, "Settings" under its users. */
.user-menu-settings {
  margin-top: 0.3rem;
  padding-top: 0.3rem;
  border-top: 1px solid var(--border);
}

/* Signing in and out of the server's wiki (Wiki.App.View.SignIn): the
   name, whose menu ("Settings", "Sign out") hangs under it as the
   switcher's does, or "Sign in", whose small form hangs under it too. */
.account {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.account .sign-in-toggle {
  white-space: nowrap;
}

.account-holder {
  position: relative;
}

/* The menu opens over what else hangs under the name: the offer to
   unlock the keys with the password (.keys-offer) would otherwise cover
   its "Sign out". */
.account-menu {
  z-index: 22;
}

.sign-in-form,
.sign-in-code-form,
.reset-request-form {
  position: absolute;
  right: 0;
  top: calc(100% + 0.3rem);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: min(18rem, calc(100vw - 2rem));
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--background);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.15);
}

.sign-in-form .field,
.sign-in-code-form .field,
.reset-request-form .field {
  flex: none;
}

.sign-in-form .actions,
.sign-in-code-form .actions,
.reset-request-form .actions {
  display: flex;
  gap: 0.5rem;
}

.reset-request-form p {
  margin: 0;
  font-size: 0.9rem;
}

/* "Forgot your password?": a button that reads as a link. */
.link-button {
  align-self: flex-start;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 0.9rem;
  text-decoration: underline;
  cursor: pointer;
}

.link-button:hover {
  background: none;
}

/* Always there, so that the inputs keep their places; no box of its own. */
.sign-in-step,
.sign-in-told {
  display: contents;
}

.sign-in-notice {
  margin: 0;
  font-size: 0.9rem;
}

.sign-in-error {
  margin: 0;
}

/* The way to the administration, for an administrator, beside the menu. */
.admin-link {
  white-space: nowrap;
  font-size: 0.92rem;
}

.admin-link[aria-current="page"] {
  font-weight: 600;
  color: var(--text);
}

.wiki-body {
  display: flex;
  flex: 1;
}

.wiki-sidebar {
  flex-shrink: 0;
  width: 16rem;
  padding: 1rem 1rem 2rem;
  border-right: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.93rem;
}

.wiki-sidebar h2 {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.wiki-content {
  flex: 1;
  min-width: 0;
  max-width: 54rem;
  padding: 1.5rem 2.25rem 4rem;
}

/* One quiet line under everything: what the wiki is built with. */
.wiki-footer {
  padding: 0.6rem 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.wiki-footer a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--border);
}

.wiki-footer a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

@media (max-width: 760px) {
  .wiki-header {
    flex-wrap: wrap;
  }

  .wiki-body {
    flex-direction: column;
  }

  .wiki-sidebar {
    width: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .wiki-content {
    padding: 1rem 1rem 3rem;
  }
}

/* ---- Spaces and their pages in the sidebar -------------------------------- */

.page-tree {
  margin: 0;
  padding-left: 0.9rem;
  list-style: none;
}

.page-node.current > a {
  font-weight: 600;
  color: var(--text);
}

/* A space's icon (Wiki.Core.Space.Icon): its emoji, its image, or the first
   letter of its name on its colour; a square the size of a line of its
   text, bigger where a heading or a card has it. */
.space-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1.5em;
  height: 1.5em;
  border-radius: 0.3em;
  font-size: 1em;
  font-style: normal;
  font-weight: 600;
  line-height: 1;
  color: #ffffff;
  vertical-align: middle;
  overflow: hidden;
}

.space-icon-emoji {
  color: inherit;
  font-size: 1.15em;
  font-weight: normal;
}

.space-icon-image {
  object-fit: cover;
  background: var(--surface);
}

.space-icon-blue,
.avatar-blue {
  background: var(--icon-blue);
}

.space-icon-teal,
.avatar-teal {
  background: var(--icon-teal);
}

.space-icon-green,
.avatar-green {
  background: var(--icon-green);
}

.space-icon-olive,
.avatar-olive {
  background: var(--icon-olive);
}

.space-icon-orange,
.avatar-orange {
  background: var(--icon-orange);
}

.space-icon-red,
.avatar-red {
  background: var(--icon-red);
}

.space-icon-pink,
.avatar-pink {
  background: var(--icon-pink);
}

.space-icon-purple,
.avatar-purple {
  background: var(--icon-purple);
}

.space-icon-indigo,
.avatar-indigo {
  background: var(--icon-indigo);
}

.space-icon-slate,
.avatar-slate {
  background: var(--icon-slate);
}


/* A user's avatar (Wiki.App.View.Common.avatar, WP5.55): their picture,
   cropped square and shown round, or the initials of their name on a colour
   of the spaces' icons (the rules above), picked from the name. Small beside
   a name in a line of text, large in the account panel. */
.avatar {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1.5em;
  height: 1.5em;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  overflow: hidden;
  background-color: var(--surface);
}

.avatar-initials {
  color: #ffffff;
  font-size: 0.75em;
  font-style: normal;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
}

/* Drawn from the attribute, so that the circle adds no text to what it is
   in. */
.avatar-initials::before {
  content: attr(data-initials);
}

.avatar-small.avatar-initials {
  width: 2em;
  height: 2em;
}

.avatar-large {
  width: 4.5rem;
  height: 4.5rem;
}

.avatar-large.avatar-initials {
  font-size: 1.6rem;
}

/* Beside the user's name in the header, and in the demo's menu of users. */
.user-name,
.user-switcher-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* A list of spaces, each its icon and name: the sidebar's outside a space,
   and a space's subspaces in it. */
.sidebar-spaces,
.sidebar-subspaces,
.sidebar-links {
  margin: 0 0 0.8rem;
  padding: 0;
  list-style: none;
}

.sidebar-spaces li,
.sidebar-subspaces li,
.sidebar-links li {
  padding: 0.12rem 0;
}

.space-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

/* The reader's own personal space, under "User subspaces" in the sidebar:
   indented below the container, as a subspace is in a tree. */
.sidebar-own-space {
  margin: 0.15rem 0 0;
  padding: 0 0 0 1.9rem;
  list-style: none;
  font-size: 0.92rem;
}

/* Inside a space: the way back to every space and to another, the space
   itself, the way up from a subspace, its home page and its pages. */
.space-switcher {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
  font-size: 0.85rem;
}

.space-switcher-toggle {
  padding: 0.1rem 0.5rem;
  font-size: 0.85rem;
}

.space-switcher-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  margin: 0.25rem 0 0;
  padding: 0.3rem;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--background);
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.15);
}

.space-switcher-option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.4rem;
  border-radius: 6px;
}

.space-switcher-option:hover {
  text-decoration: none;
  background: var(--surface);
}

.space-switcher-option[aria-current="true"] {
  font-weight: 600;
  color: var(--text);
}

.sidebar-space {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.3rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.sidebar-space .space-icon {
  font-size: 1.15rem;
}

.sidebar-up {
  display: inline-block;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
}

.sidebar-up::before {
  content: "↑ ";
}

.sidebar-links a[aria-current="page"] {
  font-weight: 600;
  color: var(--text);
}

.wiki-sidebar h2 + .empty {
  margin: 0 0 0.8rem;
  color: var(--muted);
}

.wiki-sidebar > .page-tree {
  margin: 0 0 0.8rem;
  padding-left: 0;
}

.wiki-sidebar .page-tree .page-tree {
  margin: 0.1rem 0 0.2rem 0.35rem;
  padding-left: 0.6rem;
  border-left: 1px solid var(--border);
}

.page-node {
  padding: 0.08rem 0;
}

/* The buttons that move a page or a subspace by hand, in the space's view,
   after its link: small and quiet, so that the list still reads as a list. */
.move-controls {
  display: inline-flex;
  gap: 0.15rem;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.move-controls .move {
  padding: 0 0.35rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--muted);
  background: transparent;
}

.move-controls .move:disabled {
  opacity: 0.35;
  cursor: default;
}

.move-controls .move:disabled:hover {
  border-color: var(--border);
}

.unviewable {
  color: var(--muted);
  font-style: italic;
  cursor: default;
}

.new-space-link {
  display: inline-block;
  margin-top: 1rem;
}

/* The link to "What's new?", last in the sidebar, with a dot while there
   are entries newer than the newest the reader has seen (data-unseen,
   which the shell sets once it has read what this browser keeps). */
.sidebar-whats-new {
  margin-top: 1.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.whats-new-link {
  position: relative;
}

.whats-new-link[aria-current="page"] {
  font-weight: 600;
}

.whats-new-link[data-unseen]::after {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-left: 0.4rem;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}

/* The page "What's new?": the build, then an entry per pull request. */
.whats-new-build {
  color: var(--muted);
}

.whats-new-entry + .whats-new-entry {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.whats-new-title {
  margin-bottom: 0.5rem;
}

/* ---- Views ---------------------------------------------------------------- */

.view-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.view-header h1 {
  margin-bottom: 0.25rem;
}

.badge {
  margin-left: 0.5rem;
  padding: 0.05rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--muted);
  vertical-align: middle;
}

.view-header .badge {
  margin-left: 0;
}

.badge-public {
  color: var(--tip);
  border-color: var(--tip);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 1rem;
}

.inline-form,
.confirm {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.6rem;
  margin: 0 0 1rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.confirm p {
  flex-basis: 100%;
  margin: 0;
}

/* A route followed while a change is being saved waits for it: the
   notice's dots in the accent colour, bold enough to be seen as moving. */
.leave-waiting .busy-dots {
  margin-right: 0.3rem;
  color: var(--accent);
  font-weight: 700;
}

.field {
  display: flex;
  flex: 1 1 14rem;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.error {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--danger);
  border-radius: 6px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}

.loading,
.empty {
  color: var(--muted);
}

/* What the server has not answered yet says so quietly, and only once it
   has been waited for long enough to notice: an answer that comes quickly
   (most do) replaces it before it shows, so nothing flickers. */
.loading {
  animation: loading-appears 0.2s ease-in 0.4s backwards;
}

@keyframes loading-appears {
  from {
    opacity: 0;
  }
}

/* The server could not be reached: the reason, and a way to try again. */
.error-unreachable .retry {
  margin-left: 0.75rem;
}

.space-list {
  padding-left: 1.2rem;
}

.space-list li {
  margin: 0.3rem 0;
}

.welcome {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

/* ---- The directory of spaces ----------------------------------------------- */

.directory-header {
  justify-content: space-between;
  flex-wrap: wrap;
}

.directory-intro {
  color: var(--muted);
}

.directory h2 {
  margin: 1.5rem 0 0.6rem;
  font-size: 1.05rem;
}

.recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.recent-space {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.7rem 0.3rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.recent-space:hover {
  text-decoration: none;
  border-color: var(--accent);
}

.space-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.9rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.space-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--background);
}

.space-card:has(a.space-card-link:hover) {
  border-color: var(--accent);
}

.space-card-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.space-card-link .space-icon {
  font-size: 1.35rem;
}

.space-card-description {
  flex: 1;
  margin: 0;
  color: var(--text);
}

.space-card-meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.space-card-meta .badge {
  margin-left: 0;
}

.space-card-unviewable .space-card-description {
  color: var(--muted);
}

/* ---- The finder of user spaces -------------------------------------------- */

.user-spaces section {
  margin-top: 1.4rem;
}

.user-spaces-list {
  display: grid;
  gap: 0.35rem;
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
}

.user-space {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.user-space-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.user-space-own {
  font-size: 0.8rem;
  color: var(--muted);
}

.user-spaces-search {
  width: 100%;
  max-width: 28rem;
}

.user-spaces-none,
.user-spaces-nothing,
.user-spaces-more {
  color: var(--muted);
}

/* ---- A space shown as a blog ---------------------------------------------- */

/* Its posts are the directory's cards, one under another, as a blog lists
   them, each as wide as the text. */
.post-list {
  grid-template-columns: 1fr;
  max-width: 48rem;
}

.post-card .space-card-link {
  font-size: 1.25rem;
}

.blog-home {
  margin-bottom: 1.5rem;
}

.blog-posts-heading {
  margin-top: 1rem;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1.2rem;
}

.pager-at {
  color: var(--muted);
  font-size: 0.9rem;
}

/* A post's date, and the posts before and after it, under its title. */
.post-info {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin: -0.4rem 0 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.post-date {
  margin: 0;
}

.post-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.2rem;
}

.post-nav a {
  display: inline-flex;
  gap: 0.35rem;
  max-width: 22rem;
}

.post-nav-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-nav-label {
  color: var(--muted);
}

.post-previous .post-nav-label::before {
  content: "← ";
}

.post-next .post-nav-label::after {
  content: " →";
}

/* ---- A space's pages and settings ------------------------------------------ */

.space-header {
  align-items: center;
}

.space-header .space-icon {
  font-size: 1.6rem;
}

.space-description {
  margin: 0 0 0.75rem;
  color: var(--muted);
}

.space-settings {
  margin: 1rem 0;
  padding: 0.6rem 1rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.space-settings > h2 {
  margin: 0 0 0.5rem;
}

.space-settings .space-permissions {
  margin: 1rem 0 0;
  padding: 0.8rem 0 0;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
}

.space-profile-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* The form's fields take the height of their contents: in a column, a
   field's flex basis would be its height. */
.space-profile-form .field {
  flex: none;
}

.space-profile-form textarea {
  width: 100%;
  font: inherit;
}

.field-hint {
  margin: -0.2rem 0 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.icon-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  margin: 0.2rem 0 0.4rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.icon-field legend {
  padding: 0 0.3rem;
  font-weight: 600;
}

.icon-field .field-hint {
  flex-basis: 100%;
  margin: 0;
}

.icon-preview .space-icon {
  font-size: 2rem;
}

.icon-kinds {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
}

.icon-kind {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.icon-emoji {
  width: 5rem;
}

.icon-upload input[type="file"] {
  display: none;
}

.settings-saved {
  margin-left: 0.6rem;
  color: var(--tip);
}

/* ---- Search --------------------------------------------------------------- */

/* The page picker (Wiki.App.View.PagePicker) in the header's box adds an
   element of its own around the bar and the list, which the box's layout
   does not see. */
.wiki-search > .page-picker {
  display: contents;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  max-width: 34rem;
}

.search-input {
  flex: 1;
  min-width: 6rem;
}

.search-space {
  max-width: 11rem;
}

.search-subspaces {
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

/* The list under the box: as wide as the bar, over the page. */
.search-results {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 20;
  width: 100%;
  max-width: 34rem;
  max-height: 70vh;
  overflow-y: auto;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--background);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.15);
}

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

.search-hit {
  display: block;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  color: var(--text);
}

.search-hit:hover,
.search-hit.selected {
  text-decoration: none;
  background: var(--surface);
}

.search-hit.selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.search-hit-title {
  display: block;
  font-weight: 600;
  color: var(--accent);
}

.search-hit-space {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}

.search-hit-snippet {
  display: block;
  font-size: 0.88rem;
  color: var(--text);
  overflow-wrap: anywhere;
}

.search-hit mark {
  font-weight: 700;
  color: inherit;
  background: color-mix(in srgb, var(--warning) 22%, transparent);
  border-radius: 2px;
}

.search-status {
  margin: 0;
  padding: 0.45rem 0.6rem;
  color: var(--muted);
}

.search-all {
  display: block;
  margin-top: 0.2rem;
  padding: 0.4rem 0.6rem;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
}

/* The page of all results lists them as the box does, with more room. */
.search-view .search-hits li + li {
  margin-top: 0.3rem;
}

.search-view .search-hit {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
}

.search-summary {
  color: var(--muted);
}

@media (max-width: 760px) {
  .wiki-search {
    order: 3;
    flex-basis: 100%;
  }

  .search-bar,
  .search-results {
    max-width: none;
  }
}

/* ---- A page --------------------------------------------------------------- */

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

.page-body h1,
.page-title {
  margin-top: 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}

.page-body h2 {
  margin-top: 2rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--border);
}

/* A list right after a paragraph (WP5.148 of docs/PLAN.md) sits close
   under it: 0.35em, about a third of the gap between two paragraphs, so
   that the text and the list it introduces read as one. The browser gives
   a paragraph and a list each a margin of 1em, and the two margins
   collapse into one gap, the larger of them; so both are made smaller:
   the paragraph's bottom, the list's top, and the top of the paragraph
   that starts a loose list's first item, whose margin collapses into the
   same gap. Only that pair changes: a list after a heading or another
   list, a list at the start of its box, and a paragraph after a list keep
   the browser's margins.
   The list is the paragraph's next sibling, or comes right after it in a
   wrapper the renderer adds: the empty marker of a block's source line in
   the editor's previews (.source-line, Wiki.Core.Markdown.Render's
   renderLines); the box a line of attributes before a list puts it in
   ({.incremental}, {.nonincremental}, {.sorted}); and the box of a
   slide's step (.slide-step, Wiki.Core.Slides). The renderer writes the
   text's paragraphs without a class. A paragraph with a class is a title
   it draws (a box's, .alert-title; a table of contents', .toc-title) or
   an error it shows, and a list after it is the list at the start of its
   box, which keeps its spacing. Rendered Markdown is in a .page-body
   everywhere (a page, the previews, a slide, What's new, an html fence's
   frame) but in a comment, whose text is in a .comment-body outside any
   .page-body. */
:is(.page-body, .comment-body) p:not([class]):has(
    + :is(ul, ol),
    + .source-line + :is(ul, ol),
    + :is(.incremental, .nonincremental, .sorted, .slide-step) > :is(ul, ol):first-child,
    + .source-line + :is(.incremental, .nonincremental, .sorted) > :is(ul, ol):first-child,
    + .slide-step > :is(.incremental, .nonincremental, .sorted):first-child > :is(ul, ol):first-child
  ) {
  margin-bottom: 0.35em;
}

:is(.page-body, .comment-body) :is(
    p:not([class]) + :is(ul, ol),
    p:not([class]) + .source-line + :is(ul, ol),
    p:not([class]) + :is(.incremental, .nonincremental, .sorted, .slide-step) > :is(ul, ol):first-child,
    p:not([class]) + .source-line + :is(.incremental, .nonincremental, .sorted) > :is(ul, ol):first-child,
    p:not([class]) + .slide-step > :is(.incremental, .nonincremental, .sorted):first-child > :is(ul, ol):first-child
  ),
:is(.page-body, .comment-body) :is(
    p:not([class]) + :is(ul, ol),
    p:not([class]) + .source-line + :is(ul, ol),
    p:not([class]) + :is(.incremental, .nonincremental, .sorted, .slide-step) > :is(ul, ol):first-child,
    p:not([class]) + .source-line + :is(.incremental, .nonincremental, .sorted) > :is(ul, ol):first-child,
    p:not([class]) + .slide-step > :is(.incremental, .nonincremental, .sorted):first-child > :is(ul, ol):first-child
  ) > li:first-child > p:first-child {
  margin-top: 0.35em;
}

.page-body img,
.page-body video {
  max-width: 100%;
  height: auto;
}

/* An html fence's frame (Wiki.App.Islands' HtmlFrame): as wide as the
   text, without a border, and as high as its content, which the
   application measures and sets in the frame's style. A very long block is
   capped at most of the window's height, and scrolls inside the frame. */
.wiki-html {
  display: block;
  width: 100%;
  max-height: 80vh;
  border: 0;
}

/* On a slide, the slide's body caps the frame (wiki-app/jsbits/islands.js),
   not the window: nothing in a slide's layout depends on the window, so
   that the editor's measure of a slide is the slide as presented. */
.slide .wiki-html {
  max-height: none;
}

/* An interactive SVG (Wiki.Core.Markdown.Frame; Wiki.App.Islands'
   SvgFrame): a frame as wide as the text, at the height its height
   attribute gives, which the reader can drag taller or shorter by its
   corner, since the page cannot measure a document of another origin.
   Under it, on the right, a link that downloads the file, whose label is
   drawn here from its download attribute (the file's name) so that the
   page's text gains no words, as a code block's copy button's. */
.svg-frame {
  display: block;
  margin: 0.5rem 0;
}

.wiki-svg {
  display: block;
  width: 100%;
  min-height: 4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  resize: vertical;
  overflow: hidden;
}

.svg-frame-download {
  display: block;
  width: fit-content;
  margin-left: auto;
  font-size: 0.8rem;
}

.svg-frame-download::before {
  content: "Download " attr(download);
}

/* The document inside such a frame (Wiki.Core.Markdown.Frame), whose
   stylesheet this is too: no margin, and no background of its own, so that
   the page's shows through. The block is in a .page-body, styled as the
   page's own body; flow-root keeps the margins of its first and last
   elements inside it, and so inside the height the application
   measures. */
.html-frame {
  margin: 0;
  background: transparent;
}

.html-frame > .page-body {
  display: flow-root;
}

/* A frame on a slide: the slide's palette (see "Slides" below), and the
   controls and scroll bars of that scheme. */
.html-frame-light {
  color-scheme: light;
}

.html-frame-dark {
  color-scheme: dark;
}

.page-body blockquote {
  margin: 1rem 0;
  padding: 0 1rem;
  border-left: 4px solid var(--border);
  color: var(--muted);
}

.page-body table {
  border-collapse: collapse;
  margin: 1rem 0;
  display: block;
  overflow-x: auto;
}

.page-body th,
.page-body td {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
}

.page-body th {
  background: var(--surface);
}

.page-body code {
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.88em;
  background: var(--code);
}

.page-body pre {
  padding: 0.85rem 1rem;
  border-radius: 6px;
  overflow-x: auto;
  background: var(--code);
  line-height: 1.45;
}

.page-body pre code,
.page-body pre .code-lines {
  padding: 0;
  font-size: 0.85rem;
  background: transparent;
}

/* A code block whose fence says rows=N (Wiki.Core.Markdown.Render's
   scrollingCode) has max-height: Nlh and overflow: auto in its style
   attribute. The lh unit is the block's own line height, so the block is
   set at the code's size, and a line of code is exactly 1lh high; and the
   height is that of its content, so the padding comes on top of the N
   lines. */
.page-body pre.code-scroll {
  box-sizing: content-box;
  font-size: 0.85rem;
}

.page-body pre.code-scroll code,
.page-body pre.code-scroll .code-lines {
  font-size: 1em;
}

/* A numbered listing (Wiki.Core.Markdown.Render's lineNumbers): the
   gutter and the code side by side in the <pre>, so that both scroll
   together in a listing that scrolls, down and sideways. The gutter holds
   an empty span for each line of the code, at the code's font size and
   line height, and the numbers are drawn here, right-aligned and dimmed:
   they are no text, so a selection or a copy of the code has none of
   them. A listing without the class is laid out as before. */
pre.numbered {
  display: flex;
  gap: 1em;
}

pre.numbered > code {
  flex: none;
}

.code-lines {
  flex: none;
  counter-reset: code-line;
  color: var(--muted);
  text-align: right;
  user-select: none;
  opacity: 0.75;
}

.code-lines > span {
  display: block;
  counter-increment: code-line;
}

.code-lines > span::before {
  content: counter(code-line);
}

/* A code block with its copy button (Wiki.Core.Markdown.Render's
   copyButton): the listing's <pre> and the button beside it, in a
   <div class="code-block">. The block has the margins a <pre> has, and the
   <pre> none, so that a rule for the first or last child of a page, a box
   or a comment reaches them. The button sits over the block's top right
   corner. It is not inside the <pre>, so a listing that scrolls, down
   (rows=N) or sideways, scrolls under it and the button stays in view. */
.code-block {
  position: relative;
  margin: 1em 0;
}

.code-block > pre {
  margin: 0;
}

/* The button is empty, and its label is drawn here from data-copy, which
   web/src/islands.js sets for a moment after a click: so the page's text
   has no "Copy" in it. It shows while the pointer is over the block, while
   it has the keyboard's focus, and while it says what a click did; on a
   screen without a pointer that hovers, always. */
.code-copy {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--surface);
  user-select: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.code-copy::before {
  content: "Copy";
}

.code-copy[data-copy="copied"]::before {
  content: "Copied";
}

.code-copy[data-copy="failed"]::before {
  content: "Not copied";
}

.code-copy[data-copy="failed"] {
  color: var(--danger);
}

.code-block:hover > .code-copy,
.code-copy:focus-visible,
.code-copy[data-copy] {
  opacity: 1;
}

.code-copy:hover {
  color: var(--text);
}

.code-copy:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (hover: none) {
  .code-copy {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .code-copy {
    transition: none;
  }
}

/* Without scripts nothing would copy. */
@media (scripting: none) {
  .code-copy {
    display: none;
  }
}

.page-body .task-list {
  padding-left: 1.2rem;
  list-style: none;
}

.page-body .task-list-item input {
  margin: 0 0.4rem 0 -1.2rem;
}

/* A done task (Wiki.Core.Markdown.Render), wherever tasks are rendered:
   its own text struck through, its first paragraph's and its other
   paragraphs, but not the lists in it, whose tasks are struck through
   only when they are done too. */
.task-list-item.task-done > .task-text,
.task-list-item.task-done > p {
  text-decoration: line-through;
  color: var(--muted);
}

/* A day's list, {.day} (Wiki.Core.Markdown.Render): its groups, "All
   day" and the parts of the day, each named by its data-label. The name
   is drawn here and is no text of the page, so a comment's quote never
   takes it in. Wherever a day's list is drawn: a page, a comment, a slide. */
.day-group::before {
  content: attr(data-label);
  display: block;
  margin-top: 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.day-group > ul {
  margin-top: 0.2rem;
}

/* A group with a task in it is a list of tasks, which has no bullets: its
   items without a box keep theirs (but an item whose bullet is its emoji,
   below), and its text starts where an ordinary list's does (the
   browser's 40px), so that the groups line up. */
.page-body .day-group > .task-list {
  padding-left: 40px;
}

.page-body .day-group > .task-list > li:not(.task-list-item):not(.emoji-item) {
  list-style: disc;
}

/* A highlighted entry, "!" at the start of its item: shown at its time,
   its text bold, and in no colour of its own (the owner keeps colour for
   other marks). The lists in its item are not its text: they are of the
   normal weight, and an entry highlighted among them is bold by its own
   class. */
.day-highlight {
  font-weight: 600;
}

.day-highlight ul,
.day-highlight ol {
  font-weight: normal;
}

/* A missed task on a day's page (Wiki.App.View.Page): a task not done
   whose day or hour has passed. Its own text is red, as a done task's is
   struck through: its first paragraph's and its other paragraphs', but
   not the lists in it. A highlighted one stays bold. The palette's red
   reads in both schemes: 6.6:1 on the page's background in the light one
   and 7.5:1 in the dark one, and 5.8:1 and 5.2:1 under a comment's quote.
   A screen reader hears "Missed" in the name of the task's box, which the
   renderer writes (Wiki.Core.Markdown.Render). */
.day-missed > .task-text,
.day-missed > p {
  color: var(--c-red);
}

/* A link in a missed task's own text is red too, whatever the accent
   colour of a link or a visited link, and stays underlined, so that it
   still reads as a link. */
.day-missed > .task-text a,
.day-missed > .task-text a:visited,
.day-missed > p a,
.day-missed > p a:visited {
  color: var(--c-red);
  text-decoration: underline;
}

/* Under the quote of the thread open in the panel, whose highlight is
   darker, red text would read badly in the dark scheme (2.8:1). There the
   text keeps the page's colour (11.6:1 light, 6.1:1 dark) and the task
   shows as missed by an underline: the palette's red in the light scheme
   (4.8:1 against the highlight), its orange in the dark one (3.7:1), as
   red there is 2.8:1. */
.day-missed > .task-text mark.comment-mark-focused,
.day-missed > p mark.comment-mark-focused {
  color: var(--text);
  text-decoration: underline 2px var(--c-red);
  text-underline-offset: 0.15em;
}

@media (prefers-color-scheme: dark) {
  .day-missed > .task-text mark.comment-mark-focused,
  .day-missed > p mark.comment-mark-focused {
    text-decoration-color: var(--c-orange);
  }
}

/* In forced colours (Windows' high contrast) the system draws all text in
   its own colour, and the red is lost: there a missed task's own text has
   a wavy underline, which the system keeps. It sits lower than a link's
   own underline, so a link in the task shows both. The focused quote's
   underline is left out there, as its colour is lost too and the wavy
   line already says the task is missed. */
@media (forced-colors: active) {
  .day-missed > .task-text,
  .day-missed > p {
    text-decoration: underline wavy;
    text-underline-offset: 0.3em;
  }

  .day-missed > .task-text mark.comment-mark-focused,
  .day-missed > p mark.comment-mark-focused {
    text-decoration: none;
  }
}

/* A missed task whose item has no text of its own (a formula or a
   quotation under its box, or only "!" after it, which the page does not
   show) has its box ringed in red instead: the ring is on its own box
   only, not on the tasks inside. The ring is a shadow, so that the
   outline stays the focus's: a box the keyboard is on has an outline
   outside the ring as well. */
.day-missed:not(:has(> .task-text:not(:empty), > p > .task-text:not(:empty))) > input,
.day-missed:not(:has(> .task-text:not(:empty), > p > .task-text:not(:empty))) > p > input {
  box-shadow:
    0 0 0 1px var(--background),
    0 0 0 3px var(--c-red);
}

.day-missed:not(:has(> .task-text:not(:empty), > p > .task-text:not(:empty))) > input:focus-visible,
.day-missed:not(:has(> .task-text:not(:empty), > p > .task-text:not(:empty))) > p > input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* Forced colours drop the shadow: there the ring is a solid outline in
   the system's colour, and the focus a dashed one, thicker and further
   out, in its place. */
@media (forced-colors: active) {
  .day-missed:not(:has(> .task-text:not(:empty), > p > .task-text:not(:empty))) > input,
  .day-missed:not(:has(> .task-text:not(:empty), > p > .task-text:not(:empty))) > p > input {
    outline: 2px solid CanvasText;
    outline-offset: 1px;
  }

  .day-missed:not(:has(> .task-text:not(:empty), > p > .task-text:not(:empty))) > input:focus-visible,
  .day-missed:not(:has(> .task-text:not(:empty), > p > .task-text:not(:empty))) > p > input:focus-visible {
    outline: 3px dashed Highlight;
    outline-offset: 3px;
  }
}

/* A box the reader may tick in the page view (Wiki.App.View.Page). */
.page-body .task-list-item input:enabled {
  cursor: pointer;
}

/* The bar of a page's unsaved ticks (Wiki.App.View.Page): at the bottom
   of the window while the page's text is read, and under the text once
   its end is reached. Empty, it takes no room; it stays in the page so
   that a screen reader announces what it starts to say. */
.page-ticks {
  position: sticky;
  bottom: 0;
  z-index: 15;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 1rem 0;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 -2px 8px rgb(0 0 0 / 12%);
}

.page-ticks:empty {
  display: none;
}

.page-ticks-count {
  font-weight: 600;
}

.page-ticks-changed,
.page-ticks-note {
  flex-basis: 100%;
  margin: 0;
  color: var(--muted);
}

/* An item of a bulleted list whose text starts with an emoji shows the
   emoji in the bullet's place (Wiki.Core.Markdown.Render's renderItem):
   no bullet, the emoji in a box just left of the text, where the bullet
   was, and the text where the other items' text is. The emoji is still
   the first character of the item's text; its negative right margin takes
   back the space written after it. */
.page-body li.emoji-item {
  list-style: none;
}

.page-body li.emoji-item .emoji-bullet {
  display: inline-block;
  width: 1.5em;
  margin-left: -1.5em;
  margin-right: -0.25em;
  text-align: center;
}

.page-body .footnotes {
  margin-top: 2.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--muted);
}

.page-body .footnote-ref a,
.page-body .footnote-back {
  text-decoration: none;
}

/* A box of a kind the administration defined sets --box-colour (and
   --box-icon, when the kind has an icon) in its style attribute, which
   wins over this rule. Any other box starts from no colour and no icon,
   so a box nested in a defined one does not take the outer box's. */
.page-body .alert {
  --box-colour: initial;
  --box-icon: initial;
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  border-left: 4px solid var(--box-colour, var(--border));
  border-radius: 0 6px 6px 0;
  background: var(--surface);
}

.page-body .alert > :last-child {
  margin-bottom: 0.25rem;
}

.page-body .alert-title {
  margin: 0.25rem 0;
  font-weight: 600;
  color: var(--box-colour, var(--text));
}

/* A box of a kind the administration defined (Wiki.Core.Markdown.Box)
   carries its colour, --box-colour, and its icon, --box-icon, in its
   style attribute; a kind nobody defined has neither, and is drawn plain.
   The icon is a mask in the title's colour. */
.page-body .alert-title > .alert-icon {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  margin-right: 0.4em;
  vertical-align: -0.15em;
  background-color: currentColor;
  -webkit-mask: var(--box-icon) center / contain no-repeat;
  mask: var(--box-icon) center / contain no-repeat;
}

.page-body .alert-note { border-color: var(--note); }
.page-body .alert-note .alert-title { color: var(--note); }
.page-body .alert-tip { border-color: var(--tip); }
.page-body .alert-tip .alert-title { color: var(--tip); }
.page-body .alert-important { border-color: var(--important); }
.page-body .alert-important .alert-title { color: var(--important); }
.page-body .alert-warning { border-color: var(--warning); }
.page-body .alert-warning .alert-title { color: var(--warning); }
.page-body .alert-caution { border-color: var(--caution); }
.page-body .alert-caution .alert-title { color: var(--caution); }

/* A link or an embed that names nothing the wiki has. */
.page-body .link-unresolved,
.page-body .embed-unresolved {
  color: var(--danger);
  text-decoration: underline dotted;
  cursor: help;
}

/* The HTML a page may hold that Markdown has no word for. */
.page-body kbd {
  display: inline-block;
  padding: 0.05em 0.4em;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  font: 0.82em/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--surface);
  vertical-align: 0.05em;
}

.page-body mark {
  padding: 0 0.15em;
  border-radius: 3px;
  color: inherit;
  background: color-mix(in srgb, var(--warning) 28%, transparent);
}

/* The editor's palette: a page's text in a colour, or highlighted in one.
   Classes, not styles, which a page may not have. The rules hold outside
   a page too, for the palette's swatches. */
.c-red { color: var(--c-red); }
.c-orange { color: var(--c-orange); }
.c-green { color: var(--c-green); }
.c-teal { color: var(--c-teal); }
.c-blue { color: var(--c-blue); }
.c-purple { color: var(--c-purple); }
.c-pink { color: var(--c-pink); }
.c-grey { color: var(--c-grey); }

.h-yellow,
.page-body mark.h-yellow { background: var(--h-yellow); }
.h-green,
.page-body mark.h-green { background: var(--h-green); }
.h-blue,
.page-body mark.h-blue { background: var(--h-blue); }
.h-pink,
.page-body mark.h-pink { background: var(--h-pink); }
.h-purple,
.page-body mark.h-purple { background: var(--h-purple); }

.page-body details {
  margin: 1rem 0;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.page-body details > summary {
  font-weight: 600;
  cursor: pointer;
}

.page-body details[open] > summary {
  margin-bottom: 0.5rem;
}

/* Spoilers (WP5.62 of docs/PLAN.md). An inline spoiler is blurred, and its
   text cannot be selected, until a click or a key gives it the class
   "shown" (web/src/islands.js). */
.page-body span.spoiler {
  border-radius: 3px;
  background: var(--surface);
  filter: blur(0.3em);
  user-select: none;
  cursor: pointer;
  transition: filter 0.15s;
}

.page-body span.spoiler.shown {
  filter: none;
  user-select: auto;
  cursor: auto;
}

.page-body span.spoiler:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .page-body span.spoiler {
    transition: none;
  }
}

/* A block spoiler: a box with a muted bar down its left side, as the other
   boxes have a coloured one, opened by a click on its summary. */
.page-body details.spoiler {
  border: 0;
  border-left: 4px solid var(--muted);
  border-radius: 0 6px 6px 0;
}

.page-body details.spoiler > summary {
  color: var(--muted);
}

/* A heading spoiler (## [[!spoiler]] Question): its summary is the
   section's heading, in its level's size and the text's colour, on the
   line of the disclosure triangle. The box's bar marks the section as
   hidden, in place of the heading's rule. */
.page-body details.spoiler-section > summary {
  color: inherit;
  font-weight: inherit;
}

.page-body details.spoiler-section > summary > :is(h1, h2, h3, h4, h5, h6) {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
}

/* A spoiler's marker line that is wrong, with the reason under it, and the
   blocks of a spoiler that is not closed or cuts a section: in red, so the
   author sees the mistake in the preview as it is typed. Boxes and code
   inside keep their shapes. */
.page-body .spoiler-error {
  color: var(--danger);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.page-body .spoiler-error-reason {
  display: block;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.page-body .spoiler-unclosed {
  padding-left: 0.75rem;
  border-left: 2px dashed var(--danger);
  color: var(--danger);
}

.page-body .wikilink {
  border-bottom: 1px dashed currentColor;
}

.page-body .wikilink:hover {
  text-decoration: none;
}

.page-body .emoji {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

.page-source {
  white-space: pre-wrap;
}

/* The orders of a space's subspaces and pages, side by side. */
.order-fields {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* A space's math macros: the form that edits them, with KaTeX's error
   and a formula to try them on, and the list a reader can open. */
.macros-form .field {
  flex-basis: 100%;
}

.macros-source {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: 0.85rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text);
  background: var(--background);
  resize: vertical;
}

.macros-hint {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.macros-form .macros-error {
  flex-basis: 100%;
  margin: 0;
  white-space: pre-wrap;
}

.macros-preview {
  flex-basis: 100%;
  min-height: 1.5rem;
  overflow-x: auto;
}

.space-macros {
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

/* The editor's panel of math macros (Wiki.App.View.MacrosPanel), under
   the toolbar while its button is pressed: the layers a page's formulas
   are set with, the space's and the page's editable. */
.editor-macros {
  margin: 0.5rem 0;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.editor-macros h2 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
}

.editor-macros h3 {
  margin: 0.4rem 0 0.2rem;
  font-size: 0.9rem;
}

.editor-macros .macros-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0;
}

.editor-macros-ancestor pre {
  margin: 0.2rem 0;
  font-size: 0.8rem;
  white-space: pre-wrap;
}

/* The built-in macros in the administration's Editor section, and the
   pages a removal would break. */
.editor-macros-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  max-width: 48rem;
}

.editor-macros-pages {
  margin: 0.3rem 0;
}

.space-macros summary {
  cursor: pointer;
  color: var(--muted);
}

.space-macros p {
  margin: 0.5rem 0 0.2rem;
}

.space-macros pre {
  margin: 0;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font: 0.85rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  background: var(--surface);
}

.attachments {
  margin-top: 2.5rem;
}

.attachments h2 {
  font-size: 1.1rem;
}

.attachments ul {
  padding-left: 1.2rem;
}

/* A calendar's month and days, after its text (the plugin "calendar",
   Wiki.App.Plugin.Calendar). The month is FullCalendar's, styled by
   islands/calendar.css (web/src/calendar.css), which loads with it; the
   list of days under it is folded once the month is drawn. */
.calendar-days {
  margin-top: 2.5rem;
}

.calendar-all-days {
  margin-top: 1rem;
}

.calendar-all-days summary {
  cursor: pointer;
  font-weight: 600;
}

.calendar-day-list {
  padding-left: 1.2rem;
}

.calendar-month-failed {
  color: var(--muted);
}

/* The line is always there, so that the list after it keeps its place,
   and says something only when the month could not be shown. */
.calendar-month-failed:empty {
  display: none;
}

.calendar-empty {
  color: var(--muted);
}

/* "Subscribe" or "Unsubscribe", in a row of its own above the month, at
   the right, as tall as the button whatever it says. The line at its
   left says why the last change was not made; its place is there, empty,
   otherwise. So a change of either moves nothing of the month. */
.calendar-subscription {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.calendar-subscription-problem {
  margin: 0;
  font-size: 0.9rem;
  color: var(--danger);
}

.calendar-subscribe[aria-busy="true"] {
  cursor: progress;
  opacity: 0.6;
}

/* A budget's sheet, after its text (the plugin "budget",
   Wiki.App.Plugin.Budget): the switches of the period, the order and the
   summary, the period's expenses, what could not be counted, the summary,
   the months and the settings. Colours are the wiki's tokens, so the dark
   theme needs nothing of its own. The tables scroll sideways in their own
   box when a phone is too narrow for them, and the amounts line up at the
   right in figures of one width. */
.budget-sheet {
  margin-top: 2.5rem;
}

.budget-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}

.budget-switch {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.budget-switch [aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.budget-period {
  margin: 0.5rem 0;
}

.budget-reading,
.budget-none,
.budget-empty,
.budget-doubled,
.budget-settings-how {
  color: var(--muted);
}

.budget-failed p {
  margin: 0 0 0.4rem;
}

.budget-why {
  color: var(--muted);
}

.budget-table-wrap {
  overflow-x: auto;
}

.budget-expenses,
.budget-sums {
  border-collapse: collapse;
}

.budget-expenses {
  width: 100%;
}

.budget-expenses th,
.budget-expenses td,
.budget-sums th,
.budget-sums td {
  padding: 0.3rem 0.6rem 0.3rem 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.budget-sums th {
  font-weight: normal;
}

.budget-day,
.budget-amount {
  white-space: nowrap;
}

/* On a phone the table scrolls sideways rather than squeezing the note
   into a column of one word a line. */
.budget-note {
  min-width: 10rem;
}

.budget-sheet .budget-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.budget-total th,
.budget-total td {
  font-weight: 600;
  border-bottom: none;
}

.budget-foreign {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.budget-sums .budget-foreign {
  display: inline;
}

.budget-not-counted ul {
  padding-left: 1.2rem;
}

.budget-not-counted code {
  overflow-wrap: anywhere;
}

.budget-summary-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-top: 1.5rem;
}

.budget-summary-head h4,
.budget-not-counted h4,
.budget-settings h4 {
  margin: 0.5rem 0;
}

.budget-months {
  margin-top: 1.5rem;
}

.budget-months summary {
  cursor: pointer;
  font-weight: 600;
}

.budget-month-list {
  padding-left: 1.2rem;
}

.budget-settings {
  margin-top: 1.5rem;
}

.budget-settings dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.2rem 1rem;
  margin: 0;
}

.budget-settings dt {
  font-weight: 600;
}

.budget-settings dd {
  margin: 0;
}

/* The form to add an expense: its fields side by side where they fit, the
   note taking what is left, one under another on a phone. A field that
   cannot be read has the danger colour's border and its message under it. */
.budget-add {
  margin: 0.75rem 0 1rem;
  padding: 0.6rem 0.8rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.budget-add h4 {
  margin: 0 0 0.4rem;
}

.budget-add-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.6rem;
}

.budget-add .field {
  flex: 0 1 auto;
}

.budget-add-day input {
  min-width: 9.5rem;
}

.budget-add-amount input {
  width: 8rem;
  font-variant-numeric: tabular-nums;
}

.budget-add-payer input {
  width: 9rem;
}

.budget-add .budget-add-note {
  flex: 1 1 12rem;
}

.budget-add input[aria-invalid="true"] {
  border-color: var(--danger);
}

.budget-add-problem {
  max-width: 16rem;
  color: var(--danger);
  font-size: 0.85rem;
}

@media (max-width: 30rem) {
  .budget-add .field,
  .budget-add .budget-add-note {
    flex: 1 1 100%;
  }

  .budget-add-fields input,
  .budget-add-fields select {
    width: 100%;
    box-sizing: border-box;
  }
}

/* A row's "Edit" and "Delete", small, at the row's end; the question
   whether to delete it in their place; the form to correct it across the
   row, its fields as the add form's. Why an open row was closed, muted,
   over the list. */
.budget-row-actions {
  white-space: nowrap;
  text-align: right;
}

.budget-row-buttons,
.budget-delete-ask,
.budget-edit-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
}

.budget-row-buttons button,
.budget-delete-ask button {
  font-size: 0.85rem;
  padding: 0.1rem 0.45rem;
}

.budget-edit-form .field {
  flex: 0 1 auto;
}

.budget-edit-form .budget-add-note {
  flex: 1 1 12rem;
}

.budget-edit-form input[aria-invalid="true"] {
  border-color: var(--danger);
}

.budget-notice {
  color: var(--muted);
  font-style: italic;
}

@media (max-width: 30rem) {
  .budget-edit-form .field,
  .budget-edit-form .budget-add-note {
    flex: 1 1 100%;
  }
}

/* The expenses being added, under the form: muted while their write is
   under way, in the danger colour with "Try again" and "Discard" when it
   was refused. */
.budget-pending {
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.budget-pending-expense {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  padding: 0.35rem 0;
  border-bottom: 1px dashed var(--border);
}

.budget-pending-what {
  overflow-wrap: anywhere;
}

.budget-pending-state {
  color: var(--muted);
  font-style: italic;
}

.budget-refused .budget-pending-state {
  color: var(--danger);
  font-style: normal;
}

.budget-pending-actions {
  display: inline-flex;
  gap: 0.4rem;
}

/* The start page's "Today" (Wiki.App.Plugin.Calendar.Brief), above the
   start page's document. Its body keeps at least the height of a few
   lines from the page the server renders on, so that the document under
   it moves only when the list is longer than that. A highlighted entry is
   bold, with no background; a done task is struck through and a missed
   one red, as on a day's page; the calendar's name is small. */
.start-brief {
  margin: 0 0 2rem;
}

.start-brief-title {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.start-brief-body {
  min-height: 4.5rem;
}

.start-brief-status,
.start-brief-empty,
.start-brief-no-page,
.start-brief-gone,
.start-brief-locked {
  margin: 0.25rem 0;
  color: var(--muted);
}

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

/* An entry's row: its task's box, then its link, a box of its own that
   wraps inside itself, so that all of the link's box is the link however
   narrow the row or wide the font. A control scrolled to stops below the
   sticky header. */
.start-brief-entry {
  display: flex;
  align-items: baseline;
  gap: 0.4em;
  padding: 0.15rem 0;
}

.start-brief-entry > a {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  text-decoration: none;
}

.start-brief-entry > :is(a, button) {
  scroll-margin-top: calc(var(--header-height) + 0.75rem);
}

.start-brief-entry > .start-brief-box {
  flex: none;
}

.start-brief-entry > a:hover .start-brief-label {
  text-decoration: underline;
}

.start-brief-time {
  margin-right: 0.4em;
  font-variant-numeric: tabular-nums;
}

.start-brief-time {
  color: var(--muted);
}

/* A task's box: a control for a reader who may tick it, its sign alone
   shown. Busy while its tick is out. */
button.start-brief-box {
  padding: 0 0.1em;
  border: none;
  border-radius: 0.2em;
  background: none;
  color: var(--text);
  font: inherit;
  line-height: inherit;
  cursor: pointer;
}

button.start-brief-box:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button.start-brief-box[aria-busy="true"] {
  cursor: progress;
  opacity: 0.6;
}

span.start-brief-box[aria-disabled="true"] {
  color: var(--muted);
}

.start-brief-note {
  margin: 0.25rem 0;
  color: var(--muted);
}

.start-brief-highlight .start-brief-label {
  font-weight: 600;
}

.start-brief-done .start-brief-label {
  text-decoration: line-through;
}

.start-brief-missed .start-brief-label {
  color: var(--c-red);
}

.start-brief-calendar {
  margin-left: 0.5em;
  font-size: 0.8rem;
  color: var(--muted);
}

.start-brief-subtitle {
  margin: 1rem 0 0.25rem;
  font-size: 1rem;
}

.start-brief-date {
  margin: 0.5rem 0 0.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.start-brief-gone button {
  margin-left: 0.5rem;
}

.start-brief-problem {
  margin: 0.25rem 0;
  color: var(--danger);
}

@media (forced-colors: active) {
  .start-brief-missed .start-brief-label {
    text-decoration: underline wavy;
    text-underline-offset: 0.3em;
  }
}

.attachment-meta {
  margin-left: 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Who wrote the page and when it last changed, in small print under its
   title (WP5.55): "Created by X, last edited by Y on <date>", each name with
   its avatar. When the Markdown has its own title, the line is in the
   article, after that heading. */
.page-byline {
  margin: -0.25rem 0 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  user-select: none;
}

.page-byline-author {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  vertical-align: middle;
}

.page-byline-name {
  color: var(--text);
}

.page-byline .avatar {
  width: 1.4em;
  height: 1.4em;
}

/* The title, with who else reads the page at its right. When the
   Markdown has its own title, the stack floats at the right of the
   article's first heading instead. */
.page-title-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.page-title-row > .page-title {
  flex: 1;
  min-width: 0;
}

.page-text > .page-readers {
  float: right;
  margin: 0.6rem 0 0 1rem;
}

/* Who else reads the page (WP5.55): a stack of overlapping avatars, each
   over a third of the one before it, with a ring of the page's background
   between them; then a translucent "+N", then the visitors' grey circle.
   The circle under the pointer, or with the keyboard's focus, comes to the
   top of the stack and lifts a little; hovering or focusing the stack shows
   the names under it. */
.page-readers {
  position: relative;
  flex-shrink: 0;
  z-index: 3;
}

.page-readers-stack {
  display: flex;
  align-items: center;
  padding: 0.35rem 0 0.35rem 0.6rem;
}

.page-reader {
  position: relative;
  display: inline-flex;
  margin-left: -0.6rem;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--background);
  transition:
    transform 150ms ease,
    z-index 0s 150ms;
}

.page-reader > .avatar {
  width: 1.9rem;
  height: 1.9rem;
}

.page-reader > .avatar-initials {
  font-size: 0.75rem;
}

.page-reader:hover,
.page-reader:focus-visible {
  z-index: 2;
  transform: translateY(-3px) scale(1.08);
  transition:
    transform 150ms ease,
    z-index 0s;
  outline: none;
}

.page-reader:focus-visible {
  box-shadow:
    0 0 0 2px var(--background),
    0 0 0 4px var(--accent);
}

.page-readers-more,
.page-readers-visitors {
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.page-readers-more {
  color: var(--text);
  background: color-mix(in srgb, var(--muted) 30%, transparent);
}

/* The visitors who have not signed in: a person's outline, with how many
   in a badge at its corner. */
.page-readers-visitors {
  color: #ffffff;
  background: var(--icon-slate);
}

.page-readers-glyph {
  width: 1.1rem;
  height: 1.1rem;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21c0-4.4 3.6-8 8-8s8 3.6 8 8'/%3E%3C/svg%3E") center / contain no-repeat;
}

.page-readers-count {
  position: absolute;
  right: -0.35rem;
  bottom: -0.25rem;
  min-width: 1rem;
  padding: 0 0.2rem;
  border-radius: 0.5rem;
  font-size: 0.65rem;
  line-height: 1rem;
  text-align: center;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}

.page-readers-list {
  position: absolute;
  top: 100%;
  right: 0;
  display: none;
  min-width: 12rem;
  max-width: 20rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  box-shadow: 0 6px 16px rgb(0 0 0 / 0.15);
}

.page-readers:hover > .page-readers-list,
.page-readers:focus-within > .page-readers-list {
  display: block;
}

.page-readers-list ul {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
}

.page-readers-list li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.15rem 0;
}

.page-readers-others,
.page-readers-visitors-line {
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .page-reader,
  .page-reader:hover,
  .page-reader:focus-visible {
    transition: none;
  }
}

/* ---- A page's source ------------------------------------------------------- */

/* The Markdown as it is written, in the page's code font and colours, its long
   lines wrapped rather than scrolled, so that it reads on a phone too. */
.source-text {
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--code);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 4;
}

.source-view .actions {
  align-items: center;
}

/* What Copy did, said beside it for a moment. */
.source-copied {
  font-size: 0.9rem;
  color: var(--muted);
}

/* ---- A page's history ------------------------------------------------------ */

/* The versions beside what the chosen one changed, on a wide screen; above
   it on a narrow one. The diff wants the width, so the page's reading width
   does not hold here. */
.wiki-content:has(> .history-view) {
  max-width: none;
}

.history {
  display: grid;
  grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

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

.version-list ol {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.version {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.45rem 0.75rem;
  border-top: 1px solid var(--border);
}

.version:first-child {
  border-top: none;
}

.version.chosen {
  background: var(--surface);
  box-shadow: inset 3px 0 0 var(--accent);
}

.version.chosen a {
  font-weight: 600;
}

.version-meta,
.diff-summary {
  font-size: 0.875rem;
  color: var(--muted);
}

.version-detail h2 {
  margin: 0 0 0.25rem;
  font-size: 1.2rem;
}

.version-detail .version-meta {
  margin: 0 0 0.75rem;
}

.diff-against {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.diff-against-chosen {
  font-weight: 600;
}

.diff-title del,
.diff-text del {
  background: var(--diff-removed-word);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--text) 45%, transparent);
}

.diff-title ins,
.diff-text ins {
  background: var(--diff-added-word);
  text-decoration: none;
}

.diff-title del,
.diff-title ins {
  padding: 0 0.2rem;
  border-radius: 3px;
}

/* A table of lines, numbered on each side, in the source's own type. A
   narrow screen scrolls the table rather than the page. */
.diff {
  display: block;
  overflow-x: auto;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  border-spacing: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.5;
}

.diff tbody {
  display: table;
  width: 100%;
}

.diff td {
  padding: 0 0.5rem;
  vertical-align: top;
}

.diff-number {
  width: 1%;
  min-width: 2.5rem;
  text-align: right;
  color: var(--muted);
  user-select: none;
  background: var(--surface);
}

.diff-sign {
  width: 1%;
  user-select: none;
  color: var(--muted);
}

.diff-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 4;
}

.diff-removed {
  background: var(--diff-removed);
}

.diff-added {
  background: var(--diff-added);
}

.diff-removed .diff-number,
.diff-added .diff-number {
  background: transparent;
}

.diff-gap td {
  padding: 0.2rem 0.75rem;
  color: var(--muted);
  background: var(--surface);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.8rem;
}

.restore-confirm {
  margin-bottom: 0.75rem;
}

/* ---- Slides ------------------------------------------------------------ */

/* A document's address of slides: a note in the page, with a link back to
   the document (Wiki.App.View.Slides). */
.slides-not-presentation {
  max-width: 40rem;
  margin: 2rem auto;
}

/* A page presented as slides (Wiki.App.View.Slides) covers the whole window,
   over the frame, which stays where it was beneath. Each theme sets the
   slide's own colours; the dark frame around a slide, the notes and the
   controls are the page's. */
.slides-view,
.slides-preview,
.deck-embed {
  --slide-ratio: 16 / 9;
  --slide-background: #ffffff;
  --slide-text: #1f2328;
  --slide-accent: #23376e;
  --slide-bar: #23376e;
  --slide-bar-text: #ffffff;
  --slide-muted: #59636e;
}

.slides-view {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: #15181d;
  outline: none;
}

body:has(.slides-view) {
  overflow: hidden;
}

.slides-view.slides-standard,
.slides-preview.slides-standard,
.deck-embed.slides-standard {
  --slide-ratio: 4 / 3;
}

/* The editor's preview of a presentation (Wiki.App.View.Preview): its
   slides as cards, one under the other, each with its notes under it,
   every step shown. Each slide is laid out 1024px wide, where it is
   measured (wiki-app/jsbits/slide-fit.js), and scaled to the pane by a
   transform, which leaves the layout as it is; a card not shown is laid
   out off the pane. */
.slides-preview {
  position: relative;
}

.slides-preview .slide-frame {
  position: relative;
  display: flex;
  margin-bottom: 1.5rem;
}

.slides-preview .slide-frame.slide-offstage {
  position: absolute;
  top: 0;
  left: -40000px;
  width: 1024px;
  visibility: hidden;
}

.slides-preview .slide-scaled {
  height: calc(1024px / (var(--slide-ratio)) * var(--slide-scale, 1));
  overflow: hidden;
}

.slides-preview .slide-slot {
  flex: none;
  width: 1024px;
  aspect-ratio: var(--slide-ratio);
  transform: scale(var(--slide-scale, 1));
  transform-origin: 0 0;
}

/* A presentation's preview whose cards are not measured (the detached
   preview, Wiki.App.View.LivePreview): each card is as wide as the column,
   sized by the slide's container alone as a viewer's in a page is, so no
   script sets its size and the page the server renders is the page the
   program shows. The cards not shown are not laid out, and no card has a
   mark of its fit. */
.slides-preview.slides-fluid .slide-frame.slide-offstage {
  display: none;
}

.slides-preview.slides-fluid .slide-scaled {
  height: auto;
}

.slides-preview.slides-fluid .slide-slot {
  width: 100%;
  transform: none;
}

.slides-preview.slides-fluid .slide-fit {
  display: none;
}

/* A presentation's viewer in a page (Wiki.App.View.DeckViewer): the
   slide shown as the preview's card, as wide as the viewer, with its
   controls under it. It is sized as the slides view is, by the slide's
   container alone (the slide's width and type are in container units):
   no script sets its size, so the page the server renders is the page the
   program shows. The other slides are not shown. The fit and the speaker
   notes are the editor's, not shown here. Printed, the slide alone,
   whole. */
.deck-embed {
  display: block;
  max-width: 48rem;
  margin: 1rem 0;
  outline: none;
}

.deck-embed:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.page-deck .deck-embed {
  max-width: none;
}

.deck-embed .slide-frame {
  display: flex;
  margin-bottom: 0.5rem;
}

.deck-embed .slide-frame.slide-offstage {
  display: none;
}

.deck-embed .slide-slot {
  flex: none;
  width: 100%;
  aspect-ratio: var(--slide-ratio);
}

.deck-embed .slide-fit,
.deck-embed .slide-notes {
  display: none;
}

.deck-embed-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.deck-embed-position {
  min-width: 4rem;
  text-align: center;
  color: var(--muted);
}

.deck-embed-present {
  margin-left: auto;
}

@media print {
  .deck-embed-controls,
  .deck-embed .slide-offstage {
    display: none;
  }
}

/* Whether a card's content fits: a dot at its corner, grey until
   measured, green, yellow or red. */
.slide-fit {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  z-index: 1;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--fit-colour, #8c959f);
  box-shadow: 0 0 0 2px var(--background);
}

.slide-fit-fits {
  --fit-colour: #1a7f37;
}

.slide-fit-tight {
  --fit-colour: #bf8700;
}

.slide-fit-overflowing {
  --fit-colour: #cf222e;
}

/* A slide's body ends with an empty mark, which the measure finds its
   content's end by. */
.slide-end {
  display: block;
  height: 0;
}

/* A presentation's preview is always laid out, so that its slides are
   measured: off the screen while it is not shown. */
.editor-form.deck .editor-panes .editor-preview {
  display: block;
  position: fixed;
  top: 0;
  left: -40000px;
  width: 1024px;
  visibility: hidden;
  pointer-events: none;
}

/* The room of the pane's scrollbar is kept whether the scrollbar is there
   or not. The cards are scaled to the width inside the pane
   (wiki-app/jsbits/slide-fit.js), and their height decides whether the
   pane scrolls: without the room kept, a deck at the threshold scaled its
   cards down when the scrollbar came, which then went, which scaled them
   up again, at every frame, for ever. */
.editor-form.deck .editor-panes .editor-preview {
  scrollbar-gutter: stable;
}

@media (min-width: 961px) {
  .editor-form.deck.side-by-side:not(.conflicting) .editor-panes .editor-preview {
    position: static;
    width: auto;
    visibility: visible;
    pointer-events: auto;
  }
}

.editor-form.deck.previewing .editor-panes .editor-preview {
  position: static;
  width: auto;
  visibility: visible;
  pointer-events: auto;
}

.slides-preview .slide {
  box-shadow: 0 0.25rem 1rem rgb(0 0 0 / 25%);
}

.slides-preview .slide-notes {
  display: block;
  max-height: none;
}

.slides-theme-light {
  --slide-accent: #0969da;
  --slide-bar: transparent;
  --slide-bar-text: #1f2328;
}

.slides-theme-dark {
  --slide-background: #161b22;
  --slide-text: #e6edf3;
  --slide-accent: #79c0ff;
  --slide-bar: transparent;
  --slide-bar-text: #e6edf3;
  --slide-muted: #9198a1;
}

/* A slide's look is its theme's, not the system's. The page body inside a
   slide reads the same variables as the page (code's background, the
   highlighter's colours, the inline colours and highlights, surfaces,
   borders, the alerts' colours), and the system's dark scheme switches those
   to light-on-dark values: on the light themes that made code dark text on
   a dark box, and a table's header dark. So the light themes re-declare the
   page's light set for the slide, and the dark theme its dark set, whatever
   the system prefers; the frame, notes and controls around the slide stay
   the page's. The two sets are the ones at the top of this file. An html
   fence's frame on a slide is drawn in the slide's set too: the frame's
   body has the class html-frame-light or html-frame-dark
   (Wiki.Core.Markdown.Frame's FrameScheme). */
.slide,
.html-frame-light {
  --text: #1f2328;
  --background: #ffffff;
  --surface: #f6f8fa;
  --border: #d1d9e0;
  --muted: #59636e;
  --accent: #0969da;
  --danger: #cf222e;
  --code: #eff2f5;
  --note: #0969da;
  --tip: #1a7f37;
  --important: #8250df;
  --warning: #9a6700;
  --caution: #cf222e;
  --hl-keyword: #cf222e;
  --hl-string: #0a3069;
  --hl-title: #8250df;
  --hl-type: #953800;
  --hl-number: #0550ae;
  --hl-comment: #59636e;
  --c-red: #b42228;
  --c-orange: #a3480a;
  --c-green: #17722f;
  --c-teal: #0a6d69;
  --c-blue: #075cc4;
  --c-purple: #7342cc;
  --c-pink: #a8317a;
  --c-grey: #525a64;
  --h-yellow: #fff5b8;
  --h-green: #d8f8de;
  --h-blue: #dbefff;
  --h-pink: #ffe2ef;
  --h-purple: #ece4ff;
  --icon-blue: #0b5cad;
  --icon-teal: #0b6b66;
  --icon-green: #1d6b34;
  --icon-olive: #5c6416;
  --icon-orange: #9a4a0b;
  --icon-red: #b3262d;
  --icon-pink: #a3306f;
  --icon-purple: #6b3fbf;
  --icon-indigo: #3d4bb0;
  --icon-slate: #4b5563;
  --diff-removed: #ffebe9;
  --diff-removed-word: #ffc1bc;
  --diff-added: #dafbe1;
  --diff-added-word: #aceebb;
}

.slides-theme-dark .slide,
.html-frame-dark {
  --text: #e6edf3;
  --background: #0d1117;
  --surface: #151b23;
  --border: #3d444d;
  --muted: #9198a1;
  --accent: #4493f8;
  --danger: #f85149;
  --code: #1f262f;
  --note: #4493f8;
  --tip: #3fb950;
  --important: #ab7df8;
  --warning: #d29922;
  --caution: #f85149;
  --hl-keyword: #ff7b72;
  --hl-string: #a5d6ff;
  --hl-title: #d2a8ff;
  --hl-type: #ffa657;
  --hl-number: #79c0ff;
  --hl-comment: #9198a1;
  --c-red: #ff7b72;
  --c-orange: #ffa657;
  --c-green: #3fb950;
  --c-teal: #39c5bb;
  --c-blue: #79c0ff;
  --c-purple: #d2a8ff;
  --c-pink: #ff9bce;
  --c-grey: #a2aab3;
  --h-yellow: #3d3200;
  --h-green: #123a1c;
  --h-blue: #0b2e57;
  --h-pink: #4b1834;
  --h-purple: #30215a;
  --diff-removed: #3b1219;
  --diff-removed-word: #6e1d24;
  --diff-added: #12301c;
  --diff-added-word: #1e5a2d;
}

.slides-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 1rem;
}

/* The slide shown, and under it its notes when they are open. The others
   are in the page, drawn, and hidden. */
.slide-frame {
  display: none;
  flex: 1;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  gap: 0.75rem;
}

.slide-frame.current {
  display: flex;
}

/* The room a slide has, which it fills as far as its shape lets it. */
.slide-slot {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  container-type: size;
}

/* A slide's text is sized in hundredths of the slide's width (cqi), so a
   slide looks the same in a window, on a projector and on paper. */
.slide {
  display: flex;
  flex-direction: column;
  width: min(100cqw, calc(100cqh * var(--slide-ratio)));
  aspect-ratio: var(--slide-ratio);
  overflow: hidden;
  container-type: inline-size;
  color: var(--slide-text);
  background: var(--slide-background);
  box-shadow: 0 0.5rem 2rem rgb(0 0 0 / 40%);
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.slide-title {
  padding: 0.45em 1.1em;
  font-size: 3.6cqi;
  line-height: 1.2;
  color: var(--slide-bar-text);
  background: var(--slide-bar);
}

.slide-title > * {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 1em;
  font-weight: 600;
}

.slides-theme-light .slide-title,
.slides-theme-dark .slide-title {
  margin: 0 1.1em;
  padding: 0.6em 0 0.25em;
  border-bottom: 2px solid var(--slide-accent);
}

.slide-body {
  flex: 1;
  min-height: 0;
  padding: 0.8em 1.7em;
  overflow: hidden;
  font-size: 2.4cqi;
  line-height: 1.4;
}

.slide-body > :first-child {
  margin-top: 0;
}

.slide .page-body h1,
.slide .page-body h2,
.slide .page-body h3 {
  margin: 0.6em 0 0.3em;
  padding: 0;
  border: 0;
  color: var(--slide-accent);
}

.slide .page-body pre code,
.slide .page-body pre .code-lines,
.slide .page-body code {
  font-size: 0.85em;
}

.slide .page-body .footnotes {
  margin-top: 1em;
  font-size: 0.7em;
}

.slide .page-body th,
.slide .page-body td {
  border-color: color-mix(in srgb, var(--slide-text) 25%, transparent);
}

.slide .page-body th {
  background: color-mix(in srgb, var(--slide-text) 8%, transparent);
}

.slide .wiki-mermaid svg,
.slide .page-body img,
.slide .page-body video {
  max-width: 100%;
  max-height: 60cqi;
}

.slide-footer {
  display: flex;
  justify-content: space-between;
  gap: 1em;
  padding: 0.35em 1.4em;
  font-size: 1.4cqi;
  color: var(--slide-bar-text);
  background: var(--slide-bar);
}

.slides-theme-light .slide-footer,
.slides-theme-dark .slide-footer {
  color: var(--slide-muted);
}

/* A slide titled with a level-one heading is a title slide, as Beamer's
   title page: the title large, in the middle, the text under it. */
.slide-title-page .slide-title {
  margin-top: auto;
  padding: 0 1em;
  border: 0;
  text-align: center;
  font-size: 6cqi;
  color: var(--slide-accent);
  background: none;
}

.slide-title-page .slide-body {
  flex: 0 1 auto;
  margin-bottom: auto;
  text-align: center;
}

.slide-notes {
  display: none;
  max-height: 30%;
  overflow-y: auto;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  color: var(--text);
  background: var(--surface);
}

.notes-open .slide-frame.current .slide-notes {
  display: block;
}

.slides-progress {
  height: 4px;
  background: rgb(255 255 255 / 15%);
}

.slides-progress-bar {
  height: 100%;
  background: var(--accent);
  transition: width 0.2s ease-out;
}

.slides-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  color: var(--text);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.slides-position {
  min-width: 4.5rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.slides-controls [aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

/* In full screen the controls keep out of the way until they are wanted. */
.slides-view:fullscreen .slides-controls {
  opacity: 0;
  transition: opacity 0.2s;
}

.slides-view:fullscreen .slides-controls:hover,
.slides-view:fullscreen .slides-controls:focus-within {
  opacity: 1;
}

/* Every slide, small, to pick one; the one shown is marked. */
.slides-view.overview .slides-stage {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  align-content: start;
  gap: 1rem;
  overflow-y: auto;
}

.overview .slide-frame {
  display: block;
  cursor: pointer;
}

.overview .slide-slot {
  aspect-ratio: var(--slide-ratio);
}

.overview .slide {
  pointer-events: none;
}

.overview .slide-frame.current .slide {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.overview .slide-frame .slide-notes {
  display: none;
}

/* A slide's steps (Wiki.Core.Slides): what a later step shows is in place
   already, hidden, so nothing moves when it appears. It fades in; going
   back hides it at once. An item of an incremental list is hidden whole,
   marker and all, by the empty mark at its end. */
.slide-step,
.slide li:has(> .slide-step-item) {
  transition:
    opacity 0.3s ease,
    visibility 0s;
}

.slide-step-later,
.slide li:has(> .slide-step-item.slide-step-later) {
  visibility: hidden;
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .slide-step,
  .slide li:has(> .slide-step-item) {
    transition: none;
  }
}

/* A copy of a slide at an earlier step is only for printing, with "each step
   on its own page". */
.slide-step-copy,
.overview .slide-step-copy {
  display: none;
}

/* A page's speaker notes, read on the page itself rather than presented. */
.page-body .notes {
  margin: 1rem 0;
  padding: 0.25rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 6px;
  font-size: 0.92rem;
  color: var(--muted);
}

.page-body .notes::before {
  content: "Speaker notes";
  display: block;
  margin-top: 0.25rem;
  font-weight: 600;
}

/* Printed, or saved as a PDF: a slide to a page of the slide's own shape,
   and nothing else of the window; or, with the notes, each slide on an A4
   page with its notes under it. */
@page slides-wide {
  size: 254mm 142.875mm;
  margin: 0;
}

@page slides-standard {
  size: 254mm 190.5mm;
  margin: 0;
}

@page slides-notes {
  size: A4 portrait;
  margin: 15mm;
}

@media print {
  /* What the libraries put in the page beside the application (Mermaid
     measures its text in elements of its own) is not printed either. */
  body:has(.slides-view) > :not(#app),
  .wiki:has(.slides-view) .wiki-header,
  .wiki:has(.slides-view) .wiki-sidebar,
  .wiki:has(.slides-view) .wiki-footer,
  .wiki:has(.slides-view) .leave-confirm,
  .sidebar-fold,
  .slides-progress,
  .slides-controls {
    display: none;
  }

  .wiki:has(.slides-view) .wiki-content {
    margin: 0;
    padding: 0;
  }

  .slides-view {
    position: static;
    display: block;
    background: none;
  }

  .slides-stage,
  .slides-view.overview .slides-stage {
    display: block;
    padding: 0;
    overflow: visible;
  }

  /* A break between slides rather than after each, so that the last one
     leaves no empty page behind it. */
  .slide-frame,
  .overview .slide-frame {
    display: block;
    page: slides-wide;
  }

  .slide-frame + .slide-frame {
    break-before: page;
  }

  /* A slide is printed whole, whatever step it is shown at; its copies at
     the steps before, when there are copies, are printed as they are. */
  .slide-step-copy,
  .overview .slide-step-copy {
    display: block;
  }

  .slide-frame:not(.slide-step-copy) .slide-step-later,
  .slide-frame:not(.slide-step-copy) li:has(> .slide-step-item.slide-step-later) {
    visibility: visible;
    opacity: 1;
  }

  .slide-step,
  .slide li:has(> .slide-step-item) {
    transition: none;
  }

  .slides-standard .slide-frame {
    page: slides-standard;
  }

  .slide-slot,
  .overview .slide-slot {
    width: 100vw;
    height: 100vh;
    aspect-ratio: auto;
  }

  .slide,
  .overview .slide-frame.current .slide {
    box-shadow: none;
    outline: none;
  }

  .slide-frame .slide-notes,
  .notes-open .slide-frame.current .slide-notes {
    display: none;
  }

  .print-notes .slide-frame {
    page: slides-notes;
  }

  .print-notes .slide-slot {
    width: 100%;
    height: auto;
    aspect-ratio: var(--slide-ratio);
  }

  .print-notes .slide {
    border: 1px solid #d1d9e0;
  }

  .print-notes .slide-frame .slide-notes {
    display: block;
    max-height: none;
    margin-top: 6mm;
    padding: 0;
    color: #1f2328;
    background: none;
  }
}

/* ---- The editor ------------------------------------------------------------ */

/* The editor takes the whole width the sidebar leaves: two panes side by side
   want more than a page's reading width, and the Markdown alone is easier to
   write at a width of its own choosing. */
.wiki-content:has(> .editor) {
  max-width: none;
}

.editor-heading {
  margin: 0.25rem 0 0.75rem;
  font-size: 1.4rem;
}

.editor-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.editor-title {
  flex: 1 1 18rem;
}

.editor-title input {
  font-size: 1.05rem;
}

/* A page's title in the editor, read from the text's first line: shown as
   a heading rather than a field (WP5.55). A click on it goes to that line. */
.editor-title-line {
  cursor: text;
}

.editor-title-text {
  display: block;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

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

/* The file input is the label's: the label is what shows, as a button. */
.editor-attach {
  position: relative;
  overflow: hidden;
}

.editor-attach input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* How many problems the editor marks in the text (WP5.65): quiet, beside
   the buttons, in the colour of the marks; a click moves to the next one. */
.editor-problems {
  padding: 0.1rem 0.5rem;
  font-size: 0.85rem;
  color: var(--danger);
  background: none;
  border: 1px solid var(--danger);
  border-radius: 999px;
}

.editor-problems:hover,
.editor-problems:focus-visible {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

/* A draft found when the page was opened, taken up or offered. */
.editor-draft-found {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
  padding: 0.6rem 1rem;
  border: 1px solid var(--note);
  border-radius: 6px;
  background: color-mix(in srgb, var(--note) 8%, transparent);
}

.editor-draft-found p {
  flex: 1 1 20rem;
  margin: 0;
}

.editor-draft-offered {
  border-color: var(--warning);
  background: color-mix(in srgb, var(--warning) 8%, transparent);
}

/* That the browser is offline, over the server's backend, in the bottom
   left corner of the window, until it is back online. */
.offline-notice {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 20;
  max-width: calc(100vw - 2rem);
  margin: 0;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  color: var(--background);
  background: var(--warning);
  font-weight: 600;
  box-shadow: 0 2px 8px rgb(0 0 0 / 20%);
}

@media print {
  .offline-notice {
    display: none;
  }
}

/* The notice of a section's or a selection's address copied by the page
   view (WP5.53): in the bottom right corner of the window, with the
   address in small print. */
.link-copied {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  max-width: min(32rem, calc(100vw - 2rem));
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  color: var(--background);
  background: var(--tip);
  box-shadow: 0 2px 8px rgb(0 0 0 / 20%);
}

.link-copied:empty {
  padding: 0;
  box-shadow: none;
}

.link-copied-label {
  font-weight: 600;
}

.link-copied-address {
  display: block;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

/* The editor's notices of saves (issue #193): "Saved" in green for a few
   seconds after a save that stays in the editor, and "Draft saved" in grey
   once the draft is kept. They hang under the bottom right corner of the
   editor's top, out of the flow: the top is sticky, so they stay in view
   with it, and a notice that appears covers none of its controls and moves
   none of its buttons. On a wide screen they keep clear of the writing
   assistant's bubbles, which hang at the right edge of the text; with the
   preview alone, or with two panes, the text's right edge is elsewhere and
   the notices go to the corner. Clicks go through them to the text.
   While the search's panel is open over the text, the panel sticks under
   the top, and the notices are the last child of the panel's holder
   instead (.editor-search-holder): they hang under the panel's bottom
   right corner, so that they never cover its buttons (issue #339). The
   panel is always over the text, so there they always keep clear of the
   bubbles, with two panes too. */
.editor-corner {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: calc(64px + 1.25rem);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  max-width: min(24rem, calc(100vw - 2rem));
  pointer-events: none;
}

.editor-form.previewing .editor-corner {
  right: 0;
}

@media (min-width: 961px) {
  .editor-form.side-by-side .editor-top > .editor-corner,
  .editor-form.conflicting .editor-top > .editor-corner {
    right: 0;
  }
}

/* On a phone the top does not stay (it has no box of its own there, see
   .editor-top below): the notices go to the bottom right corner of the
   window instead, above the help button. */
@media (max-width: 760px) {
  .editor-corner,
  .editor-form.previewing .editor-corner {
    position: fixed;
    top: auto;
    right: 1rem;
    bottom: 4rem;
    z-index: 20;
  }
}

/* Each notice is always there, empty and so with no size when there is
   nothing to say, so that a screen reader has the live region of "Saved"
   before the word arrives in it. */
.editor-saved-notice,
.editor-draft-status {
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  overflow-wrap: anywhere;
  box-shadow: 0 2px 8px rgb(0 0 0 / 15%);
}

.editor-saved-notice {
  color: var(--background);
  background: var(--tip);
  font-weight: 600;
}

.editor-draft-status {
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
}

.editor-saved-notice:empty,
.editor-draft-status:empty {
  padding: 0;
  border: none;
  box-shadow: none;
}

@media (prefers-reduced-motion: no-preference) {
  .editor-saved-notice:not(:empty),
  .editor-draft-status:not(:empty) {
    animation: saved-notice-in 150ms ease-out;
  }
}

@keyframes saved-notice-in {
  from {
    opacity: 0;
    transform: translateY(-0.25rem);
  }
}

@media print {
  .editor-corner {
    display: none;
  }
}

/* The editor's top: the title, Save, Save and close, Cancel, and the
   toolbar under them (WP5.38). It stays under the header while the text
   scrolls, as the page's bar of actions does, so that saving or leaving
   needs no scrolling back up; the toolbar's menus open over the text below
   it. With the preview shown alone, the toolbar is hidden and the rest
   stays. */
.editor-top {
  position: sticky;
  top: var(--header-height);
  z-index: 4;
  padding-top: 0.25rem;
  background: var(--background);
}

/* On a phone the bar takes too much of the screen to stay: only the
   toolbar does, as before. The top's own box goes (display: contents), so
   that the toolbar sticks within the whole form, not within the top. */
@media (max-width: 760px) {
  .editor-top {
    display: contents;
  }

  .editor-toolbar {
    position: sticky;
    top: var(--header-height);
    z-index: 4;
  }
}

/* The toolbar: groups of icon buttons that wrap onto more lines on a narrow
   screen, then the preview's controls at the end. */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.5rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem;
}

.toolbar-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  margin-left: auto;
}

.editor-toolbar .tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-color: transparent;
  background: transparent;
}

.editor-toolbar .tool:hover,
.editor-toolbar .tool[aria-expanded="true"] {
  border-color: var(--border);
  background: var(--background);
}

.editor-toolbar .icon,
.editor-show-preview .icon,
.editor-side-by-side .icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.editor-show-preview {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* "Side by side" is a button that stays pressed while the preview is
   beside the text; "Show preview" shows the page alone. Each has its own
   icon, two columns and an eye, so the two are not mistaken. */
.editor-side-by-side {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* A presentation's controls in the editor's toolbar (WP5.97): the switch
   between slide by slide and the raw Markdown, and the mode's button. */
.editor-slides-mode {
  display: inline-flex;
}

.editor-slides-mode button + button {
  margin-left: -1px;
}

.editor-slides-note {
  color: var(--muted);
  font-size: 0.85rem;
}

/* The editor's search (WP5.103b, Wiki.App.View.SearchPanel): above the
   text, or above the rows slide by slide. It stays under the editor's top
   while the page scrolls, so that its field and its count stay in sight
   as Enter steps from match to match, rows opening far down. Two lines:
   the text to find, its toggles, the count, Previous, Next and Close; the
   replacement and its two buttons. On a phone the editor's top does not
   stay, but its toolbar does: the panel stays under the toolbar. What
   sticks is the panel's holder, which also holds the notices of saves
   while the panel is open (.editor-corner above). */
.editor-search-holder {
  position: sticky;
  top: calc(var(--header-height) + var(--editor-top-height, 0px));
  z-index: 3;
}

@media (max-width: 760px) {
  .editor-search-holder {
    top: calc(var(--header-height) + var(--editor-toolbar-height, 0px));
  }
}

.editor-search {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

/* The providers' bubbles float over the text's right edge: the panel
   keeps clear of them, as the rows do. */
@media (min-width: 961px) {
  .editor-source:has(.editor-provider) .editor-search {
    margin-right: 5rem;
  }
}

.editor-search-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.editor-search-find,
.editor-search-replacement {
  flex: 1 1 12rem;
  min-width: 0;
}

.editor-search-find[aria-invalid="true"] {
  border-color: var(--danger);
  outline-color: var(--danger);
}

.editor-search-toggles,
.editor-search-moves,
.editor-search-replaces {
  display: inline-flex;
  flex: none;
  gap: 0.2rem;
}

.editor-search-toggle,
.editor-search-moves button {
  min-width: 2.1rem;
  padding: 0.3rem 0.45rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.editor-search-word {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.editor-search-toggle[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--background);
}

.editor-search-count {
  flex: 1 0 auto;
  min-width: 6rem;
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.editor-search-find[aria-invalid="true"] ~ .editor-search-count {
  color: var(--danger);
}

/* A presentation edited slide by slide (WP5.103): the master, the
   CodeMirror over the whole text, is hidden, and the slides are a list of
   rows. The textarea stays until the master has taken its place (the rule
   on .editor-cm:not(:empty) + .editor-text hides it then): while
   CodeMirror loads, and if it never does, the textarea is what can be
   typed in. A row is one card: one border, the same edges for every row,
   its header the first line and, while it is open, a CodeMirror over the
   slide's Markdown the rest, as tall as its text, under the header's
   bottom border and in no frame of its own. The card shows the focus
   inside it, as the application's fields do. */
.editor-form.slides .editor-source > .editor-cm {
  display: none;
}

/* The master in the moment it holds the focus slide by slide: from
   CodeMirror taking the textarea's place, while the author was typing in
   it, until the cursor's row takes the focus (web/src/editor.js's attach).
   It is drawn out of sight, one pixel clipped away, so that it can have
   the focus and the keys typed meanwhile go into the text. */
.editor-form.slides .editor-source > .editor-cm[data-holds-focus] {
  display: flex;
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.editor-slides {
  --slide-gap: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: var(--slide-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* The providers' bubbles float over the text's right edge (below): the
   cards keep clear of them, where there are any. */
@media (min-width: 961px) {
  .editor-source:has(.editor-provider) .editor-slides {
    padding-right: 5rem;
  }
}

.slide-row {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
}

.slide-row:focus-within {
  outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-color: var(--accent);
}

/* The header: the handle, the button that opens the row, the delete
   button, each control of the same width in every row (a blank where a
   row has none), so that numbers, titles and fit dots stand in columns. */
.slide-row-head {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.15rem 0.25rem;
}

.slide-row.open > .slide-row-head {
  border-bottom: 1px solid var(--border);
}

.slide-row-handle,
.slide-row-handle-space,
.slide-row-delete,
.slide-row-delete-space {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  min-width: 24px;
  height: 1.75rem;
  min-height: 24px;
}

.slide-row-handle {
  border-radius: 4px;
  color: var(--muted);
  cursor: grab;
  user-select: none;
}

.slide-row-delete {
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.slide-row-handle:hover,
.slide-row-delete:hover {
  color: var(--accent);
}

.slide-row-handle:focus-visible,
.slide-row-delete:focus-visible,
.slide-row-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  color: var(--accent);
}

.slide-row-toggle {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.3rem 0.35rem;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.slide-row-toggle:disabled {
  cursor: default;
  color: var(--muted);
}

/* The chevron of a row that opens, as the editor's fold markers draw it:
   pointing right while the row is closed, down while it is open. */
.slide-row-toggle::before {
  content: "\203a";
  flex: none;
  width: 0.8rem;
  color: var(--muted);
  text-align: center;
  transition: transform 0.1s;
}

.slide-row-toggle[aria-expanded="true"]::before {
  transform: rotate(90deg);
}

.slide-row-number {
  flex: none;
  min-width: 1.6rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.slide-row-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slide-row-part,
.slide-row-problems {
  flex: none;
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.slide-row-problems {
  color: var(--danger);
}

/* A closed row's matches of the editor's search, on the colour of their
   marks. */
.slide-row-matches {
  flex: none;
  padding: 0 0.3rem;
  border-radius: 4px;
  font-size: 0.85rem;
  white-space: nowrap;
  background: color-mix(in srgb, var(--warning) 22%, transparent);
}

.slide-row-matches:empty {
  display: none;
}

.slide-row-fit {
  flex: none;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--fit-colour, #8c959f);
}

/* An open row's text: the card is its frame. */
.editor-slides .slide-row-body.editor-cm .cm-editor,
.editor-slides .slide-row-body.editor-cm .cm-editor.cm-focused {
  height: auto;
  min-height: 2.5rem;
  border: 0;
  border-radius: 0 0 6px 6px;
  outline: none;
  resize: none;
}

@media (min-width: 961px) {
  .editor-slides .slide-row-body.editor-cm .cm-editor .cm-content {
    padding-right: 0;
  }
}

/* The "+" for a new slide after a row: in the gap under its card, shown
   while the card is hovered or the "+" has the focus, taking no room. */
.slide-row-add {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: calc(var(--slide-gap) / -2);
  height: 1.25rem;
  min-width: 24px;
  padding: 0 0.6rem;
  transform: translate(-50%, 50%);
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: var(--background);
  color: var(--muted);
  font: inherit;
  line-height: 1;
  opacity: 0;
  cursor: pointer;
}

.slide-row:hover > .slide-row-add,
.slide-row-add:hover,
.slide-row-add:focus-visible {
  opacity: 1;
}

/* Where a dragged row would go: a line in the gap above or below. */
.slide-row.drop-before::after,
.slide-row.drop-after::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 1px;
  background: var(--accent);
}

.slide-row.drop-before::after {
  top: calc(var(--slide-gap) / -2 - 2px);
}

.slide-row.drop-after::after {
  bottom: calc(var(--slide-gap) / -2 - 2px);
}

.editor-slides-mode [aria-pressed="true"],
.editor-one-slide[aria-pressed="true"],
.editor-side-by-side[aria-pressed="true"],
.editor-macros-toggle[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--background);
}

/* The side by side preview needs the width of a wide screen. */
@media (max-width: 960px) {
  .editor-side-by-side {
    display: none;
  }
}

.toolbar-menu-holder {
  position: relative;
}

.toolbar-menu {
  position: absolute;
  z-index: 10;
  top: calc(100% + 0.25rem);
  left: 0;
  display: flex;
  flex-direction: column;
  min-width: 13rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.15);
}

.toolbar-menu button {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-color: transparent;
  background: transparent;
  text-align: left;
}

.toolbar-menu button:hover {
  background: var(--surface);
}

.toolbar-menu code {
  font-size: 0.8rem;
  color: var(--muted);
}

/* The kinds of box, and for an administrator the link to define another,
   set apart below them. */
.box-menu {
  max-height: 60vh;
  overflow-y: auto;
}

.toolbar-menu .box-menu-new {
  display: block;
  margin-top: 0.25rem;
  padding: 0.35rem 0.6rem;
  border-top: 1px solid var(--border);
  text-decoration: none;
}

.toolbar-menu .box-menu-new:hover {
  background: var(--surface);
}

/* The palette: a row of text colours, a row of highlights. */
.colour-menu {
  gap: 0.25rem;
  min-width: 0;
  max-width: calc(100vw - 2rem);
}

.colour-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
}

.colour-row-name {
  width: 4.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.toolbar-menu .swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
}

.swatch-sample {
  display: inline-block;
  min-width: 1.3rem;
  padding: 0 0.2rem;
  border-radius: 3px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

/* The emoji: a field to search, and a grid of the emoji found, eight to a
   row (the arrows move by eight up and down: emojiColumns in
   Wiki.App.View.Editor). */
.emoji-menu {
  gap: 0.35rem;
  min-width: 0;
  max-width: calc(100vw - 2rem);
}

.emoji-menu .emoji-search {
  width: 100%;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(1.8rem, 2.1rem));
  gap: 0.1rem;
  max-height: 14rem;
  overflow-y: auto;
}

.toolbar-menu .emoji-choice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.1rem;
  padding: 0;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 1.25rem;
}

.emoji-none {
  margin: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* On a narrow toolbar (a phone, or a narrow editor) a menu that opens
   under a button far from the left would run past the screen's right
   edge, and the page would scroll sideways. There every menu opens under
   the whole toolbar instead, as wide as it. The toolbar is the container
   the width is read from, and the positioned box the menus are placed in:
   sticky on a phone (above), relative elsewhere. */
.editor-toolbar {
  container: editor-toolbar / inline-size;
}

@media not all and (max-width: 760px) {
  .editor-toolbar {
    position: relative;
  }
}

@container editor-toolbar (max-width: 40rem) {
  .toolbar-menu-holder {
    position: static;
  }

  .toolbar-menu {
    right: 0.25rem;
    left: 0.25rem;
    min-width: 0;
    max-width: none;
  }
}

.swatch-none .icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.4;
  stroke-linecap: round;
}

/* The Markdown alone, by default; the preview beside it on a wide screen
   when asked for; the preview alone instead of everything one edits with
   while it is shown. What is hidden stays in the page: the textarea keeps
   its text, selection, undo and scroll. */
.editor-panes {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  border-radius: 8px;
}

.editor-panes .editor-preview {
  display: none;
}

@media (min-width: 961px) {
  .editor-form.side-by-side .editor-panes {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  /* The preview beside the text scrolls on its own, as tall as the text,
     so that it can follow the line being written (web/src/editor.js). */
  .editor-form.side-by-side .editor-panes .editor-preview {
    display: block;
    height: 65vh;
    overflow-y: auto;
    padding-right: 0.5rem;
  }
}

/* A conflict: their version beside the author's text on a wide screen,
   under it on a narrow one, in the preview's place (the preview is shown
   again with "Show preview", alone). */
@media (min-width: 961px) {
  .editor-form.conflicting .editor-panes {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.editor-form.conflicting .editor-panes .editor-preview {
  display: none;
}

.editor-form.previewing .editor-conflict-pane {
  display: none;
}

.editor-conflict-pane {
  min-width: 0;
  max-height: 75vh;
  overflow: auto;
}

.editor-conflict-pane h2 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.editor-conflict {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
  padding: 0.6rem 1rem;
  border: 1px solid var(--warning);
  border-radius: 6px;
  background: color-mix(in srgb, var(--warning) 8%, transparent);
}

.editor-conflict p,
.editor-conflict ul {
  flex-basis: 100%;
  margin: 0;
}

.editor-conflict ul {
  padding-left: 1.2rem;
  font-size: 0.9rem;
}

/* Who else edits the page, and a save of it meanwhile: quiet lines. */
.editor-others,
.editor-changed {
  margin: 0.5rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.editor-changed {
  color: var(--warning);
}

/* A button's display would otherwise win over the hidden attribute's. */
.editor-back[hidden] {
  display: none;
}

.editor-form.previewing .editor-title,
.editor-form.previewing .editor-attach,
.editor-form.previewing .editor-toolbar,
.editor-form.previewing .editor-source,
.editor-form.previewing .editor-attachments {
  display: none;
}

.editor-form.previewing .editor-panes {
  grid-template-columns: minmax(0, 1fr);
}

.editor-form.previewing .editor-panes .editor-preview {
  display: block;
  max-height: none;
  height: auto;
  overflow-y: visible;
}

.editor-panes.dropping {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
}

.editor-source {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.editor-text {
  flex: 1;
  width: 100%;
  min-height: 65vh;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: var(--editor-font-size, 0.9rem) / 1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text);
  background: var(--background);
  resize: vertical;
  tab-size: 2;
}

.editor-text:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-color: var(--accent);
}

/* CodeMirror (web/src/editor.js), put in the textarea's place once the page
   has loaded it: the same box, font, colours and padding, so that nothing
   moves as it takes over, and the textarea hidden from then on. The rules
   name .editor-cm .cm-editor to outweigh CodeMirror's own theme. */
.editor-cm:empty {
  display: none;
}

.editor-cm:not(:empty) + .editor-text {
  display: none;
}

.editor-cm {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.editor-cm .cm-editor {
  flex: 1 0 auto;
  height: 65vh;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: var(--background);
  resize: vertical;
  overflow: hidden;
}

.editor-cm .cm-editor.cm-focused {
  outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-color: var(--accent);
}

.editor-cm .cm-editor .cm-scroller {
  overflow: auto;
  font: var(--editor-font-size, 0.9rem) / 1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  tab-size: 2;
}

.editor-cm .cm-editor .cm-content {
  padding: 0.75rem 0;
  caret-color: var(--text);
}

.editor-cm .cm-editor .cm-line {
  padding: 0 0.9rem;
}

/* The Markdown as it will look: its markers kept, but dimmed. */
.cm-md-syntax,
.cm-md-label,
.cm-md-url,
.cm-md-html,
.cm-md-comment {
  color: var(--muted);
}

.cm-md-strong {
  font-weight: 700;
}

.cm-md-emphasis {
  font-style: italic;
}

.cm-md-strike {
  text-decoration: line-through;
}

.cm-md-heading {
  font-weight: 700;
}

.cm-md-h1 {
  font-size: 1.6em;
}

.cm-md-h2 {
  font-size: 1.35em;
}

.cm-md-h3 {
  font-size: 1.18em;
}

.cm-md-h4 {
  font-size: 1.05em;
}

.cm-md-link {
  color: var(--accent);
}

.cm-md-link.cm-md-syntax,
.cm-md-link.cm-md-url {
  color: var(--muted);
}

/* Code: inline on a background of its own, a fenced block's every line on
   it, from edge to edge. */
.cm-md-code {
  border-radius: 3px;
  background: var(--code);
}

.cm-md-codeblock {
  background: var(--code);
}

.cm-md-codeblock .cm-md-code {
  background: none;
}

/* A quote, and a list's bullets and task boxes, set off. */
.cm-md-quoteline {
  box-shadow: inset 3px 0 var(--border);
  color: var(--muted);
}

.cm-md-bullet,
.cm-md-task {
  color: var(--accent);
  font-weight: 700;
}

.cm-md-rule {
  color: var(--muted);
  letter-spacing: 0.2em;
}

.editor-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.editor-preview {
  max-height: calc(65vh + 2rem);
  overflow-y: auto;
  padding: 0 1.25rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
}

.editor-attachments {
  margin-top: 1.5rem;
}

.editor-attachments h2 {
  font-size: 1.05rem;
}

.editor-attachments ul {
  padding-left: 1.2rem;
}

.attachment-insert {
  margin-left: 0.6rem;
  padding: 0.05rem 0.5rem;
  font-size: 0.8rem;
}

/* ---- highlight.js, in the colours above ----------------------------------- */

.hljs-keyword,
.hljs-meta .hljs-keyword,
.hljs-literal,
.hljs-built_in {
  color: var(--hl-keyword);
}

.hljs-string,
.hljs-regexp,
.hljs-meta .hljs-string {
  color: var(--hl-string);
}

.hljs-title,
.hljs-title.function_,
.hljs-section {
  color: var(--hl-title);
}

.hljs-type,
.hljs-title.class_,
.hljs-attr,
.hljs-attribute,
.hljs-variable,
.hljs-template-variable {
  color: var(--hl-type);
}

.hljs-number,
.hljs-symbol,
.hljs-selector-id,
.hljs-selector-class {
  color: var(--hl-number);
}

.hljs-comment,
.hljs-quote,
.hljs-meta {
  color: var(--hl-comment);
  font-style: italic;
}

/* ---- Administration ------------------------------------------------------ */

/* A heading per section, each section separated from the next, so that more
   of them (users and groups) can follow the wiki's data. */
.admin-section {
  margin: 1.5rem 0;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.admin-section h2 {
  margin-top: 0.5rem;
}

.admin-intro,
.admin-note,
.demo-kept {
  color: var(--muted);
}

.demo-told {
  margin: 0.5rem 0;
}

/* The wiki's people: switches for what a user may do (in the users'
   dialog), and the groups, each with its members. */
.user-login,
.group-member-login {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  color: var(--muted);
}

/* A switch: a pill with a knob, at the right when on. Its words are for
   whoever cannot see the colour. */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 4.2rem;
  padding: 0.15rem 0.6rem 0.15rem 0.2rem;
  border-radius: 999px;
}

.switch::before {
  content: "";
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: var(--border);
}

.switch[aria-checked="true"] {
  flex-direction: row-reverse;
  padding: 0.15rem 0.2rem 0.15rem 0.6rem;
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.switch[aria-checked="true"]::before {
  background: #ffffff;
}

.switch:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.group-list {
  margin: 0.5rem 0 1rem;
  padding: 0;
  list-style: none;
}

.group {
  margin: 0 0 0.75rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.group-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
}

.group-name {
  margin: 0;
  font-size: 1rem;
}

.group-count {
  flex: 1;
  font-size: 0.85rem;
  color: var(--muted);
}

.group-members {
  margin: 0.5rem 0;
  padding: 0;
  list-style: none;
}

.group-member {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.2rem 0;
}

.group-member .group-remove {
  margin-left: auto;
}

.group-empty {
  margin: 0.5rem 0;
}

.group-add {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.group .inline-form,
.group .confirm {
  margin: 0;
}

.demo-refused {
  color: var(--danger);
}

/* Import is a label around a hidden file input, looking like the buttons
   beside it; the input stays focusable, and the label shows its focus. */
.demo-import {
  position: relative;
}

.demo-import:focus-within {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.demo-import input,
.import-file input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* The import into a server: its sources, the same hidden file input as the
   demo's, and then the dialog "What to migrate". */
.import-file {
  position: relative;
}

.import-file:focus-within {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.import-busy {
  color: var(--muted);
}

.import-summary {
  margin: 0.5rem 0 1rem;
  padding: 0.6rem 1rem;
  border-left: 3px solid var(--tip);
  background: var(--surface);
}

.import-summary p,
.import-summary ul {
  margin: 0.2rem 0;
}

.import-dialog {
  margin: 1rem 0;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.import-dialog h3 {
  margin-top: 0;
}

/* The tree of spaces and pages: each level indented, a row per item with
   its box, its name and a badge saying what the server has of it. */
.import-tree,
.import-pages {
  margin: 0;
  padding-left: 1.4rem;
  list-style: none;
}

.import-dialog > .import-tree {
  padding-left: 0;
}

.import-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.5rem;
  padding: 0.15rem 0;
}

.import-row label {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
}

.import-space > .import-row .import-name {
  font-weight: 600;
}

.import-row .badge {
  margin-left: 0;
}

.import-new > .import-row .badge {
  color: var(--tip);
  border-color: var(--tip);
}

.import-conflict > .import-row .badge {
  color: var(--warning);
  border-color: var(--warning);
}

.import-attachments {
  color: var(--muted);
  font-size: 0.85rem;
}

/* A conflict's choice, under its page: which of the two pages stays. */
.import-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0 0 0.3rem 1.6rem;
  font-size: 0.9rem;
}

.import-theirs {
  flex-basis: 100%;
  color: var(--muted);
}

.import-choice label {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
}

.import-selected {
  color: var(--muted);
}

/* ---- Accounts and permissions -------------------------------------------- */

.admin-told {
  margin: 0.5rem 0;
}

/* The form for a new user, opened above the table by "New user". */
.user-create {
  margin: 0 0 1rem;
  padding: 0.8rem 1rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.user-create .actions {
  margin-bottom: 0.4rem;
}

.user-create-console {
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

.user-create h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

/* One column, as every form of the administration: each label above its
   field, the fields as wide as the form, which stops at a width a line of
   text reads well at (the server's forms below share it). */
.user-create-fields {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 30rem;
  margin-bottom: 0.6rem;
}

.user-create-fields .field {
  flex: none;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding-bottom: 0.4rem;
}

/* ---- The user's settings ------------------------------------------------- */

/* A page per section (Wiki.App.Shell), laid out as the administration's
   below: the sidebar holds the sections, and the content is one section. */
.settings-view {
  max-width: 46rem;
}

.settings-view > h1 {
  margin: 0 0 0.75rem;
}

.settings-sections {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.settings-sections > section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.settings-sections > section > h2 {
  margin: 0;
  font-size: 1.1rem;
}

.settings-sections > .account-security {
  padding-top: 1rem;
}

/* ---- The administration's pages ------------------------------------------ */

/* A page per section (Wiki.App.Shell): the sidebar holds the sections, and
   the content is one section, wider than a page of text, since the users'
   table has four columns. */
.wiki:has(.admin-view) .wiki-content {
  max-width: 64rem;
}

.admin-view > h1 {
  margin: 0 0 0.25rem;
}

.admin-view .admin-intro {
  max-width: 46rem;
}

/* The first part of a section sits under its heading, not under a rule. */
.admin-view > .admin-section,
.admin-view > div > .admin-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.admin-view > .admin-section > h2:first-child {
  margin-top: 0.75rem;
}

.admin-nav,
.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-nav-link,
.settings-nav-link {
  display: block;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  color: var(--text);
}

.admin-nav-link:hover,
.settings-nav-link:hover {
  text-decoration: none;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.admin-nav-link[aria-current="page"],
.settings-nav-link[aria-current="page"] {
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.admin-nav-link:focus-visible,
.settings-nav-link:focus-visible,
.admin-view :is(a, button, input, select):focus-visible,
.settings-view :is(a, button, input, select):focus-visible,
.user-dialog :is(button, input, select):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.admin-nav-link:focus-visible,
.settings-nav-link:focus-visible {
  outline-offset: -2px;
}

.admin-view button:disabled,
.user-dialog button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.admin-view button:disabled:hover,
.user-dialog button:disabled:hover {
  border-color: var(--border);
}

/* On a narrow screen the sections are a row of tabs above the section,
   scrolled sideways when they do not fit. */
@media (max-width: 760px) {
  .admin-sidebar,
  .settings-sidebar {
    padding: 0.4rem 0.5rem 0;
  }

  .admin-sidebar h2,
  .settings-sidebar h2 {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .admin-nav,
  .settings-nav {
    flex-direction: row;
    gap: 0.1rem;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .admin-nav-link,
  .settings-nav-link {
    padding: 0.45rem 0.7rem 0.55rem;
    border-radius: 6px 6px 0 0;
    white-space: nowrap;
  }

  .admin-nav-link[aria-current="page"],
  .settings-nav-link[aria-current="page"] {
    background: transparent;
    box-shadow: inset 0 -2px 0 var(--accent);
  }
}

/* The users (Wiki.App.View.Users): the search, the filter and "New user"
   in one row of controls of one height; the table; the count, the pages
   and the page size under it. */
.users-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
}

.users-toolbar :is(input, select, button) {
  height: 2.2rem;
  padding: 0 0.7rem;
  font-size: 0.9rem;
  line-height: 1.4;
}

.users-search {
  display: flex;
  flex: 1 1 14rem;
  margin: 0;
}

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

.user-create-open {
  margin-left: auto;
}

/* The page shown stays while the next is fetched, dimmed, and the list
   keeps a height while it loads, so that nothing under it jumps. */
.users-list {
  min-height: 14rem;
  transition: opacity 0.15s;
}

.users-fetching {
  opacity: 0.6;
}

@media (prefers-reduced-motion: reduce) {
  .users-list {
    transition: none;
  }
}

.users-loading {
  padding: 0.75rem 0;
}

.users-empty {
  margin: 0;
  padding: 2.5rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  text-align: center;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  /* The columns keep their widths from one page to the next, whatever the
     names and badges on each. */
  table-layout: fixed;
}

.user-table th:nth-child(1) {
  width: 36%;
}

.user-table th:nth-child(2) {
  width: 24%;
}

.user-table th:nth-child(4) {
  width: 7.5rem;
}

.user-who {
  overflow-wrap: anywhere;
}

.user-table th,
.user-table td {
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.user-table th {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface);
}

.user-table tbody tr:last-child td {
  border-bottom: none;
}

.user-table tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}

.user-who .user-display-name,
.user-who .user-login {
  display: block;
}

.user-display-name {
  font-weight: 600;
}

.user-sign-in {
  font-size: 0.9rem;
  color: var(--muted);
}

.user-actions {
  text-align: right;
  white-space: nowrap;
}

.user-manage {
  padding: 0.25rem 0.75rem;
}

.user-disabled .user-display-name {
  color: var(--muted);
}

.user-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.user-badges .badge {
  margin-left: 0;
  white-space: nowrap;
}

.badge-administrator {
  color: var(--accent);
  border-color: var(--accent);
}

.badge-creator {
  color: var(--important);
  border-color: var(--important);
}

.badge-second-factor {
  color: var(--tip);
  border-color: var(--tip);
}

.badge-disabled {
  color: var(--danger);
  border-color: var(--danger);
}

.users-paging {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.users-count {
  margin: 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pager li {
  display: flex;
}

.pager ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pager :is(a, .pager-step),
.pager-gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.45rem;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.pager a:hover {
  text-decoration: none;
  border-color: var(--border);
  background: var(--surface);
}

.pager a[aria-current="page"] {
  font-weight: 600;
  color: #ffffff;
  background: var(--accent);
}

.pager [aria-disabled="true"],
.pager-gap {
  color: var(--muted);
}

.pager [aria-disabled="true"] {
  opacity: 0.5;
}

.users-page-size {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
}

.users-page-size select {
  padding: 0.2rem 0.4rem;
  font-size: 0.9rem;
}

/* On a phone the table keeps who and what: how they sign in is in the
   dialog. */
@media (max-width: 600px) {
  .user-table :is(th, td):nth-child(2) {
    display: none;
  }

  .user-table th,
  .user-table td {
    padding: 0.5rem 0.6rem;
  }

  .user-table th:nth-child(1) {
    width: auto;
  }

  .user-table th:nth-child(3) {
    width: 38%;
  }

  .user-table th:nth-child(4) {
    width: 6.5rem;
  }

  .users-paging {
    flex-direction: column;
  }
}

/* The "Manage" dialog (Wiki.App.View.UserDialog): a modal in the middle of
   the window, over a dimmed page, as wide as its switches and forms need
   and never taller than the window; its header and its "Done" stay in
   view while its parts scroll. */
.user-dialog {
  width: min(34rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: var(--dialog);
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.3);
}

.user-dialog::backdrop {
  background: var(--dialog-backdrop);
}

/* The editor's "New kind…" dialog (Wiki.App.View.NewKindDialog): the
   administration's form for a kind of box, over the page being written,
   drawn as the user dialog is. Its "Link to a page" dialog
   (Wiki.App.View.LinkDialog) is drawn the same way. */
.new-kind-dialog,
.link-dialog {
  width: min(34rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: var(--dialog);
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.3);
}

.new-kind-dialog::backdrop,
.link-dialog::backdrop {
  background: var(--dialog-backdrop);
}

.new-kind-dialog-body,
.link-dialog-body {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0 1.25rem 1.25rem;
}

.new-kind-dialog-header,
.link-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 -1.25rem;
  padding: 1rem 1.25rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

.new-kind-dialog-header h2,
.link-dialog-header h2 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.3;
}

.new-kind-dialog-close,
.link-dialog-close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  background: transparent;
}

.new-kind-dialog-close:hover,
.link-dialog-close:hover {
  color: var(--text);
  background: var(--surface);
}

/* In the "Link to a page" dialog the search box's hits are a list under
   the input, in the dialog's flow, not a menu hanging over the page. */
.link-dialog .search-bar {
  max-width: none;
}

.link-dialog .search-results {
  position: static;
  max-width: none;
  max-height: 40vh;
  margin-top: 0.4rem;
  box-shadow: none;
}

.link-dialog-section-toggle {
  font-size: 0.9rem;
}

.link-dialog-sections {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
}

.link-dialog-page {
  margin: 0;
}

.link-dialog-anchors {
  align-self: stretch;
  max-height: 40vh;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.link-dialog-anchor {
  width: 100%;
  padding: 0.3rem 0.6rem;
  border: none;
  border-radius: 6px;
  text-align: left;
  color: var(--accent);
  background: transparent;
}

.link-dialog-anchor:hover,
.link-dialog-anchor:focus-visible {
  background: var(--surface);
}

/* A heading's section is indented by its level, as the contents list
   it; a box is listed at the level of the heading before it. */
.link-dialog-anchor-level-3 {
  padding-left: 1rem;
}

.link-dialog-anchor-level-4,
.link-dialog-anchor-level-5,
.link-dialog-anchor-level-6 {
  padding-left: 2rem;
}

.link-dialog-anchor-box .link-dialog-anchor {
  color: var(--text);
}

/* A dialog stands above the page: as white as the page in the light
   scheme, and a step lighter than it in the dark one. */
:root {
  --dialog: var(--background);
  --dialog-backdrop: rgb(13 17 23 / 0.5);
}

@media (prefers-color-scheme: dark) {
  :root {
    --dialog: var(--surface);
    --dialog-backdrop: rgb(1 4 9 / 0.7);
  }
}

.user-dialog-body {
  display: flex;
  flex-direction: column;
}

.user-dialog-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem 0.8rem;
  border-bottom: 1px solid var(--border);
  background: var(--dialog);
}

.user-dialog-header h2 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.3;
}

.user-dialog-login {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.25rem 0 0;
}

.user-dialog-close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  background: transparent;
}

.user-dialog-close:hover {
  color: var(--text);
  background: var(--surface);
}

.user-dialog-status {
  padding: 0 1.25rem;
}

.user-dialog-status > * {
  margin: 0.75rem 0 0;
}

.user-dialog-saved {
  font-size: 0.9rem;
  color: var(--tip);
}

.user-dialog-saved::before {
  content: "✓ ";
}

.user-dialog-part {
  padding: 0.9rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.user-dialog-part h3 {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.user-dialog-part > :last-child,
.user-dialog-part .actions {
  margin-bottom: 0;
}

.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
}

.setting + .setting {
  border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}

.setting-text {
  display: flex;
  flex-direction: column;
}

.setting-name {
  font-weight: 600;
}

.setting-help {
  font-size: 0.85rem;
  color: var(--muted);
}

.setting .switch {
  flex-shrink: 0;
}

.user-dialog-facts {
  font-size: 0.95rem;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.3rem 1rem;
  margin: 0 0 0.75rem;
}

.user-dialog-facts dt {
  color: var(--muted);
}

.user-dialog-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.user-dialog .password-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
}

.user-dialog .password-hint {
  font-size: 0.85rem;
}

.user-dialog :is(.confirm, .inline-form) {
  margin: 0.5rem 0 0;
}

.user-dialog :is(.confirm, .inline-form) .actions {
  margin: 0;
}

.user-dialog-identities,
.user-dialog-group-list {
  margin: 0.5rem 0 0.6rem;
  padding: 0;
  list-style: none;
}

.user-dialog-identity,
.user-dialog-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.3rem 0;
}

.user-dialog-group + .user-dialog-group,
.user-dialog-identity + .user-dialog-identity {
  border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}

.user-dialog-groups .empty {
  margin: 0 0 0.6rem;
}

.user-dialog-group-add {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.user-dialog-group-add select {
  flex: 1 1 10rem;
  min-width: 0;
}

/* What ends a user's sessions or takes a way in away: apart, last, and in
   the danger colour. */
.user-dialog-account {
  background: color-mix(in srgb, var(--danger) 4%, transparent);
}

.user-dialog-account h3 {
  color: var(--danger);
}

.user-dialog-dangers {
  margin: 0;
}

/* Removing an account is the one change here that cannot be undone. Its
   question has a border in the danger colour, and the field for the login
   to type takes the whole width. */
.user-dialog .remove-confirm {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
}

.user-dialog .remove-confirm .field {
  flex-basis: 100%;
}

.user-dialog .remove-confirm .user-login {
  color: var(--text);
  font-weight: 600;
}

/* The field takes the focus when the question appears. The margin makes
   the browser scroll the button under it into view too, above the
   dialog's sticky footer. */
.user-dialog .remove-confirm-login {
  scroll-margin-bottom: 7rem;
}

.user-remove-hint {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
}

button.danger-outline {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
  background: var(--dialog);
}

button.danger-outline:hover {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--dialog));
}

.user-dialog-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  padding: 0.75rem 1.25rem;
  background: var(--dialog);
}

/* A space's permissions, opened from its actions. */
.space-permissions {
  margin: 1rem 0;
  padding: 0.6rem 1rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
}

.space-permissions h2 {
  margin: 0 0 0.5rem;
}

.permissions-public,
.permissions-sealed {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.permissions-intro {
  flex: 1;
  margin: 0.3rem 0;
  color: var(--muted);
}

.grant-table {
  border-collapse: collapse;
  margin: 0.5rem 0 1rem;
}

.grant-table th,
.grant-table td {
  padding: 0.35rem 1rem 0.35rem 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.grant-table th {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.grant-inherited {
  color: var(--muted);
}

/* A grant above a space that is private from its parent: listed, but it
   does not count there (WP5.54). */
.grant-cut td {
  opacity: 0.6;
}

.grant-cut .grant-who,
.grant-cut .grant-what {
  text-decoration: line-through;
}

.grant-self {
  font-size: 0.85rem;
}

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

/* ---- Whom the wiki lets in ------------------------------------------------ */

/* "Create account" beside "Sign in" in an open wiki (Wiki.App.View.SignIn),
   its form hanging under the header as the sign-in form does. */
.account .register-toggle {
  white-space: nowrap;
}

.register-form {
  position: absolute;
  right: 0;
  top: calc(100% + 0.3rem);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: min(20rem, calc(100vw - 2rem));
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--background);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.15);
}

.register-form .field {
  flex: none;
}

.register-form .actions {
  display: flex;
  gap: 0.5rem;
}

.register-error {
  margin: 0;
}

/* A closed wiki to someone who has not signed in: the header and a word on
   why there is nothing else, in the middle of the page. */
.wiki-closed .wiki-content {
  display: flex;
  justify-content: center;
}

.closed {
  max-width: 32rem;
  margin: 3rem auto;
  text-align: center;
}

/* An invitation's page (Wiki.App.View.Invite). */
.invitation {
  max-width: 30rem;
}

.invitation-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.invitation-told {
  display: contents;
}

.invitation-error {
  margin: 0;
}

.invitation-unusable {
  color: var(--muted);
}

/* The administration's section on it (Wiki.App.View.Access). */
.access-choice {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0 0 0.8rem;
  padding: 0;
  border: none;
}

.access-choice legend {
  margin-bottom: 0.3rem;
  font-weight: 600;
}

.admin-invitations {
  margin-top: 1.2rem;
}

.admin-invitations h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.invite-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 30rem;
  margin-bottom: 0.8rem;
}

.invite-form .field {
  flex: none;
}

.invitation-made {
  margin-bottom: 0.8rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.invitation-made p {
  margin: 0 0 0.4rem;
}

.invitation-link-row {
  display: flex;
  gap: 0.5rem;
}

.invitation-link {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
}

table.invitations {
  width: 100%;
  border-collapse: collapse;
}

table.invitations th,
table.invitations td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.invitation-row.expired td:nth-child(2) {
  color: var(--muted);
}

/* The administration's section on the server itself (Wiki.App.View.Server):
   the public address, the mail server and the providers, each a part with
   its own heading; one form at a time replaces what it edits. Each form is
   one column, as the administration's others are: a label above its field,
   a hint under it, every field the form's width up to 30rem, and the
   buttons in a row under the last. */
.server-part {
  margin-top: 1.2rem;
}

.server-part h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.server-url-value {
  margin: 0 0 0.3rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.server-mail-summary,
.server-provider-row dl,
.server-provider-checked dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.2rem 0.8rem;
  margin: 0.4rem 0;
}

.server-mail-summary dt,
.server-provider-row dt,
.server-provider-checked dt {
  color: var(--muted);
}

.server-mail-summary dd,
.server-provider-row dd,
.server-provider-checked dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.server-mail-form,
.server-url-form,
.server-provider-form,
.server-service-form,
.server-mail-test {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 30rem;
  margin: 0.4rem 0 0.8rem;
}

.server-mail-form .field,
.server-url-form .field,
.server-provider-form .field,
.server-service-form .field,
.server-mail-test .field {
  flex: none;
}

/* The backups (Wiki.App.View.Backups): what they are set to do and what
   the last one came to, laid out as the mail server's summary; a fieldset
   that the demo, which makes none, disables as a whole. */
.backups-body {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.backups-body:disabled {
  opacity: 0.6;
}

.backups-state {
  margin: 0 0 0.3rem;
}

.backups-summary {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.2rem 0.8rem;
  margin: 0.4rem 0;
}

.backups-summary dt {
  color: var(--muted);
}

.backups-summary dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.backups-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 30rem;
  margin: 0.4rem 0 0.8rem;
}

.backups-form .field {
  flex: none;
}

.backups-form .field-check {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  color: inherit;
}

.backups-form textarea {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* A secret that is set: its state and the ways to change it, never it, in
   a row under its label. (A secret being typed is a field like the others,
   its input as wide as the form.) */
div.server-secret {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

div.server-secret > span:first-child {
  flex-basis: 100%;
}

.server-secret-state {
  color: var(--muted);
}

.server-provider-list,
.server-service-list {
  margin: 0.4rem 0;
  padding: 0;
  list-style: none;
}

.server-provider,
.server-service {
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.server-provider-kind {
  margin-left: 0.5rem;
  color: var(--muted);
}

/* The assistant's services (WP5.60): a name, a base URL and the API. */
.server-service-url {
  margin-left: 0.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.server-service-api {
  margin-left: 0.5rem;
  color: var(--muted);
}

.server-service-api-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.server-provider-redirect {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.server-provider-redirect-to p {
  margin: 0 0 0.3rem;
}

.server-provider-checked,
.server-mail-tested {
  flex-basis: 100%;
  margin: 0.4rem 0 0;
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  background: var(--surface);
}

.server-provider-checked p {
  margin: 0;
}

.server-provider-checked.error,
.server-mail-tested.error {
  color: var(--danger);
}

/* ---- Signing in with a provider ------------------------------------------ */

/* The providers the server signs in with (Wiki.App.View.SignIn and
   Wiki.App.View.Invite): links to the server's round trip, under the
   form's own buttons, one a line, looking like buttons. */
.sign-in-providers {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}

.sign-in-providers:empty {
  display: none;
}

.sign-in-providers p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.provider-link,
.identity-connect {
  display: block;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: inherit;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.provider-link:hover,
.identity-connect:hover {
  background: var(--surface);
}

/* The signed-in user's name, which opens their menu. */
.account .account-toggle::after {
  content: " ▾";
}

.account-methods,
.identity-connects {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.account-password {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

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

.identity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
}

.identity-email {
  flex: 1;
  overflow: hidden;
  font-size: 0.85rem;
  color: var(--muted);
  text-overflow: ellipsis;
}

.identity-disconnect {
  margin-left: auto;
}

.account-error {
  margin: 0;
}

/* The administration's account column: disconnecting a provider's account. */
.user-account .identity-unlink {
  margin-left: 0.3rem;
}

/* ---- One's own password ---------------------------------------------------- */

/* The form under "Change password…" in the settings' section "Security"
   (Wiki.App.View.SignInMethods), as the sign-in form's fields are. */
.password-change {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.password-change .field {
  flex: none;
}

.password-change .actions {
  display: flex;
  gap: 0.5rem;
}

.password-change-toggle {
  align-self: flex-start;
}

.account-told {
  margin: 0;
  font-size: 0.9rem;
}

/* ---- An account's safety (WP4.11) ----------------------------------------- */

/* The settings' sessions, second factor, passkeys, keys and address
   (Wiki.App.View.Security). */
.account-security {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}

.account-security section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.account-security h3 {
  margin: 0;
  font-size: 0.95rem;
}

.account-security p {
  margin: 0;
  font-size: 0.9rem;
}

.account-note {
  color: var(--muted);
  font-size: 0.85rem;
}

/* The account's keys (Wiki.App.View.Security): the fingerprint of the
   user's public key, in groups of four digits that wrap as whole groups,
   and the ways the vault unlocks. */
.keys-fingerprint code {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.85rem;
  word-spacing: 0.3em;
  overflow-wrap: normal;
}

.keys-vault,
.keys-identity {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.4rem;
}

.keys-unlocks {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.9rem;
}

.keys-actions {
  flex-wrap: wrap;
}

/* The offer, after a sign-in with a password, to unlock the keys with the
   password too (Wiki.App.View.SignIn), under the account's buttons. */
.keys-offer {
  position: absolute;
  right: 0;
  top: calc(100% + 0.3rem);
  z-index: 21;
  width: min(22rem, calc(100vw - 2rem));
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--background);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.15);
  font-size: 0.9rem;
}

.session-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0 0 0.4rem;
  padding: 0;
  list-style: none;
}

.session-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.1rem 0.5rem;
  align-items: center;
}

.session-address {
  font-weight: 600;
  font-size: 0.9rem;
}

.session-times {
  grid-column: 1;
  color: var(--muted);
  font-size: 0.8rem;
}

.session-this,
.session-end {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.session-this {
  color: var(--muted);
  font-size: 0.85rem;
}

.sessions-end-others,
.second-factor-start,
.second-factor-remove-ask {
  align-self: flex-start;
}

.code-form,
.email-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.code-form .actions,
.email-form .actions,
.account-email .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* The QR code of a second factor's secret: dark modules on white, whatever
   the page's colours, at a size a phone's camera reads off a screen. */
.totp-qr {
  display: block;
  width: 12rem;
  height: 12rem;
  background: #ffffff;
}

.totp-secret code,
.recovery-code-list code {
  font-size: 0.9rem;
  word-break: break-all;
}

.recovery-code-list {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 0.2rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.recovery-kept {
  align-self: flex-start;
}

/* The user's API keys (Wiki.App.View.ApiKeys): the list, a key that no
   longer works dimmed after those that work, the form, and the key just
   made, shown once. */
.api-keys {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.api-key-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.api-key {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.1rem 0.5rem;
  align-items: center;
}

.api-key-expired,
.api-key-revoked {
  opacity: 0.55;
}

.api-key-name {
  font-weight: 600;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.api-key-right,
.api-key-times,
.api-key-state {
  grid-column: 1;
  color: var(--muted);
  font-size: 0.8rem;
}

.api-key-revoke,
.api-key-confirm {
  grid-column: 2;
  grid-row: 1 / span 4;
}

.api-key-confirm {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  max-width: 18rem;
  font-size: 0.85rem;
}

.api-key-make {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 30rem;
}

.api-key-make h4 {
  margin: 0;
}

.api-key-rights {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.api-key-right-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 0.4rem;
}

.api-key-right-choice .account-note {
  grid-column: 2;
}

.api-key-make button[type="submit"] {
  align-self: flex-start;
}

.api-key-made {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.api-key-made p {
  margin: 0;
}

.api-key-made-row {
  display: flex;
  gap: 0.5rem;
}

.api-key-text {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
}

.api-key-example {
  margin: 0;
  overflow-x: auto;
  font-size: 0.8rem;
}

.api-key-made-close {
  align-self: flex-start;
}

/* The settings' section "Plugins" (Wiki.App.View.Plugins): a row a plugin,
   its name and switch on one line, what it does and its default under them;
   a plugin off reads dimmed. And the administration's switch of plugins
   (Wiki.App.View.WikiPlugins), a box a plugin. */
.plugins {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.plugin-list,
.admin-plugin-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plugin {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.plugin p {
  margin: 0;
}

/* A plugin's switch and why its last change was refused
   (Wiki.App.View.Plugins' switchView): the two lie in the row's column
   as the row's other lines do. */
.plugin-choice {
  display: contents;
}

.plugin-unlisted {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.plugin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.plugin-name,
.admin-plugin-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.plugin-off .plugin-name,
.plugin-off .plugin-description {
  opacity: 0.6;
}

.plugin-switch,
.admin-plugin-choice {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
}

.plugin-to-default,
.plugin-options {
  align-self: flex-start;
  font-size: 0.85rem;
}

.admin-plugin p {
  margin: 0.1rem 0 0;
}

.admin-plugin-note {
  color: var(--muted);
  font-size: 0.8rem;
}

/* External plugins (Wiki.App.View.Plugins, Wiki.App.View.WikiPlugins,
   Wiki.App.View.PluginUpload): a row a plugin, as a built-in one's, with
   whose it is, its permissions and its hosts under its name, and the
   warning before an upload in a box of its own. Every text a manifest
   gives may break anywhere, so that a host of 253 characters or a
   description of one long word stays inside its row. */
.plugins-external,
.admin-external {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
}

.plugins-external h3,
.admin-external h3 {
  margin: 0.4rem 0 0;
  font-size: 1rem;
}

/* The calendar's options, after the list of plugins: the subscriptions,
   each with "Unsubscribe", and "Add calendar" with, while the personal
   space is off, the line that says why it does nothing. */
.calendar-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.calendar-options h3 {
  margin: 0.4rem 0 0;
  font-size: 1rem;
}

.calendar-options-none,
.calendar-options-reading,
.calendar-add-line,
.calendar-add-why {
  margin: 0;
}

.calendar-subscriptions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.calendar-subscribed {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
}

.calendar-subscribed .start-brief-gone,
.calendar-subscribed .start-brief-locked {
  margin: 0;
}

.calendar-add[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
}

.calendar-add-why {
  margin-top: 0.3rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.admin-external-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-external-plugin {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 0;
}

.admin-external-plugin p {
  margin: 0.1rem 0 0;
}

.plugin-head .plugin-name {
  min-width: 0;
}

.plugin-name,
.admin-plugin-name,
.plugin-about,
.plugin-description,
.plugin-permissions,
.plugin-hosts,
.plugin-warning-title,
.plugin-warning-text,
.plugin-pick-error,
.plugin-refused {
  overflow-wrap: anywhere;
}

.plugin-permissions {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.85rem;
}

.plugin-about,
.plugin-hosts,
.plugin-hidden,
.plugin-changing,
.plugin-reading {
  font-size: 0.85rem;
}

.plugin-own-actions,
.plugin-warning-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.plugin-add {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
}

/* Add, Install and Replace are labels around a hidden file input, looking
   like the buttons beside them, as the import's: the input stays in the
   focus order and opens the browser's picker on Enter and Space, and the
   label shows its focus. */
.plugin-add-files,
.plugin-replace {
  position: relative;
}

.plugin-add-files:focus-within,
.plugin-replace:focus-within {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.plugin-add-files input[type="file"],
.plugin-replace input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.plugin-warning,
.plugin-pick-refused {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 0;
}

.plugin-warning p,
.plugin-pick-refused p {
  margin: 0;
}

/* The pages of a password reset's link and of an address's verification,
   as an invitation's. */
.password-reset,
.email-verification {
  max-width: 30rem;
}

.reset-form,
.reset-done,
.verify-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.reset-told {
  display: contents;
}

.reset-error,
.verify-error {
  margin: 0;
}

.reset-unusable,
.verify-unusable {
  color: var(--muted);
}

/* The administration's account column: an address, a second factor. */
.user-account .account-email,
.user-account .account-second-factor {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

/* The help under a checkbox's label, on its own line. */
.check-help {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

.new-accounts-create-spaces {
  align-items: flex-start;
}

.new-accounts-create-spaces input {
  margin-top: 0.25rem;
}

/* Comments (WP4.5): quotes marked in the page, the panel of inline threads
   beside it, the threads about the whole page under it. */

:root {
  --comment-mark: #fff1c2;
  --comment-mark-line: #d4a72c;
  --comment-mark-focused: #ffd970;
}

@media (prefers-color-scheme: dark) {
  :root {
    --comment-mark: #3a2f0b;
    --comment-mark-line: #9e7a16;
    --comment-mark-focused: #6b5512;
  }
}

/* The panel makes the page wider, as the history's comparison does. */
.wiki-content:has(.page-main.with-comments) {
  max-width: 78rem;
}

.page-main.with-comments {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem);
  gap: 1.5rem;
  align-items: start;
}

.page-main {
  position: relative;
}

mark.comment-mark {
  color: inherit;
  background: var(--comment-mark);
  border-bottom: 2px solid var(--comment-mark-line);
  cursor: pointer;
}

mark.comment-mark-focused {
  background: var(--comment-mark-focused);
}

/* The buttons over a selection in a page: "Comment" for someone who may,
   and "Copy link" for anyone (WP5.53). */
.selection-actions {
  position: absolute;
  z-index: 5;
  display: flex;
  gap: 0.3rem;
}

.comment-on-selection,
.copy-selection-link {
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  color: var(--accent);
  box-shadow: 0 2px 6px rgb(0 0 0 / 15%);
  cursor: pointer;
}

/* Under the header and the page's bar of actions, which stick too. */
.comments-panel {
  position: sticky;
  top: calc(var(--header-height) + var(--page-actions-height) + 0.75rem);
  max-height: calc(100vh - var(--header-height) - var(--page-actions-height) - 1.5rem);
  overflow-y: auto;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.comments-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.comments-panel-head h2,
.page-comments h2 {
  margin: 0 0 0.6rem;
  font-size: 1.1rem;
}

.comments-close {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.page-comments {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.comment-threads {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.comment-thread {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--background);
}

.comment-thread.focused {
  border-color: var(--comment-mark-line);
  box-shadow: 0 0 0 2px var(--comment-mark);
}

.comment-thread.resolved {
  opacity: 0.75;
}

.comment-quote {
  margin: 0 0 0.4rem;
  padding: 0.1rem 0.5rem;
  border-left: 3px solid var(--comment-mark-line);
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
}

.comment-thread.orphaned .comment-quote {
  border-left-style: dashed;
  text-decoration: line-through;
  cursor: default;
}

.comment-orphaned,
.comment-resolved-note,
.comments-empty,
.sign-in-to-comment {
  margin: 0.2rem 0;
  color: var(--muted);
  font-size: 0.85rem;
}

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

.comment + .comment {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}

.comment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: baseline;
  color: var(--muted);
  font-size: 0.8rem;
}

.comment-author {
  color: var(--text);
  font-weight: 600;
}

.comment-meta > .avatar {
  align-self: center;
}

.comment-body > :first-child {
  margin-top: 0.2rem;
}

.comment-body > :last-child {
  margin-bottom: 0;
}

.comment-actions,
.thread-actions,
.comment-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.3rem;
}

.comment-actions button.link,
.thread-actions button.link {
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 0.8rem;
  cursor: pointer;
}

.comment-form {
  margin-top: 0.5rem;
}

.comment-form textarea {
  width: 100%;
  min-height: 3.5rem;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.comment-confirm {
  margin: 0.4rem 0 0;
}

@media (max-width: 760px) {
  .page-main.with-comments {
    grid-template-columns: minmax(0, 1fr);
  }

  .comments-panel {
    position: static;
    max-height: none;
  }
}

@media print {
  .comments-panel,
  .page-comments,
  .selection-actions,
  .link-copied,
  .comments-toggle {
    display: none;
  }

  mark.comment-mark {
    background: none;
    border: none;
  }
}

/* ---- Bars that stay under the header ----------------------------------------
   A page's actions (Edit, History, Comments, …) stay at the top of the window
   under the header while a long page scrolls, so that it can be edited
   without scrolling back up: on the page's background, below the header and
   the popovers (the menus, the "Comment" button) and above the article,
   with a hairline under it once it is stuck there. The editor's toolbar
   does the same. */
.page-actions {
  position: sticky;
  top: var(--header-height);
  z-index: 4;
  margin-left: -0.5rem;
  margin-right: -0.5rem;
  padding: 0.4rem 0.5rem;
  background: var(--background);
}

/* What the live channel says of the page, at the end of its actions: who
   is editing it, and that it changed while the reader was busy with it. */
.page-live {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.page-actions[data-stuck],
.editor-top[data-stuck],
.editor-toolbar[data-stuck] {
  box-shadow:
    0 1px 0 var(--border),
    0 6px 8px -8px rgb(0 0 0 / 0.35);
}

@media print {
  .page-actions,
  .editor-top,
  .editor-toolbar {
    position: static;
    box-shadow: none;
  }
}

/* ---- Export ------------------------------------------------------------
   A page's and a space's "Export" (Wiki.App.View.Export): a <details> whose
   summary is a button and whose list of formats drops down under it, over
   what follows, so that opening it does not push the page down. */
.export-menu {
  position: relative;
}

.export-menu > summary {
  list-style: none;
}

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

.export-menu > summary::after {
  content: " ▾";
}

.export-formats {
  position: absolute;
  z-index: 5;
  top: calc(100% + 0.25rem);
  left: 0;
  min-width: 13rem;
  margin: 0;
  padding: 0.3rem 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  box-shadow: 0 6px 16px rgb(0 0 0 / 0.15);
}

/* Each format is a button that fetches the document (WP5.56), drawn as an
   entry of the list rather than as a button. */
.export-formats button {
  display: block;
  width: 100%;
  padding: 0.3rem 0.8rem;
  border: none;
  border-radius: 0;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: none;
  cursor: pointer;
}

.export-formats button:hover:not(:disabled) {
  background: var(--surface);
}

.export-formats button:disabled {
  color: var(--muted);
  cursor: progress;
}

.export-formats button[aria-busy="true"] {
  font-style: italic;
}

/* What became of the last export, in the corner of the window, as a copied
   link's notice is: the server's reason when the export was refused. */
.export-notice {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  max-width: min(32rem, calc(100vw - 2rem));
  padding: 0.45rem 0.6rem 0.45rem 0.9rem;
  border-radius: 6px;
  color: var(--background);
  background: var(--tip);
  box-shadow: 0 2px 8px rgb(0 0 0 / 20%);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.export-notice.export-refused {
  background: var(--danger);
}

.export-notice:empty {
  padding: 0;
  box-shadow: none;
}

.export-notice-dismiss {
  flex: none;
  padding: 0 0.3rem;
  border: none;
  font: inherit;
  font-size: 1.1rem;
  line-height: 1.2;
  color: inherit;
  background: none;
  cursor: pointer;
}

/* The engine's own words, in the administration's Server section. */
.server-export-output {
  max-height: 20rem;
  overflow: auto;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  white-space: pre-wrap;
  background: var(--code);
  border-radius: 6px;
}

.server-export-check {
  align-items: center;
}

.server-export-checked {
  font-size: 0.875rem;
  color: var(--muted);
}

@media print {
  .export-menu,
  .export-notice {
    display: none;
  }
}

/* Notifications (WP4.13): the header's bell with its list, the "Watch"
   toggle of a page and a space, and a mention in a page. */
.notifications {
  position: relative;
}

.notifications-toggle {
  position: relative;
  padding: 0.25rem 0.5rem;
  border: 1px solid transparent;
  background: transparent;
  line-height: 1;
}

.notifications-toggle:hover,
.notifications-toggle[aria-expanded="true"] {
  border-color: var(--border);
  background: var(--background);
}

.notifications-count {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  min-width: 1.15rem;
  padding: 0.1rem 0.3rem;
  border-radius: 999px;
  background: var(--danger);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

.notifications-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.3rem);
  z-index: 20;
  width: min(24rem, calc(100vw - 2rem));
  max-height: calc(100vh - var(--header-height, 4rem) - 1rem);
  overflow-y: auto;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--background);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.15);
}

.notifications-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

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

.notifications-empty {
  margin: 0.3rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.notification {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 0.4rem;
  border-radius: 6px;
}

.notification + .notification {
  border-top: 1px solid var(--border);
}

.notification.unread {
  background: var(--h-blue);
}

.notification-link {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  color: var(--text);
}

.notification-link:hover {
  text-decoration: none;
}

.notification-what {
  font-weight: 600;
}

.notification-page {
  color: var(--accent);
}

.notification-excerpt {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-time {
  color: var(--muted);
  font-size: 0.8rem;
}

.notification-read {
  flex: none;
  padding: 0.15rem 0.4rem;
  font-size: 0.8rem;
}

.watch-toggle.watching {
  border-color: var(--accent);
  color: var(--accent);
}

/* Stars (WP5.44): a page's "Star" toggle, and the header's "Starred" list,
   which opens under its button as the bell's list does. */
.star {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.star-toggle.starred {
  border-color: var(--warning);
  color: var(--warning);
}

.star-problem {
  color: var(--danger);
  font-size: 0.85rem;
}

.starred-menu {
  position: relative;
}

.starred-toggle {
  padding: 0.25rem 0.5rem;
  border: 1px solid transparent;
  background: transparent;
  line-height: 1;
  white-space: nowrap;
}

.starred-toggle:hover,
.starred-toggle[aria-expanded="true"] {
  border-color: var(--border);
  background: var(--background);
}

.starred-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.3rem);
  z-index: 20;
  width: min(22rem, calc(100vw - 2rem));
  max-height: calc(100vh - var(--header-height, 4rem) - 1rem);
  overflow-y: auto;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--background);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.15);
}

.starred-panel h2 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}

.starred-empty {
  margin: 0.3rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.starred-item + .starred-item {
  border-top: 1px solid var(--border);
}

/* The user's personal space, always first, apart from the stars. */
.starred-own {
  border-bottom: 1px solid var(--border);
}

.starred-link {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.4rem;
  border-radius: 6px;
  color: var(--text);
}

.starred-link:hover {
  background: var(--surface);
  text-decoration: none;
}

.starred-title {
  color: var(--accent);
}

.starred-space {
  color: var(--muted);
  font-size: 0.85rem;
}

/* Help (WP5.44): a round red "?" in the bottom right corner of every page,
   with the editor's notices of saves above it on a phone, and its dialog in the middle
   of the window, as the administration's "Manage" dialog is. */
.help-toggle {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 15;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  color: #ffffff;
  background: var(--danger);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 8px rgb(0 0 0 / 25%);
}

.help-toggle:hover,
.help-toggle:focus-visible {
  filter: brightness(1.1);
}

.help-dialog {
  width: min(48rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: var(--dialog);
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.3);
}

.help-dialog::backdrop {
  background: var(--dialog-backdrop);
}

.help-dialog-body {
  display: flex;
  flex-direction: column;
}

.help-dialog-header,
.help-dialog-footer {
  position: sticky;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.25rem;
  background: var(--dialog);
}

.help-dialog-header {
  top: 0;
  border-bottom: 1px solid var(--border);
}

.help-dialog-footer {
  bottom: 0;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

.help-dialog-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.help-dialog-close {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  background: transparent;
}

.help-dialog-close:hover {
  color: var(--text);
  background: var(--surface);
}

.help-dialog-sections {
  padding: 0 1.25rem 1rem;
}

.help-dialog-intro {
  color: var(--muted);
}

.help-section + .help-section {
  border-top: 1px solid var(--border);
}

.help-section h3 {
  margin: 1rem 0 0.4rem;
}

.help-source {
  margin: 0.4rem 0 0.8rem;
}

.help-source summary {
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
}

.help-source pre {
  overflow-x: auto;
  padding: 0.6rem;
  border-radius: 6px;
  background: var(--surface);
  font-size: 0.85rem;
}

@media print {
  .starred-menu,
  .star,
  .help {
    display: none;
  }
}

.account-notifications h3 {
  margin: 0.4rem 0;
  font-size: 0.95rem;
}

.notification-settings fieldset {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0 0 0.5rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.notification-settings .choice {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* The user's feed of notifications (WP5.31), under the choices: its secret
   address in a field as wide as the panel, written as the invitation links
   are, with "Copy" beside it. */
.notification-feed {
  margin-top: 0.8rem;
}

.notification-feed h4 {
  margin: 0 0 0.3rem;
  font-size: 0.9rem;
}

.notification-feed p {
  margin: 0 0 0.4rem;
}

.notification-feed-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.notification-feed-address {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
}

a.mention {
  padding: 0 0.15rem;
  border-radius: 4px;
  background: var(--h-blue);
}

@media print {
  .notifications,
  .watch-toggle {
    display: none;
  }
}

/* Reading offline and installing (WP4.17): the line over a page the service
   worker served from what it kept, the header's "Install", and the offline
   page the worker shows for a page it has no copy of (web/offline.html). */
.offline-copy {
  margin: 0 0 1rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--warning);
  border-radius: 6px;
  background: var(--surface);
}

.install-app {
  white-space: nowrap;
}

.offline-page .offline-pages {
  padding-left: 1.25rem;
}

.offline-page .offline-none {
  color: var(--muted);
  list-style: none;
  margin-left: -1.25rem;
}

@media print {
  .offline-copy,
  .install-app {
    display: none;
  }
}

/* ---- Headings, the table of contents and templates -------------------------
   (WP4.15.) Each heading of a page ends with an empty link to itself, which
   shows as a "#" while the heading is pointed at or the link focused, and a
   heading scrolled to stops below the header and the page's bar of actions
   rather than under them. */
.page-body :is(h1, h2, h3, h4, h5, h6) {
  scroll-margin-top: calc(var(--header-height) + var(--page-actions-height) + 0.75rem);
}

.heading-anchor {
  margin-left: 0.35em;
  color: var(--muted);
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
}

.heading-anchor::before {
  content: "#";
}

.page-body :is(h1, h2, h3, h4, h5, h6):hover > .heading-anchor,
.page-body .alert-title:hover > .heading-anchor,
.heading-anchor:focus-visible {
  opacity: 1;
}

.heading-anchor:hover {
  color: var(--accent);
}

/* A slide is no place to link into, nor is a preview of a comment. */
.slide .heading-anchor,
.comment-body .heading-anchor {
  display: none;
}

/* A list of a page's headings, nested by level: in the page where [[!toc]]
   is, and in the "Contents" panel. The section being read is marked by
   wiki-app/jsbits/toc.js, as data-current. */
.toc-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.toc-list .toc-list {
  margin: 0.1rem 0 0.2rem 0.35rem;
  padding-left: 0.6rem;
  border-left: 1px solid var(--border);
}

.toc-list li {
  padding: 0.1rem 0;
}

.toc-list a {
  display: block;
  padding: 0.05rem 0.4rem;
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  color: var(--muted);
  text-decoration: none;
}

.toc-list a:hover {
  color: var(--accent);
}

.toc-list a[data-current] {
  border-left-color: var(--accent);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}

.toc {
  margin: 1rem 0;
  padding: 0.6rem 0.9rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.toc .toc-title {
  margin: 0 0 0.3rem;
  font-weight: 600;
}

/* The panel: folded and unfolded by its title (a details element, so it
   works without the program too; this browser remembers the choice). */
.page-contents {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--background);
  font-size: 0.925rem;
}

.page-contents-title {
  font-weight: 600;
  cursor: pointer;
}

.page-contents[open] > .page-contents-title {
  margin-bottom: 0.4rem;
}

.page-contents .toc-list a[data-current] {
  background: var(--surface);
}

/* Where the panel goes. On a narrow screen, above the text, with the
   comments' panel below it; on a middling one the comments sit beside the
   text as before and the contents stay above it; on a wide one both go in
   one column beside the text, which stays under the page's bar of actions
   as the page scrolls: the contents first, the comments under them. */
.page-main.with-side {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem 1.5rem;
  align-items: start;
}

.page-side {
  display: contents;
}

.page-main.with-side > .page-text {
  grid-row: 1;
  grid-column: 1;
}

.page-main.with-contents > .page-text {
  grid-row: 2;
}

.page-side > .page-contents {
  grid-row: 1;
  grid-column: 1 / -1;
}

.page-side > .comments-panel {
  grid-row: 2;
  grid-column: 1;
}

.page-main.with-contents .page-side > .comments-panel {
  grid-row: 3;
}

@media (min-width: 761px) {
  .page-main.with-comments {
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem);
  }

  .page-side > .comments-panel {
    grid-row: 1;
    grid-column: 2;
  }

  .page-main.with-contents .page-side > .comments-panel {
    grid-row: 2;
  }
}

@media (min-width: 1200px) {
  .wiki-content:has(.page-main.with-contents) {
    max-width: 72rem;
  }

  .wiki-content:has(.page-main.with-comments) {
    max-width: 78rem;
  }

  .page-main.with-side {
    grid-template-columns: minmax(0, 1fr) minmax(13rem, 16rem);
  }

  .page-main.with-side.with-comments {
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem);
  }

  .page-main.with-side > .page-text {
    grid-row: 1;
  }

  .page-side {
    position: sticky;
    top: calc(var(--header-height) + var(--page-actions-height) + 0.75rem);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    grid-row: 1;
    grid-column: 2;
    max-height: calc(100vh - var(--header-height) - var(--page-actions-height) - 1.5rem);
    overflow-y: auto;
  }

  /* Flex items now: where the grid put them no longer counts. */
  .page-side > .page-contents,
  .page-side > .comments-panel {
    flex-shrink: 0;
  }

  .page-side > .comments-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

/* What a template is, on it. */
.template-note {
  margin: 0 0 0.8rem;
  padding: 0.45rem 0.8rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.925rem;
}

.use-as-template[aria-pressed="true"],
.page-kind[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

/* A space's templates, listed apart from its tree: in the sidebar, and in
   the space's pages. */
.sidebar-templates,
.space-templates {
  margin: 0 0 0.8rem;
  padding: 0;
  list-style: none;
}

/* The pages that link to the page shown, under "Linked from" in the
   sidebar: a plain list of links, as the templates are. */
.sidebar-backlinks {
  margin: 0 0 0.8rem;
  padding: 0;
  list-style: none;
}

.sidebar-backlinks li {
  padding: 0.12rem 0;
}

/* What a new page is, a document or a presentation, and what it starts
   from: blank, or a template of that kind. */
.new-page-kind,
.new-page-start {
  display: flex;
  flex-basis: 100%;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0;
  padding: 0;
  border: none;
}

.new-page-kind legend,
.new-page-start legend {
  margin-bottom: 0.3rem;
  font-weight: 600;
}

@media print {
  .page-contents,
  .heading-anchor,
  .code-copy {
    display: none;
  }

  .page-main.with-side {
    display: block;
  }
}

/* ---- The writing assistant (WP4.19) ---------------------------------------- */

/* The editor with the assistant open: the editing on the left, the panel
   on the right, from the title down, on a wide screen; on a narrow one the
   panel comes after the attachments, where it is in the page. */
@media (min-width: 961px) {
  .editor-form.assisting {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 24rem);
    column-gap: 1rem;
    align-items: start;
  }

  .editor-form.assisting > * {
    grid-column: 1;
  }

  .editor-form.assisting > .editor-assistant-holder {
    grid-column: 2;
    grid-row: 1 / span 6;
    position: sticky;
    top: 0.5rem;
  }
}

.editor-assistant-holder:empty,
.editor-assistant[hidden],
.editor-form.previewing .editor-assistant-holder {
  display: none;
}

/* The providers' buttons, which open the assistant: round bubbles floating
   at the top right of the text, over its right edge, stacked, with a soft
   shadow. Their row is a sticky one of no height at the top of the text,
   just under the sticky toolbar, so that they stay in view as the text
   scrolls and take no room of it; the bubbles hang from it. On hover or
   focus a bubble grows to the left into a pill with its label. */
.editor-providers {
  position: relative;
  z-index: 3;
  height: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 0.75rem 0.75rem 0 0;
}

@media (min-width: 961px) {
  .editor-providers {
    position: sticky;
    top: calc(var(--header-height) + 3.25rem);
  }

  /* Beside the open panel the toolbar wraps onto a second row. */
  .editor-form.assisting .editor-providers {
    top: calc(var(--header-height) + 5.75rem);
  }

  /* The text's lines keep clear of the bubbles. */
  .editor-cm .cm-editor .cm-content {
    padding-right: 5rem;
  }
}

.editor-provider {
  --bubble: 64px;
  --logo: 32px;
  /* Its own size, whatever the row of no height it hangs from leaves it. */
  flex: none;
  display: inline-flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: flex-start;
  min-width: var(--bubble);
  max-width: var(--bubble);
  height: var(--bubble);
  /* The logo centred in the circle: the bubble less the logo and the
     border, on each side. */
  padding: 0 calc((var(--bubble) - var(--logo) - 2px) / 2);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--background);
  color: var(--text);
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.18);
  white-space: nowrap;
  transition:
    max-width 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease,
    opacity 0.15s ease;
}

.editor-provider-label {
  margin-right: 0.6rem;
  font-size: 1rem;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.editor-provider:hover,
.editor-provider:focus-visible {
  max-width: 20rem;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.24);
}

.editor-provider:hover .editor-provider-label,
.editor-provider:focus-visible .editor-provider-label {
  opacity: 1;
}

.editor-provider[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow:
    0 0 0 2px var(--accent),
    0 6px 20px rgb(0 0 0 / 0.24);
}

.editor-provider-logo {
  flex: none;
  width: var(--logo);
  height: var(--logo);
}

/* The speech bubble of the assistant without a provider, and of a service
   other than OpenAI's own: drawn, not filled. */
.editor-provider-glyph {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

/* A provider that could not be reached from here: still there, and still
   opening the panel (which says why and offers to try again), but dimmed;
   its title says why. */
.editor-provider.unreachable {
  opacity: 0.5;
}

.editor-provider.unreachable:hover,
.editor-provider.unreachable:focus-visible {
  opacity: 0.8;
}

.editor-provider-text {
  flex: none;
  width: var(--logo);
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
}

@media (max-width: 960px) {
  .editor-provider {
    --bubble: 56px;
    --logo: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .editor-provider,
  .editor-provider-label {
    transition: none;
  }

  .editor-provider:hover,
  .editor-provider:focus-visible {
    transform: none;
  }
}

.editor-pending-note {
  font-size: 0.85rem;
  color: var(--muted);
}

.assistant {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: calc(100vh - 2rem);
  margin-top: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

@media (min-width: 961px) {
  .assistant {
    margin-top: 0;
  }
}

.assistant-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
}

.assistant-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.assistant-using {
  flex: 1 1 auto;
  font-size: 0.8rem;
  color: var(--muted);
}

/* The conversation's tokens so far, under the header, where it stays put
   as messages arrive. */
.assistant-spent {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.assistant-settings-link {
  font-size: 0.85rem;
}

/* New and Close, in words: plain small buttons at the header's end. */
.assistant-new,
.assistant-close {
  padding: 0.1rem 0.6rem;
  font-size: 0.85rem;
}

.assistant-detach {
  padding: 0 0.4rem;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
}

.assistant-setup,
.assistant-changes {
  margin: 0;
  font-size: 0.9rem;
}

.assistant-changes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.assistant-pending {
  flex: 1 1 auto;
}

/* The conversation, kept scrolled to its end as it grows: a column laid
   out from the bottom up holds the messages, which read top down. */
.assistant-log {
  display: flex;
  flex-direction: column-reverse;
  min-height: 8rem;
  max-height: 50vh;
  overflow-y: auto;
}

.assistant-messages {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.assistant-empty {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.assistant-message {
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.assistant-message.from-user {
  align-self: flex-end;
  max-width: 90%;
  background: var(--code);
}

.assistant-message.from-model {
  border: 1px solid var(--border);
  background: var(--background);
}

.assistant-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.assistant-thinking,
.assistant-status,
.assistant-stopped,
.assistant-sent {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

/* The seconds waited, after the dots. */
.assistant-waited {
  margin-left: 0.4rem;
  font-variant-numeric: tabular-nums;
}

/* The summary of the model's thinking: collapsed under "Thinking" while it
   streams, and under "Thought" once the model has gone on. */
.assistant-thinking summary,
.assistant-thought summary {
  cursor: pointer;
}

.assistant-thought {
  margin: 0 0 0.3rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.assistant-thinking-text,
.assistant-thought-text {
  margin: 0.2rem 0 0;
  padding-left: 0.6rem;
  border-left: 2px solid var(--border);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* The three dots after "Thinking" and "Editing the page", and before a
   change being saved while a route waits for it (.busy-dots, the shell's
   .leave-waiting): still, unless motion is welcome, when they blink in
   turn. */
.assistant-dots span,
.busy-dots span {
  display: inline-block;
}

/* The cursor at the end of streaming text: a thin bar, which blinks unless
   motion is unwelcome. */
.assistant-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: currentColor;
}

@media (prefers-reduced-motion: no-preference) {
  .assistant-dots span,
  .busy-dots span {
    animation: assistant-dot 1.2s infinite ease-in-out both;
  }

  .assistant-dots span:nth-child(2),
  .busy-dots span:nth-child(2) {
    animation-delay: 0.2s;
  }

  .assistant-dots span:nth-child(3),
  .busy-dots span:nth-child(3) {
    animation-delay: 0.4s;
  }

  .assistant-cursor {
    animation: assistant-cursor 1s steps(1) infinite;
  }
}

@keyframes assistant-dot {
  0%,
  80%,
  100% {
    opacity: 0.2;
  }

  40% {
    opacity: 1;
  }
}

@keyframes assistant-cursor {
  50% {
    opacity: 0;
  }
}

/* The time a message was sent, how long an answer took, and its tokens. */
.assistant-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.2rem 0 0;
  font-size: 0.7rem;
  color: var(--muted);
}

.assistant-message.from-user .assistant-meta {
  justify-content: flex-end;
}

.assistant-took::before,
.assistant-tokens::before {
  content: "\00b7";
  margin-right: 0.5rem;
}

.assistant-notes {
  margin: 0.3rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.8rem;
}

.assistant-made {
  color: var(--tip);
}

.assistant-not-made {
  color: var(--caution);
}

.assistant-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.assistant-shortcut {
  padding: 0.1rem 0.5rem;
  font-size: 0.8rem;
}

.assistant-scope {
  font-size: 0.8rem;
  color: var(--muted);
}

.assistant-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0 0 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--background);
  color: var(--text);
  font-size: 0.8rem;
}

.assistant-message .assistant-chip {
  margin-top: 0.2rem;
  padding-right: 0.5rem;
}

.assistant-compose {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.assistant-input {
  min-height: 3.5rem;
  resize: vertical;
  font: inherit;
}

/* The mode, the model and the effort, a compact row under the panel's
   header. */
.assistant-choices {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.assistant-choice {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--muted);
}

.assistant-choice select,
.assistant-model-other {
  font-size: 0.8rem;
  padding: 0.1rem 0.25rem;
}

.assistant-model-other {
  width: 11rem;
}

/* Ask or Agent: two buttons joined, the mode in force pressed. */
.assistant-mode {
  display: inline-flex;
}

.assistant-mode-choice {
  padding: 0.1rem 0.6rem;
  font-size: 0.8rem;
  border-radius: 0;
}

.assistant-mode-choice:first-child {
  border-radius: 6px 0 0 6px;
}

.assistant-mode-choice:last-child {
  border-radius: 0 6px 6px 0;
  margin-left: -1px;
}

.assistant-mode-choice[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.assistant-send-row {
  display: flex;
  justify-content: flex-end;
}

/* A refused key: the sentence and the link to the settings, then the
   provider's own message, smaller. */
.assistant-key-refused p {
  margin: 0;
}

.assistant-error-detail {
  margin-top: 0.3rem;
  font-size: 0.85em;
}

.assistant-notice {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

/* A tracked change in the editor's text: what the assistant put in, on
   green, and what it replaced, struck through on red, before it, until
   the author decides with the control after it. */
.editor-cm .cm-wiki-inserted {
  background: var(--diff-added);
  border-bottom: 1px solid var(--tip);
}

.editor-cm .cm-wiki-removed {
  background: var(--diff-removed);
  color: var(--text);
  text-decoration: line-through;
  text-decoration-color: var(--caution);
  white-space: pre-wrap;
}

/* The text's selection while the focus is elsewhere, in the assistant
   (web/src/editor.js): shown as the browser shows one. */
.editor-cm .cm-wiki-kept-selection {
  background: color-mix(in srgb, Highlight 35%, transparent);
}

/* The editor's search's matches (web/src/editor.js), in the raw Markdown
   and in the open rows: each on a ground of the warning's colour, the
   current one, which the selection is, darker and outlined. */
.editor-cm .cm-wiki-match {
  border-radius: 2px;
  background: color-mix(in srgb, var(--warning) 22%, transparent);
}

.editor-cm .cm-wiki-match-current {
  background: color-mix(in srgb, var(--warning) 50%, transparent);
  outline: 1px solid var(--warning);
}

/* Inline math left open on its line (web/src/editor.js): a wavy red
   underline to the line's end, as the browser marks a misspelt word. */
.editor-cm .cm-wiki-unclosed-math {
  text-decoration: underline wavy var(--danger);
  text-decoration-skip-ink: none;
  text-underline-offset: 0.2em;
}

/* Folded spoilers (web/src/editor.js, WP5.96): the gutter's markers, quiet
   until hovered, and the mark a fold leaves at the end of its first line,
   which a click unfolds. */
.editor-cm .cm-foldGutter .cm-gutterElement {
  color: var(--muted);
  cursor: pointer;
  padding: 0 0.15rem;
}

.editor-cm .cm-foldGutter .cm-gutterElement:hover {
  color: var(--accent);
}

.editor-cm .cm-editor .cm-wiki-folded {
  margin: 0 0.3rem;
  padding: 0 0.35rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  cursor: pointer;
}

.editor-cm .cm-editor .cm-wiki-folded:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.editor-cm .cm-wiki-change-controls {
  display: inline-flex;
  gap: 0.15rem;
  margin: 0 0.2rem;
  vertical-align: text-bottom;
}

.editor-cm .cm-wiki-change-controls button {
  padding: 0 0.3rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--background);
  font-size: 0.75rem;
  line-height: 1.3;
  cursor: pointer;
}

.editor-cm .cm-wiki-change-accept {
  color: var(--tip);
}

.editor-cm .cm-wiki-change-reject {
  color: var(--caution);
}

/* Every tooltip the editor opens (.cm-tooltip: a problem's box, opened by
   hovering its mark in the text or in the gutter, the completion's list,
   and any kind a later CodeMirror extension brings) is drawn in the wiki's
   own surface and text colours, in either scheme. CodeMirror's own theme
   gives a tooltip a light grey background while the tooltip's text takes
   the editor's colour, which in the dark scheme is nearly white: the
   colours are set here, on .cm-tooltip itself, so that a kind of tooltip
   nobody styled is still readable, and each kind adds only what is its
   own. The rules name .editor-cm .cm-editor to outweigh CodeMirror's
   theme. */
.editor-cm .cm-editor .cm-tooltip {
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: var(--background);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.15);
}

/* The gutters beside the text (the problems' marks, the folds' markers)
   and any panel an extension opens above or below the text, drawn in the
   wiki's colours for the same reason: CodeMirror's own theme gives them a
   light grey in either scheme. */
.editor-cm .cm-editor .cm-gutters {
  color: var(--muted);
  background: var(--surface);
  border-color: var(--border);
}

.editor-cm .cm-editor .cm-panels {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

/* A hover's tooltip holds one section for each source of what is shown
   there (a problem's box is one): sections after the first are parted by
   the wiki's border colour. */
.editor-cm .cm-editor .cm-tooltip-hover {
  overflow: hidden;
}

.editor-cm .cm-editor .cm-tooltip-section:not(:first-child) {
  border-top: 1px solid var(--border);
}

/* A problem's box (@codemirror/lint), opened by its mark in the text (a
   section of the hover's tooltip) or in the gutter (a tooltip of its
   own): the problem's message in the application's font, with an edge in
   the colour of a warning or an error. */
.editor-cm .cm-editor .cm-tooltip-lint {
  max-width: 36rem;
  overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.85rem;
  line-height: 1.4;
}

.editor-cm .cm-editor .cm-diagnostic-error {
  border-left-color: var(--danger);
}

.editor-cm .cm-editor .cm-diagnostic-warning {
  border-left-color: var(--warning);
}

.editor-cm .cm-editor .cm-diagnostic-info {
  border-left-color: var(--note);
}

.editor-cm .cm-editor .cm-diagnostic-hint {
  border-left-color: var(--muted);
}

/* The list that completes a mention or an emoji (@codemirror/autocomplete,
   in web/src/editor.js): a menu like the application's others, each user's
   display name and then their login, dimmed, or each emoji and its
   shortcode, and the one Enter or Tab would choose on the accent's tint.
   Its colours are every tooltip's, above. */
.editor-cm .cm-tooltip.cm-tooltip-autocomplete {
  border-radius: 8px;
  overflow: hidden;
}

.editor-cm .cm-tooltip.cm-tooltip-autocomplete > ul {
  min-width: 15rem;
  max-height: 22rem;
  padding: 0.3rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.9rem;
}

.editor-cm .cm-tooltip.cm-tooltip-autocomplete > ul > li {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: 0.3rem 0.6rem;
  border-radius: 5px;
  line-height: 1.4;
}

.editor-cm .cm-tooltip.cm-tooltip-autocomplete > ul > li:hover {
  background: var(--surface);
}

.editor-cm .cm-tooltip.cm-tooltip-autocomplete > ul > li[aria-selected] {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 16%, var(--background));
}

/* An emoji's entry: the emoji, then its shortcode. */
.editor-cm .cm-tooltip-autocomplete .cm-completionEmoji {
  width: 1.4em;
  margin-right: -0.6rem;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  text-align: center;
}

.editor-cm .cm-tooltip-autocomplete .cm-completionDetail {
  margin-left: auto;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  font-style: normal;
}

/* A place to fill of a snippet the completion wrote (a marker's name, a
   block's first line), until the snippet is done: the text in the
   editor's colour on a tint of the accent, and an empty place as a thin
   mark in the accent. CodeMirror's own theme tints by the light or the
   dark scheme of its own, which the editor does not set. */
.editor-cm .cm-editor .cm-snippetField {
  color: var(--text);
  background-color: color-mix(in srgb, var(--accent) 16%, transparent);
  border-radius: 2px;
}

.editor-cm .cm-editor .cm-snippetFieldPosition {
  border-left: 2px solid var(--accent);
}

/* The assistant's settings, a section of the user's settings. */
.assistant-settings {
  max-width: 46rem;
}

.assistant-provider-settings {
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.assistant-provider-settings h2 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.assistant-key-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
}

.assistant-key-form .field {
  flex: 1 1 18rem;
}

.assistant-model,
.assistant-provider {
  margin: 0.75rem 0 0;
  padding: 0;
  border: none;
}

.assistant-model legend,
.assistant-provider legend {
  margin-bottom: 0.3rem;
  font-weight: 600;
}

.assistant-model-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.assistant-model-row select {
  min-width: 0;
  max-width: 100%;
  font: inherit;
}

.assistant-model .assistant-model-name {
  display: block;
  width: 16rem;
  max-width: 100%;
  margin-top: 0.4rem;
}

.assistant-service-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0.5rem 0 0;
}

.assistant-service {
  width: 24rem;
  max-width: 100%;
  font: inherit;
}

.assistant-insecure,
.assistant-insecure-base-url,
.assistant-provider-settings .assistant-unreachable {
  padding: 0.5rem 0.75rem;
  border-left: 4px solid var(--warning);
  background: var(--surface);
}

.assistant-check-works {
  color: var(--tip);
}

.assistant-effort-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0.75rem 0 0;
}

.assistant-effort-field span {
  font-weight: 600;
}

.assistant-default-effort {
  width: 12rem;
  max-width: 100%;
  font: inherit;
}

.home-sections {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin-block: 1rem;
}

.home-sections p {
  flex-basis: 100%;
  margin: 0;
  color: var(--text-muted);
}

/* The home page's options, above the text in the editor of its document
   (WP5.53): the switches, then the wiki's icon (WP5.45), the space
   settings' icon field, which the favicon follows. */
.editor-home {
  margin: 0.75rem 0;
  padding: 0.5rem 1rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.editor-home legend {
  padding: 0 0.3rem;
  font-weight: 600;
}

.editor-home .home-sections {
  margin-block: 0.5rem 1rem;
}

.editor-home .home-icon {
  max-width: 34rem;
}

.editor-home .home-icon p {
  color: var(--muted);
}

/* ---- WP5.36: the sidebar folded, the editor's font, the preview following -- */

/* The sidebar folds away on a wide screen, from a button at its bottom left;
   on a narrow screen it is above the page, and does not fold. */
.sidebar-fold {
  position: fixed;
  left: 0.5rem;
  bottom: 0.5rem;
  z-index: 5;
  padding: 0.15rem 0.5rem;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--muted);
  background: var(--surface);
}

.wiki-body.sidebar-folded > .wiki-sidebar {
  display: none;
}

@media (max-width: 760px) {
  .sidebar-fold {
    display: none;
  }

  .wiki-body.sidebar-folded > .wiki-sidebar {
    display: block;
  }
}

/* The editor's font size, smaller and larger, beside the preview's controls. */
.editor-font {
  display: inline-flex;
  gap: 0.15rem;
}

.editor-font button {
  min-width: 2.2rem;
  padding: 0.2rem 0.4rem;
}

.editor-detach {
  white-space: nowrap;
}

/* Where each block of a preview starts in the source: nothing to see, but a
   place to scroll to (followLine in web/src/editor.js, wiki_live_follow in
   wiki-app/jsbits/editor.js). An empty block of no height, with no
   border, padding or overflow of its own, so that the margins on its two
   sides collapse through it as they do between the same blocks on the
   page: the preview spaces the blocks as the page does. Its top is the
   next block's top, or a few pixels above it where the next block's own
   top margin is larger than the bottom margin of the block before. */
.source-line {
  display: block;
  height: 0;
  margin: 0;
}

/* In the preview's own window the page scrolls, under the sticky header and
   the window's line: a block followed there, or the card of a slide
   brought into view, stops below both. */
.live-preview .source-line,
.live-preview .slide-frame {
  scroll-margin-top: calc(var(--header-height) + var(--page-actions-height) + 0.75rem);
}

/* The preview in a window of its own is laid out as the page view (its
   classes are the page's); in the place of the page's bar of actions, a
   line that says whom it follows, with the switch of the page's width at
   its end. */
.live-preview-state {
  margin: 0;
  align-self: center;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---- Avatars in the account panel (WP5.55) -------------------------------- */

/* The user's avatar, large: the circle is what changes it. Its file input
   covers it, unseen, so that a click anywhere on it, or Enter on it with
   the keyboard's focus, opens the file picker; a camera on a dark disc
   shows over it on hover and on focus. "Remove" is a small text button
   under it. */
.avatar-settings {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
}

.avatar-change {
  position: relative;
  display: inline-flex;
  border-radius: 50%;
  cursor: pointer;
}

.avatar-change input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  opacity: 0;
  cursor: pointer;
}

.avatar-change-icon {
  position: absolute;
  right: 0;
  bottom: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  color: #ffffff;
  background: rgb(0 0 0 / 0.55);
  opacity: 0;
  transition: opacity 150ms ease;
  pointer-events: none;
}

.avatar-change-icon .icon {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
}

.avatar-change:hover .avatar-change-icon,
.avatar-change:focus-within .avatar-change-icon {
  opacity: 1;
}

.avatar-change:has(input:focus-visible) {
  box-shadow:
    0 0 0 2px var(--background),
    0 0 0 4px var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .avatar-change-icon {
    transition: none;
  }
}

/* The avatar's crop dialog (Wiki.App.View.Avatar): a modal <dialog>, in
   the browser's top layer and centred in the window, drawn as the editor's
   dialogs are. The cropper's canvas is a square of up to 28rem, smaller
   where the window is: the dialog's padding, title, help and buttons fit
   around it. */
.avatar-crop-dialog {
  --avatar-crop-size: min(calc(100vw - 4.5rem), calc(100vh - 14rem), 28rem);
  width: auto;
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 2rem);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: var(--dialog);
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.3);
}

.avatar-crop-dialog::backdrop {
  background: var(--dialog-backdrop);
}

.avatar-crop-body {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1rem 1.25rem 1.25rem;
}

.avatar-crop-title {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.3;
}

.avatar-crop-help {
  max-width: var(--avatar-crop-size);
  margin: 0;
}

.avatar-crop-body .actions {
  margin: 0;
}

/* Cropper.js's canvas fills this square; the picture is fitted whole
   inside it (web/src/avatar.js). */
.avatar-crop {
  width: var(--avatar-crop-size);
  height: var(--avatar-crop-size);
}

.avatar-crop cropper-canvas {
  width: 100%;
  height: 100%;
}

/* The square kept, shown round, with what is cut away dimmed. */
.avatar-crop cropper-selection {
  border-radius: 50%;
  box-shadow: 0 0 0 100vmax rgb(0 0 0 / 0.5);
}

/* ---- The page's width (WP5.55) --------------------------------------------- */

/* The switch at the end of the page's bar: "Compact" or "Full width". It
   changes the layout of a wide screen only, and is hidden on a narrower
   one. */
.page-width-switch {
  display: none;
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.page-width-option {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  border: none;
  border-radius: 0;
  font-size: 0.8rem;
  color: var(--muted);
  background: transparent;
}

.page-width-option + .page-width-option {
  border-left: 1px solid var(--border);
}

.page-width-option[aria-checked="true"] {
  color: var(--text);
  background: var(--surface);
}

.page-width-option .icon {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
}

/* On a wide screen the page view takes the content's whole width: its bar
   of actions on one row across it, the text at a reading width in the
   middle of the room the side column leaves, or as wide as that room in
   full width, and the side column (the contents, the comments) at the
   right edge. The page's other parts (the title, the attachments, the
   comments under the text) are in the text's column. */
@media (min-width: 1200px) {
  .page-width-switch {
    display: inline-flex;
  }

  .wiki-content:has(.page-view),
  .wiki-content:has(.page-main.with-contents):has(.page-view),
  .wiki-content:has(.page-main.with-comments):has(.page-view) {
    max-width: none;
  }

  .page-view {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 54rem) minmax(0, 1fr);
    column-gap: 1.5rem;
    align-items: start;
  }

  .page-view:has(> .page-main.with-side) {
    grid-template-columns: minmax(0, 1fr) minmax(0, 54rem) minmax(0, 1fr) minmax(16rem, 22rem);
  }

  .page-view.page-width-full {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-view.page-width-full:has(> .page-main.with-side) {
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem);
  }

  .page-view > * {
    grid-column: 2;
  }

  .page-view.page-width-full > * {
    grid-column: 1;
  }

  .page-view > .page-actions {
    grid-column: 1 / -1;
  }

  .page-view > .page-main.with-side {
    grid-column: 2 / -1;
    grid-template-columns: subgrid;
    gap: 1rem 1.5rem;
  }

  .page-view.page-width-full > .page-main.with-side {
    grid-column: 1 / -1;
  }

  .page-view > .page-main.with-side > .page-text {
    grid-column: 1;
  }

  .page-view > .page-main.with-side > .page-side {
    grid-column: -2;
  }
}
