/* ==========================================================================
   nuxx.net wiki archive — restyle
   Drop-in overrides that bring the mwoffliner/Minerva static export in line
   with the "nuxx Modern" WordPress theme: forest-green masthead, a green
   accent system, a centered content card, and cleaner typography.

   Loaded LAST (after the Minerva modules) so plain selectors win; a few
   !important flags override Minerva's own !important / positioning rules.
   Authored in OKLCH — same tokens as the WordPress theme.
   ========================================================================== */

:root {
  --canvas:       oklch(0.93 0.008 160);
  --bg:           oklch(0.99 0.005 155);
  --surface:      #ffffff;
  --ink:          oklch(0.24 0.015 160);
  --ink-soft:     oklch(0.40 0.015 160);
  --ink-faint:    oklch(0.56 0.014 160);
  --line:         oklch(0.90 0.008 160);
  --line-strong:  oklch(0.80 0.010 160);
  --accent:       oklch(0.48 0.11 155);
  --accent-hover: oklch(0.40 0.11 155);
  --accent-soft:  oklch(0.93 0.045 155);
  --header-bg:    oklch(0.32 0.05 158);
  --header-ink:   oklch(0.98 0.01 150);
  --header-muted: oklch(0.80 0.03 155);
  --header-line:  oklch(1 0 0 / .14);
  --shadow: 0 1px 2px oklch(0.2 0.02 160 / .05), 0 30px 70px -40px oklch(0.2 0.03 160 / .3);
  --ui-font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --serif-font: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Times New Roman', serif;
  --mono-font: ui-monospace, 'SF Mono', 'Menlo', 'Consolas', monospace;
  --shell: 1392px;   /* matches the nuxx Modern blog theme shell width */
  /* external-link glyph (Feather "external-link"); tinted via currentColor mask */
  --ext-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23000'%20stroke-width='2.25'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M14%203h7v7'/%3E%3Cpath%20d='M21%203l-9%209'/%3E%3Cpath%20d='M19%2013v6a2%202%200%200%201-2%202H5a2%202%200%200%201-2-2V7a2%202%200%200%201%202-2h6'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   Page canvas + centered content card
   -------------------------------------------------------------------------- */
html, body.mediawiki { background: var(--canvas) !important; }

#mw-mf-viewport { padding: 22px 20px 0; background: var(--canvas); }

/* Injected chrome should size like the card (border-box), so max-width caps the
   full box, not just the content — keeps masthead/footer aligned with the card. */
.nx-masthead, #content.mw-body, .nx-footer-inner { box-sizing: border-box; }

/* Neutralize Minerva's absolute/translate positioning AND its full-height
   stretch (height/min-height:100%), then re-flow as a normal centered column
   that shrinks to its content (so the footer follows the article). */
#mw-mf-viewport { height: auto !important; min-height: 0 !important; }
#mw-mf-page-center {
  position: static !important;
  left: auto !important; right: auto !important;
  width: auto !important; height: auto !important; min-height: 0 !important;
  max-width: var(--shell);
  margin: 0 auto !important;
  overflow: visible !important;
  transform: none !important;
  background: transparent !important;
  box-shadow: none;
}

/* The white article card. */
#content.mw-body {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-top: 0;
  border-bottom: 0;
  box-shadow: var(--shadow);
  padding: 8px 40px 44px !important;
  overflow: hidden; /* contain floated thumbnails */
}

/* --------------------------------------------------------------------------
   Masthead (injected <header class="nx-masthead">) — forest-green bar atop the
   card, brand links back to the wiki home.
   -------------------------------------------------------------------------- */
.nx-masthead {
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: 4px 20px;
  background: var(--header-bg);
  padding: 18px 40px;
  border: 1px solid var(--header-line);
  border-bottom: 0;
}
/* :link/:visited included so these beat Minerva's `a:visited{color:#5a3696}`
   (0,1,1) rule, which would otherwise turn the brand purple once visited. */
.nx-brand, .nx-brand:link, .nx-brand:visited {
  font-family: var(--ui-font); font-weight: 800; font-size: 20px;
  letter-spacing: -.02em; line-height: 1; color: var(--header-ink);
  text-decoration: none;
}
.nx-brand span { color: var(--header-muted); font-weight: 600; }
.nx-brand:hover span { color: var(--header-ink); }

/* --------------------------------------------------------------------------
   Footer (injected <footer class="nx-footer">) — bookends the masthead.
   Body-level element; inner block re-centers to the card's width.
   -------------------------------------------------------------------------- */
.nx-footer { padding: 0 20px 56px; background: var(--canvas); }
.nx-footer-inner {
  max-width: var(--shell); margin: 0 auto;
  background: var(--header-bg); color: var(--header-muted);
  border: 1px solid var(--header-line); border-top: 0;
  box-shadow: var(--shadow);
  padding: 26px 40px;
  display: flex; flex-direction: column; gap: 14px;
}
.nx-footer-note {
  margin: 0; font-family: var(--ui-font); font-size: 13.5px;
  line-height: 1.65; color: var(--header-muted); max-width: 74ch;
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
.mw-body,
.mw-body p {
  font-family: var(--ui-font);
  color: var(--ink-soft);
}
.mw-body { font-size: 16px; line-height: 1.65; }
.mw-body p { margin: 0 0 1.1em; }

/* Keep text column comfortably narrow inside the wider card. */
#mw-mf-page-center .content,
#mw-mf-page-center .pre-content,
#mw-mf-page-center .post-content { max-width: none; }

/* Page title (injected <h1 class="nx-page-title"> — Minerva omits an on-page
   title, so the reader lands with no heading). */
.nx-page-title {
  font-family: var(--ui-font);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.12;
  color: var(--ink);
  margin: .4em 0 .7em;
  padding-bottom: .45em;
  border-bottom: 1px solid var(--line);
}

/* Headings — sans, tight, green underline on h2 instead of flat gray. */
.mw-body h1, .mw-body h2, .mw-body h3,
.mw-body h4, .mw-body h5, .mw-body h6 {
  font-family: var(--ui-font);
  color: var(--ink);
  font-weight: 700;
  line-height: 1.25;
  padding: 0;
}
.mw-body h2 {
  font-size: 23px;
  letter-spacing: -.012em;
  margin: 1.6em 0 .6em;
  padding-bottom: .3em;
  border-bottom: 2px solid var(--accent-soft);
}
.mw-body h3 { font-size: 19px; margin: 1.4em 0 .5em; border-bottom: 0; }
.mw-body h4 { font-size: 16.5px; margin: 1.2em 0 .4em; border-bottom: 0; }

/* Links — match the blog: theme green, semibold, always underlined. */
.mw-body a,
#content a:not(.image) {
  color: var(--accent); font-weight: 600;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px;
}
.mw-body a:hover,
#content a:not(.image):hover { color: var(--accent-hover); text-decoration-thickness: 2px; }
/* Image/thumbnail links carry no text — keep them undecorated. */
#content a.image, #content .thumb a { text-decoration: none; font-weight: 400; }

/* External-link icon — Minerva ships a hardcoded BLUE arrow (stroke #06c /
   fill #06f), which clashed with the green links. Replace it with a mask-driven
   glyph tinted with currentColor, so it always matches the link (incl. hover).
   :not(:empty) leaves any auto-numbered [1] ExtLinks alone. */
.mw-body a.external { background-image: none !important; padding-right: 0 !important; }
.mw-body a.external:not(:empty)::after {
  content: ""; display: inline-block;
  width: .66em; height: .66em; margin-left: .22em; vertical-align: -0.01em;
  background-color: currentColor;
  -webkit-mask: var(--ext-icon) no-repeat center / contain;
  mask: var(--ext-icon) no-repeat center / contain;
}

/* --------------------------------------------------------------------------
   Blockquotes, code, tables
   -------------------------------------------------------------------------- */
.mw-body blockquote {
  font-family: var(--ui-font) !important;
  font-size: 15px !important;
  color: var(--ink) !important;
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 12px 20px !important;
  quotes: none !important;
}
.mw-body blockquote:before,
.mw-body blockquote:after { content: "" !important; }

.mw-body pre,
.mw-body code,
.mw-body tt {
  font-family: var(--mono-font);
  font-size: 13.5px;
}
.mw-body pre {
  background: var(--bg);
  border: 1px solid var(--line) !important;
  border-radius: 10px;
  padding: 14px 16px !important;
  color: var(--ink);
  line-height: 1.55;
}
.mw-body code, .mw-body tt {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
  color: var(--ink);
}
.mw-body pre code, .mw-body pre tt { background: none; border: 0; padding: 0; }

.mw-body table.wikitable {
  border-collapse: collapse;
  border: 1px solid var(--line);
  font-size: 14.5px;
}
.mw-body table.wikitable > tr > th,
.mw-body table.wikitable > * > tr > th,
.mw-body table.wikitable > tr > td,
.mw-body table.wikitable > * > tr > td {
  border: 1px solid var(--line);
  padding: 8px 12px;
}
.mw-body table.wikitable > tr > th,
.mw-body table.wikitable > * > tr > th {
  background: var(--bg);
  color: var(--ink);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Thumbnails / figures — match the theme's bordered image card
   -------------------------------------------------------------------------- */
.thumbinner {
  background: var(--bg) !important;
  border: 1px solid var(--line) !important;
  border-radius: 0 !important;
  padding: 6px !important;
}
.thumbimage, .thumbinner img { border: 1px solid var(--ink) !important; }
.thumbcaption {
  font-size: 12.5px !important;
  line-height: 1.5 !important;
  color: var(--ink-faint) !important;
  font-style: italic;
  padding: 8px 2px 2px !important;
}

/* --------------------------------------------------------------------------
   Lists + Main Page groups
   -------------------------------------------------------------------------- */
.mw-body ul, .mw-body ol { margin: 0 0 1.1em; padding-left: 1.4em; }
.mw-body li { margin: .3em 0; line-height: 1.55; }

.mwo-groups h3 {
  color: var(--accent);
  border-bottom: 1px solid var(--line);
  padding-bottom: .2em;
}

/* Category footer (defensive — styled as chips if present). */
.mwo-catlinks {
  background: var(--bg) !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px;
  padding: 8px 12px !important;
}
.mwo-catlinks li { border-left-color: var(--line) !important; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 720px) {
  #mw-mf-viewport { padding: 12px 12px 40px; }
  #content.mw-body { padding: 4px 20px 32px !important; }
  #mw-mf-page-center::before { padding: 16px 20px; font-size: 18px; }
  #mw-mf-page-center::after { padding: 0 20px 14px; }
}
