/* Realms of Elynia Wiki — OSRS-henkinen artikkelilayout pelin design-tokeneilla
   (public/assets/tokens.css). Tumma night-pohja + parchment/bronze/gold-aksentit. */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--night);
  color: var(--night-text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--gold); color: var(--night); padding: 8px 14px; z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ── Topbar ─────────────────────────────────────────────────────────────── */
.wiki-topbar {
  display: flex; align-items: center; gap: var(--gap);
  padding: 10px 18px;
  background: linear-gradient(180deg, var(--night-soft), var(--night));
  border-bottom: 2px solid var(--night-line);
  position: sticky; top: 0; z-index: 40;
}
.wiki-brand { display: flex; align-items: baseline; gap: 8px; }
.wiki-brand-mark {
  font-family: var(--font-display); font-weight: 700; letter-spacing: .04em;
  font-size: 1.25rem; color: var(--gold);
}
.wiki-brand-sub {
  font-family: var(--font-display); color: var(--ink-soft); text-transform: uppercase;
  font-size: .8rem; letter-spacing: .18em;
}
.wiki-search { position: relative; margin-left: auto; width: min(340px, 45vw); }
.wiki-search input {
  width: 100%; padding: 8px 12px; border-radius: var(--radius);
  border: 1px solid var(--night-line); background: #1b140c; color: var(--night-text);
  font-family: var(--font-body); font-size: .95rem;
}
.wiki-search input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.wiki-search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #1b140c; border: 1px solid var(--night-line); border-radius: var(--radius);
  max-height: 60vh; overflow-y: auto; z-index: 50; box-shadow: var(--shadow);
}
.wiki-search-results a {
  display: block; padding: 8px 12px; color: var(--night-text); border-bottom: 1px solid var(--night-line);
}
.wiki-search-results a:last-child { border-bottom: 0; }
.wiki-search-results a:hover, .wiki-search-results a.active { background: var(--night-soft); text-decoration: none; }
.wiki-search-results .sr-section { color: var(--ink-soft); font-size: .8rem; margin-left: 6px; }
.wiki-search-results .sr-empty { padding: 10px 12px; color: var(--ink-soft); }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.wiki-layout { display: flex; align-items: flex-start; gap: 0; max-width: 1200px; margin: 0 auto; }

.wiki-nav {
  flex: 0 0 220px; padding: 18px 14px; position: sticky; top: 58px;
  align-self: flex-start; max-height: calc(100vh - 58px); overflow-y: auto;
  border-right: 1px solid var(--night-line);
}
.nav-group { margin-bottom: 16px; }
.nav-group-label {
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: .12em;
  font-size: .72rem; color: var(--ink-soft); margin-bottom: 6px;
}
.nav-links { list-style: none; margin: 0; padding: 0; }
.nav-links li { margin: 0; }
.nav-links a {
  display: block; padding: 4px 8px; border-radius: 4px; color: var(--night-text); font-size: .95rem;
}
.nav-links a:hover { background: var(--night-soft); text-decoration: none; }
.nav-links a.active { background: var(--bronze); color: #fff; }

.wiki-main { flex: 1 1 auto; min-width: 0; padding: 20px 28px 60px; }
.article { max-width: 840px; }

/* ── Typography ─────────────────────────────────────────────────────────── */
h1, h2, h3 { font-family: var(--font-display); color: var(--gold); line-height: 1.2; }
h1 { font-size: 2rem; margin: 0 0 12px; border-bottom: 2px solid var(--night-line); padding-bottom: 10px; }
h2 { font-size: 1.4rem; margin: 28px 0 10px; border-bottom: 1px solid var(--night-line); padding-bottom: 6px; }
h3 { font-size: 1.1rem; margin: 20px 0 8px; }
.lead { font-size: 1.05rem; color: #f3ead2; }
.muted { color: var(--ink-soft); font-weight: normal; }
.note { color: var(--ink-soft); font-style: italic; }
.fineprint { color: var(--ink-soft); font-size: .85rem; }
code { background: #1b140c; border: 1px solid var(--night-line); border-radius: 4px; padding: 1px 5px; font-size: .9em; }
hr { border: 0; border-top: 1px solid var(--night-line); margin: 28px 0; }

.breadcrumb { font-size: .85rem; color: var(--ink-soft); margin-bottom: 10px; }
.breadcrumb a { color: var(--bronze); }
.crumb-sep { margin: 0 6px; opacity: .6; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 12px 0; }
.wtable {
  border-collapse: collapse; width: 100%; background: #201811;
  border: 1px solid var(--night-line); font-size: .95rem;
}
.wtable caption { text-align: left; color: var(--ink-soft); padding: 4px 2px; font-style: italic; }
.wtable th, .wtable td { padding: 7px 10px; border: 1px solid var(--night-line); text-align: left; }
.wtable thead th { background: var(--night-soft); color: var(--gold); font-family: var(--font-display); font-weight: 700; }
.wtable tbody tr:nth-child(even) { background: #241b12; }
.wtable th[scope="row"] { color: var(--ink-soft); font-weight: 700; white-space: nowrap; }

/* Rarity-nimivärit toimivat tummalla; .on-light EI käytetä täällä (tumma pohja). */
.wtable .rarity-common { color: var(--rarity-common); }

/* ── Cards / grids ──────────────────────────────────────────────────────── */
.stat-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.stat-tile {
  background: #201811; border: 1px solid var(--night-line); border-radius: var(--radius);
  padding: 12px 18px; min-width: 110px; text-align: center;
}
.stat-n { display: block; font-family: var(--font-display); font-size: 1.7rem; color: var(--gold); }
.stat-l { display: block; color: var(--ink-soft); font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 14px 0; }
.card {
  display: flex; flex-direction: column; gap: 4px;
  background: #201811; border: 1px solid var(--night-line); border-radius: var(--radius);
  padding: 14px; color: var(--night-text);
}
.card:hover { border-color: var(--bronze); text-decoration: none; }
.card-title { font-family: var(--font-display); color: var(--gold); font-weight: 700; }
.card-text { color: var(--ink-soft); font-size: .9rem; }
.card-media img { width: 100%; height: 120px; object-fit: cover; border-radius: 4px; margin-bottom: 6px; }
.boss-hero { margin: 16px 0; max-width: 420px; }

.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.item-card {
  display: flex; gap: 10px; background: #201811; border: 1px solid var(--night-line);
  border-radius: var(--radius); padding: 10px;
}
.item-card img { width: 56px; height: 56px; object-fit: contain; flex: none; }
.item-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.item-name { font-family: var(--font-display); font-weight: 700; }
.item-meta { color: var(--ink-soft); font-size: .8rem; text-transform: capitalize; }
.sample { font-size: .82rem; color: #cabfa4; }
.item-obtained { font-size: .82rem; color: var(--ink-soft); }

.coming-soon {
  background: #201811; border: 1px dashed var(--night-line); border-radius: var(--radius);
  padding: 20px; margin-top: 12px;
}

/* Infobox (oikealle kelluva) */
.infobox {
  float: right; width: 260px; margin: 0 0 16px 20px;
  background: #1b140c; border: 1px solid var(--night-line); border-radius: var(--radius);
  overflow: hidden;
}
.ib-title { font-family: var(--font-display); font-weight: 700; color: var(--gold); padding: 10px 12px; background: var(--night-soft); text-align: center; }
.ib-image img { width: 100%; display: block; }
.ib-table { width: 100%; border-collapse: collapse; }
.ib-table th, .ib-table td { padding: 6px 10px; border-top: 1px solid var(--night-line); font-size: .9rem; text-align: left; }
.ib-table th { color: var(--ink-soft); width: 45%; }

/* ── Leaderboard tabs / pager ───────────────────────────────────────────── */
.lb-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.lb-tabs a { padding: 4px 10px; border: 1px solid var(--night-line); border-radius: 4px; color: var(--night-text); font-size: .88rem; }
.lb-tabs a.active { background: var(--bronze); color: #fff; border-color: var(--bronze); }
.pager { display: flex; align-items: center; gap: 14px; margin: 14px 0; }
.pager .disabled { color: var(--ink-soft); opacity: .5; }

/* Forge simulator: koko työpaja tyylitellään omassa /wiki/forge-sim.css:ssä,
   joka ladataan vain Forge-sivulla (worker/wiki/pages/forge.js). Ei tyylejä
   täällä — ne olisivat kuollutta koodia muilla wikisivuilla. */

/* ── Footer ─────────────────────────────────────────────────────────────── */
.wiki-footer { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--night-line); color: var(--ink-soft); font-size: .85rem; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 820px) {
  .wiki-nav { display: none; }
  .wiki-main { padding: 16px; }
  .infobox { float: none; width: auto; margin: 0 0 16px; }
  .wiki-search { width: 50vw; }
}
