/* MaliWikis (2026-10-21): the article and hub pages that wiki-tools/build.rb
   writes. Uses the space theme's tokens (space.css loads after this and only
   sets tokens + shared skins), so dark and light both follow chamali_theme. */
.wk {
  --wk-w: 1180px;
  max-width: var(--wk-w);
  margin: 0 auto;
  padding: 28px 24px 64px;
  color: var(--text);
  font-family: var(--font-body, "Inter", "SukhumvitSet", sans-serif);
}
.wk a { color: inherit; }
/* one language at a time: html[data-wl] is set before paint (see <head>) */
html[data-wl="en"] .wl-th, html:not([data-wl="en"]) .wl-en { display: none !important; }
.wk-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- head ---------- */
.wk-crumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 22px; padding: 0; font-size: 13px; color: var(--muted); }
.wk-crumbs li { display: flex; align-items: center; gap: 6px; }
.wk-crumbs li + li::before { content: "›"; opacity: .6; }
.wk-crumbs a { text-decoration: none; color: var(--muted); border-radius: 6px; }
.wk-crumbs a:hover { color: var(--accent); }
.wk-crumbs [aria-current] { color: var(--text); font-weight: 600; }

.wk-title { display: flex; align-items: center; gap: 18px; }
.wk-title-ic { flex: none; width: 72px; height: 72px; border-radius: 18px; display: grid; place-items: center; background: var(--surface-soft); border: 1px solid var(--edge); }
.wk-title-ic img { width: 48px; height: 48px; }
.wk-kicker { margin: 0 0 4px; font: 600 12px/1.3 var(--sp-display, inherit); letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.wk h1 { margin: 0; font: 700 clamp(30px, 4.4vw, 52px)/1.15 var(--sp-display, inherit); letter-spacing: -.01em; }
.wk-sum { max-width: 68ch; margin: 18px 0 0; font-size: 18px; line-height: 1.75; color: var(--muted); }
.wk-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 0; font-size: 13px; color: var(--muted); }
.wk-dot { opacity: .5; }
.wk-review { padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.wk-en-note { margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; border: 1px dashed var(--line-strong); font-size: 14px; color: var(--muted); max-width: 68ch; }

/* ---------- article layout ---------- */
.wk-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 48px; margin-top: 36px; align-items: start; }
.wk-side { position: sticky; top: 96px; }
.wk-side-in { display: grid; gap: 18px; }
.wk-info, .wk-toc { border: 1px solid var(--edge); border-radius: var(--radius-lg, 16px); background: var(--surface); }
.wk-info { overflow: hidden; }
.wk-info-h { display: flex; align-items: center; gap: 10px; margin: 0; padding: 14px 16px; background: var(--surface-soft); border-bottom: 1px solid var(--line); font: 700 15px/1.3 var(--sp-display, inherit); }
.wk-info-h img { width: 32px; height: 32px; }
.wk-info dl { margin: 0; padding: 4px 16px 10px; }
.wk-info dl > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 14px; line-height: 1.5; }
.wk-info dl > div:last-child { border-bottom: 0; }
.wk-info dt { color: var(--muted); }
.wk-info dd { margin: 0; font-weight: 600; }
.wk-toc { padding: 4px 6px 8px; }
.wk-toc summary { list-style: none; cursor: pointer; padding: 10px 10px 6px; font: 600 12px/1.3 var(--sp-display, inherit); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.wk-toc summary::-webkit-details-marker { display: none; }
.wk-toc ol { list-style: none; margin: 0; padding: 0; max-height: calc(100vh - 420px); min-height: 120px; overflow: auto; }
.wk-toc a { display: block; padding: 6px 10px; border-radius: 8px; text-decoration: none; font-size: 14px; line-height: 1.45; color: var(--muted); }
.wk-toc .l3 a { padding-left: 24px; font-size: 13px; }
.wk-toc a:hover { color: var(--text); background: var(--fill); }
.wk-toc a.is-on { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

/* ---------- article text ---------- */
.wk-body { max-width: 72ch; font-size: 17px; line-height: 1.85; }
.wk-body > :first-child { margin-top: 0; }
.wk-body h2 { margin: 48px 0 14px; font: 700 26px/1.3 var(--sp-display, inherit); scroll-margin-top: 20px; }
.wk-body h3 { margin: 30px 0 10px; font: 700 19px/1.4 var(--sp-display, inherit); scroll-margin-top: 20px; }
.wk-body p { margin: 0 0 16px; }
.wk-body ul, .wk-body ol { margin: 0 0 18px; padding-left: 1.4em; }
.wk-body li { margin: 6px 0; }
.wk-body li::marker { color: var(--accent); font-weight: 700; }
.wk-body strong { font-weight: 700; }
.wk-body a { color: var(--accent); text-underline-offset: 3px; }
.wk-tip { margin: 22px 0; padding: 16px 18px; border-radius: 14px; border-left: 3px solid var(--accent); background: var(--accent-soft); font-size: 16px; line-height: 1.75; }
.wk-table { margin: 18px 0 24px; overflow-x: auto; border: 1px solid var(--edge); border-radius: 14px; background: var(--surface); }
.wk-table:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wk-table table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.55; }
.wk-table th, .wk-table td { padding: 11px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.wk-table th { background: var(--surface-soft); font-weight: 700; white-space: nowrap; }
.wk-table tr:last-child td { border-bottom: 0; }

/* ---------- crafting grids (Minecraft) ---------- */
.wk-crafts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 18px 0 26px; }
.wk-craft { margin: 0; padding: 14px; border: 1px solid var(--edge); border-radius: 16px; background: var(--surface); }
.wk-craft-row { display: flex; align-items: center; gap: 10px; }
.wk-grid { flex: none; display: grid; grid-template-columns: repeat(3, 30px); grid-auto-rows: 30px; gap: 3px; padding: 4px; border-radius: 8px; background: color-mix(in srgb, var(--text) 10%, transparent); }
.wk-cell { display: grid; place-items: center; border-radius: 5px; background: color-mix(in srgb, var(--text) 6%, transparent); font: 700 13px/1 var(--sp-display, inherit); color: #2b1a12; }
.wk-cell.is-on { background: var(--t); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .14); }
.wk-arrow { flex: none; font-size: 20px; color: var(--muted); }
.wk-craft figcaption { min-width: 0; font: 700 15px/1.35 var(--sp-display, inherit); }
.wk-key { list-style: none; margin: 12px 0 0; padding: 10px 0 0; border-top: 1px dashed var(--line); display: grid; gap: 5px; font-size: 13.5px; line-height: 1.45; }
.wk-body .wk-key li { margin: 0; display: flex; align-items: baseline; gap: 8px; }
.wk-key li span { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; background: var(--t); color: #2b1a12; font-weight: 700; font-size: 11.5px; }

/* the real item icons (2026-10-21): the grid looks like the game's crafting
   window (grey slots with a bevel), icons drawn pixel-sharp; several icons in
   one slot take turns like the recipe book (wiki.js) */
.wk-craft.has-ic .wk-grid { grid-template-columns: repeat(3, 38px); grid-auto-rows: 38px; gap: 2px; padding: 6px; border-radius: 6px; background: #c6c6c6; box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #555; }
.wk-craft.has-ic .wk-cell, .wk-out { border-radius: 0; background: #8b8b8b; box-shadow: inset 2px 2px 0 #373737, inset -2px -2px 0 #fff; }
.wk-craft.has-ic .wk-cell.is-on { background: #8b8b8b; }
.wk-cell img, .wk-out img, .wk-key .has-ic img { display: block; width: 32px; height: 32px; image-rendering: pixelated; }
.wk-out { flex: none; position: relative; display: grid; place-items: center; width: 52px; height: 52px; }
.wk-out img { width: 38px; height: 38px; }
.wk-out b { position: absolute; right: 4px; bottom: 1px; font: 700 15px/1 var(--sp-display, inherit); color: #fff; text-shadow: 2px 2px 0 #3f3f3f; }
.wk-cyc { position: relative; display: block; width: 32px; height: 32px; }
.wk-out .wk-cyc { width: 38px; height: 38px; }
.wk-cyc img { position: absolute; inset: 0; opacity: 0; transform: scale(.7); transition: opacity .25s, transform .3s cubic-bezier(.34, 1.5, .5, 1); }
.wk-cyc img.is-on { opacity: 1; transform: none; }
.wk-key li span.has-ic { width: 26px; height: 26px; background: #8b8b8b; border-radius: 3px; box-shadow: inset 1px 1px 0 #373737, inset -1px -1px 0 #fff; }
.wk-key .has-ic img, .wk-key .has-ic .wk-cyc { width: 22px; height: 22px; }
.wk-craft.has-ic figcaption { flex: 1; }
.wk-craft.has-ic { transition: transform .25s cubic-bezier(.22, 1, .36, 1), border-color .2s; }
.wk-craft.has-ic:hover { transform: translateY(-3px); border-color: var(--accent-line); }

/* ---------- real pictures: cards, lists, figures (2026-10-21) ---------- */
.wk-pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 18px 0 28px; }
.wk-pc { margin: 0; display: flex; flex-direction: column; border: 1px solid var(--edge); border-radius: 16px; background: var(--surface); overflow: hidden; transition: transform .25s cubic-bezier(.22, 1, .36, 1), border-color .2s, box-shadow .25s; }
.wk-pc:hover { transform: translateY(-3px); border-color: var(--accent-line); box-shadow: 0 10px 26px -14px rgba(0, 0, 0, .45); }
.wk-pc-img { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 10; overflow: hidden; background: radial-gradient(70% 80% at 50% 60%, color-mix(in srgb, var(--accent) 14%, var(--surface-soft)), var(--surface-soft)); }
.wk-pc-img img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.22, 1, .36, 1); }
.wk-pc:hover .wk-pc-img img { transform: scale(1.06); }
/* mob renders and structure models stand on their own, uncropped */
.wk-pc-mobs .wk-pc-img, .wk-pc-structures .wk-pc-img { aspect-ratio: 4 / 3; }
.wk-pc-mobs .wk-pc-img img, .wk-pc-structures .wk-pc-img img { left: 9%; top: 7%; width: 82%; height: 86%; object-fit: contain; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .28)); }
.wk-pc-mobs:hover .wk-pc-img img { transform: translateY(-4px) scale(1.06); }
.wk-pc-none .wk-pc-img { display: none; }
.wk-pc figcaption { display: grid; gap: 8px; padding: 12px 14px 14px; }
.wk-pc figcaption > b { font: 700 16px/1.35 var(--sp-display, inherit); }
.wk-pc dl { margin: 0; display: grid; gap: 6px; font-size: 13.5px; line-height: 1.5; }
.wk-pc dt { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; color: var(--muted); }
.wk-pc dd { margin: 1px 0 0; }
.wk-body .wk-plist { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.wk-body .wk-plist li { margin: 0; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--edge); border-radius: 14px; background: var(--surface); font-size: 15px; line-height: 1.55; }
.wk-pl-img { flex: none; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 12px; background: var(--surface-soft); }
.wk-pl-img img { width: 52px; height: 52px; object-fit: contain; }
.wk-fig { margin: 18px 0 26px; }
.wk-fig img { display: block; width: 100%; height: auto; border-radius: 16px; border: 1px solid var(--edge); }
.wk-fig figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) {
  .wk-pc, .wk-pc-img img, .wk-craft.has-ic, .wk-cyc img { transition: none; }
}

/* ---------- cards (hubs + related) ---------- */
.wk-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 30px; }
.wk-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--edge); border-radius: var(--radius-lg, 16px); background: var(--surface); text-decoration: none; transition: transform .2s var(--sp-ease, ease), border-color .2s; }
a.wk-card:hover { transform: translateY(-2px); border-color: var(--accent-line); }
.wk-card-ic { flex: none; width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-soft); }
.wk-card-ic img { width: 38px; height: 38px; }
.wk-card-t { display: grid; gap: 3px; min-width: 0; }
.wk-card-t b { font: 700 16px/1.3 var(--sp-display, inherit); }
.wk-card-t small { font-size: 13px; line-height: 1.5; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wk-card-t em { font-style: normal; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.wk-card > i { margin-left: auto; flex: none; font-style: normal; font-size: 20px; color: var(--muted); }
.wk-card.is-soon { opacity: .7; border-style: dashed; }
.wk-related { margin-top: 64px; }
.wk-related h2 { margin: 0; font: 700 22px/1.3 var(--sp-display, inherit); }
.wk-related .wk-cards { margin-top: 16px; }
.wk-hub-body { margin-top: 36px; }
.wk-legal { max-width: 80ch; margin: 48px 0 0; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.7; color: var(--muted); }

/* ---------- search (wiki home) ---------- */
.wk-search { position: relative; max-width: 620px; margin-top: 28px; }
.wk-search input { width: 100%; box-sizing: border-box; height: 52px; padding: 0 18px 0 48px; border-radius: 999px; border: 1px solid var(--edge); background: var(--surface) no-repeat 18px 50% / 18px; color: var(--text); font: inherit; font-size: 16px; }
.wk-search::before { content: ""; position: absolute; left: 18px; top: 17px; width: 13px; height: 13px; border: 2px solid var(--muted); border-radius: 50%; pointer-events: none; }
.wk-search::after { content: ""; position: absolute; left: 31px; top: 31px; width: 7px; height: 2px; background: var(--muted); transform: rotate(45deg); border-radius: 2px; pointer-events: none; }
.wk-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.wk-results:empty { display: none; }
.wk-results { margin-top: 12px; display: grid; gap: 8px; }
.wk-results .wk-none { margin: 0; padding: 12px 4px; color: var(--muted); font-size: 15px; }
.wk-hub.is-searching #wkCards { display: none; }

/* ---------- light / dark details ---------- */
html[data-theme="dark"] .wk-title-ic, html[data-theme="dark"] .wk-card-ic { background: #0b0908 var(--sp-stars-dark) 0 0 / 160px; border-color: rgba(255, 243, 228, .12); }

/* ---------- tablet and phone ---------- */
@media (max-width: 1023px) {
  .wk-layout { grid-template-columns: minmax(0, 1fr); gap: 22px; margin-top: 26px; }
  .wk-side { position: static; }
  .wk-side-in { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .wk-toc ol { max-height: none; }
}
@media (max-width: 700px) {
  .wk { padding: 16px 16px 120px; }
  .wk-crafts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .wk-craft { padding: 10px; }
  .wk-craft-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .wk-grid { grid-template-columns: repeat(3, 26px); grid-auto-rows: 26px; }
  .wk-arrow { display: none; }
  .wk-craft.has-ic .wk-craft-row { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .wk-craft.has-ic .wk-grid { grid-template-columns: repeat(3, 30px); grid-auto-rows: 30px; padding: 4px; }
  .wk-craft.has-ic .wk-cell img, .wk-craft.has-ic .wk-cell .wk-cyc { width: 24px; height: 24px; }
  .wk-out { width: 42px; height: 42px; }
  .wk-out img, .wk-out .wk-cyc { width: 30px; height: 30px; }
  .wk-craft.has-ic figcaption { flex-basis: 100%; }
  .wk-pcards { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .wk-pc figcaption { padding: 10px 11px 12px; }
  .wk-pc figcaption > b { font-size: 15px; }
  .wk-body .wk-plist { grid-template-columns: minmax(0, 1fr); }
  .wk-crumbs ol { margin-bottom: 16px; }
  .wk-title { gap: 14px; }
  .wk-title-ic { width: 56px; height: 56px; border-radius: 14px; }
  .wk-title-ic img { width: 38px; height: 38px; }
  .wk h1 { font-size: 28px; }
  .wk-sum { font-size: 16px; margin-top: 14px; }
  .wk-side-in { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .wk-info dl > div { grid-template-columns: 92px minmax(0, 1fr); }
  .wk-toc ol { padding-bottom: 4px; }
  .wk-body { font-size: 16px; line-height: 1.8; }
  .wk-body h2 { font-size: 22px; margin-top: 38px; }
  .wk-body h3 { }
  .wk-table table { font-size: 14px; }
  .wk-table th { white-space: normal; min-width: 88px; }
  .wk-cards { grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 22px; }
  .wk-search { margin-top: 20px; }
}
@media (prefers-reduced-motion: reduce) { .wk-card { transition: none; } }
