/* ===========================================================
   myblog — 干净的博客内容站模板
   风格参考：折叠栏目导航 + 首页轮播 + 站内搜索 + 文章卡片
   颜色全部用 CSS 变量，改主题只改 :root 即可
   =========================================================== */

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #1c2230;
  --muted: #5b6475;
  --brand: #4457ff;
  --brand-soft: #eef1ff;
  --border: #e4e7ef;
  --shadow: 0 1px 3px rgba(20, 28, 58, .08), 0 8px 24px rgba(20, 28, 58, .05);
  --radius: 14px;
  --maxw: 1080px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1117;
    --surface: #161b24;
    --text: #e8ebf2;
    --muted: #9aa3b5;
    --brand: #6b7bff;
    --brand-soft: #1d2440;
    --border: #262d3a;
    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] {
  --bg: #0e1117; --surface: #161b24; --text: #e8ebf2; --muted: #9aa3b5;
  --brand: #6b7bff; --brand-soft: #1d2440; --border: #262d3a;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex; align-items: center; gap: 20px;
  min-height: 64px; flex-wrap: wrap;
}
.brand { font-weight: 800; font-size: 20px; letter-spacing: .3px; white-space: nowrap; }
.brand span { color: var(--brand); }

/* search */
.search { position: relative; flex: 1 1 260px; max-width: 420px; }
#site-search-input {
  width: 100%; padding: 10px 14px; font-size: 15px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg); color: var(--text);
}
#site-search-input:focus { outline: 2px solid var(--brand); border-color: transparent; }
#site-search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; z-index: 60;
}
#site-search-results[hidden] { display: none; }
.site-search-result { display: block; padding: 10px 14px; color: inherit; border-bottom: 1px solid var(--border); }
.site-search-result:last-child { border-bottom: 0; }
.site-search-result:hover { background: var(--brand-soft); text-decoration: none; }
.site-search-result-title { font-weight: 600; display: block; }
.site-search-result-summary { font-size: 13px; color: var(--muted); display: block; }

/* nav */
.nav-toggle {
  margin-left: auto; display: none; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 12px; border-radius: 10px; font-size: 14px;
}
.main-nav { display: flex; gap: 6px; }
.main-nav a {
  color: var(--text); padding: 8px 12px; border-radius: 10px; font-size: 15px;
}
.main-nav a:hover, .main-nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); text-decoration: none; }

@media (max-width: 760px) {
  .nav-toggle { display: inline-block; }
  .main-nav {
    flex-basis: 100%; flex-direction: column; gap: 2px;
    max-height: 0; overflow: hidden; transition: max-height .25s ease;
  }
  .main-nav.is-open { max-height: 320px; padding-bottom: 10px; }
}

/* ---------- Hero carousel ---------- */
.hero { margin: 28px 0 8px; }
#hero-track {
  display: flex; gap: 16px; overflow-x: auto;
  scroll-snap-type: x mandatory; scrollbar-width: none;
  border-radius: var(--radius);
}
#hero-track::-webkit-scrollbar { display: none; }
#hero-track > .slide {
  flex: 0 0 100%; scroll-snap-align: start;
  min-height: 260px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand), #8a3ffb);
  color: #fff; padding: 36px; display: flex; flex-direction: column; justify-content: flex-end;
  text-decoration: none;
}
#hero-track > .slide:nth-child(2) { background: linear-gradient(135deg, #ff5a7a, #ff9a3c); }
#hero-track > .slide:nth-child(3) { background: linear-gradient(135deg, #16a34a, #0ea5e9); }
.slide .tag { font-size: 13px; opacity: .85; }
.slide h2 { margin: 6px 0 8px; font-size: 26px; line-height: 1.25; color: #fff; }
.slide p { margin: 0; opacity: .9; }

.hero-controls { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.hero-controls button[data-hero-prev], .hero-controls button[data-hero-next] {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer; font-size: 16px;
}
[data-hero-dots] { display: inline-flex; gap: 8px; margin-left: auto; }
[data-hero-dot] { width: 10px; height: 10px; border-radius: 50%; border: none; background: var(--border); cursor: pointer; padding: 0; }
[data-hero-dot].is-active { background: var(--brand); }

/* ---------- Article grid ---------- */
.section-title { margin: 36px 0 16px; font-size: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; display: flex; flex-direction: column; transition: transform .15s ease;
}
.card:hover { transform: translateY(-3px); }
.card .thumb { aspect-ratio: 16/9; background: var(--brand-soft); }
.card .body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card .cat { font-size: 12px; color: var(--brand); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.card h3 { margin: 0; font-size: 17px; line-height: 1.4; }
.card h3 a { color: var(--text); }
.card p { margin: 0; color: var(--muted); font-size: 14px; }
.card .meta { margin-top: auto; font-size: 12px; color: var(--muted); }

/* ---------- Article page ---------- */
.article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px; margin: 28px 0; }
.article h1 { margin-top: 0; font-size: 30px; line-height: 1.3; }
.related-posts h2 { margin-top: 0; font-size: 20px; }
.related-posts li + li { margin-top: 8px; }
.article .meta { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.article :is(h2,h3) { margin-top: 1.6em; }
.breadcrumb { font-size: 13px; color: var(--muted); margin: 20px 0 0; }
.breadcrumb a { color: var(--muted); }

/* ---------- FAQ（常见问题） ---------- */
.faq { display: grid; gap: 10px; }
.faq details {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 2px 18px; box-shadow: var(--shadow);
}
.faq summary {
  cursor: pointer; font-weight: 600; padding: 14px 0;
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--brand); font-weight: 700; font-size: 20px; }
.faq details[open] summary::after { content: "\2013"; }
.faq .faq-a { padding: 0 0 16px; color: var(--muted); }

/* ---------- 栏目列表（横幅 + 一行一篇） ---------- */
.list-banner {
  width: 100%; aspect-ratio: 3 / 1; object-fit: cover;
  border-radius: 12px; margin: 16px 0 10px; background: var(--brand-soft);
}
.post-list { border-top: 1px solid var(--border); margin: 10px 0 0; }
.post-row { padding: 16px 2px; border-bottom: 1px solid var(--border); }
.post-row-head { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; }
.post-row-title { font-size: 17px; font-weight: 600; color: var(--text); }
.post-row-title:hover { color: var(--brand); text-decoration: none; }
.post-row-date { font-size: 13px; color: var(--muted); white-space: nowrap; }
.post-row-summary { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
@media (max-width: 560px) {
  .post-row-head { flex-direction: column; gap: 2px; }
}

/* ---------- 文章顶部封面图 ---------- */
.article-hero {
  width: 100%; height: auto; object-fit: cover;
  border-radius: 12px; margin: 4px 0 22px; background: var(--brand-soft);
}

/* ---------- 分享 / 收藏条 ---------- */
.share-bar { display: flex; gap: 10px; margin: -6px 0 22px; flex-wrap: wrap; }
.share-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; font-size: 14px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; transition: border-color .15s ease, color .15s ease;
}
.share-btn:hover { border-color: var(--brand); color: var(--brand); }
.share-btn.is-on { border-color: var(--brand); color: var(--brand); }

/* ---------- 轻提示 toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 40px;
  transform: translateX(-50%) translateY(10px);
  background: rgba(20, 28, 58, .92); color: #fff;
  padding: 10px 18px; border-radius: 999px; font-size: 14px;
  z-index: 999; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 评论区 ---------- */
.comments {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 28px; margin: 28px 0;
}
.comments-title { margin: 0 0 18px; font-size: 20px; }
.comment-list { list-style: none; margin: 0 0 28px; padding: 0; display: grid; gap: 18px; }
.comment-list:empty { display: none; }
.comment-item { display: flex; gap: 12px; }
.comment-avatar { width: 40px; height: 40px; border-radius: 50%; flex: 0 0 40px; background: var(--brand-soft); }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.comment-name { font-weight: 600; }
.comment-date { font-size: 12px; color: var(--muted); }
.comment-text { margin: 0; color: var(--text); white-space: pre-wrap; word-wrap: break-word; }

.comment-form-title { font-size: 17px; margin: 0 0 6px; }
.comment-note { font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.comment-form { display: grid; gap: 12px; }
.comment-form-row { display: flex; align-items: center; gap: 12px; }
.comment-input, .comment-textarea {
  width: 100%; padding: 10px 14px; font-size: 15px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text);
}
.comment-textarea { min-height: 110px; resize: vertical; }
.comment-input:focus, .comment-textarea:focus { outline: 2px solid var(--brand); border-color: transparent; }
.comment-submit {
  justify-self: start; padding: 10px 22px; font-size: 15px; cursor: pointer;
  border: none; border-radius: 10px; background: var(--brand); color: #fff;
}
.comment-submit:hover { filter: brightness(1.05); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 48px; padding: 28px 0; color: var(--muted); font-size: 14px; text-align: center; }
.footer-links { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--brand); }

/* ================= 首页增强板块 ================= */

/* 大标题 + 简介带（居中） */
.hero-band { padding: 36px 0 4px; text-align: center; }
.hero-band h1 { font-size: 34px; margin: 0 0 10px; }
.hero-band p { color: var(--muted); max-width: 720px; margin: 0 auto; font-size: 16px; }

/* 主题切换按钮 */
.theme-toggle {
  margin-left: 6px; flex: 0 0 auto;
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 16px; line-height: 1;
}
.theme-toggle:hover { border-color: var(--brand); }

/* 精选网格 */
.featured-grid {
  display: grid; gap: 16px; margin: 24px 0;
  grid-template-columns: repeat(4, 1fr); grid-auto-rows: 170px;
}
.featured-grid .feat {
  position: relative; border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 18px; color: #fff; text-decoration: none; background-size: cover; background-position: center;
}
.featured-grid .feat::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.66), rgba(0,0,0,0) 62%); }
.featured-grid .feat > * { position: relative; z-index: 1; }
.featured-grid .feat .t { font-weight: 700; line-height: 1.35; }
.featured-grid .feat .d { font-size: 12px; opacity: .85; margin-top: 6px; }
.featured-grid .feat:first-child { grid-column: span 2; grid-row: span 2; }
.featured-grid .feat:first-child .t { font-size: 22px; }
@media (max-width: 860px) { .featured-grid { grid-template-columns: repeat(2, 1fr); } .featured-grid .feat:first-child { grid-column: span 2; grid-row: auto; } }
@media (max-width: 520px) { .featured-grid { grid-template-columns: 1fr; } .featured-grid .feat:first-child { grid-column: auto; } }

/* 核心栏目卡片 */
.feature-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.feature-card { display: flex; flex-direction: column; gap: 6px; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); text-decoration: none; transition: transform .15s ease; }
.feature-card:hover { transform: translateY(-3px); text-decoration: none; }
.feature-card .ft { font-weight: 700; color: var(--text); }
.feature-card .fd { font-size: 13px; color: var(--muted); }

/* 分栏目预览 */
.category-preview { display: grid; grid-template-columns: 200px 1fr; gap: 22px; align-items: start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin: 18px 0; }
.category-preview .cp-img { position: relative; overflow: hidden; border-radius: 10px; aspect-ratio: 4/3; background: var(--brand-soft); background-size: cover; background-position: center; }
.category-preview .cp-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.category-preview .cp-img::after { content: "197737.com"; position: absolute; right: 8px; bottom: 6px; color: rgba(255,255,255,.65); font-size: 10px; line-height: 1.2; pointer-events: none; }
.category-preview h2 { margin: 0 0 4px; font-size: 19px; }
.category-preview .cp-desc { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.docs-inline-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.docs-inline-list li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--border); padding-bottom: 8px; font-size: 14px; }
.docs-inline-list .dt { color: var(--muted); font-size: 12px; white-space: nowrap; }
@media (max-width: 600px) { .category-preview { grid-template-columns: 1fr; } }

/* 热门标签 */
.tag-cloud { line-height: 2.4; }
.tag-cloud span { display: inline-block; padding: 4px 12px; margin: 2px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; color: var(--muted); }

/* 关于我们摘要 */
.about-summary { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin: 18px 0; }
.about-summary h2 { margin-top: 0; }
.about-summary p { color: var(--muted); }
