/* Torchdelve Wiki: a reference work in the game's colours. Long-form reading first. */
body.wiki { background: var(--ink); color: var(--bone); min-height: 100vh; }
.wiki .skip { position: absolute; left: -9999px; }
.wiki .skip:focus { left: 16px; top: 8px; z-index: 50; background: var(--torch); color: var(--ink); padding: .4rem .8rem; border-radius: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Top bar */
.wiki-top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem;
  padding: .6rem max(16px, calc((100vw - 78rem) / 2)); padding-top: calc(.6rem + env(safe-area-inset-top));
  background: rgba(14, 12, 10, .96); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px);
}
.wiki-brand { text-decoration: none; white-space: nowrap; }
.wiki-brand span { font: 700 1.7rem/1 var(--display); color: var(--torch); text-shadow: 0 0 14px var(--torch-glow); }
.wiki-brand em { font: 600 .95rem var(--body); font-style: normal; color: var(--bone-dim); letter-spacing: .04em; margin-left: .2rem; }
.wiki-search { flex: 1; max-width: 26rem; margin-left: auto; }
.wiki-search input {
  width: 100%; padding: .45rem .8rem; font: inherit; font-size: .95rem; color: var(--bone);
  background: var(--stone); border: 1px solid var(--line); border-radius: 6px;
}
.wiki-search input:focus { outline: 2px solid var(--torch); outline-offset: 1px; }
.wiki-play { text-decoration: none; white-space: nowrap; }

/* Layout: contents on the left, articles on the right */
.wiki-layout { display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); gap: 2.5rem; max-width: 78rem; margin: 0 auto; padding: 1.5rem 16px 4rem; }
.wiki-nav { position: sticky; top: 4.4rem; align-self: start; max-height: calc(100vh - 5.5rem); overflow-y: auto; padding-right: .4rem; }
.wiki-nav-toggle { display: none; }
.nav-group { margin: 1.1rem 0 .3rem; font-size: .78rem; font-weight: 700; color: var(--torch); letter-spacing: .04em; }
.nav-group:first-child { margin-top: 0; }
.wiki-nav ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.wiki-nav a { display: block; padding: .22rem 0 .22rem .8rem; margin-left: -1px; border-left: 2px solid transparent; color: var(--bone-dim); text-decoration: none; font-size: .92rem; }
.wiki-nav a:hover { color: var(--bone); }
.wiki-nav a.current { color: var(--bone); border-left-color: var(--torch); font-weight: 600; }
.wiki-nav li.miss { display: none; }

/* Articles */
.wiki-main { min-width: 0; }
.wiki-meta { color: var(--bone-dim); font-size: .85rem; margin: 0 0 1rem; }
.wiki-empty { padding: 2rem 0; color: var(--bone-dim); }
.article { padding: 1.4rem 0 2rem; border-top: 1px solid var(--line); scroll-margin-top: 4.6rem; line-height: 1.65; }
.article:first-of-type { border-top: 0; padding-top: 0; }
.article[hidden] { display: none; }
.crumb { margin: 0; font-size: .78rem; font-weight: 700; color: var(--torch); letter-spacing: .04em; }
.article h2 { position: relative; font: 700 clamp(1.9rem, 4vw, 2.4rem)/1.1 var(--display); color: var(--bone); margin: .15rem 0 .8rem; }
.article h2 .anchor { position: absolute; left: -1.1em; color: var(--line); text-decoration: none; opacity: 0; transition: opacity .15s; }
.article h2:hover .anchor { opacity: 1; }
.article h3 { font: 700 1.35rem/1.2 var(--display); color: var(--bone); margin: 1.6rem 0 .5rem; }
.article h4 { font: 700 1.2rem/1.2 var(--display); color: var(--bone); margin: 0; }
.article p, .article li, .article dd { max-width: 72ch; }
.article a { color: var(--torch); }
.article a:focus-visible { outline: 2px solid var(--torch); outline-offset: 2px; }
.lede { font-size: 1.1rem; }
.small { font-size: .85rem; color: var(--bone-dim); }
.muted { color: var(--bone-dim); font-weight: 400; }
.article ul, .article ol { padding-left: 1.3rem; }
.article li { margin-bottom: .3rem; }
.article li::marker { color: var(--torch); }
ol.steps li { margin-bottom: .45rem; }

/* Definition lists and FAQ */
.deflist, .faq { margin: .6rem 0 0; }
.deflist dt, .faq dt { font-weight: 700; color: var(--bone); margin-top: .8rem; }
.deflist dd, .faq dd { margin: .15rem 0 0; color: #d7d0bd; }

/* Callouts */
.callout { display: flex; gap: .8rem; margin: 1.1rem 0; padding: .7rem .9rem; border-radius: 6px; border: 1px solid var(--line); background: var(--stone); font-size: .95rem; }
.callout strong { flex: none; font-size: .78rem; letter-spacing: .04em; padding-top: .15rem; min-width: 4.2rem; }
.callout div { min-width: 0; }
.callout-math { border-left: 3px solid #5a92d6; } .callout-math strong { color: #8fb6ea; }
.callout-rule { border-left: 3px solid var(--torch); } .callout-rule strong { color: var(--torch); }
.callout-tip { border-left: 3px solid var(--good); } .callout-tip strong { color: var(--good); }

/* Tables: scroll sideways inside their own box on narrow screens, never the page */
.tbl { overflow-x: auto; margin: .8rem 0 1rem; border: 1px solid var(--line); border-radius: 6px; }
.tbl table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.tbl th, .tbl td { padding: .45rem .7rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.tbl thead th { background: var(--stone-2); color: var(--bone-dim); font-weight: 700; white-space: nowrap; }
.tbl tbody th { font-weight: 600; color: var(--bone); white-space: nowrap; }
.tbl tbody tr:last-child th, .tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:nth-child(even) { background: rgba(255, 255, 255, .02); }
.tbl small { display: block; color: var(--bone-dim); font-size: .8rem; }

/* Quest chains */
.chain { border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem; margin: 1rem 0; background: rgba(30, 38, 41, .5); scroll-margin-top: 4.6rem; }
.chain header { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .8rem; }
.chain .stars { color: var(--torch); letter-spacing: .1em; }
.chain .intro { margin: .4rem 0 .5rem; font-style: italic; color: #d7d0bd; }
.chain-steps { margin: 0; padding-left: 1.3rem; }
.chain-steps li { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .2rem 0; border-bottom: 1px dashed rgba(58, 69, 65, .6); max-width: none; }
.chain-steps li em { font-style: normal; color: var(--bone-dim); font-size: .85rem; white-space: nowrap; }
.chain .final { margin: .6rem 0 0; font-size: .92rem; }

mark { background: rgba(229, 164, 67, .35); color: inherit; border-radius: 2px; }
.wiki-foot { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--bone-dim); font-size: .9rem; }

@media (max-width: 900px) {
  .wiki-layout { grid-template-columns: 1fr; gap: 1rem; padding-top: 1rem; }
  .wiki-nav { position: static; max-height: none; overflow: visible; padding: 0; }
  .wiki-nav-toggle {
    display: flex; justify-content: space-between; width: 100%; padding: .6rem .8rem; cursor: pointer;
    font: 700 .95rem var(--body); color: var(--bone); background: var(--stone); border: 1px solid var(--line); border-radius: 6px;
  }
  .wiki-nav-toggle::after { content: "▾"; color: var(--torch); }
  .wiki-nav-toggle[aria-expanded="true"]::after { content: "▴"; }
  .wiki-nav-list { display: none; padding: .6rem .2rem 0; }
  .wiki-nav.open .wiki-nav-list { display: block; }
  .article h2 .anchor { display: none; }
}
@media (max-width: 560px) {
  .wiki-top { flex-wrap: wrap; gap: .5rem .8rem; }
  .wiki-search { order: 3; flex-basis: 100%; max-width: none; }
  .wiki-play { margin-left: auto; }
}

/* Definition box: what a thing IS, first in every article */
.definition { margin: .2rem 0 1.1rem; padding: .8rem 1rem .85rem; border: 1px solid rgba(229, 164, 67, .45); border-left: 4px solid var(--torch); border-radius: 6px; background: rgba(229, 164, 67, .07); }
.definition + .definition { margin-top: -.4rem; }
.def-label { margin: 0 0 .15rem !important; font-size: .74rem; font-weight: 700; letter-spacing: .05em; color: var(--torch); }
.definition p { margin: 0; font-size: 1.02rem; }
.article dfn { font-style: normal; font-weight: 700; color: var(--bone); }

/* At a glance: key facts in a compact grid */
.glance { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); margin: 0 0 1.2rem; background: var(--stone); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.glance div { padding: .5rem .75rem; outline: 1px solid var(--line); }
.glance dt { font-size: .76rem; font-weight: 700; color: var(--bone-dim); }
.glance dd { margin: .1rem 0 0; font-size: .92rem; }
.glossary dt { scroll-margin-top: 4.6rem; }
.glossary dd a { font-size: .85rem; margin-left: .3rem; }

/* Forum link in the top bar (shown when the forum is on) */
.wiki-forum { color: var(--bone-dim); text-decoration: none; font-weight: 600; white-space: nowrap; }
.wiki-forum:hover { color: var(--torch); }
.wiki-forum[hidden], .wiki-forum-note[hidden] { display: none; }
.wiki-forum-note { margin: 2.5rem 0 0; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: 6px; background: var(--stone); }
.wiki-forum-note a { color: var(--torch); }
