/* Genomopedia — static site styles
   Layout and typography follow the familiar encyclopedia conventions
   (serif headings, sans body, left navigation, infobox on the right),
   with Genomopedia's own identity colours. */

:root {
  --bg: #ffffff;
  --bg-subtle: #f8f9fa;
  --bg-sidebar: #ffffff;
  --text: #202122;
  --text-muted: #54595d;
  --border: #a2a9b1;
  --border-subtle: #eaecf0;
  --link: #2a5db0;
  --link-visited: #6a4a9c;
  --link-missing: #b34700;
  --brand: #1f4e5f;
  --brand-soft: #e6f0f2;

  --banner-bg: #fef6e7;
  --banner-border: #edab00;
  --banner-text: #3d2f00;

  --ev-confirmed: #0f6b3a;   --ev-confirmed-bg: #e3f4ea;
  --ev-mechanism: #1d4f91;   --ev-mechanism-bg: #e5eefa;
  --ev-unification: #5b3a8e; --ev-unification-bg: #efe8f8;
  --ev-hypothesis: #8a5a00;  --ev-hypothesis-bg: #fbf0d9;
  --ev-conventional: #4a4f55; --ev-conventional-bg: #eceef0;

  --serif: "Linux Libertine", "Georgia", "Times", "Source Serif 4", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --pagefind-ui-scale: 0.8;
  --pagefind-ui-primary: var(--link);
  --pagefind-ui-text: var(--text);
  --pagefind-ui-background: var(--bg);
  --pagefind-ui-border: var(--border);
  --pagefind-ui-tag: var(--bg-subtle);
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: 2px;
  --pagefind-ui-font: var(--sans);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101418;
    --bg-subtle: #1b2127;
    --bg-sidebar: #101418;
    --text: #eaecf0;
    --text-muted: #a2a9b1;
    --border: #54595d;
    --border-subtle: #2b3238;
    --link: #88a3e8;
    --link-visited: #b39ddb;
    --link-missing: #f0a868;
    --brand: #9fd3c7;
    --brand-soft: #16282e;

    --banner-bg: #2b2310;
    --banner-border: #c69200;
    --banner-text: #f5e6bf;

    --ev-confirmed: #7fd4a4;   --ev-confirmed-bg: #12301f;
    --ev-mechanism: #9dbcf0;   --ev-mechanism-bg: #15243a;
    --ev-unification: #c5aef0; --ev-unification-bg: #251a38;
    --ev-hypothesis: #f0c56e;  --ev-hypothesis-bg: #33270d;
    --ev-conventional: #c3c8cd; --ev-conventional-bg: #252a2f;

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
    --bg: #101418;
    --bg-subtle: #1b2127;
    --bg-sidebar: #101418;
    --text: #eaecf0;
    --text-muted: #a2a9b1;
    --border: #54595d;
    --border-subtle: #2b3238;
    --link: #88a3e8;
    --link-visited: #b39ddb;
    --link-missing: #f0a868;
    --brand: #9fd3c7;
    --brand-soft: #16282e;

    --banner-bg: #2b2310;
    --banner-border: #c69200;
    --banner-text: #f5e6bf;

    --ev-confirmed: #7fd4a4;   --ev-confirmed-bg: #12301f;
    --ev-mechanism: #9dbcf0;   --ev-mechanism-bg: #15243a;
    --ev-unification: #c5aef0; --ev-unification-bg: #251a38;
    --ev-hypothesis: #f0c56e;  --ev-hypothesis-bg: #33270d;
    --ev-conventional: #c3c8cd; --ev-conventional-bg: #252a2f;

    color-scheme: dark;
  }

* { box-sizing: border-box; }

html { font-size: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:visited { color: var(--link-visited); }

.gp-skip { position: absolute; left: -999px; }
.gp-skip:focus { left: 8px; top: 8px; background: var(--bg); padding: 4px 8px; z-index: 10; }

/* ---------- Header ---------- */

.gp-header {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 1300px;
  margin: 0 auto;
  padding: 10px 16px;
}
.gp-brand { display: flex; align-items: center; gap: 10px; color: var(--text); flex-shrink: 0; }
.gp-brand:hover { text-decoration: none; }
.gp-brand:visited { color: var(--text); }
.gp-logo { width: 40px; height: 40px; display: block; }
.gp-wordmark { display: flex; flex-direction: column; line-height: 1.15; }
.gp-name { font-family: var(--serif); font-size: 1.45rem; letter-spacing: 0.02em; }
.gp-motto { font-size: 0.72rem; color: var(--text-muted); }

.gp-search { flex: 1; max-width: 520px; margin-left: auto; position: relative; }
.gp-search .pagefind-ui__drawer {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--bg); border: 1px solid var(--border); border-top: 0;
  max-height: 70vh; overflow: auto; padding: 0 12px; z-index: 20;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}
.gp-search .pagefind-ui__drawer:empty,
.gp-search .pagefind-ui__drawer:not(:has(*)) { display: none; }

/* Light/dark toggle: shows the icon of the mode it switches to */
.gp-theme-toggle {
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0; cursor: pointer;
  background: none; color: var(--text-muted);
  border: 1px solid var(--border-subtle); border-radius: 50%;
}
.gp-theme-toggle:hover { color: var(--text); background: var(--bg-subtle); }
.gp-theme-toggle:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.gp-icon-moon { display: block; }
.gp-icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .gp-icon-moon { display: none; }
  :root:not([data-theme="light"]) .gp-icon-sun { display: block; }
}
:root[data-theme="dark"] .gp-icon-moon { display: none; }
:root[data-theme="dark"] .gp-icon-sun { display: block; }
:root[data-theme="light"] .gp-icon-moon { display: block; }
:root[data-theme="light"] .gp-icon-sun { display: none; }

.gp-menu { display: none; }
.gp-menu summary { list-style: none; cursor: pointer; padding: 8px; }
.gp-menu summary::-webkit-details-marker { display: none; }
.gp-menu-icon, .gp-menu-icon::before, .gp-menu-icon::after {
  display: block; width: 20px; height: 2px; background: var(--text); position: relative;
}
.gp-menu-icon::before, .gp-menu-icon::after { content: ""; position: absolute; }
.gp-menu-icon::before { top: -6px; }
.gp-menu-icon::after { top: 6px; }
.gp-menu-panel {
  position: absolute; left: 16px; right: 16px; margin-top: 8px;
  background: var(--bg); border: 1px solid var(--border); z-index: 30;
  display: flex; flex-direction: column; padding: 8px 0;
}
.gp-menu-panel a { padding: 8px 16px; }

/* ---------- Heterodox banner (always shown) ---------- */

.gp-banner {
  max-width: 1300px;
  margin: 0 auto 8px;
  padding: 10px 16px 10px 16px;
  background: var(--banner-bg);
  border: 1px solid var(--banner-border);
  border-left: 6px solid var(--banner-border);
  color: var(--banner-text);
  font-size: 0.875rem;
  display: flex;
  gap: 14px;
  align-items: baseline;
}
.gp-banner p { margin: 0; }
.gp-banner a { color: inherit; text-decoration: underline; }
.gp-banner-label {
  text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.72rem;
  white-space: nowrap; font-weight: 700;
}

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

.gp-page {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  gap: 24px;
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 16px;
}

.gp-sidebar { font-size: 0.85rem; padding-top: 8px; }
.gp-sidebar-heading {
  font-size: 0.75rem; font-weight: 600; color: var(--text-muted);
  margin: 18px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--border-subtle);
  font-family: var(--sans);
}
.gp-sidebar ul { list-style: none; margin: 0; padding: 0; }
.gp-sidebar li { margin: 4px 0; }
.gp-legend li { margin: 6px 0; }

.gp-main { min-width: 0; padding-bottom: 40px; }

.gp-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.95rem;
  line-height: 1.3;
  margin: 8px 0 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.gp-title-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.gp-tagline { font-size: 0.8rem; color: var(--text-muted); margin: 6px 0 12px; }

/* ---------- Article content (MediaWiki parser output) ---------- */

.mw-parser-output h2 {
  font-family: var(--serif); font-weight: 400; font-size: 1.5rem;
  margin: 1.2em 0 0.3em; padding-bottom: 2px; border-bottom: 1px solid var(--border);
  line-height: 1.3;
}
.mw-parser-output h3 { font-size: 1.1rem; font-weight: 700; margin: 1em 0 0.2em; }
.mw-parser-output h4 { font-size: 1rem; font-weight: 700; margin: 0.9em 0 0.2em; }
.mw-parser-output .mw-heading { clear: none; }
.mw-parser-output p { margin: 0.4em 0 0.6em; }
.mw-parser-output ul, .mw-parser-output ol { margin: 0.3em 0 0.6em 1.6em; padding: 0; }
.mw-parser-output li { margin-bottom: 0.15em; }
.mw-parser-output dl { margin: 0.4em 0; }
.mw-parser-output dt { font-weight: 700; }
.mw-parser-output pre, .mw-parser-output code {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.875em;
  background: var(--bg-subtle); border: 1px solid var(--border-subtle); border-radius: 2px;
}
.mw-parser-output code { padding: 1px 4px; }
.mw-parser-output pre { padding: 10px 12px; overflow-x: auto; }
.mw-parser-output img { max-width: 100%; height: auto; }

/* Images: thumb / frame figures (MediaWiki 1.43 markup) */
.mw-parser-output figure { margin: 0.5em 0 1em; }
.mw-parser-output figure[typeof~="mw:File/Thumb"],
.mw-parser-output figure[typeof~="mw:File/Frame"] {
  float: right; clear: right; margin: 0.5em 0 1.2em 1.4em;
  padding: 3px; background: var(--bg-subtle); border: 1px solid var(--border-subtle);
  display: table; max-width: 100%;
}
.mw-parser-output figure.mw-halign-left { float: left; clear: left; margin: 0.5em 1.4em 1.2em 0; }
.mw-parser-output figure.mw-halign-center { float: none; margin-left: auto; margin-right: auto; }
.mw-parser-output figure.mw-halign-none { float: none; }
.mw-parser-output figure > a, .mw-parser-output figure > span { display: block; }
.mw-parser-output figcaption {
  display: table-caption; caption-side: bottom; padding: 4px 4px 2px;
  font-size: 0.8rem; line-height: 1.45; color: var(--text);
  background: var(--bg-subtle); border: 1px solid var(--border-subtle); border-top: 0;
}
.mw-parser-output figure[typeof~="mw:File"] figcaption { display: none; }

.gp-missing { color: var(--link-missing); border-bottom: 1px dotted currentColor; cursor: help; }
.gp-unpublished { color: inherit; }

.hatnote { font-style: italic; color: var(--text-muted); padding-left: 1.6em; margin-bottom: 0.5em; }

/* Table of contents (parser-generated) */
.mw-parser-output #toc, .mw-parser-output .toc {
  display: inline-block; background: var(--bg-subtle); border: 1px solid var(--border);
  padding: 8px 14px; margin: 0.5em 0 1em; font-size: 0.9rem;
}
.mw-parser-output .toctitle h2 { font-family: var(--sans); font-size: 0.95rem; font-weight: 700; border: 0; margin: 0; }
.mw-parser-output .toc ul { list-style: none; margin: 0.3em 0 0; }
.mw-parser-output .toc ul ul { margin-left: 1.2em; }
.mw-parser-output .tocnumber { color: var(--text-muted); margin-right: 0.3em; }
.mw-parser-output .toctogglespan, .mw-parser-output .toctogglecheckbox { display: none; }

/* Infobox */
.infobox {
  float: right; clear: right; width: 22em; max-width: 100%;
  margin: 0.5em 0 1em 1.4em; padding: 4px;
  background: var(--bg-subtle); border: 1px solid var(--border);
  border-collapse: separate; border-spacing: 3px; font-size: 0.85rem; line-height: 1.45;
}
.infobox .infobox-title {
  font-family: var(--serif); font-size: 1.2rem; font-weight: 400; padding: 4px 6px 6px;
  background: var(--brand-soft); color: var(--text);
}
.infobox th { text-align: left; vertical-align: top; padding: 3px 6px; width: 38%; }
.infobox td { vertical-align: top; padding: 3px 6px; }
.infobox .infobox-summary { text-align: center; font-style: italic; color: var(--text-muted); }

/* Wikitable */
.wikitable {
  border-collapse: collapse; margin: 0.8em 0; background: var(--bg-subtle);
  border: 1px solid var(--border); font-size: 0.9rem;
}
.wikitable th, .wikitable td { border: 1px solid var(--border); padding: 4px 9px; }
.wikitable th { background: var(--border-subtle); text-align: center; }
.mw-parser-output > table.wikitable { display: block; overflow-x: auto; max-width: 100%; }

/* References (Cite) */
.mw-parser-output sup.reference { line-height: 1; font-size: 0.75em; }
.mw-parser-output ol.references { font-size: 0.875rem; margin-left: 2em; }
.mw-parser-output .mw-cite-backlink { margin-right: 0.3em; }
.mw-parser-output .references li:target { background: var(--brand-soft); }

/* Evidence labels */
.gp-evidence {
  display: inline-block; font-size: 0.72rem; font-weight: 600; line-height: 1.5;
  padding: 0 7px; border-radius: 999px; white-space: nowrap; vertical-align: 0.1em;
  border: 1px solid currentColor; cursor: help;
}
.gp-evidence-confirmed { color: var(--ev-confirmed); background: var(--ev-confirmed-bg); }
.gp-evidence-mechanism { color: var(--ev-mechanism); background: var(--ev-mechanism-bg); }
.gp-evidence-unification { color: var(--ev-unification); background: var(--ev-unification-bg); }
.gp-evidence-hypothesis { color: var(--ev-hypothesis); background: var(--ev-hypothesis-bg); }
.gp-evidence-conventional { color: var(--ev-conventional); background: var(--ev-conventional-bg); }
.gp-evidence-unknown { color: var(--text-muted); }

/* Open tests */
.gp-open-test {
  margin: 0.8em 0; padding: 8px 12px;
  background: var(--ev-hypothesis-bg); border-left: 4px solid var(--ev-hypothesis);
}
.gp-open-test-label {
  font-weight: 700; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ev-hypothesis); margin-right: 6px;
}

/* Wikipedia attribution notice */
.gp-attribution {
  clear: both; margin: 1.5em 0 0; padding: 8px 12px; font-size: 0.8rem;
  color: var(--text-muted); border-top: 1px solid var(--border-subtle); background: var(--bg-subtle);
}

/* Main page */
.gp-mainpage-intro {
  font-size: 1.02rem; background: var(--brand-soft); border: 1px solid var(--border-subtle);
  padding: 14px 18px; margin: 8px 0 12px;
}
.gp-columns { columns: 2 260px; column-gap: 32px; }
.gp-group { break-inside: avoid; padding-top: 0.6em; }
.gp-group dl { margin: 0; }

/* Index lists */
.gp-index { columns: 3 220px; column-gap: 28px; }

/* Categories and footer */
.gp-catlinks {
  clear: both; margin-top: 2em; padding: 6px 10px; font-size: 0.85rem;
  border: 1px solid var(--border); background: var(--bg-subtle);
}
.gp-footer {
  max-width: 1300px; margin: 0 auto; padding: 16px 16px 32px 216px;
  border-top: 1px solid var(--border-subtle); font-size: 0.78rem; color: var(--text-muted);
}
.gp-footer p { margin: 0.4em 0; }

/* ---------- Narrow screens ---------- */

@media (max-width: 900px) {
  .gp-page { grid-template-columns: minmax(0, 1fr); }
  .gp-sidebar { display: none; }
  .gp-menu { display: block; }
  .gp-footer { padding-left: 16px; }
}
@media (max-width: 640px) {
  .gp-header { flex-wrap: wrap; gap: 8px; }
  .gp-search { flex-basis: 100%; max-width: none; order: 3; }
  .gp-motto { display: none; }
  .gp-banner { flex-direction: column; gap: 4px; margin: 0 16px 8px; }
  .infobox { float: none; width: auto; margin: 0.5em 0 1em; }
  .gp-title { font-size: 1.6rem; }
}
@media (max-width: 1332px) {
  .gp-banner { margin-left: 16px; margin-right: 16px; }
}
