/* ==========================================================================
   凡人修仙传 Wiki — v3 墨黑暖金 · 仙侠氛围
   ========================================================================== */

@import url('https://cdn.jsdelivr.net/npm/lxgw-wenkai-webfont@1.1.0/style.css');
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;600;700&display=swap');

/* --------------------------------------------------------------------------
   Color palette override — 墨黑 + 暖金
   -------------------------------------------------------------------------- */

[data-md-color-scheme="slate"] {
  --md-default-bg-color: #0f0f17;
  --md-default-fg-color: #c9d1d9;
  --md-default-fg-color--light: #768390;
  --md-default-fg-color--lighter: #484f58;
  --md-default-fg-color--lightest: #2a2a3a;
  --md-primary-fg-color: #0f0f17;
  --md-primary-bg-color: #c9d1d9;
  --md-accent-fg-color: #c9a96e;
  --md-typeset-a-color: #c9a96e;
  --md-code-bg-color: #161620;
  --md-code-fg-color: #c9d1d9;
  --md-footer-bg-color: #0a0a12;
  --md-footer-fg-color: #768390;
}

:root {
  --gold: #c9a96e;
  --gold-bright: #e8c17a;
  --gold-dim: #8a7345;
  --gold-glow: rgba(201, 169, 110, 0.08);
  --surface: rgba(255, 255, 255, 0.025);
  --border: #2a2a3a;
  --bg-deep: #0f0f17;
}

/* --------------------------------------------------------------------------
   Global atmosphere — background + subtle top glow
   -------------------------------------------------------------------------- */

body {
  background: var(--bg-deep);
}

.md-main {
  position: relative;
}

.md-main::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 600px;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(201,169,110,0.04) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

.md-main__inner {
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   Header + tabs — fused into dark background
   -------------------------------------------------------------------------- */

.md-header {
  background: rgba(15, 15, 23, 0.92) !important;
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(201, 169, 110, 0.06);
  box-shadow: 0 1px 20px rgba(0, 0, 0, 0.3);
}

.md-tabs {
  background: rgba(15, 15, 23, 0.95) !important;
  border-bottom: 1px solid rgba(201, 169, 110, 0.06);
}

.md-tabs__link {
  color: #a0aab4 !important;
  transition: color 0.2s;
}

.md-tabs__link--active,
.md-tabs__link:hover {
  color: var(--gold) !important;
}

/* Site title in header */
.md-header__title {
  font-family: 'LXGW WenKai', serif;
  font-size: 1.1rem;
  color: var(--gold);
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */

.md-sidebar {
  background: transparent;
}

.md-nav__link:hover,
.md-nav__link--active {
  color: var(--gold) !important;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.md-grid {
  max-width: 1400px;
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

.md-content .md-typeset {
  font-family: 'Noto Serif SC', 'Noto Sans SC', serif;
  line-height: 1.85;
  letter-spacing: 0.01em;
}

.md-typeset h1 {
  font-family: 'LXGW WenKai', serif;
  font-size: 2.2rem;
  background: linear-gradient(135deg, var(--gold-bright) 0%, var(--gold) 60%, var(--gold-dim) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  border: none;
  padding-bottom: 0;
  margin-bottom: 0.6em;
}

.md-typeset h2 {
  font-family: 'LXGW WenKai', serif;
  font-size: 1.6rem;
  color: var(--gold);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.2em;
  margin-top: 2em;
}

.md-typeset h3 {
  font-family: 'LXGW WenKai', serif;
  font-size: 1.3rem;
  color: var(--gold-bright);
}

.md-typeset h4 {
  font-family: 'Noto Sans SC', sans-serif;
  font-weight: 700;
  color: #c9d1d9;
}

/* Links */
.md-typeset a {
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid rgba(201, 169, 110, 0.2);
  transition: border-color 0.2s, color 0.2s;
}

.md-typeset a:hover {
  color: var(--gold-bright);
  border-bottom-color: var(--gold);
}

/* Permalink */
.md-typeset .headerlink {
  border: none;
}

.md-typeset .headerlink:hover {
  color: var(--gold-bright);
}

/* --------------------------------------------------------------------------
   Home page — Hero
   -------------------------------------------------------------------------- */

.hero {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-family: 'LXGW WenKai', serif !important;
  font-size: 3.5rem !important;
  background: linear-gradient(135deg, var(--gold-bright) 0%, var(--gold) 50%, var(--gold-dim) 100%) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  margin: 0 0 0.2em !important;
  border: none !important;
  letter-spacing: 0.05em;
}

.hero-subtitle {
  font-family: 'Noto Serif SC', serif;
  font-size: 1.2rem;
  letter-spacing: 0.6em;
  color: #768390;
  margin: 0 0 1rem;
}

.hero-stats {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 0.9rem;
  color: #768390;
  margin: 0;
}

.hero-stats strong {
  color: var(--gold);
}

.hero-wip {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 0.8rem;
  color: #484f58;
  margin: 0.6rem 0 0;
  font-style: italic;
}

/* --------------------------------------------------------------------------
   Ornamental divider
   -------------------------------------------------------------------------- */

.ornament {
  text-align: center;
  margin: 1.5rem 0;
  line-height: 1;
}

.ornament::before {
  content: '━━━\00a0\00a0◈\00a0\00a0━━━';
  color: rgba(201, 169, 110, 0.25);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
}

/* --------------------------------------------------------------------------
   Home page — Category card grid (glassmorphism)
   -------------------------------------------------------------------------- */

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.5rem;
  margin: 1rem 0;
}

.cat-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none !important;
  color: inherit !important;
  transition: all 0.3s ease;
  backdrop-filter: blur(6px);
}

.cat-card:hover {
  border-color: rgba(201, 169, 110, 0.35);
  box-shadow: 0 0 24px var(--gold-glow), 0 2px 8px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
  background: rgba(201, 169, 110, 0.04);
}

.cat-name {
  font-family: 'LXGW WenKai', serif;
  font-size: 1.1rem;
  color: #c9d1d9;
  transition: color 0.2s;
}

.cat-card:hover .cat-name {
  color: var(--gold-bright);
}

.cat-count {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold-dim);
  transition: color 0.2s;
}

.cat-card:hover .cat-count {
  color: var(--gold);
}

/* --------------------------------------------------------------------------
   Footer note
   -------------------------------------------------------------------------- */

.footer-note {
  text-align: center;
  font-size: 0.8rem;
  color: #484f58;
  margin-top: 0.5rem;
}

/* --------------------------------------------------------------------------
   Source tip — hover tooltip for chapter/provenance
   -------------------------------------------------------------------------- */

.source-tip {
  cursor: help;
  position: relative;
}

.source-tip::after {
  content: '\2020';
  color: var(--gold-dim);
  font-size: 0.65em;
  vertical-align: super;
  margin-left: 0.1em;
  opacity: 0.6;
  font-family: 'Noto Sans SC', sans-serif;
  transition: opacity 0.2s, color 0.2s;
}

.source-tip:hover::after {
  opacity: 1;
  color: var(--gold-bright);
}

/* --------------------------------------------------------------------------
   HR — golden gradient divider (replaces default ---)
   -------------------------------------------------------------------------- */

.md-typeset hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(201,169,110,0.3), transparent);
  margin: 2rem 0;
}

/* --------------------------------------------------------------------------
   Entity page — field list (field names as panels, sub-items as bullets)
   -------------------------------------------------------------------------- */

/* Reset: all top-level list items start clean */
.md-typeset > ul {
  padding-left: 0;
}

.md-typeset > ul > li {
  list-style: none;
  transition: border-color 0.2s;
}

/* Field name items (contain <strong>) → panel heading */
.md-typeset > ul > li:has(> strong) {
  background: var(--surface);
  border-left: 3px solid var(--gold-dim);
  border-radius: 0 4px 4px 0;
  padding: 0.5em 0.8em;
  margin-top: 0.8em;
  margin-bottom: 0.15em;
}

.md-typeset > ul > li:has(> strong):first-child {
  margin-top: 0;
}

.md-typeset > ul > li:has(> strong):hover {
  border-left-color: var(--gold);
}

/* Field name text */
.md-typeset > ul > li > strong,
.md-content .md-typeset > ul > li > strong {
  color: var(--gold);
  font-family: 'LXGW WenKai', 'Noto Sans SC', serif;
  font-size: 1.05em;
  font-weight: 600;
}

/* Sub-items (no <strong>) → indented bullet points */
.md-typeset > ul > li:not(:has(> strong)) {
  background: transparent;
  border: none;
  border-left: 1px solid rgba(201, 169, 110, 0.1);
  padding: 0.15em 0 0.15em 1.2em;
  margin-left: 0.5em;
  margin-bottom: 0;
  font-size: 0.95em;
  position: relative;
}

/* Small dot bullet for sub-items */
.md-typeset > ul > li:not(:has(> strong))::before {
  content: '';
  position: absolute;
  left: -3px;
  top: 0.65em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold-dim);
}

/* Nested <ul> inside any <li> (for properly nested content) */
.md-typeset > ul > li > ul {
  border-left: 2px solid rgba(201, 169, 110, 0.15);
  padding-left: 1em;
  margin-top: 0.3em;
  margin-bottom: 0;
}

.md-typeset > ul > li > ul > li {
  padding: 0.15em 0;
  list-style: none;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.md-typeset table:not([class]) {
  font-size: 0.88rem;
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.md-typeset table:not([class]) th {
  white-space: nowrap;
  background: rgba(201, 169, 110, 0.08);
  color: var(--gold);
  font-family: 'LXGW WenKai', 'Noto Sans SC', serif;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.md-typeset table:not([class]) td {
  border-bottom: 1px solid rgba(42, 42, 58, 0.4);
  transition: background 0.2s;
}

.md-typeset table:not([class]) tr:last-child td {
  border-bottom: none;
}

.md-typeset table:not([class]) tr:hover td {
  background: rgba(201, 169, 110, 0.04);
}

.md-typeset table:not([class]) td:first-child {
  white-space: nowrap;
  font-weight: 600;
  color: var(--gold-dim);
  border-left: 3px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}

.md-typeset table:not([class]) tr:hover td:first-child {
  border-left-color: var(--gold-dim);
  color: var(--gold);
}

/* --------------------------------------------------------------------------
   Category index
   -------------------------------------------------------------------------- */

.category-desc {
  color: #768390;
  font-style: italic;
  margin-bottom: 1.5em;
  padding-left: 0.5em;
  border-left: 3px solid var(--border);
}

/* --------------------------------------------------------------------------
   Back navigation
   -------------------------------------------------------------------------- */

.back-nav {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 0.9em;
}

.back-nav a {
  color: var(--gold-dim) !important;
  text-decoration: none !important;
  border: none !important;
  transition: color 0.2s;
}

.back-nav a:hover {
  color: var(--gold) !important;
}

/* --------------------------------------------------------------------------
   Search highlight
   -------------------------------------------------------------------------- */

.md-typeset mark {
  background-color: rgba(201, 169, 110, 0.2);
}

/* --------------------------------------------------------------------------
   Admonitions
   -------------------------------------------------------------------------- */

.md-typeset .admonition,
.md-typeset details {
  border-left-color: var(--gold-dim);
  background: var(--surface);
}

/* --------------------------------------------------------------------------
   Scrollbar
   -------------------------------------------------------------------------- */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gold-dim);
}

/* --------------------------------------------------------------------------
   Content area — subtle surface feel
   -------------------------------------------------------------------------- */

.md-content {
  background: transparent;
}

/* Table of contents */
.md-nav--secondary .md-nav__link--active {
  color: var(--gold) !important;
}

/* Footer */
.md-footer {
  border-top: 1px solid rgba(201, 169, 110, 0.06);
}

/* --------------------------------------------------------------------------
   Category index — Alphabet group header
   -------------------------------------------------------------------------- */

.alpha-header {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
  padding: 0.3rem 0;
  margin-top: 1.2rem;
  margin-bottom: 0.3rem;
  border-bottom: 1px solid rgba(201, 169, 110, 0.15);
  letter-spacing: 0.1em;
}

.alpha-header:first-of-type {
  margin-top: 0;
}

/* --------------------------------------------------------------------------
   Category index — Entity card grid
   -------------------------------------------------------------------------- */

.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.45rem;
  margin: 1rem 0;
}

.entity-card {
  display: flex;
  flex-direction: column;
  padding: 0.6rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none !important;
  color: inherit !important;
  transition: all 0.3s ease;
  overflow: hidden;
}

.entity-card:hover {
  border-color: rgba(201, 169, 110, 0.35);
  box-shadow: 0 0 20px var(--gold-glow), 0 2px 6px rgba(0, 0, 0, 0.25);
  transform: translateY(-1px);
  background: rgba(201, 169, 110, 0.03);
}

.entity-name {
  font-family: 'LXGW WenKai', serif;
  font-size: 1.05rem;
  color: #c9d1d9;
  transition: color 0.2s;
  line-height: 1.4;
}

.entity-card:hover .entity-name {
  color: var(--gold-bright);
}

.entity-meta {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 0.75rem;
  color: #768390;
  margin-top: 0.2em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   Entity page — Info strip (category + chapter range)
   -------------------------------------------------------------------------- */

.entity-info {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 0.4rem 0.8rem;
  margin-bottom: 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 0.8rem;
  color: #768390;
}

.entity-info span {
  display: inline-flex;
  align-items: center;
}

.entity-info span::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold-dim);
  margin-right: 0.4rem;
}

.entity-info span:first-child::before {
  background: var(--gold);
}

/* --------------------------------------------------------------------------
   Timeline table — sticky header
   -------------------------------------------------------------------------- */

.md-typeset table:not([class]) thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(15, 15, 23, 0.97);
  backdrop-filter: blur(6px);
}
