/* UC8 Wiki – public design system.
   "Brass & copper" look inspired by steampunk machinery. All colours are custom
   properties in :root; the artwork (static/images/*.svg) is original. No external
   fonts/assets are loaded (privacy + CSP). */

/* Jersey 10 (SIL OFL 1.1, see static/fonts/OFL-Jersey10.txt), self-hosted; used for headings on the public pages. Single weight, so no bold is faked. */
@font-face { font-family: "Jersey 10"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/jersey-10-400.woff2") format("woff2"); }

:root {
  --bg: #f7f9ef; --bg-soft: #eaf0da; --fg: #1a2314; --muted: #55654a;
  --border: #cdd8b8; --accent: #3d6b10; --accent-soft: #dbe8c0; --accent-fg: #ffffff;
  --brass: #7fb523; --copper: #7a4a28; --metal-dark: #0f1712; --edge: #2c3d1f; --btn: #a7d11f; --btn-edge: #2f4a0c;  /* names kept from the brass draft: --brass = lime accent line, --copper = wood brown */
  --code-bg: #e4ebd2; --shadow: 0 1px 3px rgb(20 40 10 / .12);
  --note: #3d6b10; --tip: #2f7d6b; --warning: #a56a0b; --danger: #b8372b;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Rockwell", "Roboto Slab", "Rockwell Nova", ui-serif, Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --header-h: 56px; --sidebar-w: 280px; --toc-w: 230px;
  color-scheme: light;
}
/* Dark theme: explicit choice, or OS preference when nothing is chosen. */
:root[data-theme="dark"] {
  --bg: #0f1712; --bg-soft: #17231a; --fg: #e8efe0; --muted: #9fb08f;
  --border: #2a3b2d; --accent: #b6dc2f; --accent-soft: #263616; --accent-fg: #10180a;
  --code-bg: #1a281d; --shadow: none; --tip: #62c2a8; --warning: #e0a03a; --danger: #ef7a6c;
  --note: #b6dc2f; --brass: #8fbf2a; --edge: #040704; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0f1712; --bg-soft: #17231a; --fg: #e8efe0; --muted: #9fb08f;
    --border: #2a3b2d; --accent: #b6dc2f; --accent-soft: #263616; --accent-fg: #10180a;
    --code-bg: #1a281d; --shadow: none; --tip: #62c2a8; --warning: #e0a03a; --danger: #ef7a6c;
    --note: #b6dc2f; --brass: #8fbf2a; --edge: #040704; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 16px); }
body { margin: 0; font: 16px/1.65 var(--font); background: var(--bg); color: var(--fg); }
a { color: var(--accent); }
h1, h2, h3, h4 { line-height: 1.25; font-family: var(--font-head); letter-spacing: .01em; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-fg); padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; top: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.demo-banner { background: linear-gradient(90deg, #4a2c17, #7a4a28 50%, #4a2c17); color: #fff4e0; text-align: center; padding: 6px 12px; font-size: 14px; }

/* --- header --- */
.site-header { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: var(--header-h); padding: 0 16px; background: var(--bg); border-bottom: 3px solid var(--brass); box-shadow: 0 2px 0 rgb(0 0 0 / .08); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--fg); text-decoration: none; white-space: nowrap; }
.brand { font-family: var(--font-head); font-size: 1.05rem; }
.brand-logo { width: 34px; height: 34px; display: block; border: 2px solid var(--edge); image-rendering: pixelated; }
.brand-sub { color: var(--muted); font-weight: 500; }
.search-form { flex: 1; max-width: 420px; margin-left: auto; display: flex; gap: 8px; }
.search-form input { width: 100%; padding: 8px 12px; font: inherit; color: var(--fg); background: var(--bg-soft); border: 2px solid var(--edge); border-radius: 0; }
.icon-button { border: 2px solid var(--edge); background: var(--bg-soft); color: var(--fg); border-radius: 0; width: 38px; height: 38px; font-size: 18px; cursor: pointer; }
.nav-toggle { display: none; }
button, .button { font: inherit; }
.search-form button, .button { background: var(--btn); color: #10180a; border: 2px solid var(--btn-edge); border-radius: 0; padding: 8px 16px; cursor: pointer; text-decoration: none; display: inline-block; font-weight: 700; }
.search-form button:hover, .button:hover { background: #bfe53a; }
/* --- layout --- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); max-width: 1500px; margin: 0 auto; }
.layout:has(.toc) { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w); }
.sidebar { position: sticky; top: var(--header-h); align-self: start; height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 16px; border-right: 1px solid var(--border); background: var(--bg); }
.content { grid-column: 2; padding: 24px 40px 64px; min-width: 0; width: 100%; max-width: 980px; margin-inline: auto; }
.toc { grid-column: 3; position: sticky; top: var(--header-h); align-self: start; max-height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 24px 16px; font-size: 14px; }
.site-footer { text-align: center; color: var(--muted); font-size: 14px; padding: 24px; border-top: 1px solid var(--border); }

/* --- sidebar navigation --- */
.nav-category { margin-bottom: 8px; }
.nav-category > summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.nav-category > summary a { color: var(--fg); text-decoration: none; }
.nav-list { list-style: none; margin: 0 0 0 4px; padding-left: 12px; border-left: 1px solid var(--border); }
.nav-list .nav-list { margin-left: 0; }
.nav-list a { display: block; padding: 4px 8px; border-radius: 0; color: var(--muted); text-decoration: none; font-size: 15px; }
.nav-list a:hover { background: var(--bg-soft); color: var(--fg); }
.nav-list a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-backdrop { display: none; }

/* --- table of contents --- */
.toc-title { font-weight: 700; margin: 0 0 8px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc a { display: block; padding: 3px 12px; color: var(--muted); text-decoration: none; }
.toc a:hover, .toc a.active { color: var(--accent); }
.toc a.active { border-left: 2px solid var(--accent); margin-left: -1px; }
.toc-level-3 a { padding-left: 24px; }

/* --- home, cards --- */
.hero { position: relative; margin: 0 0 28px; padding: 40px 36px 36px; border-radius: 0; border: 3px solid var(--edge); overflow: hidden; color: #eef5e2;
  background: #0f1712; box-shadow: 5px 5px 0 var(--edge), inset 0 0 0 2px var(--brass); }
.hero::before { content: ""; position: absolute; inset: 0 0 0 auto; width: 50%; background: url("../images/uc8-hero.jpg") center / cover no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 38%); mask-image: linear-gradient(90deg, transparent 0, #000 38%); }
.hero > * { position: relative; max-width: 50%; }
.hero h1 { font-size: 2.4rem; margin: 0 0 8px; color: #d4ef47; text-shadow: 0 2px 0 rgb(0 0 0 / .5); }
.hero .lead { color: #dbe6cc; }
.hero-kicker { display: inline-block; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #b6dc2f; margin: 0 0 8px; }
.lead { font-size: 1.1rem; color: var(--muted); }
.search-form-large { max-width: 560px; margin: 16px 0 0; }
.search-form-large input { padding: 12px 16px; background: #f9fcf2; color: #1a2314; border-color: #8fbf2a; border-radius: 0; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin: 12px 0 32px; }
.card { display: flex; flex-direction: column; gap: 4px; padding: 16px; background: var(--bg-soft); border: 2px solid var(--edge); border-left: 6px solid var(--copper); border-radius: 0; box-shadow: 3px 3px 0 var(--edge); color: var(--fg); text-decoration: none; }
.card:hover { background: var(--accent-soft); }
.card-title { font-weight: 700; color: var(--accent); font-family: var(--font-head); }

/* Category tiles with artwork (templates/wiki/home.html). */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; margin: 12px 0 32px; }
.tile { display: flex; flex-direction: column; background: var(--bg-soft); border: 3px solid var(--edge); border-radius: 0; box-shadow: 4px 4px 0 var(--edge); color: var(--fg); text-decoration: none; }
.tile:hover { background: var(--accent-soft); }
.tile-art { height: 112px; background-color: #2a3a1c; background-size: 64px 64px; background-position: center; border-bottom: 3px solid var(--edge); }
.tile-grass .tile-art { background-image: url("../images/tiles/grass.svg"); }
.tile-planks .tile-art { background-image: url("../images/tiles/planks.svg"); }
.tile-stone .tile-art { background-image: url("../images/tiles/stone.svg"); }
.tile-leaves .tile-art { background-image: url("../images/tiles/leaves.svg"); }
.tile-body { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 16px; }
.tile-title { font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; color: var(--accent); }
.tile-text { color: var(--muted); font-size: 14px; }
.tile-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card-text { color: var(--muted); font-size: 14px; }
.card-meta { color: var(--muted); font-size: 13px; }
.recent-list { list-style: none; padding: 0; }
.recent-list li { padding: 6px 0; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.breadcrumbs { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.breadcrumbs a { color: var(--muted); }
.article-meta { margin-top: -8px; font-size: 14px; }
.results { list-style: none; padding: 0; }
.results li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.results p { margin: 4px 0 0; color: var(--muted); }
.result-title { font-weight: 700; font-size: 1.1rem; margin-right: 8px; }

/* --- rendered article content (.prose) --- */
.prose h2 { margin-top: 2em; padding-bottom: .3em; border-bottom: 1px solid var(--border); }
.prose img { max-width: 100%; height: auto; border-radius: 0; }
.prose blockquote { margin: 1em 0; padding: .1em 1em; border-left: 4px solid var(--border); color: var(--muted); }
.prose code { font-family: var(--mono); font-size: .9em; background: var(--code-bg); padding: .15em .35em; border-radius: 0; }
.prose pre { position: relative; overflow-x: auto; background: var(--code-bg); padding: 14px 16px; border-radius: 0; border: 2px solid var(--edge); }
.prose pre code { background: none; padding: 0; }
.copy-button { position: absolute; top: 6px; right: 6px; font-size: 12px; padding: 2px 8px; background: var(--bg); color: var(--muted); border: 1px solid var(--border); border-radius: 0; cursor: pointer; }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; margin: 1em 0; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.prose th { background: var(--bg-soft); }
.prose th[align="right"], .prose td[align="right"] { text-align: right; }
.prose th[align="center"], .prose td[align="center"] { text-align: center; }
.prose hr { border: 0; border-top: 1px solid var(--border); }
.prose kbd { font-family: var(--mono); font-size: .85em; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: .1em .4em; background: var(--bg-soft); }

/* Admonitions: `!!! warning "Title"` in Markdown. */
.admonition { margin: 1em 0; padding: 0 16px 8px; border-left: 6px solid var(--note); border-radius: 0; background: var(--bg-soft); }
.admonition-title { font-weight: 700; margin-bottom: 0; color: var(--note); }
.admonition.tip, .admonition.hint, .admonition.success { border-color: var(--tip); }
.admonition.tip .admonition-title, .admonition.hint .admonition-title, .admonition.success .admonition-title { color: var(--tip); }
.admonition.warning, .admonition.caution, .admonition.important { border-color: var(--warning); }
.admonition.warning .admonition-title, .admonition.caution .admonition-title, .admonition.important .admonition-title { color: var(--warning); }
.admonition.danger { border-color: var(--danger); }
.admonition.danger .admonition-title { color: var(--danger); }

/* Responsive video embed (`{{youtube:ID}}`). */
.embed-responsive { position: relative; aspect-ratio: 16 / 9; margin: 1em 0; }
.embed-responsive iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0; }

/* --- narrow content column: banner becomes a faint backdrop behind the text --- */
@media (max-width: 1000px) {
  .hero::before { width: 100%; opacity: .22; -webkit-mask-image: none; mask-image: none; }
  .hero > * { max-width: none; }
}
/* --- tablet: drop the table of contents --- */
@media (max-width: 1100px) {
  .layout, .layout:has(.toc) { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
}
/* --- phone: sidebar becomes an off-canvas drawer --- */
@media (max-width: 900px) {
  .layout { display: block; }
  .nav-toggle { display: inline-block; }
  .brand-text { display: none; }
  .content { padding: 16px 16px 48px; }
  .sidebar { position: fixed; left: 0; top: var(--header-h); bottom: 0; width: min(85vw, 320px); height: auto; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .nav-open .sidebar { transform: none; }
  .nav-open .nav-backdrop { display: block; position: fixed; inset: var(--header-h) 0 0 0; background: rgb(0 0 0 / .45); z-index: 35; }
  .search-form { max-width: none; }
  .hero { padding: 24px 18px; }
  .hero > * { max-width: none; }
  .hero h1 { font-size: 1.7rem; }
  body.mc .hero h1 { font-size: 2.6rem; }
}
/* ==========================================================================
   Minecraft menu look – public pages only (templates/base.html sets <body class="mc">).
   The dashboard shares this file and is NOT affected: everything below is scoped to
   body.mc. Original pixel textures (static/images/tiles/*.svg), no game assets.
   Bevel recipe: panel = outer 3px edge + light top-left / dark bottom-right inner
   edge; slot = the same with light and dark swapped (looks pressed in).
   ========================================================================== */
body.mc {
  --bg: #c6c6c6; --bg-soft: #a9a9a9; --fg: #161616; --muted: #3b3b3b; --border: #373737;
  --accent: #1b5004; --accent-soft: #d3e6a8; --accent-fg: #ffffff; --code-bg: #b3b3b3;
  --edge: #000000; --hi: #ffffff; --lo: #555555; --mcbtn: #8b8b8b; --btn: #5ea01f; --btn-edge: #000000;
  --note: #1b5004; --tip: #1b5004; --warning: #7a4a00; --danger: #8c1d12;
  --panel: 0 0 0 3px var(--edge), inset 3px 3px 0 var(--hi), inset -3px -3px 0 var(--lo);
  --slot: 0 0 0 2px var(--edge), inset 2px 2px 0 var(--lo), inset -2px -2px 0 var(--hi);
  background: #2b1d11 url("../images/tiles/dirt.svg") 0 0 / 64px 64px;
  color: var(--fg);
}
:root[data-theme="dark"] body.mc {
  --bg: #3a3a3a; --bg-soft: #262626; --fg: #ececec; --muted: #b8b8b8; --border: #111111;
  --accent: #b6dc2f; --accent-soft: #3f5016; --accent-fg: #10180a; --code-bg: #1f1f1f;
  --hi: #6b6b6b; --lo: #1b1b1b; --mcbtn: #5a5a5a;
  --note: #b6dc2f; --tip: #7ee05a; --warning: #ffb84d; --danger: #ff7a6b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) body.mc {
    --bg: #3a3a3a; --bg-soft: #262626; --fg: #ececec; --muted: #b8b8b8; --border: #111111;
    --accent: #b6dc2f; --accent-soft: #3f5016; --accent-fg: #10180a; --code-bg: #1f1f1f;
    --hi: #6b6b6b; --lo: #1b1b1b; --mcbtn: #5a5a5a;
    --note: #b6dc2f; --tip: #7ee05a; --warning: #ffb84d; --danger: #ff7a6b;
  }
}

/* Pixel headings (falls back to the slab-serif stack while the font loads). Jersey 10 runs narrow and small, so sizes are raised. */
body.mc h1, body.mc h2, body.mc h3, body.mc h4, body.mc .brand, body.mc .card-title, body.mc .tile-title, body.mc .toc-title { font-family: "Jersey 10", var(--font-head); font-weight: 400; font-synthesis: none; letter-spacing: .03em; }
body.mc h1 { font-size: 2.9rem; line-height: 1.1; }
body.mc .hero h1 { font-size: 3.4rem; line-height: 1.05; }
body.mc h2, body.mc .prose h2 { font-size: 2.2rem; line-height: 1.15; }
body.mc h3 { font-size: 1.7rem; }
body.mc .brand { font-size: 1.5rem; }
body.mc .card-title, body.mc .tile-title { font-size: 1.6rem; line-height: 1.1; }
body.mc .toc-title { font-size: 1.3rem; }
body.mc .login-card h1 { font-size: 2.6rem; }

/* header: dark stone bar */
body.mc .site-header { background: #343437 url("../images/tiles/deepslate.svg") 0 0 / 64px 64px; border-bottom: 4px solid #000; box-shadow: 0 3px 0 rgb(0 0 0 / .35); }
body.mc .brand, body.mc .brand-sub { color: #fff; text-shadow: 2px 2px 0 #3f3f3f; }
body.mc .brand-sub { color: #b6dc2f; }
body.mc .brand-logo { border: 2px solid #000; }

/* Minecraft-style controls: bevelled grey buttons, black text fields */
body.mc .icon-button, body.mc .copy-button { background: var(--mcbtn); color: #fff; text-shadow: 2px 2px 0 #3f3f3f; border: 0; border-radius: 0;
  box-shadow: 0 0 0 2px #000, inset 2px 2px 0 rgb(255 255 255 / .55), inset -2px -2px 0 rgb(0 0 0 / .45); }
body.mc .icon-button:hover { background: #7f9a4a; }
body.mc .search-form button, body.mc .button { background: var(--btn); color: #fff; text-shadow: 2px 2px 0 rgb(0 0 0 / .55); border: 0; border-radius: 0; font-weight: 700;
  box-shadow: 0 0 0 2px #000, inset 2px 2px 0 rgb(255 255 255 / .45), inset -2px -2px 0 rgb(0 0 0 / .4); }
body.mc .search-form button:hover, body.mc .button:hover { background: #78bd2c; }
body.mc .search-form button:active, body.mc .button:active { box-shadow: 0 0 0 2px #000, inset 2px 2px 0 rgb(0 0 0 / .4), inset -2px -2px 0 rgb(255 255 255 / .3); }
body.mc .search-form input { background: #000; color: #fff; border: 2px solid #a0a0a0; border-radius: 0; }
body.mc .search-form input::placeholder { color: #8d8d8d; }
body.mc .search-form input:focus-visible { border-color: #fff; outline: none; }

/* layout: three separate menu windows on the dirt background */
body.mc .layout { gap: 24px; padding: 24px 20px 32px; }
body.mc .sidebar { top: calc(var(--header-h) + 24px); height: calc(100vh - var(--header-h) - 48px); border: 0; background: var(--bg); box-shadow: var(--panel); }
body.mc .content { background: var(--bg); box-shadow: var(--panel); padding: 28px 40px 48px; margin-inline: auto; }
body.mc .toc { top: calc(var(--header-h) + 24px); max-height: calc(100vh - var(--header-h) - 48px); background: var(--bg); box-shadow: var(--panel); padding: 16px; }
body.mc .site-footer { color: #fff; text-shadow: 2px 2px 0 #000; border: 0; background: rgb(0 0 0 / .35); }
body.mc .site-footer a { color: #b6dc2f; }

/* navigation inside the sidebar window */
body.mc .nav-list { border-left: 2px solid var(--border); }
body.mc .nav-list a { color: var(--fg); }
body.mc .nav-list a:hover { background: var(--accent-soft); }
body.mc .nav-list a.active { background: var(--btn); color: #fff; text-shadow: 2px 2px 0 rgb(0 0 0 / .55); box-shadow: 0 0 0 2px #000; }
body.mc .toc a { color: var(--muted); }
body.mc .toc ul { border-left: 2px solid var(--border); }

/* home: banner and slots */
body.mc .hero { border: 0; box-shadow: 0 0 0 3px #000, inset 0 0 0 2px #5ea01f; }
body.mc .hero h1 { text-shadow: 3px 3px 0 rgb(0 0 0 / .6); }
body.mc .search-form-large input { background: #000; color: #fff; border: 2px solid #a0a0a0; }
body.mc .card, body.mc .tile { background: var(--bg-soft); border: 0; box-shadow: var(--slot); }
body.mc .card { border-left: 0; padding: 16px 18px; }
body.mc .tile-grid, body.mc .card-grid { gap: 22px; }
body.mc .card:hover, body.mc .tile:hover { background: var(--accent-soft); }
body.mc .tile-art { border-bottom: 3px solid #000; }
body.mc .card-title, body.mc .tile-title { color: var(--accent); }
body.mc .recent-list li, body.mc .results li { border-bottom: 2px solid rgb(0 0 0 / .25); }

/* article content */
body.mc .prose h2 { border-bottom: 3px solid var(--border); }
body.mc .prose pre { border: 0; box-shadow: var(--slot); }
body.mc .prose th, body.mc .prose td { border: 2px solid var(--border); }
body.mc .prose blockquote { border-left: 6px solid var(--border); }
body.mc .prose kbd { border: 2px solid #000; border-bottom-width: 4px; background: var(--mcbtn); color: #fff; text-shadow: 1px 1px 0 #3f3f3f; }
/* admonitions look like item tooltips: near-black violet box, coloured title */
body.mc .admonition { background: #100010; color: #f2f2f2; border: 0; box-shadow: 0 0 0 2px #2b0a63, inset 0 0 0 2px #1a0638; padding: 4px 18px 12px; }
body.mc .admonition-title { color: #55ffff; }
body.mc .admonition.tip .admonition-title, body.mc .admonition.hint .admonition-title, body.mc .admonition.success .admonition-title { color: #55ff55; }
body.mc .admonition.warning .admonition-title, body.mc .admonition.caution .admonition-title, body.mc .admonition.important .admonition-title { color: #ffaa00; }
body.mc .admonition.danger .admonition-title { color: #ff5555; }
body.mc .admonition a { color: #55ffff; }
body.mc .admonition code { background: #2a1f33; color: #fff; }

@media (max-width: 900px) {
  body.mc .layout { padding: 12px 10px 24px; gap: 14px; }
  body.mc .content { padding: 18px 16px 32px; }
  body.mc .sidebar { top: var(--header-h); height: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
