/* ============================================
   Adventure Wiki — Shared Light Theme
   Each wiki.html sets:
     --accent, --accent-light, --accent-glow, --bg
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 19px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: var(--bg, #f5f6f8);
  color: #2a2e36;
  line-height: 1.85;
  min-height: 100vh;
  overflow-x: hidden;
  font-weight: 450;
}
a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent-light, var(--accent)); }
::selection { background: var(--accent-glow, rgba(100,120,160,.2)); }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,.03); }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* --- Layout --- */
.page-wrapper { display: flex; flex-direction: column; min-height: 100vh; }
.main-layout { display: flex; flex: 1; max-width: 1440px; margin: 0 auto; width: 100%; }

/* --- Top Navigation --- */
.top-nav {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(255,255,255,.88); backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,0,0,.06);
  padding: 0 2rem; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-brand { display: flex; align-items: center; gap: .6rem; }
.nav-brand-icon { font-size: 1.6rem; }
.nav-brand-logo { width: 32px; height: 32px; border-radius: 6px; object-fit: contain; }
.nav-brand-text { font-size: 1.35rem; font-weight: 900; color: var(--accent); letter-spacing: 1.5px; }
.nav-brand-ver { font-size: .75rem; color: #999; background: color-mix(in srgb, var(--accent) 10%, transparent); padding: 2px 8px; border-radius: 10px; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { color: #666; font-size: .9rem; font-weight: 500; transition: color .2s; }
.nav-links a:hover, .nav-links a.active { color: var(--accent); }
.nav-search {
  background: rgba(0,0,0,.03); border: 1px solid rgba(0,0,0,.08); border-radius: 8px;
  padding: 6px 14px; color: #3a3f4b; font-size: .85rem; width: 200px;
  outline: none; transition: border-color .2s;
}
.nav-search:focus { border-color: var(--accent); }
.nav-search::placeholder { color: #bbb; }
.nav-home { display: flex; align-items: center; gap: .3rem; color: #999 !important; font-size: .8rem !important; }
.nav-home:hover { color: var(--accent) !important; }
.mobile-menu-btn { display: none; background: none; border: none; color: var(--accent); font-size: 1.4rem; cursor: pointer; }

/* --- Left Sidebar --- */
.sidebar {
  width: 260px; min-width: 260px; padding: 1.5rem 0;
  border-right: 1px solid rgba(0,0,0,.06);
  height: calc(100vh - 56px); position: sticky; top: 56px;
  overflow-y: auto; overflow-x: hidden;
  background: rgba(255,255,255,.5);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }
.sidebar-group { margin-bottom: .8rem; }
.sidebar-group-title {
  font-size: .75rem; text-transform: uppercase; letter-spacing: 2px;
  color: var(--accent); padding: .5rem 1.5rem; font-weight: 700;
  display: flex; align-items: center; gap: .5rem;
}
.sidebar-group-title::after { content: ''; flex: 1; height: 1px; background: color-mix(in srgb, var(--accent) 20%, transparent); }
.sidebar-link {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem 1.5rem .5rem 2rem;
  font-size: .95rem; color: #555; font-weight: 500; cursor: pointer;
  transition: all .15s; border-left: 2px solid transparent;
}
.sidebar-link:hover { color: #4a4f5a; background: rgba(0,0,0,.03); }
.sidebar-link.active {
  color: var(--accent); border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent); font-weight: 700;
}
.sidebar-link-icon { font-size: .9rem; width: 20px; text-align: center; }

/* --- Content Area --- */
.content-area {
  flex: 1; padding: 2rem 3rem; max-width: 900px;
  min-height: calc(100vh - 56px);
}

/* Page sections */
.doc-page { display: none; animation: fadeIn .3s ease; }
.doc-page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* --- Right mini-TOC --- */
.right-toc {
  width: 200px; min-width: 200px; padding: 2rem 1rem;
  position: sticky; top: 56px; height: calc(100vh - 56px);
  overflow-y: auto; font-size: .78rem;
}
.right-toc-title { color: var(--accent); font-size: .7rem; text-transform: uppercase; letter-spacing: 2px; margin-bottom: .8rem; font-weight: 600; }
.right-toc a {
  display: block; color: #aaa; padding: .25rem 0; border-left: 1px solid #ddd;
  padding-left: .8rem; transition: all .15s;
}
.right-toc a:hover, .right-toc a.active { color: var(--accent); border-left-color: var(--accent); }

/* --- Typography --- */
.doc-page h1 {
  font-size: 2.6rem; font-weight: 900; color: #1a1e26;
  margin-bottom: 1.2rem; padding-bottom: .8rem;
  border-bottom: 2px solid color-mix(in srgb, var(--accent) 25%, transparent);
  display: flex; align-items: center; gap: .6rem;
}
.doc-page h1 .page-icon { font-size: 2rem; }
.doc-page h2 {
  font-size: 1.6rem; font-weight: 800; color: var(--accent);
  margin: 2.5rem 0 1rem; padding-bottom: .5rem;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 15%, transparent);
}
.doc-page h3 { font-size: 1.28rem; font-weight: 700; color: color-mix(in srgb, var(--accent) 80%, #1a1e26); margin: 1.5rem 0 .6rem; }
.doc-page h4 { font-size: 1.12rem; font-weight: 700; color: #3a3f4b; margin: 1.2rem 0 .4rem; }
.doc-page p { margin-bottom: 1.1rem; font-size: 1.05rem; font-weight: 450; }
.doc-page ul, .doc-page ol { padding-left: 1.5rem; margin-bottom: 1.1rem; }
.doc-page li { margin-bottom: .5rem; font-size: 1.05rem; font-weight: 450; }
.doc-page strong { color: var(--accent); font-weight: 700; }

/* --- Code Blocks --- */
.doc-page code {
  font-family: 'Cascadia Code', 'Consolas', 'SF Mono', 'Menlo', monospace;
  font-size: .9em; background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent); padding: 3px 7px; border-radius: 5px; font-weight: 600;
}
.doc-page pre {
  background: #fafbfc; border: 1px solid rgba(0,0,0,.08);
  border-radius: 10px; padding: 1.2rem 1.5rem;
  margin-bottom: 1.2rem; overflow-x: auto;
  position: relative;
}
.doc-page pre code {
  background: none; color: #3a3f4b; padding: 0;
  font-size: .92rem; line-height: 1.75; font-weight: 500;
}
/* YAML syntax colors */
.doc-page pre .key { color: #2b6cb0; }
.doc-page pre .val-str { color: #2f855a; }
.doc-page pre .val-num { color: #c05621; }
.doc-page pre .comment { color: #aaa; font-style: italic; }
.doc-page pre .val-bool { color: #c53030; }

/* --- Tables --- */
.doc-page table {
  width: 100%; border-collapse: collapse; margin-bottom: 1.5rem;
  font-size: .96rem;
}
.doc-page th {
  background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent);
  text-align: left; padding: .65rem 1rem; font-weight: 700;
  border-bottom: 2px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.doc-page td {
  padding: .5rem 1rem;
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.doc-page tr:hover td { background: rgba(0,0,0,.02); }

/* --- Alert Boxes --- */
.alert {
  padding: 1rem 1.2rem; border-radius: 10px; margin-bottom: 1.2rem;
  border-left: 4px solid; font-size: .95rem; font-weight: 480;
}
.alert-title { font-weight: 800; font-size: 1rem; margin-bottom: .3rem; display: flex; align-items: center; gap: .4rem; }
.alert-info { background: rgba(59,130,246,.06); border-color: #3b82f6; }
.alert-info .alert-title { color: #2563eb; }
.alert-warn { background: rgba(245,158,11,.06); border-color: #f59e0b; }
.alert-warn .alert-title { color: #d97706; }
.alert-danger { background: rgba(239,68,68,.06); border-color: #ef4444; }
.alert-danger .alert-title { color: #dc2626; }
.alert-tip { background: rgba(34,197,94,.06); border-color: #22c55e; }
.alert-tip .alert-title { color: #16a34a; }

/* --- Feature Cards --- */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.feature-card {
  background: rgba(255,255,255,.6);
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 12px; padding: 1.2rem 1.4rem;
  transition: all .25s;
}
.feature-card:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.06); }
.feature-card-icon { font-size: 2rem; margin-bottom: .6rem; }
.feature-card-title { font-size: 1.15rem; font-weight: 800; color: #1a1e26; margin-bottom: .4rem; }
.feature-card-desc { font-size: .95rem; color: #555; line-height: 1.6; font-weight: 480; }

/* --- Hero Section --- */
.hero {
  text-align: center; padding: 3rem 2rem;
  background: linear-gradient(180deg, rgba(255,255,255,.5) 0%, transparent 100%);
  margin: -2rem -3rem 2rem; border-bottom: 1px solid rgba(0,0,0,.05);
}
.hero h1 { justify-content: center; font-size: 3rem; font-weight: 900; border: none; padding-bottom: 0; }
.hero-subtitle { color: #666; font-size: 1.25rem; font-weight: 500; margin-top: .6rem; letter-spacing: 0.08em; }
.hero-badges { display: flex; gap: .8rem; justify-content: center; margin-top: 1.2rem; flex-wrap: wrap; }
.hero-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  background: color-mix(in srgb, var(--accent) 8%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 15%, transparent);
  padding: .35rem .9rem; border-radius: 20px; font-size: .8rem; color: var(--accent); font-weight: 600;
}

/* --- Badge (inline) --- */
.badge { display: inline-block; font-size: .7rem; padding: 2px 8px; border-radius: 10px; font-weight: 700; vertical-align: middle; margin-left: .4rem; }
.badge-new { background: rgba(34,197,94,.1); color: #16a34a; }
.badge-ver { background: rgba(59,130,246,.1); color: #2563eb; }
.badge-warn { background: rgba(245,158,11,.1); color: #d97706; }
.badge-fix { background: rgba(239,68,68,.1); color: #dc2626; }
.badge-improved { background: rgba(59,130,246,.1); color: #3b82f6; }
.badge-config { background: rgba(139,92,246,.1); color: #7c3aed; }

/* --- Page Navigation --- */
.page-nav { display: flex; justify-content: space-between; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid rgba(0,0,0,.06); gap: 1rem; }
.page-nav-btn {
  display: flex; flex-direction: column; padding: .8rem 1.2rem;
  background: rgba(255,255,255,.5); border: 1px solid rgba(0,0,0,.06);
  border-radius: 10px; transition: all .2s; cursor: pointer; min-width: 0; flex: 1; max-width: 48%;
}
.page-nav-btn:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 5%, transparent); }
.page-nav-label { font-size: .7rem; color: #999; }
.page-nav-title { font-size: 1rem; color: var(--accent); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Footer --- */
.footer {
  text-align: center; padding: 1.5rem; font-size: .75rem; color: #888; font-weight: 500;
  border-top: 1px solid rgba(0,0,0,.06);
}

/* --- Search overlay --- */
.search-overlay {
  display: none; position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,.3); backdrop-filter: blur(4px);
  justify-content: center; padding-top: 15vh;
}
.search-overlay.active { display: flex; }
.search-box {
  background: #fff; border: 1px solid rgba(0,0,0,.1);
  border-radius: 14px; width: 560px; max-width: 92vw; padding: 1.2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.12);
}
.search-input {
  width: 100%; background: transparent; border: none; outline: none;
  color: #3a3f4b; font-size: 1.1rem; padding: .5rem;
}
.search-input::placeholder { color: #bbb; }
.search-results { max-height: 50vh; overflow-y: auto; margin-top: .5rem; }
.search-result-item {
  display: block; padding: .7rem .8rem; border-radius: 8px;
  cursor: pointer; transition: background .15s; font-size: .88rem;
}
.search-result-item:hover { background: rgba(0,0,0,.04); }
.search-result-title { color: var(--accent); font-weight: 600; }
.search-result-desc { color: #999; font-size: .78rem; margin-top: .15rem; }

/* --- Responsive --- */
@media (max-width: 1100px) {
  .right-toc { display: none; }
}
@media (max-width: 860px) {
  .sidebar { display: none; position: fixed; left: 0; top: 56px; z-index: 900; width: 280px; height: calc(100vh - 56px); background: #fff; border-right: 1px solid rgba(0,0,0,.08); }
  .sidebar.open { display: block; }
  .mobile-menu-btn { display: block; }
  .content-area { padding: 1.5rem 1.2rem; }
  .hero { margin: -1.5rem -1.2rem 1.5rem; }
  .nav-search { width: 140px; }
  .feature-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .nav-search { display: none; }
  .nav-links a:not(.nav-home) { display: none; }
}
