/* ============================================================
   博德之门3 攻略站 · 官网风格版（baldursgate3.game）
   纯黑底 + 米金细线 + 衬线标题 + 零圆角 + 菱形角饰
   设计规范见 DESIGN.md，字体全部本机字体
   ============================================================ */

:root {
  --bg: #000000;
  --surface: #0e0c09;
  --surface-2: #12100b;
  --surface-3: #17130d;
  --line: rgba(193, 153, 118, .35);
  --line-strong: rgba(193, 153, 118, .7);
  --primary: #c19976;
  --accent: #fbcea0;
  --text: #d8ccb4;
  --muted: #8a7f68;
  --danger: #b34a3a;
  --safe: #8fbf8f;
  --rare: #8fa8c9;
  --font-head: 'Georgia', 'Palatino Linotype', 'STZhongsong', '华文中宋', 'SimSun', serif;
  --font-body: 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
  --font-read: 'SimSun', '宋体', 'Noto Serif SC', serif;
  --font-display: 'Trajan Pro', 'Georgia', 'Palatino Linotype', serif;
  --font-mono: 'Cascadia Mono', 'Consolas', 'Courier New', monospace;
  --shadow: 0 14px 44px rgba(0, 0, 0, .8);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

::selection { background: rgba(193, 153, 118, .35); color: #000; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #000; }
::-webkit-scrollbar-thumb { background: #2a2218; border: 2px solid #000; }
::-webkit-scrollbar-thumb:hover { background: #3d3222; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(193, 153, 118, .08), transparent 55%),
    radial-gradient(ellipse at 90% 110%, rgba(193, 153, 118, .05), transparent 55%),
    #000;
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.75;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #fff; text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #000; padding: 8px 14px; z-index: 99;
  font-weight: 700;
}
.skip-link:focus { left: 0; }

/* ---------- 顶栏 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(0, 0, 0, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.header-inner {
  max-width: 1400px; margin: 0 auto; padding: 10px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  background: #000;
}
.brand-text {
  font-family: var(--font-head);
  font-size: 20px; letter-spacing: 5px; color: var(--accent);
}
.brand-text small {
  display: block;
  font-family: var(--font-display);
  font-size: 10px; letter-spacing: 6px; color: var(--muted);
  text-transform: uppercase;
}
.search-input {
  width: 260px; max-width: 100%;
  background: #000; color: var(--text);
  border: 1px solid var(--line); border-radius: 0;
  padding: 8px 14px; font-size: 14px; outline: none;
  transition: border-color .2s;
}
.search-input::placeholder { color: var(--muted); }
.search-input:focus { border-color: var(--primary); }

/* ---------- 布局 ---------- */
.layout {
  max-width: 1400px; margin: 0 auto;
  display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 26px;
  padding: 26px 22px 52px;
  align-items: start;
}

/* ---------- 侧栏：传送门链（官网风） ---------- */
.waypoint-rail {
  position: sticky; top: 82px;
  max-height: calc(100vh - 100px); overflow: auto;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 16px 12px 20px;
}
.waypoint-rail-inner { display: flex; flex-direction: column; gap: 2px; }
.waypoint-region { position: relative; padding-left: 18px; }
.waypoint-region::before {
  content: ''; position: absolute; left: 12px; top: 28px; bottom: 8px; width: 1px;
  background: repeating-linear-gradient(180deg, var(--line) 0 4px, transparent 4px 9px);
  opacity: .6;
}
.waypoint-region:last-child::before { display: none; }
.waypoint-region-label {
  font-family: var(--font-display);
  font-size: 11px; letter-spacing: 5px; color: var(--primary);
  text-transform: uppercase;
  padding: 8px 2px 5px;
}
.waypoint-link {
  display: flex; align-items: center; gap: 11px;
  padding: 7px 9px;
  color: var(--text); font-size: 13.5px;
  transition: background .15s, color .15s;
}
.waypoint-link:hover { background: var(--surface-2); color: var(--accent); text-decoration: none; }
.waypoint-stone {
  flex: none; width: 12px; height: 12px; transform: rotate(45deg);
  border: 1px solid var(--line-strong);
  transition: background .15s, box-shadow .15s;
}
.waypoint-link:hover .waypoint-stone { border-color: var(--accent); }
.waypoint-link.active { color: var(--accent); }
.waypoint-link.active .waypoint-stone {
  background: var(--accent);
  box-shadow: 0 0 12px rgba(251, 206, 160, .35);
}
.waypoint-name { line-height: 1.4; }
.waypoint-link[hidden] { display: none; }
.waypoint-region:not(:has(.waypoint-link:not([hidden]))) { display: none; }

/* ---------- 正文 ---------- */
.content { min-width: 0; }
.journal-page {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 34px 42px 46px;
}
.journal-page::before {
  content: '◆';
  position: absolute; top: 10px; left: 12px;
  color: var(--primary); font-size: 12px; opacity: .8;
}
.journal-page::after {
  content: '◆';
  position: absolute; bottom: 10px; right: 12px;
  color: var(--primary); font-size: 12px; opacity: .8;
}

.journal-eyebrow {
  display: inline-block;
  margin: 0 0 12px; padding: 2px 0;
  font-family: var(--font-display);
  font-size: 12px; letter-spacing: 6px; color: var(--primary);
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}

.journal-page h1 {
  font-family: var(--font-head);
  font-size: 34px; letter-spacing: 4px; color: var(--accent);
  margin: 4px 0 20px; padding-bottom: 16px;
  border-bottom: 2px solid var(--primary);
  font-weight: 600;
}
.journal-page h1::after {
  content: '◆';
  margin-left: 12px; font-size: 12px; color: var(--primary);
  vertical-align: middle;
}
.journal-page h2 {
  font-family: var(--font-head);
  font-size: 26px; letter-spacing: 2px; color: var(--accent);
  margin: 40px 0 14px; padding: 4px 0 10px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}
.journal-page h3 {
  font-family: var(--font-head);
  font-size: 18px; letter-spacing: 1px; color: var(--accent);
  margin: 30px 0 10px; font-weight: 600;
}
.journal-page h3::before { content: '◆ '; color: var(--primary); font-size: 11px; }
.journal-page h4 { color: var(--text); font-size: 15px; margin: 18px 0 8px; }
.journal-page p { margin: 10px 0; font-family: var(--font-read); font-size: 16px; line-height: 1.9; }
.journal-page ul, .journal-page ol { padding-left: 26px; }
.journal-page li { margin: 5px 0; font-family: var(--font-read); font-size: 15.5px; line-height: 1.85; }
.journal-page strong { color: var(--accent); }
.journal-page blockquote {
  margin: 16px 0; padding: 12px 18px;
  border-left: 2px solid var(--primary);
  background: var(--surface-2);
  color: var(--muted); font-style: italic;
}
.journal-page hr { border: none; border-top: 1px solid var(--line); margin: 26px 0; }
.journal-page code {
  background: #000; border: 1px solid var(--line);
  color: var(--accent); padding: 1px 7px;
  font-family: var(--font-mono); font-size: .88em;
}

/* ---------- 表格 ---------- */
.table-wrap {
  overflow-x: auto; margin: 16px 0;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.md-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.md-table th {
  background: var(--surface-3);
  color: var(--accent);
  font-family: var(--font-head);
  font-weight: 600; letter-spacing: 2px;
  text-align: left; padding: 11px 14px;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.md-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(193, 153, 118, .14);
  vertical-align: top; color: var(--text);
  font-family: var(--font-read); font-size: 14.5px; line-height: 1.7;
}
.md-table tbody tr:nth-child(even) td { background: rgba(255, 255, 255, .015); }
.md-table tbody tr:hover td { background: var(--surface-3); }
.md-table tbody tr:last-child td { border-bottom: none; }
.md-table a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* 稀有度徽章（暗底低饱和） */
.rarity {
  display: inline-block; padding: 1px 10px;
  font-size: 12px; letter-spacing: 1px; font-family: var(--font-body);
  border: 1px solid; white-space: nowrap;
}
.rarity-safe { color: var(--safe); border-color: rgba(143, 191, 143, .45); }
.rarity-rare { color: var(--rare); border-color: rgba(143, 168, 201, .45); }
.rarity-danger { color: #d07a6a; border-color: rgba(179, 74, 58, .55); }

/* ---------- 地图图版 ---------- */
.md-img {
  margin: 20px auto; text-align: center;
  border: 1px solid var(--line);
  background:
    radial-gradient(ellipse at 50% 30%, rgba(193, 153, 118, .08), transparent 70%),
    #000;
  padding: 12px;
  max-width: min(960px, 100%);
}
.md-img img {
  display: block; max-width: 100%; height: auto;
  filter: saturate(.94) brightness(.98);
}
.md-img figcaption {
  font-family: var(--font-display);
  font-size: 11px; letter-spacing: 3px; color: var(--muted);
  text-transform: uppercase;
  margin-top: 9px;
}

/* ---------- 剧透折叠 ---------- */
.spoiler {
  margin: 18px 0;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.spoiler summary {
  cursor: pointer; list-style: none;
  padding: 13px 18px;
  font-family: var(--font-head);
  font-weight: 600; letter-spacing: 1px; color: var(--accent);
  background: var(--surface-3);
  border-bottom: 1px solid transparent;
  display: flex; align-items: center; gap: 10px;
  transition: background .2s;
}
.spoiler summary::-webkit-details-marker { display: none; }
.spoiler summary::before {
  content: '◆';
  color: var(--primary); font-size: 11px;
  transition: transform .25s;
}
.spoiler summary::after {
  content: '展开';
  margin-left: auto;
  font-family: var(--font-body); font-size: 11px; font-weight: 400;
  color: var(--muted); letter-spacing: 3px;
}
.spoiler summary:hover { background: #1b1610; }
.spoiler[open] summary { border-bottom-color: var(--line); }
.spoiler[open] summary::before { transform: rotate(45deg); }
.spoiler[open] summary::after { content: '收起'; }
.spoiler-body { padding: 14px 22px 16px; }
.spoiler-body p:first-child { margin-top: 4px; }

/* ---------- 通用徽章 ---------- */
.badge {
  display: inline-block; padding: 2px 11px;
  font-size: 12px; letter-spacing: 1px; border: 1px solid; font-family: var(--font-body);
}
.badge-null { color: var(--safe); border-color: rgba(143, 191, 143, .45); }
.badge-light { color: var(--rare); border-color: rgba(143, 168, 201, .45); }
.badge-detail { color: #d07a6a; border-color: rgba(179, 74, 58, .55); }

/* ---------- 首页 ---------- */
.hero {
  position: relative;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .86), rgba(0, 0, 0, .96)),
    url('../images/荒野地图-中央.png') center/cover no-repeat;
  min-height: 330px;
  display: flex; align-items: flex-end;
}
.hero-inner { padding: 34px 36px 38px; }
.hero-kicker {
  font-family: var(--font-display);
  letter-spacing: 8px; font-size: 12px; color: var(--primary);
  text-transform: uppercase; margin: 0 0 10px;
}
.hero h1 {
  font-family: var(--font-head);
  font-size: 46px; letter-spacing: 7px; color: var(--accent);
  margin: 4px 0 12px; font-weight: 600;
}
.hero-sub { color: var(--text); margin: 8px 0 18px; font-size: 16px; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 9px; }
.hero-tags span {
  border: 1px solid var(--line);
  color: var(--text); padding: 4px 14px;
  font-size: 12px; letter-spacing: 2px;
}
.hero-d20 {
  position: absolute; right: 30px; bottom: 26px;
  opacity: .9;
  animation: d20-float 5s ease-in-out infinite;
}
@keyframes d20-float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-6px) rotate(2deg); }
}
.home-section { margin-top: 32px; }
.home-section h2 {
  font-family: var(--font-head);
  color: var(--accent); letter-spacing: 3px;
  margin: 0 0 16px; font-size: 24px; font-weight: 600;
  padding: 4px 0 10px; border-bottom: 2px solid var(--primary);
}
.chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.chapter-card {
  display: flex; flex-direction: column; gap: 7px;
  padding: 17px 20px 16px;
  background: var(--surface);
  border: 1px solid var(--line); border-left-width: 3px;
  color: var(--text);
  transition: border-color .15s, background .15s;
  position: relative;
}
.chapter-card:hover {
  border-color: var(--line-strong); background: var(--surface-2); text-decoration: none;
}
.chapter-card.act-prep { border-left-color: #6d6a63; }
.chapter-card.act-prologue { border-left-color: var(--primary); }
.chapter-card.act-one { border-left-color: #7d9b6a; }
.chapter-card.act-two { border-left-color: #7d93ad; }
.chapter-card.act-three { border-left-color: #b34a3a; }
.chapter-card.act-ref { border-left-color: #b58a5a; }
.card-group {
  font-family: var(--font-display);
  font-size: 10px; letter-spacing: 5px; color: var(--muted);
  text-transform: uppercase;
}
.card-title { font-family: var(--font-head); font-size: 19px; color: var(--accent); letter-spacing: 1px; }
.card-arrow {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  color: var(--primary); opacity: 0; transition: opacity .15s; font-size: 14px;
}
.chapter-card:hover .card-arrow { opacity: 1; }
.chapter-card[hidden] { display: none; }
.panel {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 18px 24px;
}
.panel li { font-family: var(--font-read); }

/* ---------- 页脚与按钮 ---------- */
.site-footer {
  margin-top: 26px; padding: 22px 10px 10px;
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: 13px; text-align: center;
}
.site-footer p { margin: 4px 0; }
.footer-flavor { font-family: var(--font-display); letter-spacing: 4px; font-size: 11px; color: var(--primary); }
.btn {
  border: 1px solid var(--line-strong); background: transparent; color: var(--primary);
  padding: 8px 18px; cursor: pointer; font-size: 13px; letter-spacing: 2px;
  margin: 10px 6px 0 0; transition: background .15s, color .15s;
}
.btn:hover { background: var(--primary); color: #000; }
.btn.ghost { border-color: var(--line); }

/* ---------- 动效克制 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; padding-top: 16px; gap: 18px; }
  .waypoint-rail {
    position: static; max-height: none; overflow-x: auto;
    padding: 10px;
  }
  .waypoint-rail-inner { flex-direction: row; gap: 4px; }
  .waypoint-region { display: flex; align-items: center; gap: 2px; padding-left: 0; }
  .waypoint-region::before { display: none; }
  .waypoint-region-label {
    padding: 0 8px 0 4px; letter-spacing: 2px; white-space: nowrap;
    border-right: 1px solid var(--line); margin-right: 4px;
  }
  .waypoint-link { white-space: nowrap; padding: 6px 8px; }
  .waypoint-name { font-size: 13px; }
  .header-inner { justify-content: center; }
  .header-tools { width: 100%; }
  .search-input { width: 100%; }
  .journal-page { padding: 22px 18px 30px; }
  .journal-page h1 { font-size: 26px; letter-spacing: 3px; }
  .hero { min-height: 260px; }
  .hero h1 { font-size: 30px; letter-spacing: 4px; }
  .hero-d20 { display: none; }
  .hero-inner { padding: 28px 22px 32px; }
}
