/* Theme C — Space Industrial (community MES WebWiki) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500;600;700&display=swap');

:root {
  --mes-bg-deep: #0a0c0f;
  --mes-bg-panel: #12151a;
  --mes-bg-elevated: #1a1e26;
  --mes-bg-hover: #222830;
  --mes-border: #2e3540;
  --mes-border-strong: #3d4654;
  --mes-text: #e4e8ed;
  --mes-text-muted: #9aa3b2;
  --mes-amber: #f0a030;
  --mes-amber-bright: #ffb347;
  --mes-amber-dim: #c47a18;
  --mes-amber-glow: rgba(240, 160, 48, 0.15);
  --mes-code-bg: #0f1218;
  --mes-sidebar-width: 320px;
  --mes-content-max: 960px;
}

/* --- Shell & layout --- */
.wy-body-for-nav,
.wy-nav-content-wrap,
.wy-nav-content {
  background: var(--mes-bg-deep);
}

.wy-nav-content {
  max-width: var(--mes-content-max);
  color: var(--mes-text);
  padding: 1.75rem 2.5rem 3rem;
}

.wy-nav-side {
  background: var(--mes-bg-panel);
  border-right: 1px solid var(--mes-border);
  width: var(--mes-sidebar-width);
}

.wy-side-nav-search {
  background: linear-gradient(180deg, #1e2229 0%, var(--mes-bg-panel) 100%);
  border-bottom: 2px solid var(--mes-amber-dim);
}

.wy-side-nav-search > a {
  color: var(--mes-amber-bright) !important;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.wy-side-nav-search .wy-dropdown > a,
.wy-side-nav-search input[type='text'] {
  border: 1px solid var(--mes-border-strong) !important;
  background: var(--mes-bg-deep) !important;
  color: var(--mes-text) !important;
  border-radius: 4px;
}

.wy-side-nav-search input[type='text']::placeholder {
  color: var(--mes-text-muted);
}

body,
.rst-content {
  color: var(--mes-text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

h1,
h2,
h3,
h4,
h5,
h6,
.rst-content h1,
.rst-content h2,
.rst-content h3,
.rst-content h4,
.rst-content h5,
.rst-content h6 {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 600;
  color: var(--mes-text);
  letter-spacing: 0.01em;
}

.rst-content h1 {
  border-bottom: 2px solid var(--mes-amber-dim);
  padding-bottom: 0.35em;
  margin-bottom: 0.75em;
}

.rst-content h2 {
  border-bottom: 1px solid var(--mes-border);
  padding-bottom: 0.25em;
  margin-top: 1.75em;
}

.rst-content a {
  color: var(--mes-amber-bright);
}

.rst-content a:hover {
  color: #ffd080;
}

/* --- Sidebar navigation --- */
.wy-side-scroll {
  overflow-anchor: none;
}

.wy-menu-vertical a {
  color: var(--mes-text-muted);
  font-size: 0.92rem;
  line-height: 1.45;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.wy-menu-vertical a:hover {
  background: var(--mes-bg-hover);
  color: var(--mes-text);
  border-left-color: var(--mes-amber-dim);
}

.wy-menu-vertical li.current > a {
  background: rgba(240, 160, 48, 0.08);
  color: var(--mes-amber-bright);
  border-left-color: var(--mes-amber);
  font-weight: 600;
}

.wy-menu-vertical li.on > a,
.wy-menu-vertical li.current > a:hover {
  background: rgba(240, 160, 48, 0.08);
  color: var(--mes-amber-bright);
}

/* ReadTheDocs theme sets nested nav links to #404040 — unreadable on dark sidebar. */
.wy-menu-vertical li.toctree-l2 a,
.wy-menu-vertical li.toctree-l3 a,
.wy-menu-vertical li.toctree-l4 a,
.wy-menu-vertical li.toctree-l5 a,
.wy-menu-vertical li.toctree-l6 a,
.wy-menu-vertical li.toctree-l7 a,
.wy-menu-vertical li.toctree-l8 a,
.wy-menu-vertical li.toctree-l9 a,
.wy-menu-vertical li.toctree-l10 a {
  color: var(--mes-text-muted) !important;
}

.wy-menu-vertical li.toctree-l2 a:hover,
.wy-menu-vertical li.toctree-l3 a:hover,
.wy-menu-vertical li.toctree-l4 a:hover,
.wy-menu-vertical li.toctree-l5 a:hover,
.wy-menu-vertical li.toctree-l6 a:hover,
.wy-menu-vertical li.toctree-l7 a:hover,
.wy-menu-vertical li.toctree-l8 a:hover,
.wy-menu-vertical li.toctree-l9 a:hover,
.wy-menu-vertical li.toctree-l10 a:hover {
  color: var(--mes-text) !important;
  background: var(--mes-bg-hover) !important;
  border-left-color: var(--mes-amber-dim) !important;
}

/* RTD li.on a / li.current a (descendant) paints #fcfcfc on every link in expanded branches. */
.wy-menu-vertical li.on a,
.wy-menu-vertical li.current a {
  background: transparent !important;
  font-weight: inherit !important;
  border-top: none !important;
  border-bottom: none !important;
}

.wy-menu-vertical li.on a:hover,
.wy-menu-vertical li.current a:hover {
  background: var(--mes-bg-hover) !important;
  color: var(--mes-text) !important;
  border-left-color: var(--mes-amber-dim) !important;
}

/* RTD paints expanded nested sections with light gray backgrounds. */
.wy-menu-vertical li.current,
.wy-menu-vertical li.on,
.wy-menu-vertical li.toctree-l1.current,
.wy-menu-vertical li.toctree-l2.current,
.wy-menu-vertical li.toctree-l3.current,
.wy-menu-vertical li.toctree-l4.current,
.wy-menu-vertical li.toctree-l5.current {
  background: transparent !important;
}

.wy-menu-vertical li.current > ul,
.wy-menu-vertical li.on > ul,
.wy-menu-vertical li.toctree-l1.current > ul,
.wy-menu-vertical li.toctree-l2.current > ul,
.wy-menu-vertical li.toctree-l3.current > ul,
.wy-menu-vertical li.toctree-l4.current > ul {
  background: transparent !important;
}

.wy-menu-vertical li.toctree-l2.current > a,
.wy-menu-vertical li.toctree-l2.current li.toctree-l3 > a,
.wy-menu-vertical li.toctree-l3.current > a,
.wy-menu-vertical li.toctree-l3.current li.toctree-l4 > a,
.wy-menu-vertical li.toctree-l4.current > a,
.wy-menu-vertical li.toctree-l4.current li.toctree-l5 > a,
.wy-menu-vertical li.toctree-l5.current > a,
.wy-menu-vertical li.toctree-l5.current li.toctree-l6 > a {
  background: transparent !important;
}

.wy-menu-vertical li.toctree-l2.current > a,
.wy-menu-vertical li.toctree-l3.current > a,
.wy-menu-vertical li.toctree-l4.current > a,
.wy-menu-vertical li.toctree-l5.current > a {
  color: var(--mes-amber-bright) !important;
}

.wy-menu-vertical li.toctree-l2.current > a:hover,
.wy-menu-vertical li.toctree-l3.current > a:hover,
.wy-menu-vertical li.toctree-l4.current > a:hover,
.wy-menu-vertical li.toctree-l5.current > a:hover,
.wy-menu-vertical li.current > a:hover {
  color: var(--mes-amber-bright) !important;
  background: rgba(240, 160, 48, 0.12) !important;
}

.wy-menu-vertical li.toctree-l2 button.toctree-expand,
.wy-menu-vertical li.toctree-l3 button.toctree-expand,
.wy-menu-vertical li.toctree-l4 button.toctree-expand,
.wy-menu-vertical li.toctree-l5 button.toctree-expand {
  color: var(--mes-text-muted) !important;
  opacity: 0.85;
}

/* MkDocs captions: Player Support, Admin & Configuration, Modding, … */
.wy-menu-vertical p.caption {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mes-amber) !important;
  margin: 1em 0 0.35em;
  padding: 0 0 0 1em;
}

.wy-menu-vertical p.caption .caption-text {
  color: var(--mes-amber) !important;
}

/* Hide expand toggles when there are no nested nav items (empty ul doesn't count).
   RTD/MkDocs place the button inside the <a>, not as a direct child of li. */
.wy-menu-vertical li:not(:has(> ul > li)) button.toctree-expand {
  display: none !important;
}

/* MkDocs emits an empty ul on leaf pages — suppress it entirely. */
.wy-menu-vertical li.current > ul:not(:has(> li)),
.wy-menu-vertical li.current > ul.current:not(:has(> li)) {
  display: none !important;
}

/* Leaf pages must not show a separator line before the next nav item. */
.wy-menu-vertical li.toctree-l1.current:not(:has(> ul > li)) + li.toctree-l1 {
  border-top: none !important;
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* No TOC separator after leaf pages (only when real in-page sections exist). */
.wy-menu-vertical ul.current > li.toctree-l1.current:has(> ul > li) + li.toctree-l1 {
  margin-top: 0.65em;
  padding-top: 0.55em;
  border-top: 1px solid var(--mes-border);
}

/* Subsection group labels (Spawning, Behaviors, …) — nav items without a page href */
.wy-menu-vertical li.toctree-l1 > a:not([href]) {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--mes-amber-dim);
  margin-top: 0.35em;
  background: transparent;
  border-left-color: transparent;
}

.wy-menu-vertical li.toctree-l1 > a:not([href]):hover {
  color: var(--mes-amber);
  background: transparent;
}

.wy-menu-vertical li.toctree-l1.on > a:not([href]) {
  color: var(--mes-amber-dim) !important;
  background: transparent !important;
}

.wy-menu-vertical li.toctree-l1.on > a:not([href]):hover {
  color: var(--mes-amber) !important;
  background: transparent !important;
}

/* In-page TOC (anchor links) under the current page — only when sections exist */
.wy-menu-vertical li.toctree-l1.current > ul.current:has(> li) {
  margin: 0.35em 0 0.5em 0.85em;
  padding: 0.15em 0 0.45em 0.65em;
  border-left: 2px solid var(--mes-amber-dim);
  background: var(--mes-bg-deep);
  border-radius: 0 3px 3px 0;
}

.wy-menu-vertical li.toctree-l1.current > ul.current:has(> li)::before {
  content: 'On this page';
  display: block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mes-text-muted);
  padding: 0.15em 0 0.4em 0.35em;
}

.wy-menu-vertical li.toctree-l1.current > ul.current:has(> li) a {
  font-size: 0.78rem !important;
  font-weight: 400 !important;
  font-family: 'Inter', system-ui, sans-serif !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  color: var(--mes-text-muted) !important;
  padding-left: 0.5em !important;
  border-left-color: transparent !important;
}

.wy-menu-vertical li.toctree-l1.current > ul.current:has(> li) a:hover {
  color: var(--mes-text) !important;
  background: var(--mes-bg-hover) !important;
}

.wy-menu-vertical li.toctree-l1.current > ul.current:has(> li) li.toctree-l2.current > a {
  color: var(--mes-amber-bright) !important;
  font-weight: 500 !important;
  background: rgba(240, 160, 48, 0.08) !important;
  border-left-color: var(--mes-amber) !important;
}


/* Current page title stays normal nav styling even when it has an in-page TOC */
.wy-menu-vertical li.toctree-l1.current > a.current,
.wy-menu-vertical li.toctree-l1.current > a[href='#'] {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  color: var(--mes-amber-bright) !important;
  background: rgba(240, 160, 48, 0.08) !important;
  border-left-color: var(--mes-amber) !important;
  border-top: none !important;
  border-bottom: none !important;
}

.wy-menu-vertical li.toctree-l2 > a {
  padding-left: 1.25em;
}

.wy-menu-vertical li.toctree-l3 > a {
  padding-left: 1.75em;
}

.wy-menu-vertical li.toctree-l4 > a {
  padding-left: 2.25em;
}

.wy-menu-vertical li.toctree-l5 > a {
  padding-left: 2.75em;
}

/* --- Breadcrumbs & header links --- */
.wy-breadcrumbs li a {
  color: var(--mes-amber);
}

.wy-breadcrumbs li.wy-breadcrumbs-aside a {
  color: var(--mes-text-muted);
  font-size: 0.85rem;
}

/* --- Code & tables --- */
.rst-content code,
.rst-content tt,
code {
  background: var(--mes-code-bg);
  border: 1px solid var(--mes-border);
  color: var(--mes-amber-bright);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.88em;
  border-radius: 3px;
  padding: 0.1em 0.35em;
}

.rst-content pre {
  background: var(--mes-code-bg);
  border: 1px solid var(--mes-border-strong);
  border-left: 3px solid var(--mes-amber-dim);
  border-radius: 4px;
}

.rst-content pre code {
  border: none;
  background: transparent;
  color: #d4dae4;
}

.rst-content table.docutils thead {
  color: var(--mes-amber-bright);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

th {
  background: var(--mes-bg-elevated) !important;
  border: 1px solid var(--mes-border-strong) !important;
}

.rst-content table.docutils:not(.field-list) tr:nth-child(2n-1) td,
td {
  border: 1px solid var(--mes-border) !important;
  background-color: var(--mes-bg-panel);
  color: var(--mes-text);
}

.rst-content table.docutils tr:nth-child(2n) td {
  background-color: var(--mes-bg-deep);
}

.rst-content table.docutils th {
  word-wrap: normal;
}

.wy-table-responsive table td,
.wy-table-responsive table th {
  white-space: normal !important;
}

.wy-table-responsive {
  overflow: visible !important;
}

/* --- Mobile top bar --- */
.wy-nav-top {
  background: var(--mes-bg-panel);
  border-bottom: 2px solid var(--mes-amber-dim);
}

.wy-nav-top a {
  color: var(--mes-amber-bright);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* --- Mobile / narrow screens (ReadTheDocs ≤768px) --- */
@media screen and (max-width: 768px) {
  /*
   * RTD hides the sidebar with left: -300px but our sidebar is 320px wide,
   * so ~20px (border + search box) peeks on the left when the menu is closed.
   */
  .wy-nav-side {
    width: 85%;
    max-width: var(--mes-sidebar-width);
    left: -100%;
    border-right: none;
  }

  .wy-nav-side.shift {
    left: 0;
    border-right: 1px solid var(--mes-border);
  }

  .wy-nav-content-wrap {
    margin-left: 0 !important;
    width: 100%;
  }

  .wy-nav-content {
    max-width: none;
    padding: 1.25rem 1rem 2rem;
  }

  .wy-table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .wy-breadcrumbs li.wy-breadcrumbs-aside {
    display: block;
    margin-top: 0.35rem;
  }
}

/* --- Admonitions / notes --- */
.rst-content .note,
.rst-content .warning,
.rst-content .important {
  background: var(--mes-bg-elevated);
  border: 1px solid var(--mes-border-strong);
  border-left: 4px solid var(--mes-amber);
  border-radius: 4px;
}

/* --- Footer --- */
footer,
footer .rst-footer-buttons {
  color: var(--mes-text-muted);
}

footer a {
  color: var(--mes-amber-dim);
}

/* MES-WEBWIKI-STYLE-SYNC-START */
.rst-footer-buttons,
footer .rst-footer-buttons {
  display: none !important;
}

.mes-wiki-updates {
  border: 1px solid var(--mes-border-strong, #3d4654);
  border-left: 4px solid var(--mes-amber, #f0a030);
  background: var(--mes-bg-elevated, #1a1e26);
  padding: 1em 1.25em;
  margin: 1.5em 0 2em;
  border-radius: 4px;
}

.mes-wiki-updates-label {
  margin: 0 0 0.35em;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mes-amber, #f0a030);
}

.mes-wiki-updates-summary {
  margin: 0 0 0.75em;
  color: var(--mes-text-muted, #9aa3b2);
}

.mes-wiki-updates-meta {
  margin: 0 0 0.25em;
  color: var(--mes-text, #e4e8ed);
}

.mes-wiki-updates-source {
  margin: 0 0 0.75em;
  font-size: 0.92em;
  color: var(--mes-text-muted, #9aa3b2);
}

.mes-wiki-updates a {
  color: var(--mes-amber-bright, #ffb347);
  text-decoration: none;
}

.mes-wiki-updates a:hover {
  text-decoration: underline;
}

.mes-wiki-updates-latest,
.mes-wiki-updates-history ul {
  margin: 0 0 0.75em 1.1em;
  padding: 0;
}

.mes-wiki-updates-history-entry {
  margin-bottom: 0.85em;
}

.mes-wiki-updates-history-date {
  margin: 0 0 0.35em;
  font-weight: 600;
  color: var(--mes-text-muted, #9aa3b2);
}

.mes-wiki-updates-history summary {
  cursor: pointer;
  color: var(--mes-amber, #f0a030);
  margin-bottom: 0.5em;
}
/* MES-WEBWIKI-STYLE-SYNC-END */
