/* ============================================================
   Beako 博客 — 共享样式 (内页)
   基于 DESIGN.md + 首页设计语言:奶油画布 / default_font / 珊瑚 CTA / 卡片
   字体在 ../fonts/ ;新页面 <link> 本文件
   ============================================================ */

/* ---- 字体 ---- */
@font-face {
  font-family: "Beako CJK";
  src: url("../fonts/default_font.woff") format("woff");
  font-weight: 400; font-style: normal; font-display: swap;
}
/* Font Awesome 6 Free 由 base.html/admin_base.html 的 CDN 全量引入（替代原设计稿的子集字体，
   以覆盖迁移后用到的 fa-pen-nib/fa-mug-hot/fa-house/fa-gear 等图标）。 */

/* ---- Tokens (from DESIGN.md) ----
   --color-primary 由 base.html/admin_base.html 从 settings 主题色注入；
   --primary 回落到 --color-primary，使按钮/链接/品牌等随设置变色。
   未注入时（默认）仍是珊瑚 #cc785c。 */
:root {
  --color-primary: #cc785c;
  --primary: var(--color-primary); --primary-active: #a9583e; --primary-disabled: #e6dfd8;
  --accent-teal: #5db8a6; --accent-amber: #e8a55a;
  --canvas: #faf9f5; --surface-soft: #f5f0e8; --surface-card: #efe9de;
  --surface-cream-strong: #e8e0d2; --surface-dark: #181715;
  --surface-dark-elevated: #252320; --surface-dark-soft: #1f1e1b;
  --ink: #141413; --body: #3d3d3a; --body-strong: #252523;
  --muted: #6c6a64; --muted-soft: #8e8b82;
  --on-primary: #ffffff; --on-dark: #faf9f5; --on-dark-soft: #a09d96;
  --hairline: #e6dfd8; --hairline-soft: #ebe6df;
  --error: #c64545; --success: #5db872;
  --font-sans: "Beako CJK", "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  --font-serif: var(--font-sans);
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-pill: 9999px;
  /* 代码块（chroma class-based，奶白底可读；比品牌色略深一档） */
  --code-bg: var(--surface-soft);
  --code-text: var(--ink);
  --code-comment: #9a978f;
  --code-keyword: #a9583e;
  --code-string: #2f8a7a;
  --code-number: #b07423;
  --code-func: #c56a4f;
  --code-tag: #a9583e;
  --code-builtin: #2f8a7a;
  --code-punct: var(--body);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  color: var(--body);
  background: var(--canvas);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 760px; margin: 0 auto; padding: 0 24px; }

/* ---- Font Awesome (本地,常用图标) ---- */
.fas { font-family: "Font Awesome 6 Free"; font-weight: 900; font-style: normal; }
.fa-fw { text-align: center; width: 1.25em; }
.fa-search::before, .fa-magnifying-glass::before { content: "\f002"; }
.fa-rss::before { content: "\f09e"; }
.fa-folder::before { content: "\f07b"; }
.fa-tag::before { content: "\f02b"; }
.fa-tags::before { content: "\f02c"; }
.fa-user::before { content: "\f007"; }
.fa-lock::before { content: "\f023"; }
.fa-envelope::before { content: "\f0e0"; }
.fa-arrow-left::before { content: "\f060"; }
.fa-arrow-right::before { content: "\f061"; }
.fa-pen::before { content: "\f303"; }
.fa-chart-line::before { content: "\f201"; }
.fa-comments::before { content: "\f086"; }
.fa-gear::before, .fa-cog::before { content: "\f013"; }
.fa-house::before, .fa-home::before { content: "\f015"; }
.fa-file-lines::before { content: "\f15c"; }
.fa-right-from-bracket::before, .fa-sign-out::before { content: "\f2f5"; }
.fa-plus::before { content: "\f067"; }
.fa-eye::before { content: "\f06e"; }
.fa-check::before { content: "\f00c"; }
.fa-copy::before { content: "\f0c5"; }
.fa-github::before { content: "\f09b"; }

/* ---- Top nav (内页:实心奶油) ---- */
.top-nav {
  position: sticky; top: 0; z-index: 50;
  height: 64px;
  background: rgba(250, 249, 245, 0.92);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
}
.top-nav .container {
  max-width: none;                       /* 跟首页一致:靠边,不居中 */
  height: 100%;
  padding: 0 clamp(16px, 2.5vw, 28px);   /* 左右只留小安全边距 */
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); }
.brand .name { font-size: 26px; font-weight: 600; color: var(--ink); line-height: 1; }
.nav-right { display: flex; align-items: center; gap: 30px; }
.nav-links { display: flex; gap: 28px; }
.nav-links a, .signin { font-size: 16px; font-weight: 600; color: var(--ink); transition: color .15s ease; }
.nav-links a:hover, .signin:hover { color: var(--primary); }
.nav-search { display: inline-flex; align-items: center; gap: 7px; line-height: 1; }
.nav-search i {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.25em; height: 1em; font-size: 15px; line-height: 1; flex: none; transform: translateY(-1px);
}

/* ---- Buttons ---- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 20px; background: var(--primary); color: var(--on-primary);
  border: none; border-radius: var(--r-md); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .15s ease;
}
.btn-primary:hover { background: var(--primary-active); }
.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 20px; background: var(--canvas); color: var(--ink);
  border: 1px solid var(--hairline); border-radius: var(--r-md); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: border-color .15s ease;
}
.btn-secondary:hover { border-color: var(--muted-soft); }
.btn-lg { height: 48px; padding: 0 26px; font-size: 15px; }
.btn-block { width: 100%; }
.text-link { color: var(--primary); font-weight: 600; }
.text-link:hover { color: var(--primary-active); }

/* ---- Badges ---- */
.badge-pill { display: inline-flex; align-items: center; line-height: 1; background: var(--surface-card); color: var(--ink); font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: var(--r-pill); }
.badge-coral { display: inline-flex; align-items: center; background: var(--primary); color: var(--on-primary); font-size: 12px; font-weight: 600; letter-spacing: 1.5px; padding: 4px 12px; border-radius: var(--r-pill); text-transform: uppercase; }

/* ---- Category tabs ---- */
.cat-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.cat-tab { padding: 8px 16px; border-radius: var(--r-md); font-size: 14px; font-weight: 600; color: var(--muted); background: transparent; border: 1px solid transparent; cursor: pointer; transition: all .15s ease; }
.cat-tab:hover { color: var(--ink); }
.cat-tab.active { background: var(--surface-card); color: var(--ink); }

/* ---- Cards ---- */
.card { background: var(--surface-card); border-radius: var(--r-lg); padding: 32px; }
.card.flat { background: var(--canvas); border: 1px solid var(--hairline); }
.card.dark { background: var(--surface-dark); color: var(--on-dark); }

/* post card */
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.post-card { position: relative; background: var(--surface-card); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; cursor: pointer; transition: transform .2s ease; }
.post-card:hover { transform: translateY(-2px); }
.post-thumb { aspect-ratio: 5 / 2; background: var(--surface-cream-strong); border-bottom: 1px solid var(--hairline); }
.post-thumb svg { display: block; width: 100%; height: 100%; }
.post-body { padding: 26px 28px 28px; display: flex; flex-direction: column; flex: 1; }
.post-tag { position: absolute; bottom: 26px; right: 28px; display: inline-flex; align-items: center; line-height: 1; background: var(--surface-card); color: var(--ink); font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: var(--r-pill); border: 1px solid #cbc4b7; }
.post-tag::before { content: "\f02b"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 11px; margin-right: 6px; }
.post-meta { padding-right: 76px; } /* 给右下角 tag 让出空间 */
.post-title { font-size: 24px; font-weight: 600; line-height: 1.25; color: var(--ink); margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-excerpt { font-size: 15px; color: var(--muted); margin-bottom: 22px; flex: 1; line-height: 1.6; }
.post-meta { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--muted-soft); }
.post-meta .dot { width: 3px; height: 3px; background: var(--muted-soft); border-radius: 50%; }

/* ---- Forms ---- */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
.text-input {
  width: 100%; height: 44px; padding: 0 14px; background: var(--canvas); color: var(--ink);
  border: 1px solid var(--hairline); border-radius: var(--r-md); font-family: var(--font-sans); font-size: 15px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.text-input::placeholder { color: var(--muted-soft); }
.text-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(204, 120, 92, 0.15); }
.input-with-icon { position: relative; }
.input-with-icon i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted-soft); font-size: 15px; }
.input-with-icon .text-input { padding-left: 42px; }
.checkbox-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted); }

/* ---- Section helpers ---- */
.section { padding: 72px 0; }
.section-head { margin-bottom: 40px; }
.section-head h1, .section-head h2 { font-size: clamp(32px, 4vw, 46px); font-weight: 600; color: var(--ink); line-height: 1.15; letter-spacing: -0.01em; }
.section-head p { color: var(--muted); margin-top: 10px; font-size: 16px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; color: var(--primary); margin-bottom: 12px; display: inline-block; }

/* ---- Footer ---- */
.footer { background: var(--canvas); border-top: 1px solid var(--hairline); text-align: center; padding: 48px 24px; }
.footer-inner { font-size: 13px; line-height: 1.9; }
.footer-inner p { margin: 0; color: var(--body); }
.footer-inner p + p { color: var(--muted-soft); }

/* ---- Cream token (首页 hero/导航用，home.css 可覆盖) ---- */
:root { --cream: #f5ead2; }

/* ---- 文章目录 (post.js 构建) ---- */
.toc-wrap { max-width: 220px; }
.toc { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.toc a { color: var(--muted); padding-left: 8px; border-left: 2px solid transparent; transition: color .15s ease, border-color .15s ease; }
.toc a.toc-sub { padding-left: 20px; font-size: 13px; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--primary); border-left-color: var(--primary); }

/* ---- 错误页（404 等） ---- */
.error-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 24px; gap: 14px; }
.error-page h1 { font-size: clamp(72px, 12vw, 140px); font-weight: 600; color: var(--ink); line-height: 1; letter-spacing: -0.04em; }
.error-page p { font-size: 18px; color: var(--muted); }
.error-page .btn-primary { margin-top: 8px; }

/* ---- Responsive ---- */
@media (max-width: 1024px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) {
  .nav-links, .signin { display: none; }
  .post-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
