/* The wiki window: section tabs, then the outline sidebar beside the article.
   Builds on /site.css (tokens, site bar, windows, buttons, tips). */

/* ---------- section tabs, like the mod's storage screen */
.tabs { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.tab {
  position: relative; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 10px;
  background: var(--row); border: 2px solid var(--border); border-bottom: 0;
  color: var(--text); font: 16px var(--pixel); text-decoration: none; white-space: nowrap; overflow: hidden;
}
.tab:hover { background: var(--row-hover); color: var(--text); }
.tab.on { background: var(--green); }
.tab span { overflow: hidden; text-overflow: ellipsis; }

.body {
  margin-top: 12px; background: var(--panel-dark); padding: 24px 24px 28px;
  display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; align-items: start;
}

/* ---------- sidebar: search, then the page's outline as plain rows */
.side { position: sticky; top: 84px; }
.side .editbox { margin-bottom: 14px; }
/* Search results: outline-style rows, the page each one is on under it in grey. */
.search-results { list-style: none; margin: 0 0 14px; padding: 0 0 10px; border-bottom: 2px solid var(--rule); }
.search-results .jl { padding: 5px 10px; line-height: 1.35; color: var(--text); }
.search-results .where { display: block; font-size: 14px; color: var(--muted); }
.search-results .none { padding: 3px 10px; color: var(--muted); }
.outline > summary { display: none; }
.side-list { max-height: calc(100vh - 160px); overflow-y: auto; padding-right: 6px; }
/* An h2 with h3s: a green label over its indented links. A lone h2 is a plain link
   lined up with the labels. */
.group { display: flex; align-items: center; gap: 10px; padding-left: 10px; font: 15px var(--pixel); color: var(--accent); margin: 16px 0 4px; }
.group:first-child { margin-top: 0; }
.group::after { content: ''; flex: 1; height: 2px; background: var(--rule); }
.kids { margin-bottom: 12px; }
.kids .jl { padding-left: 24px; }
.jl { display: block; padding: 3px 10px; color: var(--muted); font: 17px/1.55 var(--plain); text-decoration: none; }
.jl:hover { background: var(--row); color: var(--text); }
/* The open page, on a hand-written page's outline: the only row drawn as a card. */
.jl.on {
  position: relative; display: flex; align-items: center; gap: 10px; height: 44px; margin: 4px 0; padding: 0 6px;
  background: var(--row-selected); border: 2px solid var(--border); color: var(--text);
}
.jl.on::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--accent); }

/* ---------- the article: plain text on the dark body. Only pictures get a frame.
   Heading fonts and link colours come from /site.css. */
.article { max-width: 820px; min-width: 0; }
.heading { display: flex; align-items: center; gap: 12px; margin: 8px 0 16px; }
.heading h1 { margin: 0; }
.article * + h2 { margin-top: 40px; }
.article h2 + h3 { margin-top: 0; }
.article ul { list-style: none; margin: 0 0 14px; padding: 0; }
.article ul li { position: relative; padding-left: 18px; margin: 6px 0; }
.article ul li::before { content: ''; position: absolute; left: 2px; top: .66em; width: 6px; height: 6px; background: var(--dim); }
.article > ol { margin: 0 0 14px; padding-left: 26px; }
.article > ol li { margin: 6px 0; padding-left: 4px; }
.article > ol li::marker { color: var(--dim); font-weight: 700; }
.article code { font: 15px var(--plain); color: #e0e0e0; background: #000; border: 2px solid #a0a0a0; padding: 1px 7px; }
.article .pic { margin: 16px 0 20px; }
.more { margin: 0 0 16px; }
.prevnext { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; padding-top: 18px; border-top: 2px solid var(--rule); }
.credit { margin: 16px 0 0; font: 15px var(--plain); color: var(--dim); }
.credit a { color: var(--muted); }

/* ---------- hand-written pages (e.g. Lumberjack): extra parts the import never makes */
.back { font: 16px var(--plain); color: var(--muted); text-decoration: none; }
.back:hover { color: var(--text); }

/* The top: text on the left, the facts card and pictures in a column on the right. */
.overview { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 32px; align-items: start; }
.overview > :last-child .pic { margin: 16px 0 0; }
.facts { background: var(--row); border: 2px solid var(--border); }
.facts img { display: block; width: 100%; height: auto; border-bottom: 2px solid var(--border); }
.facts dl { margin: 0; padding: 4px 12px 6px; font: 16px/1.35 var(--plain); }
.facts div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; }
.facts div + div { border-top: 2px solid var(--panel); }
.facts dt { flex: none; color: var(--muted); }
.facts dd { margin: 0; text-align: right; }

/* Two plain lists side by side, each h3 marked with a green or red square. */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin: 4px 0 8px; }
.article .cols h3 { display: flex; align-items: center; gap: 10px; font: 16px var(--pixel); color: var(--text); margin: 0 0 4px; }
.cols h3::before { content: ''; flex: none; width: 10px; height: 10px; background: var(--accent); }
.cols .keep h3::before { background: var(--denied); }

/* A working copy of one of the mod's screens (wiki.js runs it; nothing is saved).
   Vanilla textures are allowed in here and nowhere else. */
.mcwin { max-width: 604px; margin: 6px 0 14px; background: #242424; border: 2px solid #121212; padding: 0 16px 16px; }
.mcwin button { appearance: none; margin: 0; cursor: pointer; }
.mcwin .wt { display: flex; align-items: center; gap: 10px; height: 44px; font: 16px var(--pixel); color: var(--text); }
.mcwin .wtabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mcwin .wtab {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 6px;
  background: var(--row); border: 2px solid var(--rule); border-bottom: 0; color: var(--text); font: 16px var(--pixel);
}
.mcwin .wtab:hover { background: var(--row-hover); }
.mcwin .wtab.on { background: var(--green); }
.mcwin .wtab.on::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--accent); }
.mcwin .inset { background: var(--view); padding: 4px; margin-top: 8px; display: grid; gap: 4px; min-height: 224px; align-content: start; }
.mcwin .inset[hidden] { display: none; }
.srow {
  display: flex; align-items: center; width: 100%; height: 40px; padding: 0 10px 0 14px; border: 0;
  background: #282828; color: var(--text); font: 17px var(--plain); text-align: left; user-select: none;
}
.srow:hover { background: #303030; }
.srow .lbl { margin-right: auto; }
.srow .state { margin-right: 8px; color: var(--off-text); }
.srow.is-on .state { color: var(--on); }
.switch { width: 68px; height: 24px; background: var(--off); position: relative; }
.switch::after { content: ''; position: absolute; top: 2px; left: 4px; width: 20px; height: 20px; background: #fff; }
.srow.is-on .switch { background: var(--on); }
.srow.is-on .switch::after { left: 44px; }
.action { position: relative; width: 176px; height: 36px; display: grid; place-items: center; background: var(--row); border: 2px solid var(--border); }
.srow:hover .action { background: var(--row-hover); }
.action::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--accent); }
.action.cut::after { background: var(--gold); }
.action.leave { color: #ccc; }
.action.leave::after { background: var(--off-text); }
.sheading { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 8px; color: var(--accent); font: 16px var(--pixel); }
.sheading::after { content: ''; flex: 1; height: 2px; background: var(--rule); }

/* The skill track over a levels table, like the job screen's level bar. */
.track { margin: 10px 0 18px; }
.bar { height: 16px; background: var(--border); padding: 2px; }
.bar > div { height: 100%; background: #090909; padding: 2px 0; }
.bar > div > div { height: 100%; background: var(--accent); }
.ticks { position: relative; height: 28px; font: 15px var(--plain); color: var(--muted); }
.ticks span { position: absolute; top: 6px; transform: translateX(-50%); }
.ticks span:first-child { transform: none; }
.ticks span:last-child { transform: translateX(-100%); }

/* ---------- narrow windows: the other tabs shrink to their texture */
@media (max-width: 1230px) {
  .tabs { display: flex; }
  .tab { flex: 1 1 0; justify-content: center; padding: 0 4px; }
  .tab.on { flex: 3 1 auto; justify-content: flex-start; padding: 0 10px; }
  .tab:not(.on) span { display: none; }
}
/* The overview's right column goes under the text. */
@media (max-width: 1000px) {
  .overview { grid-template-columns: 1fr; }
  .overview > :last-child { max-width: 420px; }
}
/* Phones: the sidebar goes above the article, with the outline in a fold. */
@media (max-width: 860px) {
  .tabs { gap: 4px; }
  .tab.on { flex: 0 0 auto; }
  .tab:not(.on) { padding: 0; }
  .body { grid-template-columns: 1fr; gap: 20px; padding: 12px; }
  .side { position: static; }
  .outline > summary {
    list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 10px; height: 36px; padding: 0 14px;
    background: var(--row); border: 2px solid var(--border); font: 16px var(--plain); color: var(--text);
  }
  .outline > summary::-webkit-details-marker { display: none; }
  .outline > summary:hover { background: var(--row-hover); border-color: var(--border-hover); }
  .outline > summary::before { content: '+'; color: var(--accent); }
  .outline[open] > summary::before { content: '-'; }
  .side-list { max-height: none; overflow: visible; margin-top: 12px; }
  .cols { grid-template-columns: 1fr; gap: 12px; }
  .action { width: 120px; }
}
/* Small phones: the other tabs are narrower than a 32px texture, so draw theirs
   at the texture's own 16px rather than cut it off. */
@media (max-width: 520px) {
  .tab:not(.on) .tex { width: 16px; height: 16px; }
  /* The settings window's tabs too: only the open one keeps its label. */
  .mcwin { padding: 0 8px 8px; }
  .mcwin .wtabs { display: flex; gap: 4px; }
  .mcwin .wtab { flex: 1 1 0; }
  .mcwin .wtab.on { flex: 0 0 auto; padding: 0 10px; }
  .mcwin .wtab:not(.on) span { display: none; }
}
