/* Wikipedia-style theme for /wiki — serif headings, bordered sections, TOC box,
   blue links. Light by default (classic Wikipedia), with dark + system support. */

:root {
  /* DARK (data-theme=dark, or system on a dark OS) */
  --w-bg: #0f1216;
  --w-content: #15191e;
  --w-text: #e6e9ee;
  --w-muted: #99a2ad;
  --w-line: #2b323b;
  --w-line-soft: #20262d;
  --w-link: #6ea8fe;
  --w-link-visited: #b8a3ec;
  --w-bar: #13171c;
  --w-toc: #12161b;
  --w-accent: #c8f135;
}
:root[data-theme="light"] {
  --w-bg: #f6f7f9;
  --w-content: #ffffff;
  --w-text: #202122;
  --w-muted: #54595d;
  --w-line: #a2a9b1;
  --w-line-soft: #c8ccd1;
  --w-link: #3366cc;
  --w-link-visited: #795cb2;
  --w-bar: #ffffff;
  --w-toc: #f8f9fa;
  --w-accent: #5f8a00;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
    --w-bg: #f6f7f9;
    --w-content: #ffffff;
    --w-text: #202122;
    --w-muted: #54595d;
    --w-line: #a2a9b1;
    --w-line-soft: #c8ccd1;
    --w-link: #3366cc;
    --w-link-visited: #795cb2;
    --w-bar: #ffffff;
    --w-toc: #f8f9fa;
    --w-accent: #5f8a00;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--w-bg);
  color: var(--w-text);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

/* serif headings, the classic Wikipedia signal */
.warticle__title, .wbody h2, .wbody h3, .wbody h4, .wlogo__name {
  font-family: "Linux Libertine", Georgia, "Times New Roman", serif;
}

/* top bar */
.wbar { border-bottom: 1px solid var(--w-line); background: var(--w-bar); }
.wbar__in {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.wlogo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--w-text); }
.wlogo__mark {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--w-accent), transparent 70%), var(--w-content);
  border: 1px solid var(--w-line);
}
.wlogo__name { font-size: 1.3rem; font-weight: 700; }
.wlogo__name span { color: var(--w-muted); }
.wnav { display: inline-flex; align-items: center; gap: 18px; }
.wnav a { color: var(--w-link); text-decoration: none; font-size: 0.9rem; }
.wnav a:hover { text-decoration: underline; }

/* theme switcher (compact) */
.theme { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--w-line); border-radius: 10px; }
.theme__btn { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 7px; background: transparent; color: var(--w-muted); cursor: pointer; }
.theme__btn svg { width: 15px; height: 15px; }
.theme__btn:hover { color: var(--w-text); }
.theme__btn.is-active { background: color-mix(in srgb, var(--w-accent) 18%, transparent); color: var(--w-accent); }

/* page + article */
.wpage { max-width: 1100px; margin: 0 auto; padding: 22px 20px 60px; }
.warticle {
  background: var(--w-content);
  border: 1px solid var(--w-line-soft);
  border-radius: 2px;
  padding: clamp(20px, 4vw, 40px);
}
.warticle__title {
  font-size: clamp(1.7rem, 5vw, 2.3rem);
  font-weight: 400;
  line-height: 1.2;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--w-line);
}
.warticle__sub { color: var(--w-muted); font-style: italic; font-size: 0.85rem; margin: 6px 0 18px; }

/* table of contents */
.wtoc {
  display: inline-block;
  min-width: 240px;
  max-width: 100%;
  margin: 0 0 20px;
  padding: 12px 16px 14px;
  background: var(--w-toc);
  border: 1px solid var(--w-line-soft);
  border-radius: 2px;
}
.wtoc__head { font-weight: 700; font-size: 0.95rem; margin-bottom: 6px; }
.wtoc__list { list-style: none; }
.wtoc__item { margin: 3px 0; }
.wtoc__item--sub { padding-left: 18px; }
.wtoc__item a { color: var(--w-link); text-decoration: none; }
.wtoc__item a:hover { text-decoration: underline; }
.wtoc__num { color: var(--w-muted); margin-right: 5px; }

/* body content */
.wbody { font-size: 0.98rem; }
.wbody > * + * { margin-top: 0.85em; }
.wbody h2 {
  font-size: 1.5rem;
  font-weight: 400;
  margin-top: 1.3em;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--w-line);
}
.wbody h3 { font-size: 1.2rem; font-weight: 700; margin-top: 1.1em; }
.wbody p { line-height: 1.65; }
.wbody a { color: var(--w-link); text-decoration: none; }
.wbody a:visited { color: var(--w-link-visited); }
.wbody a:hover { text-decoration: underline; }
.wbody a .ext { font-size: 0.75em; padding-left: 1px; vertical-align: super; opacity: 0.8; }
.wbody ul, .wbody ol { padding-left: 1.6em; }
.wbody li { margin: 4px 0; line-height: 1.6; }
.wbody hr { border: 0; border-top: 1px solid var(--w-line); margin: 1.4em 0; }
.wbody blockquote { border-left: 3px solid var(--w-line); padding-left: 1em; color: var(--w-muted); }

.warticle__meta {
  margin-top: 28px;
  padding-top: 12px;
  border-top: 1px solid var(--w-line-soft);
  font-size: 0.8rem;
  color: var(--w-muted);
}

/* all-pages list on the index */
.wall { list-style: square; padding-left: 1.5em; margin-top: 10px; }
.wall li { margin: 6px 0; }
.wall a { color: var(--w-link); text-decoration: none; }
.wall a:hover { text-decoration: underline; }
.wall__date { color: var(--w-muted); font-size: 0.85rem; }

/* footer */
.wfoot { border-top: 1px solid var(--w-line); background: var(--w-bar); }
.wfoot__in {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--w-muted);
}
.wfoot a { color: var(--w-link); text-decoration: none; }
.wfoot a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--w-link); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
