/* ==========================================================================
   OpenWiki skin
   ========================================================================== */

:root {
  --ow-bg-page: #f8f9fa;
  --ow-bg-content: #ffffff;
  --ow-bg-subtle: #f8f9fa;
  --ow-bg-interactive: #eaecf0;
  --ow-bg-hover: #eaecf0;
  --ow-text: #202122;
  --ow-text-subtle: #54595d;
  --ow-text-muted: #72777d;
  --ow-border: #a2a9b1;
  --ow-border-subtle: #c8ccd1;
  --ow-border-faint: #eaecf0;
  --ow-link: #3366cc;
  --ow-link-visited: #6b4ba1;
  --ow-link-red: #d73333;
  --ow-progressive: #36c;
  --ow-accent-bg: #eaf3ff;
  --ow-shadow: rgba(0, 0, 0, 0.08);
  --ow-content-width: 60rem;
  --ow-font-size: 0.875rem;

  --ow-serif: 'Linux Libertine', 'Georgia', 'Times New Roman', serif;
  --ow-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --ow-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  color-scheme: light;
}

html[data-theme='dark'] {
  --ow-bg-page: #101418;
  --ow-bg-content: #101418;
  --ow-bg-subtle: #27292d;
  --ow-bg-interactive: #27292d;
  --ow-bg-hover: #303336;
  --ow-text: #eaecf0;
  --ow-text-subtle: #c8ccd1;
  --ow-text-muted: #a2a9b1;
  --ow-border: #54595d;
  --ow-border-subtle: #404244;
  --ow-border-faint: #2e3136;
  --ow-link: #88a3e8;
  --ow-link-visited: #b397dd;
  --ow-link-red: #f77;
  --ow-progressive: #88a3e8;
  --ow-accent-bg: #1b2536;
  --ow-shadow: rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  html[data-theme='auto'] {
    --ow-bg-page: #101418;
    --ow-bg-content: #101418;
    --ow-bg-subtle: #27292d;
    --ow-bg-interactive: #27292d;
    --ow-bg-hover: #303336;
    --ow-text: #eaecf0;
    --ow-text-subtle: #c8ccd1;
    --ow-text-muted: #a2a9b1;
    --ow-border: #54595d;
    --ow-border-subtle: #404244;
    --ow-border-faint: #2e3136;
    --ow-link: #88a3e8;
    --ow-link-visited: #b397dd;
    --ow-link-red: #f77;
    --ow-progressive: #88a3e8;
    --ow-accent-bg: #1b2536;
    --ow-shadow: rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

html[data-width='wide'] { --ow-content-width: 100%; }
html[data-fontsize='small'] { --ow-font-size: 0.8125rem; }
html[data-fontsize='large'] { --ow-font-size: 1rem; }

* { box-sizing: border-box; }

/* An author `display:` beats the browser's own [hidden] rule, so anything set
   to flex or block stays on screen even when hidden is set. Settled once. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ow-bg-page);
  color: var(--ow-text);
  font-family: var(--ow-sans);
  font-size: var(--ow-font-size);
  line-height: 1.6;
}

a { color: var(--ow-link); text-decoration: none; }
a:visited { color: var(--ow-link-visited); }
a:hover { text-decoration: underline; }
a.new, a.new:visited { color: var(--ow-link-red); }
a.external::after {
  content: '';
  display: inline-block;
  width: 0.6em; height: 0.6em;
  margin-left: 0.25em;
  background-color: currentColor;
  -webkit-mask: no-repeat center/contain url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M6 1h5v5L9 4 5.5 7.5 4.5 6.5 8 3 6 1zM2 3h2v1H3v5h5V8h1v2H2V3z'/%3E%3C/svg%3E");
  mask: no-repeat center/contain url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M6 1h5v5L9 4 5.5 7.5 4.5 6.5 8 3 6 1zM2 3h2v1H3v5h5V8h1v2H2V3z'/%3E%3C/svg%3E");
  opacity: 0.7;
}

/* --------------------------------------------------------------- header -- */

.ow-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--ow-bg-content);
  border-bottom: 1px solid var(--ow-border-faint);
}

.ow-header-left { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.ow-menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border: 0; border-radius: 2px;
  background: transparent;
  color: var(--ow-text);
  cursor: pointer;
}
.ow-menu-toggle:hover { background: var(--ow-bg-hover); }
.ow-menu-toggle svg { width: 20px; height: 20px; fill: currentColor; }

.ow-logo { display: flex; align-items: center; gap: 8px; }
.ow-logo:hover { text-decoration: none; }
.ow-logo img, .ow-logo svg { width: 42px; height: 42px; }
.ow-wordmark { display: flex; flex-direction: column; line-height: 1.1; }
.ow-wordmark b {
  font-family: var(--ow-serif);
  font-size: 1.4rem;
  font-weight: normal;
  color: var(--ow-text);
  letter-spacing: 0.01em;
}
.ow-wordmark span { font-size: 0.6875rem; color: var(--ow-text-subtle); }

.ow-search { flex: 1; max-width: 32rem; margin: 0 auto; position: relative; }
.ow-search form { display: flex; }
.ow-search-box { position: relative; flex: 1; }
.ow-search input[type='search'] {
  width: 100%;
  padding: 6px 10px 6px 32px;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--ow-text);
  background: var(--ow-bg-content);
  border: 1px solid var(--ow-border);
  border-radius: 2px;
  outline: 0;
}
.ow-search input[type='search']:focus {
  border-color: var(--ow-progressive);
  box-shadow: inset 0 0 0 1px var(--ow-progressive);
}
.ow-search-icon {
  position: absolute;
  left: 9px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  fill: var(--ow-text-muted);
  pointer-events: none;
}
.ow-search button {
  margin-left: 8px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--ow-text);
  background: var(--ow-bg-interactive);
  border: 1px solid var(--ow-border);
  border-radius: 2px;
  cursor: pointer;
}
.ow-search button:hover { background: var(--ow-bg-hover); }

.ow-suggestions {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: var(--ow-bg-content);
  border: 1px solid var(--ow-border);
  border-top: 0;
  box-shadow: 0 2px 6px var(--ow-shadow);
  z-index: 60;
}
.ow-suggestions a {
  display: block;
  padding: 6px 10px;
  color: var(--ow-text);
  border-bottom: 1px solid var(--ow-border-faint);
}
.ow-suggestions a:last-child { border-bottom: 0; }
.ow-suggestions a:hover, .ow-suggestions a.is-active { background: var(--ow-bg-hover); text-decoration: none; }

.ow-header-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.ow-header-right a, .ow-header-right button {
  /* Buttons do not inherit line-height, so it is set explicitly here: without
     it the button's box is shorter than the links' and the hover state on
     Appearance sits a few pixels short of everything beside it. */
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  font-family: inherit;
  font-size: 0.8125rem;
  line-height: 1.6;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--ow-link);
  cursor: pointer;
}
.ow-header-right a:hover, .ow-header-right button:hover { background: var(--ow-bg-hover); text-decoration: none; }

/* ---------------------------------------------------------------- layout -- */

.ow-page { display: flex; align-items: flex-start; gap: 0; }

.ow-sidebar {
  flex: 0 0 176px;
  width: 176px;
  padding: 16px 12px 40px 16px;
  position: sticky;
  top: 51px;
  max-height: calc(100vh - 51px);
  overflow-y: auto;
  font-size: 0.875rem;
}
body.ow-sidebar-hidden .ow-sidebar { display: none; }

.ow-sidebar h3 {
  margin: 16px 0 4px;
  font-size: 0.75rem;
  font-weight: normal;
  color: var(--ow-text-muted);
  text-transform: none;
}
.ow-sidebar ul { list-style: none; margin: 0; padding: 0; }
.ow-sidebar li a {
  display: block;
  padding: 3px 8px 3px 6px;
  border-radius: 2px;
  color: var(--ow-link);
}
.ow-sidebar li a:hover { background: var(--ow-bg-hover); text-decoration: none; }
.ow-sidebar li a.is-current { font-weight: 600; background: var(--ow-bg-hover); }

.ow-main {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
  padding: 0 0 40px;
}

.ow-content-wrapper { width: 100%; max-width: var(--ow-content-width); }

.ow-content {
  background: var(--ow-bg-content);
  border: 1px solid var(--ow-border-subtle);
  border-top: 0;
  padding: 16px 24px 32px;
}
html[data-width='wide'] .ow-content-wrapper { max-width: none; }

/* ------------------------------------------------------------------ tabs -- */

.ow-tabs {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding: 0 8px;
  background: var(--ow-bg-page);
  border-bottom: 1px solid var(--ow-border-subtle);
  font-size: 0.8125rem;
}
.ow-tabs ul { display: flex; list-style: none; margin: 0; padding: 0; }
.ow-tabs li a {
  display: block;
  padding: 8px 12px 7px;
  border: 1px solid transparent;
  border-bottom: 0;
  color: var(--ow-link);
}
.ow-tabs li a:hover { background: var(--ow-bg-hover); text-decoration: none; }
.ow-tabs li.is-selected a {
  background: var(--ow-bg-content);
  border-color: var(--ow-border-subtle);
  color: var(--ow-text);
  margin-bottom: -1px;
  padding-bottom: 8px;
}

/* --------------------------------------------------------------- content -- */

.ow-title-block { border-bottom: 1px solid var(--ow-border); padding-bottom: 4px; margin-bottom: 12px; }
.ow-title {
  font-family: var(--ow-serif);
  font-size: 1.9rem;
  font-weight: normal;
  line-height: 1.3;
  margin: 4px 0 2px;
}
.ow-tagline { font-size: 0.8125rem; color: var(--ow-text-subtle); margin-bottom: 6px; }
.ow-subtitle { font-size: 0.8125rem; color: var(--ow-text-subtle); margin: -6px 0 10px; }

.ow-body { max-width: 100%; }
.ow-body p { margin: 0.5em 0 1em; }
.ow-body > p:first-child { margin-top: 0; }

.ow-heading { display: flex; align-items: baseline; gap: 8px; }
.ow-body h2, .ow-body h3, .ow-body h4, .ow-body h5, .ow-body h6 { margin: 1em 0 0.25em; font-weight: normal; }
.ow-body h2 {
  font-family: var(--ow-serif);
  font-size: 1.5rem;
  padding-bottom: 0.25em;
  flex: 1;
}
.ow-heading-2 { border-bottom: 1px solid var(--ow-border); margin: 1.2em 0 0.5em; }
.ow-body h3 { font-size: 1.125rem; font-weight: 700; }
.ow-body h4, .ow-body h5, .ow-body h6 { font-size: 1rem; font-weight: 700; }
.ow-edit-section { font-size: 0.75rem; white-space: nowrap; color: var(--ow-text-muted); }
.ow-edit-section a { color: var(--ow-link); }

.ow-body ul, .ow-body ol { margin: 0.3em 0 1em 1.6em; padding: 0; }
.ow-body li { margin-bottom: 0.1em; }
.ow-body dl { margin: 0.4em 0 1em; }
.ow-body dt { font-weight: 700; }
.ow-body dd { margin: 0 0 0.5em 1.6em; }
.ow-body hr { border: 0; border-top: 1px solid var(--ow-border-subtle); margin: 1em 0; }
.ow-body pre, .ow-body code {
  font-family: var(--ow-mono);
  font-size: 0.85em;
  background: var(--ow-bg-subtle);
  border: 1px solid var(--ow-border-faint);
  border-radius: 2px;
}
.ow-body code { padding: 1px 4px; }
.ow-body pre { padding: 12px; overflow-x: auto; line-height: 1.45; }
.ow-body blockquote {
  margin: 1em 0 1em 1.6em;
  padding-left: 1em;
  border-left: 3px solid var(--ow-border-subtle);
  color: var(--ow-text-subtle);
}

/* ----------------------------------------------------------------- media -- */

.ow-thumb {
  margin: 0.5em 0 1.2em 1.4em;
  padding: 3px;
  background: var(--ow-bg-subtle);
  border: 1px solid var(--ow-border-subtle);
  font-size: 0.8125rem;
  line-height: 1.4;
}
.ow-thumb img { display: block; width: 100%; height: auto; background: #fff; }
.ow-thumb figcaption { padding: 5px 4px 3px; color: var(--ow-text-subtle); }
.ow-right { float: right; clear: right; max-width: 45%; }
.ow-left { float: left; clear: left; margin: 0.5em 1.4em 1.2em 0; max-width: 45%; }
.ow-center { margin-left: auto; margin-right: auto; }
.ow-inline-img img { vertical-align: middle; max-height: 1.4em; width: auto; }

/* --------------------------------------------------------------- infobox -- */

.infobox {
  float: right;
  clear: right;
  width: 22em;
  max-width: 45%;
  margin: 0 0 1em 1.4em;
  padding: 0;
  background: var(--ow-bg-subtle);
  border: 1px solid var(--ow-border);
  border-collapse: collapse;
  font-size: 0.8125rem;
  line-height: 1.5;
}
.infobox caption,
.infobox tr:first-child th[colspan] {
  padding: 8px 10px;
  font-size: 1.15em;
  font-weight: 700;
  text-align: center;
  background: var(--ow-bg-interactive);
  line-height: 1.3;
}
.infobox th, .infobox td { padding: 5px 8px; vertical-align: top; border-top: 1px solid var(--ow-border-faint); }
.infobox th { text-align: left; width: 38%; }
.infobox td[colspan], .infobox th[colspan] { text-align: center; }
.infobox img { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.infobox .ow-infobox-section {
  text-align: center;
  background: var(--ow-bg-interactive);
  font-weight: 700;
}

/* ---------------------------------------------------------------- tables -- */

.wikitable, .ow-table {
  margin: 1em 0;
  border-collapse: collapse;
  background: var(--ow-bg-content);
  font-size: 0.9375em;
}
.wikitable { border: 1px solid var(--ow-border); }
.wikitable th, .wikitable td { padding: 6px 10px; border: 1px solid var(--ow-border-subtle); }
.wikitable th { background: var(--ow-bg-interactive); text-align: center; font-weight: 700; }
.wikitable caption, .ow-table caption { font-weight: 700; padding: 4px; text-align: center; }
.ow-table td, .ow-table th { padding: 4px 8px; vertical-align: top; }
.ow-align-left { text-align: left; }
.ow-align-right { text-align: right; }
.ow-align-center { text-align: center; }
.ow-table-scroll { overflow-x: auto; }

/* ------------------------------------------------------------ references -- */

sup.reference { font-size: 0.75em; line-height: 1; vertical-align: super; white-space: nowrap; }
sup.reference a { text-decoration: none; }
.references { font-size: 0.85rem; margin: 0.5em 0 1em 1.8em; color: var(--ow-text-subtle); }
.references li { margin-bottom: 0.35em; }
.references li:target {
  background: var(--ow-accent-bg);
  padding: 2px 6px;
  margin-left: -6px;
  border-radius: 3px;
}
.ow-backlink a { font-weight: 700; text-decoration: none; }
:target { scroll-margin-top: 60px; }

/* ------------------------------------------------------------- hatnotes -- */

.ow-hatnote {
  margin: 0 0 0.6em 1.6em;
  font-style: italic;
  color: var(--ow-text-subtle);
}
.ow-ambox {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 1em;
  padding: 8px 12px;
  background: var(--ow-bg-subtle);
  border: 1px solid var(--ow-border-subtle);
  border-left: 8px solid #fc3;
  font-size: 0.9em;
}
.ow-ambox.ow-ambox-info { border-left-color: var(--ow-progressive); }
.ow-ambox.ow-ambox-stub { border-left-color: var(--ow-border); font-style: italic; }

/* ------------------------------------------------------------ categories -- */

.ow-catlinks {
  margin: 24px 0 0;
  padding: 6px 10px;
  background: var(--ow-bg-subtle);
  border: 1px solid var(--ow-border-subtle);
  font-size: 0.8125rem;
}
.ow-catlinks ul { display: inline; list-style: none; margin: 0; padding: 0; }
.ow-catlinks li { display: inline-block; margin: 0; padding: 0 0.6em; border-left: 1px solid var(--ow-border); }
.ow-catlinks li:first-child { border-left: 0; padding-left: 0.4em; }

/* -------------------------------------------------------------------- toc -- */

.ow-toc-sidebar {
  flex: 0 0 200px;
  width: 200px;
  position: sticky;
  top: 63px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  padding: 12px 8px 24px 12px;
  font-size: 0.8125rem;
}
.ow-toc-sidebar h2 { font-size: 0.75rem; color: var(--ow-text-muted); font-weight: normal; margin: 0 0 6px; }
.ow-toc-sidebar ul { list-style: none; margin: 0; padding: 0; }
.ow-toc-sidebar li a {
  display: block;
  padding: 3px 6px;
  border-left: 2px solid transparent;
  color: var(--ow-text-subtle);
}
.ow-toc-sidebar li a:hover { background: var(--ow-bg-hover); text-decoration: none; }
.ow-toc-sidebar li a.is-active {
  border-left-color: var(--ow-progressive);
  color: var(--ow-text);
  font-weight: 600;
}
.ow-toc-level-3 { padding-left: 12px; }
.ow-toc-level-4 { padding-left: 24px; }
.ow-toc-level-5, .ow-toc-level-6 { padding-left: 36px; }

.ow-toc-inline {
  display: table;
  margin: 1em 0;
  padding: 10px 18px 10px 12px;
  background: var(--ow-bg-subtle);
  border: 1px solid var(--ow-border-subtle);
  font-size: 0.875rem;
}
.ow-toc-inline h2 { font-size: 1rem; font-family: var(--ow-sans); font-weight: 700; margin: 0 0 4px; text-align: center; }
.ow-toc-inline ol { margin: 0 0 0 1.4em; padding: 0; }

/* ------------------------------------------------------------- main page -- */

.ow-mainpage-banner {
  padding: 14px 18px;
  margin-bottom: 14px;
  background: var(--ow-accent-bg);
  border: 1px solid var(--ow-border-subtle);
  text-align: center;
}
.ow-mainpage-banner h1 {
  font-family: var(--ow-serif);
  font-size: 1.75rem;
  font-weight: normal;
  margin: 0 0 4px;
}
.ow-mainpage-banner p { margin: 0; color: var(--ow-text-subtle); }
.ow-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ow-box {
  border: 1px solid var(--ow-border-subtle);
  background: var(--ow-bg-content);
}
.ow-box > h2 {
  margin: 0;
  padding: 6px 12px;
  font-family: var(--ow-serif);
  font-size: 1.1rem;
  font-weight: normal;
  background: var(--ow-bg-interactive);
  border-bottom: 1px solid var(--ow-border-subtle);
}
.ow-box-body { padding: 10px 14px 14px; }
.ow-box-body p:first-child { margin-top: 0; }
.ow-box-body ul { margin: 0.3em 0 0.3em 1.4em; }
.ow-box-featured { border-left: 4px solid var(--ow-progressive); }

/* ------------------------------------------------------------ forms/edit -- */

.ow-form label { display: block; margin: 12px 0 4px; font-weight: 600; }
.ow-editor {
  width: 100%;
  min-height: 60vh;
  padding: 10px;
  font-family: var(--ow-mono);
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--ow-text);
  background: var(--ow-bg-content);
  border: 1px solid var(--ow-border);
  border-radius: 2px;
  resize: vertical;
  tab-size: 4;
}
.ow-editor:focus, .ow-input:focus { outline: 0; border-color: var(--ow-progressive); box-shadow: inset 0 0 0 1px var(--ow-progressive); }
.ow-input {
  width: 100%;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--ow-text);
  background: var(--ow-bg-content);
  border: 1px solid var(--ow-border);
  border-radius: 2px;
}
.ow-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
/* Used on both <a> and <button>. Buttons do not inherit line-height and links
   pick up the global visited/underline rules, so both are pinned here: without
   this the anchors in a button row (Cancel, Back) come out a few pixels taller
   than the real buttons beside them. */
.ow-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 32px;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.35;
  text-align: center;
  white-space: nowrap;
  color: var(--ow-text);
  background: var(--ow-bg-interactive);
  border: 1px solid var(--ow-border);
  border-radius: 2px;
  cursor: pointer;
  vertical-align: middle;
}
a.ow-button, a.ow-button:visited { color: var(--ow-text); text-decoration: none; }
a.ow-button:hover { text-decoration: none; }
.ow-button:hover { background: var(--ow-bg-hover); }
.ow-button-primary { background: var(--ow-progressive); border-color: var(--ow-progressive); color: #fff; }
.ow-button-primary:hover { filter: brightness(1.08); background: var(--ow-progressive); }
.ow-checkbox { display: flex; align-items: center; gap: 6px; font-size: 0.8125rem; }
.ow-editnotice {
  padding: 10px 12px;
  margin-bottom: 12px;
  background: var(--ow-bg-subtle);
  border: 1px solid var(--ow-border-subtle);
  font-size: 0.8125rem;
}
.ow-toolbar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: -1px; }
.ow-toolbar button {
  padding: 4px 9px;
  font-family: inherit;
  font-size: 0.8125rem;
  background: var(--ow-bg-subtle);
  color: var(--ow-text);
  border: 1px solid var(--ow-border-subtle);
  border-radius: 2px 2px 0 0;
  cursor: pointer;
}
.ow-toolbar button:hover { background: var(--ow-bg-hover); }
.ow-preview {
  padding: 12px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--ow-border-subtle);
  background: var(--ow-bg-content);
}
.ow-preview-label {
  margin: 0 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--ow-border);
  font-family: var(--ow-serif);
  font-size: 1.3rem;
}

/* -------------------------------------------------------- history / diff -- */

.ow-history { list-style: none; margin: 12px 0; padding: 0; font-size: 0.875rem; }
.ow-history li { padding: 5px 4px; border-bottom: 1px solid var(--ow-border-faint); }
.ow-history li:hover { background: var(--ow-bg-subtle); }
.ow-history .ow-cur { color: var(--ow-text-muted); }
.ow-minor { font-weight: 700; color: var(--ow-text-muted); }
.ow-bytes { color: var(--ow-text-muted); }
.ow-delta-pos { color: #14866d; font-weight: 700; }
.ow-delta-neg { color: #b32424; font-weight: 700; }
.ow-summary { color: var(--ow-text-subtle); font-style: italic; }
.ow-new-badge {
  display: inline-block;
  padding: 0 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  color: #fff;
  background: #14866d;
  border-radius: 2px;
}

.ow-diff { width: 100%; border-collapse: collapse; font-family: var(--ow-mono); font-size: 0.8125rem; table-layout: fixed; }
.ow-diff td { padding: 2px 6px; vertical-align: top; word-wrap: break-word; white-space: pre-wrap; }
.ow-diff .ow-diff-marker { width: 2%; text-align: center; color: var(--ow-text-muted); font-weight: 700; }
.ow-diff .ow-diff-context { background: var(--ow-bg-content); }
.ow-diff .ow-diff-deleted { background: #ffe6e6; }
.ow-diff .ow-diff-added { background: #d8ecff; }
html[data-theme='dark'] .ow-diff .ow-diff-deleted { background: #3c1f1f; }
html[data-theme='dark'] .ow-diff .ow-diff-added { background: #1b3049; }
@media (prefers-color-scheme: dark) {
  html[data-theme='auto'] .ow-diff .ow-diff-deleted { background: #3c1f1f; }
  html[data-theme='auto'] .ow-diff .ow-diff-added { background: #1b3049; }
}
.ow-diff ins, .ow-diff del { text-decoration: none; padding: 0 1px; border-radius: 2px; }
.ow-diff del { background: #ffb6b6; }
.ow-diff ins { background: #a3d3ff; }
html[data-theme='dark'] .ow-diff del { background: #6b2828; }
html[data-theme='dark'] .ow-diff ins { background: #204b73; }
.ow-diff-header {
  background: var(--ow-bg-interactive);
  font-family: var(--ow-sans);
  font-weight: 700;
  padding: 6px !important;
}
.ow-diff-skip { text-align: center; color: var(--ow-text-muted); background: var(--ow-bg-subtle); }

/* --------------------------------------------------------------- search -- */

.ow-searchresults { list-style: none; margin: 16px 0; padding: 0; }
.ow-searchresults li { margin-bottom: 18px; }
.ow-result-title { font-size: 1.05rem; }
.ow-result-snippet { color: var(--ow-text-subtle); margin: 2px 0; }
.ow-result-meta { font-size: 0.75rem; color: var(--ow-text-muted); }
.ow-searchresults mark, .ow-body mark { background: #fc3; color: inherit; padding: 0 1px; }
html[data-theme='dark'] .ow-searchresults mark { background: #8a6d1c; color: #fff; }

.ow-columns { column-width: 16rem; column-gap: 2rem; }
.ow-columns ul { margin: 0; padding-left: 1.2em; }
.ow-columns li { break-inside: avoid; }

/* --------------------------------------------------------------- footer -- */

.ow-footer {
  max-width: var(--ow-content-width);
  margin: 0 auto;
  padding: 20px 24px 40px;
  color: var(--ow-text-subtle);
  font-size: 0.75rem;
  border-top: 1px solid var(--ow-border-subtle);
}
.ow-footer ul { list-style: none; display: flex; flex-wrap: wrap; gap: 16px; margin: 10px 0 0; padding: 0; }
.ow-footer-info { margin: 0 0 4px; }

/* --------------------------------------------------------- appearance UI -- */

.ow-appearance {
  position: fixed;
  right: 16px; top: 60px;
  width: 230px;
  padding: 12px 14px;
  background: var(--ow-bg-content);
  border: 1px solid var(--ow-border);
  border-radius: 2px;
  box-shadow: 0 2px 8px var(--ow-shadow);
  z-index: 70;
  font-size: 0.8125rem;
}
.ow-appearance h3 { margin: 0 0 8px; font-size: 0.875rem; }
.ow-appearance fieldset { border: 0; padding: 0; margin: 0 0 12px; }
.ow-appearance legend { padding: 0; font-size: 0.75rem; color: var(--ow-text-muted); margin-bottom: 4px; }
.ow-appearance label { display: flex; align-items: center; gap: 6px; padding: 3px 0; cursor: pointer; }

/* ------------------------------------------------------------ responsive -- */

@media (max-width: 1200px) { .ow-toc-sidebar { display: none; } }
@media (max-width: 850px) {
  .ow-sidebar { display: none; }
  body.ow-sidebar-open .ow-sidebar {
    display: block;
    position: fixed;
    left: 0; top: 51px; bottom: 0;
    width: 250px;
    background: var(--ow-bg-content);
    border-right: 1px solid var(--ow-border-subtle);
    z-index: 40;
  }
  .ow-content { padding: 12px 14px 24px; border-left: 0; border-right: 0; }
  .ow-grid { grid-template-columns: 1fr; }
  .infobox, .ow-right, .ow-left {
    float: none;
    width: auto;
    max-width: none;
    margin: 1em 0;
  }
  .ow-wordmark span { display: none; }
  .ow-header-right .ow-hide-mobile { display: none; }
  .ow-title { font-size: 1.6rem; }
}
@media (max-width: 560px) {
  .ow-wordmark { display: none; }
  .ow-tabs { font-size: 0.75rem; padding: 0; }
  .ow-tabs li a { padding: 8px 7px 7px; }
}

@media print {
  .ow-header, .ow-sidebar, .ow-tabs, .ow-toc-sidebar, .ow-edit-section, .ow-appearance { display: none; }
  .ow-content { border: 0; }
  body { background: #fff; }
}

.ow-logo { color: var(--ow-text); }
.ow-logo svg { color: var(--ow-text); }

/* Plain (unframed) images, used inside infoboxes */
.ow-plain-img { display: block; }
.ow-plain-img img { display: block; width: 100%; height: auto; margin: 0 auto; background: transparent; }
.ow-plain-caption { display: block; padding: 6px 4px 2px; text-align: center; color: var(--ow-text-subtle); font-size: 0.95em; }
.infobox .ow-plain-img img { max-width: 100%; }

.ow-quote-attr { margin-top: 6px; font-size: 0.9em; font-style: normal; color: var(--ow-text-muted); }
.ow-box-title {
  margin: 0;
  padding: 6px 12px;
  font-family: var(--ow-serif);
  font-size: 1.1rem;
  background: var(--ow-bg-interactive);
  border-bottom: 1px solid var(--ow-border-subtle);
}

.ow-mainpage-title {
  font-family: var(--ow-serif);
  font-size: 1.75rem;
  line-height: 1.3;
  margin-bottom: 4px;
}
.ow-redlink-demo { color: var(--ow-link-red); }

/* Remote images that failed to load */
.ow-broken-img {
  display: block;
  padding: 14px 10px;
  text-align: center;
  color: var(--ow-text-muted);
  background: var(--ow-bg-interactive);
  border: 1px dashed var(--ow-border);
  font-size: 0.8125rem;
  line-height: 1.5;
}

/* Table of contents in the left sidebar */
.ow-toc-nav { margin-top: 18px; border-top: 1px solid var(--ow-border-faint); padding-top: 10px; }
.ow-toc-nav li a {
  display: block;
  padding: 3px 6px 3px 8px;
  border-left: 2px solid transparent;
  color: var(--ow-text-subtle);
  border-radius: 0 2px 2px 0;
}
.ow-toc-nav li a:hover { background: var(--ow-bg-hover); text-decoration: none; }
.ow-toc-nav li a.is-active {
  border-left-color: var(--ow-progressive);
  color: var(--ow-text);
  font-weight: 600;
  background: var(--ow-bg-subtle);
}
.ow-toc-nav .ow-toc-top { color: var(--ow-text-muted); }
.ow-toc-level-2 { padding-left: 0; }
.ow-toc-nav .ow-toc-level-3 a { padding-left: 20px; font-size: 0.95em; }
.ow-toc-nav .ow-toc-level-4 a { padding-left: 32px; font-size: 0.95em; }
.ow-toc-nav .ow-toc-level-5 a, .ow-toc-nav .ow-toc-level-6 a { padding-left: 44px; font-size: 0.95em; }

/* Heading spacing below level two */
.ow-heading-3 { margin-top: 1.1em; }
.ow-heading-4, .ow-heading-5, .ow-heading-6 { margin-top: 0.9em; }

/* "(Redirected from ...)" note under the title */
.ow-redirect { color: var(--ow-text-subtle); }

/* Accounts: forms, errors and the header chip */
.ow-authform { max-width: 26rem; }
.ow-formerror {
  margin: 0 0 14px;
  padding: 10px 12px;
  background: #fee7e6;
  border: 1px solid #d73333;
  border-left-width: 4px;
  color: #7d2c26;
  font-size: 0.875rem;
}
html[data-theme='dark'] .ow-formerror { background: #3a1f1e; color: #f4c4c1; border-color: #a3413a; }
@media (prefers-color-scheme: dark) {
  html[data-theme='auto'] .ow-formerror { background: #3a1f1e; color: #f4c4c1; border-color: #a3413a; }
}
.ow-hint { margin: 4px 0 0; font-size: 0.75rem; color: var(--ow-text-muted); }
.ow-editnotice-anon { border-left: 4px solid var(--ow-progressive); }
.ow-user-chip { display: inline-flex; align-items: center; gap: 5px; }
.ow-user-chip svg { width: 14px; height: 14px; fill: currentColor; opacity: 0.8; }

/* ==========================================================================
   Moderation: badges, notices, admin controls
   ========================================================================== */

.ow-tab-count {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 4px;
  margin-left: 3px;
  background: var(--ow-bg-interactive);
  border-radius: 9px;
  font-size: 0.85em;
  text-align: center;
  color: var(--ow-text-subtle);
}
.ow-tabs li.is-selected .ow-tab-count { background: var(--ow-border-faint); }

.ow-watch form { margin: 0; }
.ow-watch button {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px 7px;
  border: 0;
  background: transparent;
  color: var(--ow-link);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.35;
  cursor: pointer;
}
.ow-watch button:hover { background: var(--ow-bg-hover); }

.ow-ambox-protected { border-left-color: #a2a9b1; }
.ow-ambox-pending { border-left-color: #f0a13a; }
.ow-ambox-filter { border-left-color: #d73333; }
.ow-ambox ul { margin: 6px 0 0 1.2em; }
.ow-ambox p { margin: 6px 0 0; }

.ow-badge {
  display: inline-block;
  padding: 0 6px;
  border-radius: 9px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  vertical-align: middle;
}
.ow-badge-closed { background: var(--ow-bg-interactive); color: var(--ow-text-muted); }
.ow-badge-pending { background: #fdf0d5; color: #8a5b00; }
.ow-badge-blocked { background: #fee7e6; color: #a3221b; }
html[data-theme='dark'] .ow-badge-pending { background: #4a3612; color: #f5d79a; }
html[data-theme='dark'] .ow-badge-blocked { background: #45201d; color: #f3b5b0; }

.ow-tag {
  display: inline-block;
  padding: 0 5px;
  background: var(--ow-bg-interactive);
  border: 1px solid var(--ow-border-subtle);
  border-radius: 2px;
  font-size: 0.6875rem;
  color: var(--ow-text-subtle);
}

.ow-unpatrolled { color: #d73333; font-weight: 700; }
.ow-rev-pending { background: #fffaf0; }
html[data-theme='dark'] .ow-rev-pending { background: #2b2415; }
.ow-rev-actions { white-space: nowrap; }
.ow-rev-actions a, .ow-rollback { font-size: 0.8125rem; }

.ow-inlineform { display: inline; margin: 0; }
.ow-linkbutton {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ow-link);
  font: inherit;
  font-size: inherit;
  line-height: inherit;
  vertical-align: baseline;
  cursor: pointer;
}
.ow-linkbutton:hover { text-decoration: underline; }
.ow-linkbutton-danger { color: var(--ow-link-red); }
.ow-button-danger { background: #d73333; border-color: #d73333; color: #fff; }
.ow-button-danger:hover { background: #b32424; }
.ow-input-small { width: auto; padding: 2px 4px; font-size: 0.75rem; }

.ow-radio {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin: 6px 0;
  padding: 8px 10px;
  border: 1px solid var(--ow-border-subtle);
  border-radius: 2px;
  cursor: pointer;
}
.ow-radio:hover { background: var(--ow-bg-subtle); }
.ow-radio span { flex: 1 1 100%; margin-left: 22px; color: var(--ow-text-muted); font-size: 0.8125rem; }
/* ==========================================================================
   Discussions - plain by design: a list of topics, a thread of messages
   ========================================================================== */

.ow-discuss-intro {
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ow-border-faint);
  color: var(--ow-text-subtle);
  font-size: 0.8125rem;
}
.ow-dot { margin: 0 6px; color: var(--ow-border); }
.ow-empty { color: var(--ow-text-muted); font-style: italic; }

/* new topic ------------------------------------------------------------- */
.ow-newtopic { margin: 0 0 20px; font-size: 0.875rem; }
.ow-newtopic summary { cursor: pointer; color: var(--ow-link); padding: 2px 0; }
.ow-newtopic[open] summary { margin-bottom: 8px; font-weight: 600; }
.ow-newtopic form {
  padding: 12px 14px;
  background: var(--ow-bg-subtle);
  border: 1px solid var(--ow-border-subtle);
}
.ow-newtopic label { display: block; margin: 8px 0 3px; font-size: 0.75rem; font-weight: 600; }
.ow-newtopic label:first-child { margin-top: 0; }
.ow-newtopic textarea { font-family: inherit; line-height: 1.6; resize: vertical; }

/* topic list ------------------------------------------------------------ */
.ow-topics { list-style: none; margin: 0; padding: 0; }
.ow-topics li { padding: 9px 0; border-bottom: 1px solid var(--ow-border-faint); }
.ow-topic-link { font-size: 0.9375rem; font-weight: 600; }
.ow-topic-meta, .ow-topic-preview { font-size: 0.75rem; color: var(--ow-text-muted); margin-top: 2px; }
.ow-topic-preview { color: var(--ow-text-subtle); }

/* messages -------------------------------------------------------------- */
/* The list is pulled out by the same amount each message is padded, so text
   still lines up with the rest of the column while any highlight on a message
   has room around it instead of running flush against the words. */
.ow-msgs { margin: 4px -10px 20px; }
.ow-msg { padding: 12px 10px; border-bottom: 1px solid var(--ow-border-faint); }
.ow-msg-reply { margin-left: 1.6em; padding-left: 12px; border-left: 2px solid var(--ow-border-faint); }

/* Landing on a message after posting or following a permalink flashes it,
   then settles. A permanent blue slab reads as an error state. */
.ow-msg:target {
  border-radius: 3px;
  box-shadow: inset 3px 0 0 var(--ow-progressive);
  background: var(--ow-accent-bg);
  animation: ow-flash 2s ease-out 2s forwards;
}
@keyframes ow-flash {
  from { background: var(--ow-accent-bg); }
  to { background: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .ow-msg:target { animation: none; }
}
.ow-msg-deleted { color: var(--ow-text-muted); }
.ow-msg-meta { font-size: 0.75rem; color: var(--ow-text-muted); }
.ow-author { font-weight: 700; }
.ow-author-anon { font-weight: 700; color: var(--ow-text-subtle); }
.ow-ip {
  font-family: var(--ow-mono);
  font-size: 0.92em;
  color: var(--ow-text-muted);
  border-bottom: 1px dotted var(--ow-border);
  cursor: help;
}
.ow-you {
  padding: 0 4px;
  background: var(--ow-accent-bg);
  border-radius: 2px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ow-progressive);
}
.ow-inreply { color: var(--ow-text-muted); }
.ow-msg-edited { font-style: italic; }
.ow-msg-text { margin-top: 5px; }
.ow-msg-text p:first-child { margin-top: 0; }
.ow-msg-text p:last-child { margin-bottom: 0; }
.ow-msg-actions { margin-top: 5px; font-size: 0.75rem; line-height: 1.6; }
.ow-msg-actions > * { margin-right: 12px; }
.ow-msg-actions a, .ow-msg-actions button { color: var(--ow-text-muted); font-size: 0.75rem; }
.ow-msg-actions a:hover, .ow-msg-actions button:hover { color: var(--ow-link); }

/* composer -------------------------------------------------------------- */
.ow-composer { margin: 0 0 8px; }
.ow-composer textarea {
  width: 100%;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--ow-text);
  background: var(--ow-bg-content);
  border: 1px solid var(--ow-border);
  border-radius: 2px;
  resize: vertical;
}
.ow-composer textarea:focus {
  outline: 0;
  border-color: var(--ow-progressive);
  box-shadow: inset 0 0 0 1px var(--ow-progressive);
}
.ow-composer-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}
.ow-composer-note { font-size: 0.75rem; color: var(--ow-text-muted); }
.ow-replying {
  margin-bottom: 6px;
  padding: 4px 8px;
  background: var(--ow-accent-bg);
  font-size: 0.75rem;
}
.ow-replying button { margin-left: 8px; }

.ow-thread-admin { margin-top: 4px; font-size: 0.75rem; }

/* site-wide discussion list --------------------------------------------- */
.ow-recentposts { list-style: none; margin: 0; padding: 0; }
.ow-recentposts li { padding: 9px 0; border-bottom: 1px solid var(--ow-border-faint); }

/* Credit for text reused from another wiki under CC BY-SA */
.ow-attribution {
  margin: 26px 0 0;
  padding: 8px 12px;
  background: var(--ow-bg-subtle);
  border: 1px solid var(--ow-border-subtle);
  border-left: 4px solid var(--ow-border);
  font-size: 0.75rem;
  color: var(--ow-text-subtle);
}

/* Generated lists that fetch more as you reach the bottom */
.ow-wantedlist { margin: 0; padding-left: 1.4em; }
.ow-wantedlist li {
  margin-bottom: 5px;
  /* The list is unbounded, so let the browser skip layout and painting for
     rows that are off screen. contain-intrinsic-size gives it a height to
     assume for those, which keeps the scrollbar honest. */
  content-visibility: auto;
  contain-intrinsic-size: auto 26px;
}
.ow-wanted-from { font-size: 0.8125rem; color: var(--ow-text-muted); }
.ow-loadmore {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 4px;
  min-height: 34px;
  font-size: 0.8125rem;
  color: var(--ow-text-muted);
}
.ow-loadmore .ow-hint { margin: 0; }
/* The spinner only appears while a batch is actually in flight. When the
   prefetch is keeping up, the reader never sees it at all. */
.ow-loadmore-spinner,
.ow-loadmore-status { opacity: 0; transition: opacity 0.15s ease-in; }
.ow-loadmore.is-loading .ow-loadmore-spinner,
.ow-loadmore.is-loading .ow-loadmore-status { opacity: 1; }
.ow-loadmore-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid var(--ow-border-subtle);
  border-top-color: var(--ow-progressive);
  border-radius: 50%;
  animation: ow-spin 0.7s linear infinite;
}
@keyframes ow-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .ow-loadmore-spinner { animation-duration: 2s; }
}

/* Anti-spam proof-of-work check */
.ow-pow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 12px 0;
  font-size: 0.75rem;
  color: var(--ow-text-muted);
}
.ow-pow-spinner {
  width: 11px;
  height: 11px;
  border: 2px solid var(--ow-border-subtle);
  border-top-color: var(--ow-progressive);
  border-radius: 50%;
  animation: ow-spin 0.7s linear infinite;
}
.ow-pow.is-done .ow-pow-spinner { display: none; }
.ow-pow.is-failed .ow-pow-spinner { display: none; }
.ow-pow.is-done { color: var(--ow-text-muted); opacity: 0.7; }
.ow-pow.is-failed { color: var(--ow-link-red); }

/* Getting from "this page is missing" to writing it */
.ow-createhint {
  margin: 12px 0;
  padding: 9px 12px;
  background: var(--ow-bg-subtle);
  border: 1px solid var(--ow-border-subtle);
  border-left: 4px solid var(--ow-progressive);
  font-size: 0.875rem;
}
.ow-suggest-create {
  border-top: 1px solid var(--ow-border) !important;
  color: var(--ow-text-subtle) !important;
}
.ow-suggest-create b { color: var(--ow-link); }

/* Account menu in the header */
.ow-usermenu { position: relative; }
.ow-user-chip { display: inline-flex; align-items: center; gap: 5px; }
.ow-user-chip svg { width: 14px; height: 14px; fill: currentColor; opacity: 0.8; }
.ow-user-chip .ow-caret { width: 9px; height: 9px; fill: none; opacity: 0.7; }
.ow-usermenu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 11rem;
  padding: 4px 0;
  background: var(--ow-bg-content);
  border: 1px solid var(--ow-border);
  border-radius: 2px;
  box-shadow: 0 2px 8px var(--ow-shadow);
  z-index: 70;
}
.ow-usermenu-panel a {
  display: block;
  padding: 6px 14px;
  font-size: 0.8125rem;
  line-height: 1.5;
  white-space: nowrap;
  color: var(--ow-link);
}
.ow-usermenu-panel a:hover { background: var(--ow-bg-hover); text-decoration: none; }
.ow-usermenu-panel a:last-child {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--ow-border-faint);
}
