/* ============================================================
   Mortal Shell II Wiki — Obsidian / Bone / Ember theme
   heimaomi-style dense card grid + dark fantasy identity
   ============================================================ */
:root {
  --color-bg: #0c0908;
  --color-surface: #171110;
  --color-surface-2: #221a17;
  --color-border: #33261d;
  --color-text: #ece2d0;
  --color-muted: #a3947e;
  --color-brand: #c9a227;
  --color-brand-strong: #e0b93a;
  --color-accent: #b23a2e;
  --color-accent-soft: #7d3a30;
  --color-evidence-official: #7a9a5a;
  --color-evidence-build: #5a8aa8;
  --color-evidence-community: #b08a2e;
  --color-evidence-speculation: #8a837a;
  --shadow-sm: 0 1px 3px rgb(0 0 0 / .4);
  --shadow-md: 0 8px 24px rgb(0 0 0 / .45);
  --shadow-gold: 0 0 0 1px #c9a22733, 0 8px 28px rgb(0 0 0 / .5);
  --radius: .9rem;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: Georgia, "Palatino Linotype", "Book Antiqua", Palatino, serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0a0807;
    --color-surface: #16100f;
    --color-surface-2: #201815;
    --color-border: #33261d;
    --color-text: #ece2d0;
    --color-muted: #9c8e79;
    --color-brand: #c9a227;
    --color-brand-strong: #e0b93a;
  }
}

/* ===== 基础 ===== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); background: var(--color-bg); color: var(--color-text); line-height: 1.65; }
a { color: var(--color-brand); text-decoration: none; }
a:hover { color: var(--color-brand-strong); text-decoration: none; }
img { max-width: 100%; height: auto; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 1.25rem; }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--color-brand); color: #1a1208; padding: .5rem 1rem; z-index: 2000; }
.skip-link:focus { left: 0; }
::selection { background: #c9a22744; }

/* ===== Header ===== */
.site-header { position: sticky; top: 0; z-index: 100; background: color-mix(in srgb, var(--color-bg) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--color-border); box-shadow: 0 4px 20px rgb(0 0 0 / .25); }
.header-inner { display: flex; align-items: center; gap: 1.25rem; height: 62px; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.12rem; color: var(--color-text); text-decoration: none; font-family: var(--font-display); letter-spacing: .02em; }
.brand-mark { width: 24px; height: 24px; border-radius: 7px; background: conic-gradient(from 210deg, #c9a227, #b23a2e, #3d2b22, #c9a227); display: inline-block; box-shadow: inset 0 0 0 1px #ffffff22; }
.brand-name { background: linear-gradient(180deg, #f4e8c8, #c9a227); -webkit-background-clip: text; background-clip: text; color: transparent; }
.site-nav { display: flex; gap: .25rem; margin-left: auto; }
.nav-item { position: relative; }
.nav-link { display: block; padding: .45rem .85rem; border-radius: .5rem; font-weight: 600; font-size: .92rem; color: var(--color-text); }
.nav-link:hover { background: var(--color-surface-2); color: var(--color-brand-strong); }
.nav-link.active { color: var(--color-brand); box-shadow: inset 0 -2px 0 var(--color-brand); }
.nav-panel { position: absolute; top: calc(100% + 8px); left: 0; min-width: 230px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: .75rem; box-shadow: var(--shadow-md); padding: .5rem; display: none; }
.nav-item:hover .nav-panel, .nav-item:focus-within .nav-panel { display: block; }
.nav-panel a { display: block; padding: .5rem .75rem; border-radius: .45rem; color: var(--color-text); font-size: .9rem; }
.nav-panel a:hover { background: var(--color-surface-2); color: var(--color-brand-strong); }
.header-actions { display: flex; align-items: center; gap: .5rem; }
.search-trigger { background: none; border: 1px solid var(--color-border); border-radius: .5rem; padding: .4rem .55rem; cursor: pointer; color: var(--color-text); }
.search-trigger:hover { background: var(--color-surface-2); color: var(--color-brand-strong); }
.lang-switch { position: relative; }
.lang-current { padding: .4rem .55rem; border: 1px solid var(--color-border); border-radius: .5rem; font-size: .82rem; cursor: pointer; color: var(--color-muted); }
.lang-menu { position: absolute; right: 0; top: calc(100% + 8px); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: .75rem; box-shadow: var(--shadow-md); padding: .3rem; display: none; min-width: 130px; }
.lang-switch:hover .lang-menu { display: block; }
.lang-menu a { display: block; padding: .45rem .6rem; border-radius: .4rem; font-size: .88rem; color: var(--color-text); }
.lang-menu a.active { color: var(--color-brand); font-weight: 600; }

/* ===== Hero ===== */
.hero { padding: 2.5rem 0 1rem; }
.hero-visual { margin: 0 auto 1.5rem; max-width: 100%; border-radius: 1.1rem; overflow: hidden; box-shadow: 0 18px 60px rgb(0 0 0 / .55); border: 1px solid #4a3a26; position: relative; }
.hero-visual::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, #0c0908cc); pointer-events: none; }
.hero-visual img { display: block; width: 100%; height: auto; aspect-ratio: 21/9; object-fit: cover; }
.hero-inner { text-align: center; margin-top: -3.2rem; position: relative; z-index: 2; padding-bottom: .5rem; }
.hero h1 { font-family: var(--font-display); font-size: clamp(2.1rem, 5vw, 3.4rem); margin: 0 0 .4rem; letter-spacing: -.01em; text-shadow: 0 2px 24px rgb(0 0 0 / .7), 0 0 40px #c9a22722; }
.hero h1 em { font-style: italic; color: var(--color-brand); }
.hero .hero-desc { color: var(--color-muted); max-width: 680px; margin: 0 auto; font-size: 1.05rem; text-shadow: 0 1px 8px rgb(0 0 0 / .6); }
.hero-facts { margin-top: 1.1rem; display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }
.fact { background: #171110e6; border: 1px solid #4a3a26; border-radius: .7rem; padding: .45rem .85rem; font-size: .85rem; color: var(--color-muted); box-shadow: var(--shadow-sm); }
.fact b { color: var(--color-brand); font-weight: 700; }
.hero-cta { margin-top: 1.4rem; display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; }
.cta-btn { display: inline-flex; align-items: center; gap: .45rem; background: linear-gradient(180deg, #e0b93a, #b3871a); color: #1a1208; font-weight: 700; padding: .6rem 1.3rem; border-radius: .65rem; box-shadow: 0 4px 16px #c9a22733; transition: transform .15s ease, box-shadow .15s ease; }
.cta-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 22px #c9a22755; color: #1a1208; }
.cta-btn.ghost { background: #171110e6; color: var(--color-text); border: 1px solid #4a3a26; box-shadow: none; }
.cta-btn.ghost:hover { border-color: var(--color-brand); color: var(--color-brand-strong); box-shadow: var(--shadow-sm); }

/* ===== 首页卡片区 ===== */
.section { padding: 1.8rem 0; }
.section-title { font-family: var(--font-display); font-size: 1.45rem; margin: 0 0 1.1rem; display: flex; align-items: center; gap: .6rem; }
.section-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--color-border), transparent); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.card-panel { display: block; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow-sm); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; border-top: 3px solid var(--color-border); }
.card-panel:hover { transform: translateY(-3px); box-shadow: var(--shadow-gold); text-decoration: none; border-top-color: var(--color-brand); }
.panel-label { display: inline-block; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--color-accent); font-weight: 800; margin-bottom: .35rem; }
.panel-title { font-size: 1.02rem; font-weight: 700; margin: 0 0 .3rem; color: var(--color-text); }
.panel-desc { font-size: .88rem; color: var(--color-muted); margin: 0; }
.panel-link { margin-top: .5rem; font-size: .85rem; font-weight: 700; color: var(--color-brand); }

/* hub 导航卡片（heimaomi 风格：大图 + 标题 + 描述 + 彩色标签 + 进入链接） */
.nav-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.nav-card { display: block; background: linear-gradient(165deg, #1c1612, #120d0a); border: 1px solid #45362657; border-radius: 1rem; overflow: hidden; box-shadow: 0 10px 28px rgb(0 0 0 / .42); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; text-decoration: none; color: inherit; }
.nav-card:hover { transform: translateY(-4px); box-shadow: 0 0 0 1px color-mix(in srgb, var(--hub-c, #c9a227) 65%, transparent), 0 14px 34px rgb(0 0 0 / .55); border-color: color-mix(in srgb, var(--hub-c, #c9a227) 55%, transparent); }
.nav-thumb { position: relative; aspect-ratio: 16/7; overflow: hidden; border-bottom: 1px solid #45362657; background: var(--color-surface-2); }
.nav-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease, filter .35s ease; }
.nav-card:hover .nav-thumb img { transform: scale(1.04); filter: brightness(1.08); }
.nav-thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, #120d0a); pointer-events: none; }
.nav-thumb span { position: absolute; top: .55rem; left: .55rem; background: rgb(12 9 8 / .72); backdrop-filter: blur(4px); border: 1px solid color-mix(in srgb, var(--hub-c, #c9a227) 50%, transparent); color: var(--color-brand-strong); font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; padding: .18rem .5rem; border-radius: .45rem; color-margin: 0; }
.nav-body { padding: 1rem 1.1rem 1.15rem; }
.nav-top { display: flex; align-items: center; gap: .6rem; margin-bottom: .4rem; }
.nav-icon { width: 30px; height: 30px; border-radius: .6rem; background: color-mix(in srgb, var(--hub-c, #c9a227) 14%, #171110); border: 1px solid color-mix(in srgb, var(--hub-c, #c9a227) 40%, transparent); display: grid; place-items: center; font-size: 1.05rem; flex: none; }
.nav-body h3 { margin: 0; font-family: var(--font-display); font-size: 1.16rem; color: var(--color-text); }
.nav-meta { display: flex; flex-wrap: wrap; gap: .9rem; margin: 0 0 .55rem; font-size: .75rem; color: var(--color-muted); }
.nav-meta b { color: var(--color-brand); font-weight: 700; }
.nav-desc { margin: 0 0 .65rem; font-size: .86rem; color: var(--color-muted); line-height: 1.5; }
.nav-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .7rem; }
.tag { display: inline-block; border-radius: 999px; padding: .16rem .62rem; font-size: .72rem; font-weight: 700; letter-spacing: .02em; }
.tag-sun { background: #e2b43c; color: #241a06; }
.tag-rose { background: #c14f3c; color: #260d09; }
.tag-sky { background: #5f8fb0; color: #0a1720; }
.tag-stone { background: #241e18; color: var(--color-muted); border: 1px solid #3a3126; }
.nav-go { display: inline-flex; align-items: center; gap: .35rem; font-size: .84rem; font-weight: 700; color: var(--hub-c, var(--color-brand)); }
.nav-card:hover .nav-go { color: var(--color-brand-strong); }

/* hub-block（featured 每栏） */
.hub-block { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 1rem; padding: 1.1rem; box-shadow: var(--shadow-sm); }
.hub-title { margin: 0 0 .7rem; font-family: var(--font-display); font-size: 1.15rem; }
.hub-title a { color: var(--color-brand); }
.hub-title a:hover { color: var(--color-brand-strong); }

/* 截图画廊 */
.gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.gallery-grid figure { margin: 0; border-radius: .9rem; overflow: hidden; border: 1px solid var(--color-border); background: var(--color-surface-2); box-shadow: var(--shadow-sm); }
.gallery-grid img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; transition: transform .3s ease, filter .3s ease; }
.gallery-grid figure:hover img { transform: scale(1.03); filter: brightness(1.1); }
.gallery-grid figcaption { font-size: .78rem; color: var(--color-muted); padding: .45rem .7rem; background: #14100e; }

/* ===== 文章页 ===== */
.article-page { max-width: 780px; margin: 0 auto; padding: 2rem 1.25rem 3rem; }
.breadcrumbs { font-size: .85rem; color: var(--color-muted); margin-bottom: 1.5rem; display: flex; gap: .5rem; flex-wrap: wrap; }
.breadcrumbs a { color: var(--color-muted); }
.breadcrumbs a:hover { color: var(--color-brand); }
.article-header h1 { font-family: var(--font-display); font-size: clamp(1.8rem, 3.5vw, 2.4rem); margin: 0 0 .6rem; line-height: 1.18; }
.article-desc { color: var(--color-muted); font-size: 1.05rem; margin: 0 0 .8rem; }
.article-meta { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; font-size: .85rem; color: var(--color-muted); }
.article-body { margin-top: 1.5rem; font-size: 1.02rem; }
.article-body h2 { font-family: var(--font-display); font-size: 1.4rem; margin: 2.2rem 0 .8rem; padding-bottom: .4rem; border-bottom: 1px solid var(--color-border); }
.article-body h3 { font-size: 1.15rem; margin: 1.6rem 0 .5rem; }
.article-body table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .92rem; }
.article-body th, .article-body td { border: 1px solid var(--color-border); padding: .5rem .7rem; text-align: left; }
.article-body th { background: var(--color-surface-2); color: var(--color-brand); }
.article-body tr:nth-child(even) td { background: #120d0b; }
.article-body blockquote { border-left: 3px solid var(--color-accent); margin: 1rem 0; padding: .4rem 1rem; color: var(--color-muted); background: var(--color-surface-2); border-radius: 0 .5rem .5rem 0; }
.article-body ul, .article-body ol { padding-left: 1.4rem; }
.article-body li { margin: .35rem 0; }
.article-body ul li::marker { color: var(--color-brand); }
.article-hero-figure { margin: 1.5rem 0 0; border-radius: 1rem; overflow: hidden; border: 1px solid var(--color-border); box-shadow: var(--shadow-sm); }
.article-hero { display: block; width: 100%; height: auto; aspect-ratio: 21/9; object-fit: cover; }
.article-body img { display: block; margin: 1.5rem auto; max-width: 100%; border-radius: .9rem; border: 1px solid var(--color-border); box-shadow: var(--shadow-sm); }

/* ===== 页脚 ===== */
.site-footer { border-top: 1px solid var(--color-border); padding: 2rem 0 3rem; margin-top: 2.5rem; background: linear-gradient(180deg, transparent, #0a0706); }
.footer-inner { display: grid; gap: 1rem; }
.footer-brand { display: flex; align-items: center; gap: .5rem; font-weight: 600; font-family: var(--font-display); }
.footer-nav { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .9rem; }
.footer-nav a { color: var(--color-muted); }
.footer-nav a:hover { color: var(--color-brand); }
.footer-disclaimer { color: var(--color-muted); font-size: .82rem; margin: 0; }

/* ===== 相关推荐 ===== */
.related { margin-top: 2.5rem; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem; }
.related-card { display: block; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: .9rem 1rem; }
.related-card:hover { border-color: var(--color-brand); box-shadow: var(--shadow-sm); }
.related-card strong { display: block; color: var(--color-text); margin-bottom: .2rem; }
.related-card span { font-size: .85rem; color: var(--color-muted); }

/* ===== 搜索面板（依赖 .search-overlay 等由 Search.astro 定义） ===== */
.search-overlay { position: fixed; inset: 0; background: #0a0706e6; backdrop-filter: blur(6px); z-index: 900; display: none; padding: 2rem 1rem; }
.search-overlay.open { display: block; }
.search-box { max-width: 640px; margin: 0 auto; }
.search-box input { width: 100%; padding: .9rem 1rem; font-size: 1.05rem; background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-brand); border-radius: .75rem; outline: none; }
.search-results { margin-top: 1rem; display: grid; gap: .6rem; max-height: 60vh; overflow: auto; }
.search-results a { display: block; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: .7rem; padding: .8rem 1rem; color: var(--color-text); }
.search-results a:hover { border-color: var(--color-brand); }
.search-results small { color: var(--color-muted); }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .site-nav { display: none; }
  .card-grid { grid-template-columns: 1fr; }
  .hub-grid { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: 1fr; }
  .hero-visual img { aspect-ratio: 16/9; }
  .hero-inner { margin-top: -1.6rem; }
}