/* Chatacombs wiki. Builds on ../styles.css (tokens, nav, buttons, footer). */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wiki code { font: 1.15em/1 var(--font-mono); color: var(--torch-hot); }

/* ---------- Header ---------- */
.wiki-hero {
  position: relative;
  padding: calc(var(--nav-h) + clamp(48px, 8vw, 96px)) var(--gutter) clamp(36px, 5vw, 56px);
  text-align: center;
  background:
    radial-gradient(ellipse 70% 80% at 50% 0%, rgba(255, 110, 30, .16), transparent 70%),
    radial-gradient(ellipse 60% 70% at 50% 30%, #1c1520, var(--void) 75%);
  border-bottom: 1px solid var(--line);
}
.wiki-hero h1 { font-family: var(--font-display); font-size: clamp(52px, 9vw, 108px); }
.wiki-hero__lede { margin: 14px auto 0; max-width: 560px; color: var(--bone-dim); font-size: 18px; }

.search {
  display: flex; align-items: center; gap: 10px;
  max-width: 560px; margin: 30px auto 0; padding: 0 18px; height: 54px;
  border-radius: 999px; background: rgba(12, 10, 15, .7);
  box-shadow: 0 0 0 1px rgba(255, 138, 42, .3), 0 20px 60px -30px rgba(255, 110, 30, .6);
}
.search:focus-within { box-shadow: 0 0 0 2px var(--torch), 0 20px 60px -30px rgba(255, 110, 30, .8); }
.search svg { width: 20px; height: 20px; fill: var(--torch); flex: none; }
.search input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none;
  color: var(--bone); font: 500 16px var(--font-body);
}
.search input::placeholder { color: var(--bone-dim); opacity: .7; }
.search__empty { margin-top: 16px; color: var(--bone-dim); }

/* ---------- Layout ---------- */
.wiki-layout {
  display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(24px, 4vw, 56px);
  max-width: 1280px; margin: 0 auto; padding: 0 var(--gutter);
}

.toc { min-width: 0; position: sticky; top: calc(var(--nav-h) + 24px); align-self: start; padding: 32px 0; max-height: calc(100vh - var(--nav-h) - 24px); overflow-y: auto; }
.toc__title { font-size: 12px; font-weight: 600; letter-spacing: .3em; text-transform: uppercase; color: var(--torch); margin-bottom: 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a {
  display: block; padding: 6px 0 6px 16px; margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--bone-dim); text-decoration: none; font-size: 15px;
  transition: color .2s, border-color .2s;
}
.toc a:hover { color: var(--bone); }
.toc a.is-active { color: var(--torch-hot); border-left-color: var(--torch); }

.wiki-main { min-width: 0; padding-bottom: 80px; }

.wiki-section { padding-top: clamp(48px, 7vw, 80px); scroll-margin-top: calc(var(--nav-h) + 8px); }
.wiki-section__head { margin-bottom: 28px; }
.wiki-section h2 { font-family: var(--font-display); font-size: clamp(38px, 5.5vw, 60px); }
.wiki-lede { margin-top: 12px; max-width: 760px; color: var(--bone-dim); font-size: 17px; }
.wiki-h3 { font: 600 20px/1.2 var(--font-body); margin: 36px 0 16px; scroll-margin-top: calc(var(--nav-h) + 8px); }
.wiki-p { color: var(--bone-dim); max-width: 760px; }
.wiki-note { margin-top: 18px; font-size: 14px; color: var(--bone-dim); }

.pill {
  flex: none;
  font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--bone-dim); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px;
}

/* ---------- Facts ---------- */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.fact {
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 20px; border-radius: 12px;
  background: linear-gradient(180deg, var(--stone), var(--crypt));
  box-shadow: 0 0 0 1px var(--line);
}
.fact b { font-weight: 600; color: var(--bone); }
.fact span { color: var(--bone-dim); font-size: 15px; }

/* ---------- Tables ---------- */
.wiki-table-wrap { overflow-x: auto; border-radius: 12px; box-shadow: 0 0 0 1px var(--line); margin-bottom: 16px; }
.wiki-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.wiki-table th {
  text-align: left; padding: 12px 16px;
  font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--torch);
  background: #16121a; border-bottom: 1px solid var(--line);
}
.wiki-table td { padding: 12px 16px; vertical-align: top; color: var(--bone-dim); border-bottom: 1px solid var(--line); }
.wiki-table tr:last-child td { border-bottom: 0; }
.wiki-table td b { color: var(--bone); font-weight: 600; }
.wiki-table td:first-child { white-space: nowrap; }

.tier { font-weight: 700; color: var(--tier); text-shadow: 0 0 14px color-mix(in srgb, var(--tier) 45%, transparent); }
.haz { font-weight: 700; }
.haz--fire { color: #ff8a2a; }
.haz--acid { color: #a6e22e; }
.haz--water { color: #5aa9ff; }
.haz--ice { color: #9ff4f4; }
.haz--lava { color: #ff4d1a; }

/* ---------- Class cards ---------- */
.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.class-card {
  --accent: var(--torch);
  position: relative; display: flex; flex-direction: column;
  padding: 22px 22px 18px; border-radius: 14px;
  background:
    radial-gradient(ellipse 80% 60% at 0% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    linear-gradient(180deg, var(--stone), var(--crypt));
  box-shadow: 0 0 0 1px var(--line), inset 3px 0 0 var(--accent);
  scroll-margin-top: calc(var(--nav-h) + 16px);
}
.class-card header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.class-card h3 { font: 400 34px/1 var(--font-display); color: var(--accent); }
.class-card__words { margin-top: 8px; font-size: 13px; color: var(--bone-dim); }
.class-card__words code { font-size: 17px; }
.class-card__blurb { margin-top: 10px; font-size: 15px; color: var(--bone); }
.kit { list-style: none; margin: 16px 0 0; padding: 14px 0 0; border-top: 1px dashed rgba(236, 228, 210, .12); display: grid; gap: 6px; }
.kit li { display: flex; align-items: baseline; gap: 10px; font-size: 15px; }
.kit__lvl { flex: none; width: 42px; font: 18px/1 var(--font-mono); color: var(--bone-dim); }
.kit a { color: var(--bone); text-decoration: none; border-bottom: 1px solid rgba(236, 228, 210, .2); }
.kit a:hover { color: var(--torch-hot); border-bottom-color: var(--torch); }
.kit__ult a { color: var(--accent); font-weight: 600; border-bottom-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.kit__ult em { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }

/* ---------- Entries ---------- */
.entry-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.entry {
  --accent: var(--torch);
  padding: 18px 20px; border-radius: 12px;
  background: linear-gradient(180deg, #18141c, #110e14);
  box-shadow: 0 0 0 1px var(--line);
  scroll-margin-top: calc(var(--nav-h) + 16px);
}
.entry header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.entry h3 { font: 600 19px/1.2 var(--font-body); }
.entry h3 code { font-size: 22px; }
.entry p { color: var(--bone-dim); font-size: 15px; }
.entry .cd { flex: none; font: 20px/1 var(--font-mono); color: var(--torch-hot); }
.entry .cd::before { content: "⟳ "; color: var(--bone-dim); }
.entry__who { margin-top: 10px; padding-top: 10px; border-top: 1px dashed rgba(236, 228, 210, .1); font-size: 14px !important; }
.entry__who a { color: var(--accent); text-decoration: none; font-weight: 600; }
.entry__who a:hover { text-decoration: underline; }
.entry__who small { color: var(--bone-dim); font-size: 12px; }
.entry header > a { flex: none; color: var(--accent); text-decoration: none; font-size: 14px; font-weight: 600; }
.entry header > a:hover { text-decoration: underline; }

.entry--ult { box-shadow: 0 0 0 1px var(--line), inset 3px 0 0 var(--accent); }
.entry--ult h3 { font: 400 28px/1 var(--font-display); color: var(--accent); }

.entry .power { font: 20px/1 var(--font-mono); color: var(--torch-hot); margin-bottom: 8px; }
.entry--legend {
  background:
    radial-gradient(ellipse 90% 70% at 100% 0%, rgba(255, 128, 0, .12), transparent 70%),
    linear-gradient(180deg, #1b1510, #110e14);
  box-shadow: 0 0 0 1px rgba(255, 128, 0, .25);
}
.entry--legend h3 { color: #ff9a2e; text-shadow: 0 0 18px rgba(255, 128, 0, .35); }
.entry--legend .power::before { content: "★ "; }

/* ---------- Bosses ---------- */
.boss-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.boss-list li {
  padding: 14px 18px; border-radius: 12px;
  background: linear-gradient(180deg, #1f1014, #120c0f);
  box-shadow: 0 0 0 1px rgba(224, 36, 47, .25);
}
.boss-list b { display: block; font: 400 26px/1.05 var(--font-display); color: #ff6b6b; }
.boss-list span { font-size: 14px; color: var(--bone-dim); }

/* ---------- Search ---------- */
[data-entry].is-hidden, [data-section].is-hidden, .wiki-h3.is-hidden { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .wiki-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toc {
    position: sticky; top: var(--nav-h); z-index: 10;
    margin: 0 calc(var(--gutter) * -1); padding: 10px var(--gutter);
    max-height: none; overflow: visible;
    background: rgba(12, 10, 15, .9); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
  }
  .toc__title { display: none; }
  .toc ol { display: flex; gap: 6px; overflow-x: auto; border: 0; scrollbar-width: none; }
  .toc ol::-webkit-scrollbar { display: none; }
  .toc a {
    white-space: nowrap; padding: 6px 12px; margin: 0; border: 1px solid var(--line); border-radius: 999px; font-size: 14px;
  }
  .toc a.is-active { border-color: var(--torch); }
}
@media (max-width: 480px) {
  .class-grid, .entry-list, .facts { grid-template-columns: 1fr; }
  .wiki-table { font-size: 14px; }
  .wiki-table th, .wiki-table td { padding: 10px 12px; }
}
