/* PasWiki default theme: screen styles, light and dark. */

/* Colours are light-dark() pairs: the operating system picks one, data-theme on <html> overrides it. */
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

:root {
  --bg: light-dark(#ffffff, #15181d);
  --fg: light-dark(#1d2129, #e3e6eb);
  --muted: light-dark(#5c6370, #9aa3ae);
  --border: light-dark(#d8dce3, #2f353e);
  --accent: light-dark(#1f5fa8, #7db3f0);
  --accent-visited: light-dark(#6b3fa0, #c3a0f0);
  --missing: light-dark(#b3261e, #f2847c);
  --code-bg: light-dark(#f4f5f7, #1e2228);
  --header-bg: light-dark(#f0f3f7, #1b1f25);
  --tok-keyword: light-dark(#0b4f9c, #82b8ff);
  --tok-string: light-dark(#1b7a33, #8fd19e);
  --tok-comment: light-dark(#6a737d, #8b949e);
  --tok-number: light-dark(#a3410a, #f0a672);
  --tok-symbol: light-dark(#6f42c1, #d2a8ff);
  --tok-directive: light-dark(#8a5a00, #e3c07a);
  --diff-del-bg: light-dark(#fde8e7, #4a2022);
  --diff-ins-bg: light-dark(#e3f6e6, #1d3d26);
  --diff-hunk-bg: light-dark(#eef2f8, #1f2733);
  --banner-bg: light-dark(#fff7e0, #2e2a1c);
  --mark-bg: light-dark(#fff1a8, #5a4b12);
  --box-bg: light-dark(#f8f9fa, #1b1f25);
  --box-border: light-dark(#a2a9b1, #4a525d);
  --diagram-bg: light-dark(transparent, #f4f5f7);
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-code: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 var(--font-body);
}

a { color: var(--accent); }
a:visited { color: var(--accent-visited); }
a.missing { color: var(--missing); }
a.invalid { color: var(--missing); text-decoration: line-through; }

[data-directive="template-error"] {
  color: var(--missing);
  border: 1px solid var(--missing);
  border-radius: 4px;
  padding: 0 6px;
}
div[data-directive="template-error"] { margin: 1em 0; padding: 8px 12px; }

.site-header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  padding: 10px 16px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}
.site-name {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--fg);
}
.site-logos { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.site-logos img { display: block; }
.site-search { flex: 1 1 200px; max-width: 420px; }
.site-search input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}
.user-menu { margin-left: auto; }
.theme-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  padding: 5px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: none;
  color: var(--fg);
  cursor: pointer;
}
.theme-switch:hover, .theme-switch:focus-visible { border-color: var(--border); background: var(--bg); }
.theme-switch svg { display: block; }
.theme-switch + .user-menu { margin-left: 0; }
.user-name { margin-right: 0.6em; }
.user-logout {
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
}

.page { max-width: 960px; margin: 0 auto; padding: 16px; }
.page-actions { display: flex; gap: 16px; justify-content: flex-end; font-size: 0.9rem; }
.page-actions .page-admin { padding-left: 16px; border-left: 1px solid var(--border); }
.page-title { margin: 0.3em 0 0.6em; font-size: 2rem; line-height: 1.25; }

.toc {
  display: inline-block;
  min-width: 240px;
  margin: 0 0 1em;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.92rem;
}
.toc h2 { margin: 0 0 4px; font-size: 1rem; }
.toc ul { margin: 0; padding-left: 1.2em; }
.toc a.toc-current { font-weight: 600; color: var(--fg); }

@media (min-width: 1200px) {
  .page-with-toc { max-width: 1252px; }
  .page-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    grid-template-areas: "body toc";
    column-gap: 32px;
  }
  .page-columns > .page-body { grid-area: body; min-width: 0; }
  .page-columns > .toc {
    grid-area: toc;
    align-self: start;
    position: sticky;
    top: 16px;
    display: block;
    min-width: 0;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    margin: 0;
  }
}

.page-body h2 { border-bottom: 1px solid var(--border); padding-bottom: 0.2em; }
.section-heading { display: flex; align-items: baseline; gap: 0.75em; }
.section-heading > h1, .section-heading > h2, .section-heading > h3,
.section-heading > h4, .section-heading > h5, .section-heading > h6 { flex: 1 1 auto; min-width: 0; }
.section-edit { flex: none; font-size: 0.85rem; }
.page-body img { max-width: 100%; }
.page-body img:not([height]), .page-body img[width] { height: auto; }
.page-body table { border-collapse: collapse; margin: 1em 0; display: block; overflow-x: auto; }
.page-body th, .page-body td { border: 1px solid var(--border); padding: 4px 10px; }
.page-body th { background: var(--header-bg); }
.page-body blockquote { margin: 1em 0; padding: 0 1em; border-left: 4px solid var(--border); color: var(--muted); }

code, pre { font-family: var(--font-code); font-size: 0.92em; }
:not(pre) > code { background: var(--code-bg); padding: 0.1em 0.3em; border-radius: 4px; }
pre {
  background: var(--code-bg);
  padding: 10px 14px;
  border-radius: 6px;
  overflow-x: auto;
  line-height: 1.45;
}

/* fcl-syntax token classes */
.keyword { color: var(--tok-keyword); font-weight: 600; }
.strings, .characters, .rawstring { color: var(--tok-string); }
.comment { color: var(--tok-comment); font-style: italic; }
.numbers { color: var(--tok-number); }
.symbol, .operator { color: var(--tok-symbol); }
.directive { color: var(--tok-directive); }

.history-list { list-style: none; padding: 0; margin: 0; }
.history-list li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.history-links { font-size: 0.9rem; margin-right: 8px; }
.history-time { font-family: var(--font-code); font-size: 0.9em; }
.history-minor { font-weight: 600; color: var(--muted); }
.history-size { color: var(--muted); font-size: 0.9rem; }
.history-comment { font-style: italic; color: var(--muted); }
.history-hidden { color: var(--muted); text-decoration: line-through; }
.history-older { margin-top: 1em; }

.language-bar { margin: -0.3em 0 1em; font-size: 0.9rem; }
.language-bar ul { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; padding: 0; list-style: none; }
.language-bar a.current { font-weight: 600; color: inherit; text-decoration: none; }

.page-categories {
  margin: 2em 0 0;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
}
.page-categories ul { display: inline; margin: 0; padding: 0; list-style: none; }
.page-categories li { display: inline; }
.page-categories li + li::before { content: " | "; color: var(--muted); }
.category-members h2 { border-bottom: 1px solid var(--border); padding-bottom: 0.2em; }
.category-count { color: var(--muted); font-size: 0.9rem; }
.category-subcategories, .category-groups { columns: 16em 3; column-gap: 2em; }
.category-subcategories { padding-left: 1.2em; }
.category-group { break-inside: avoid; }
.category-group h3 { margin: 0.6em 0 0.2em; font-size: 1rem; }
.category-group ul { margin: 0; padding-left: 1.2em; }
[data-directive="category"]::before { content: "Category: "; color: var(--muted); }

.site-footer {
  max-width: 960px;
  margin: 2em auto 0;
  padding: 16px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}
.site-links { display: inline-flex; gap: 12px; }

.special-namespaces ul { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 0; list-style: none; }
.special-namespaces a.current { font-weight: 600; color: var(--fg); }
.special-intro { color: var(--muted); font-size: 0.9rem; }
.special-groups { columns: 18em 3; column-gap: 2em; }
.special-group { break-inside: avoid; }
.special-group:only-child { break-inside: auto; }
.special-group h2 { margin: 0.6em 0 0.2em; font-size: 1rem; border: 0; }
.special-list { margin: 0; padding-left: 1.2em; }
.special-list a.redirect { font-style: italic; }
.special-statistics th { text-align: left; font-weight: normal; padding: 4px 24px 4px 0; }
.special-statistics td { text-align: right; font-variant-numeric: tabular-nums; }
.special-index li { margin: 0.2em 0; }
.special-form label { min-width: 10em; }

@media (max-width: 600px) {
  .page-title { font-size: 1.6rem; }
  .user-menu { margin-left: 0; }
  .site-logos img { width: auto; height: 36px; }
}

/* ---- History: old revisions, revision list and diffs (history.cgi) ---- */

.page-wide { max-width: 1400px; }

.revision-banner {
  margin: 0 0 1em;
  padding: 8px 14px;
  background: var(--banner-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.92rem;
}
.revision-banner p { margin: 0.2em 0; }
.revision-nav, .history-paging { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.9rem; }
.history-comment { color: var(--muted); font-style: italic; overflow-wrap: anywhere; }
.history-minor { font-weight: 600; text-decoration: none; }

.history-list { border-collapse: collapse; width: 100%; margin: 0 0 1em; font-size: 0.92rem; }
.history-list th, .history-list td { border-bottom: 1px solid var(--border); padding: 4px 8px; text-align: left; vertical-align: top; }
.history-list th { background: var(--header-bg); }
.history-size { text-align: right; font-variant-numeric: tabular-nums; }

.diff-header { display: flex; gap: 16px; margin: 0 0 1em; font-size: 0.92rem; }
.diff-side { flex: 1 1 0; min-width: 0; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; }
.diff-side-old { border-left: 4px solid var(--diff-del-bg); }
.diff-side-new { border-left: 4px solid var(--diff-ins-bg); }
.diff-notice { padding: 6px 10px; background: var(--banner-bg); border-radius: 6px; }

.diff-wrap { overflow-x: auto; }
table.diff {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: var(--font-code);
  font-size: 0.85rem;
  line-height: 1.45;
}
table.diff col.diff-ln-col { width: 4em; }
table.diff col.diff-sign-col { width: 1.5em; }
table.diff td { padding: 1px 6px; vertical-align: top; white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 4; }
table.diff td.diff-ln { color: var(--muted); text-align: right; user-select: none; }
table.diff td.diff-sign { user-select: none; }
table.diff tr.diff-hunk td { background: var(--diff-hunk-bg); color: var(--muted); }
table.diff td.diff-del, table.diff tr.diff-del td.diff-text, table.diff tr.diff-del td.diff-sign { background: var(--diff-del-bg); }
table.diff td.diff-ins, table.diff tr.diff-ins td.diff-text, table.diff tr.diff-ins td.diff-sign { background: var(--diff-ins-bg); }
table.diff td.diff-empty { background: var(--code-bg); }

@media (max-width: 600px) {
  .diff-header { flex-direction: column; }
  table.diff col.diff-ln-col { width: 2.5em; }
}

/* ---- Search results (searchd) ---- */


.search-form { display: flex; gap: 8px; margin: 0 0 1em; max-width: 640px; }
.search-form input[type="search"] {
  flex: 1 1 auto;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}
.search-form button { padding: 6px 14px; font: inherit; }
.search-count, .search-none, .search-exact { color: var(--muted); }
.search-results { padding-left: 1.5em; }
.search-results li { margin: 0 0 1em; }
.search-title { font-size: 1.05rem; font-weight: 600; }
.search-snippet { margin: 0.2em 0 0; color: var(--fg); overflow-wrap: anywhere; }
.search-snippet mark { background: var(--mark-bg); color: inherit; padding: 0 1px; border-radius: 2px; }
.search-paging { display: flex; gap: 16px; }

/* ---- Special pages of history.cgi: links, contributions, log ---- */

.history-contribs { font-size: 0.85rem; color: var(--muted); }
.special-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 1em; }
.special-form input[type="text"], .special-form input[type="search"] {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}
.special-form button { padding: 4px 12px; font: inherit; }
.links-list, .log-list { padding-left: 1.5em; }
.links-list li, .log-list li { margin: 0 0 0.4em; overflow-wrap: anywhere; }
.links-redirect, .links-more, .log-target-log { color: var(--muted); font-size: 0.9rem; }
.links-empty { color: var(--muted); }
.log-types { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 1em; font-size: 0.9rem; }
.log-types a[aria-current] { font-weight: 600; text-decoration: none; color: var(--fg); }
.log-list time { font-family: var(--font-code); font-size: 0.9em; margin-right: 6px; }
.log-detail { color: var(--muted); }
.log-reason { font-style: italic; color: var(--muted); }
.log-reason::before { content: "("; }
.log-reason::after { content: ")"; }
.contribs-list .history-size { white-space: nowrap; }

/* ---- Audit log of admin.cgi ---- */

.audit-filter { display: grid; grid-template-columns: max-content minmax(0, 24em); gap: 6px 10px; align-items: center; margin: 0 0 1em; }
.audit-filter .edit-buttons { grid-column: 2; }
.audit-filter select, .audit-filter input { font: inherit; padding: 4px; }
.audit-table { font-size: 0.9rem; }
.audit-table td { vertical-align: top; overflow-wrap: anywhere; }
.audit-time, .audit-ip { white-space: nowrap; font-family: var(--font-code); }
.audit-none, .audit-links { color: var(--muted); }
.audit-detail-list { display: grid; grid-template-columns: max-content 1fr; gap: 0 0.6em; margin: 0; }
.audit-detail-list dt { font-weight: 600; }
.audit-detail-list dd { margin: 0; white-space: pre-wrap; }

/* ---- Mermaid diagrams ---- */

figure.mermaid { margin: 1em 0; padding: 8px; overflow-x: auto; background: var(--diagram-bg); border-radius: 6px; }
figure.mermaid svg { display: block; max-width: 100%; height: auto; }
.mermaid-error {
  margin: 1em 0 0.3em;
  padding: 8px 12px;
  color: var(--missing);
  border: 1px solid var(--missing);
  border-radius: 4px;
}

/* ---- List tables (:::table) ---- */

.page-body table[data-directive="table"] > caption { padding: 4px 0; font-weight: 600; text-align: left; }
.page-body table[data-directive="table"] th,
.page-body table[data-directive="table"] td { vertical-align: top; text-align: left; }
.page-body table[data-directive="table"] tbody th { background: var(--header-bg); }
.page-body table[data-directive="table"]:not(.wikitable) th,
.page-body table[data-directive="table"]:not(.wikitable) td { border-color: transparent; }
.page-body table[data-directive="table"] :is(th, td) > :first-child { margin-top: 0; }
.page-body table[data-directive="table"] :is(th, td) > :last-child { margin-bottom: 0; }
.page-body table[data-directive="table"] :is(th, td) > ul,
.page-body table[data-directive="table"] :is(th, td) > ol { padding-left: 1.4em; }
.table-error {
  margin: 1em 0 0.3em;
  padding: 8px 12px;
  color: var(--missing);
  border: 1px solid var(--missing);
  border-radius: 4px;
}

@media print {
  .page-body table[data-directive="table"] { display: table; overflow: visible; }
  .page-body table[data-directive="table"] tr { break-inside: avoid; }
  .page-body table[data-directive="table"].wikitable :is(th, td) { border-color: #999; }
  .page-body table[data-directive="table"] tbody th { background: none; }
}

/* ---- Galleries and math ---- */

.gallery { margin: 1em 0; }
.gallery-title { margin: 0 0 0.5em; font-weight: 600; }
.gallery-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.gallery-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--code-bg);
  box-sizing: border-box;
}
.gallery-item img { display: block; max-width: 100%; max-height: 160px; width: auto; height: auto; object-fit: contain; }
.gallery-item figcaption { margin-top: 6px; font-size: 0.88rem; text-align: center; overflow-wrap: anywhere; }

@media (max-width: 600px) {
  .gallery-items { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
}

@media print {
  .gallery-items { grid-template-columns: repeat(3, 1fr); }
  .gallery-item { break-inside: avoid; background: none; border-color: #999; }
}

/* ---- File description pages ---- */

.file-info h2 { border-bottom: 1px solid var(--border); padding-bottom: 0.2em; }
.file-preview { margin: 1em 0; }
.file-preview img {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  border: 1px solid var(--border);
  background: var(--code-bg);
}
.file-download a { font-weight: 600; overflow-wrap: anywhere; }
.file-details, .file-usage-count { color: var(--muted); font-size: 0.9rem; }
.file-history { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.file-history th, .file-history td { border-bottom: 1px solid var(--border); padding: 4px 8px; text-align: left; vertical-align: top; }
.file-history th { background: var(--header-bg); }
.file-history td:last-child { overflow-wrap: anywhere; }
.file-version { font-family: var(--font-code); white-space: nowrap; }
.file-current td:first-child { font-weight: 600; }
.file-usage { padding-left: 1.5em; }
.file-usage li { overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .file-history th:nth-child(4), .file-history td:nth-child(4) { display: none; }
}

/* ---- Layout classes of the div and span directives (wiki.md.layout) ---- */


.wiki-floatleft { float: left; clear: left; margin: 0 1em 0.5em 0; }
.wiki-floatright { float: right; clear: right; margin: 0 0 0.5em 1em; }
.wiki-clear { clear: both; }
.wiki-center { text-align: center; }
div.wiki-center > table { margin-left: auto; margin-right: auto; }
.wiki-right { text-align: right; }
.wiki-justify { text-align: justify; }
div.wiki-box {
  display: flow-root;
  margin: 0.5em 0;
  padding: 0.5em 1em;
  border: 1px solid var(--box-border);
  border-radius: 6px;
  background: var(--box-bg);
}
div.wiki-box.wiki-floatleft { margin: 0 1em 0.5em 0; max-width: 50%; }
div.wiki-box.wiki-floatright { margin: 0 0 0.5em 1em; max-width: 50%; }
span.wiki-box { padding: 0 0.3em; border: 1px solid var(--box-border); border-radius: 3px; background: var(--box-bg); }
.wiki-underline { text-decoration: underline; }
.wiki-strike { text-decoration: line-through; }
.wiki-small { font-size: 0.85em; }
.wiki-big { font-size: 1.2em; }
.wiki-huge { font-size: 3em; line-height: 1.2; }
.wiki-bold { font-weight: 600; }
.wiki-italic { font-style: italic; }
.wiki-nowrap { white-space: nowrap; }
.wiki-mark { background: var(--mark-bg); color: inherit; padding: 0 2px; border-radius: 2px; }
.wiki-abbr { text-decoration: underline dotted; cursor: help; }
.wiki-mono, .wiki-key, .wiki-symbol, .wiki-dir, .wiki-cmt, .wiki-int, .wiki-str { font-family: var(--font-code); font-size: 0.92em; }
.wiki-key { color: var(--tok-keyword); font-weight: 600; }
.wiki-symbol { color: var(--tok-symbol); }
.wiki-dir { color: var(--tok-directive); }
.wiki-cmt { color: var(--tok-comment); font-style: italic; }
.wiki-int { color: var(--tok-number); }
.wiki-str { color: var(--tok-string); }
.wiki-floatleft[class*="wiki-w"], .wiki-floatright[class*="wiki-w"] { clear: none; margin: 0 0 0.5em 0; box-sizing: border-box; }
.wiki-floatleft[class*="wiki-w"] { padding-right: 1em; }
.wiki-floatright[class*="wiki-w"] { padding-left: 1em; }
.wiki-floatleft[class*="wiki-w"] + :not(.wiki-floatleft):not(.wiki-floatright),
.wiki-floatright[class*="wiki-w"] + :not(.wiki-floatleft):not(.wiki-floatright) { clear: both; }
.wiki-w10 { width: 10%; } .wiki-w15 { width: 15%; } .wiki-w20 { width: 20%; } .wiki-w25 { width: 25%; }
.wiki-w30 { width: 30%; } .wiki-w35 { width: 35%; } .wiki-w40 { width: 40%; } .wiki-w45 { width: 45%; }
.wiki-w50 { width: 50%; } .wiki-w55 { width: 55%; } .wiki-w60 { width: 60%; } .wiki-w65 { width: 65%; }
.wiki-w70 { width: 70%; } .wiki-w75 { width: 75%; } .wiki-w80 { width: 80%; } .wiki-w85 { width: 85%; }
.wiki-w90 { width: 90%; } .wiki-w95 { width: 95%; } .wiki-w100 { width: 100%; }
img.wiki-center { display: block; margin: 0.5em auto; }
span.wiki-thumb {
  display: inline-block;
  width: min-content;
  max-width: 100%;
  margin: 0.5em 0;
  padding: 4px;
  border: 1px solid var(--box-border);
  border-radius: 4px;
  background: var(--box-bg);
  vertical-align: top;
  box-sizing: border-box;
}
span.wiki-thumb.wiki-floatleft { margin: 0.2em 1em 0.5em 0; }
span.wiki-thumb.wiki-floatright { margin: 0.2em 0 0.5em 1em; }
span.wiki-thumb.wiki-center { display: block; margin: 0.5em auto; }
span.wiki-thumb > img { display: block; max-width: min(calc(100vw - 50px), 918px); }
span.wiki-thumb > .wiki-caption { display: block; padding: 4px 2px 0; font-size: 0.9em; line-height: 1.35; }

@media (max-width: 600px) {
  .wiki-floatleft, .wiki-floatright, div.wiki-box.wiki-floatleft, div.wiki-box.wiki-floatright {
    float: none;
    max-width: none;
    margin: 0.5em 0;
  }
  .wiki-floatleft[class*="wiki-w"], .wiki-floatright[class*="wiki-w"] { width: auto; padding: 0; }
  span.wiki-thumb.wiki-floatleft, span.wiki-thumb.wiki-floatright { margin: 0.5em 0; }
}
