/* ============================================================
   OnePage Firefly 主题 v3 · 按 saicaca/Firefly (MIT) 源码数值复刻
   layout-base.css: 壁纸 65vh(首页)/45vh(文章页), content-top = 横幅高-3.5rem,
                    移动端非首页壁纸隐藏(content-top 5.5rem)
   MainGridLayout:  grid 17.5rem 1fr 17.5rem, gap-4(1rem), px-2/md:px-4,
                    容器 max-w 100rem (xl: 92vw)
   PostCard.astro:  标题 text-3xl + 绿竖线 w-1 h-5 @ top-35px left-18px,
                    封面 absolute top/right/bottom-4 width 30% rounded-xl hover 放大
   Profile.astro:   头像卡内 rounded-xl, 名字下 w-5 h-1 主色小条, btn-regular 圆角社交钮
   variables.styl:  oklch hue 色板（默认 hue 165）
   ============================================================ */

/* ---------- 设计变量 ---------- */
:root {
  --hue: 165;
  --radius-large: 1rem;

  --primary: oklch(0.70 0.14 var(--hue));
  --page-bg: oklch(0.95 0.01 var(--hue));
  --card-bg: white;
  --btn-content: oklch(0.55 0.12 var(--hue));
  --btn-regular-bg: oklch(0.95 0.025 var(--hue));
  --btn-regular-bg-hover: oklch(0.90 0.05 var(--hue));
  --btn-regular-bg-active: oklch(0.85 0.08 var(--hue));
  --btn-plain-bg-hover: oklch(0.95 0.025 var(--hue));
  --deep-text: oklch(0.25 0.02 var(--hue));
  --title-active: oklch(0.60 0.10 var(--hue));

  --line-divider: rgba(0, 0, 0, 0.08);
  --content-meta: rgba(0, 0, 0, 0.7);
  --text-90: rgba(0, 0, 0, 0.9);
  --text-75: rgba(0, 0, 0, 0.75);
  --text-50: rgba(0, 0, 0, 0.5);
  --inline-code-bg: var(--btn-regular-bg);
  --inline-code-color: var(--btn-content);
  --codeblock-bg: oklch(0.17 0.015 var(--hue));
  --selection-bg: oklch(0.90 0.05 var(--hue));

  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.06);
  --text-main: oklch(0.30 0.02 var(--hue));

  --ff-banner-h: 65vh;          /* --banner-height-home */
  --ff-wallpaper: linear-gradient(160deg,
      oklch(0.82 0.07 var(--hue)) 0%,
      oklch(0.68 0.11 calc(var(--hue) + 25)) 55%,
      oklch(0.55 0.10 calc(var(--hue) + 45)) 100%);
}

html.dark {
  --primary: oklch(0.75 0.14 var(--hue));
  --page-bg: oklch(0.16 0.014 var(--hue));
  --card-bg: oklch(0.23 0.015 var(--hue));
  --btn-content: oklch(0.75 0.10 var(--hue));
  --btn-regular-bg: oklch(0.33 0.035 var(--hue));
  --btn-regular-bg-hover: oklch(0.38 0.04 var(--hue));
  --btn-regular-bg-active: oklch(0.43 0.045 var(--hue));
  --btn-plain-bg-hover: oklch(0.30 0.035 var(--hue));
  --deep-text: oklch(0.92 0.01 var(--hue));
  --title-active: oklch(0.80 0.10 var(--hue));
  --line-divider: rgba(255, 255, 255, 0.08);
  --content-meta: rgba(255, 255, 255, 0.6);
  --text-90: rgba(255, 255, 255, 0.9);
  --text-75: rgba(255, 255, 255, 0.75);
  --text-50: rgba(255, 255, 255, 0.5);
  --codeblock-bg: oklch(0.17 0.015 var(--hue));
  --selection-bg: oklch(0.40 0.08 var(--hue));
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.25);
  --text-main: oklch(0.90 0.01 var(--hue));
}

/* ---------- 基础 ---------- */
/* Firefly/Tailwind 全局 border-box：width 含 padding，卡片内容不再被内边距撑出边界 */
.ff-main, .ff-main *, .ff-navbar, .ff-navbar *, .ff-wallpaper, .ff-wallpaper * {
  box-sizing: border-box;
}
html { background: var(--page-bg); }
body {
  background: var(--page-bg);
  color: var(--text-main);
  font: 16px/1.8 "Roboto", -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}
::selection { background: var(--selection-bg); }
a { color: inherit; text-decoration: none; transition: color .15s ease, background-color .15s ease; }
h1, h2, h3, h4 { color: var(--text-90); }

/* ---------- 壁纸层（WallpaperSection：absolute 顶到顶部，底部渐隐到 page-bg） ---------- */
.ff-wallpaper {
  position: absolute; top: 0; left: 0; right: 0;
  height: var(--ff-banner-h);
  background: var(--ff-wallpaper) center / cover no-repeat;
  overflow: hidden; z-index: 0;
}
html.dark .ff-wallpaper::before {
  content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .35);
}
.ff-wallpaper::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 7rem;
  background: linear-gradient(to bottom, transparent, var(--page-bg));
}
/* 文章页：横幅缩短为 45vh（桌面端非首页 transform 上移的等效实现） */
body.ff-post .ff-wallpaper { height: 45vh; }
/* 移动端非首页：壁纸整体隐藏，内容从导航下方 5.5rem 开始 */
@media (max-width: 1023px) {
  body.ff-post .ff-wallpaper { display: none; }
}

/* ---------- 横幅文字覆盖（BannerHomeTextOverlay：absolute inset-0 flex center） ---------- */
.ff-banner-overlay {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 0 1.2rem;
}
.ff-banner-text { max-width: 60rem; }
.ff-banner-title {
  color: #fff; font-size: clamp(2rem, 5vw, 3rem); font-weight: 700;
  line-height: 1.25; margin: 0 0 .8rem;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .3);
}
.ff-banner-sub { color: rgba(255, 255, 255, .94); font-size: clamp(.95rem, 2vw, 1.1rem); margin: 0; white-space: pre-line; }
.ff-hero-pills { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; margin-top: 1.4rem; }
.ff-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem 1.1rem; border-radius: 999px; font-size: .9rem; color: #fff;
  background: rgba(255, 255, 255, .16);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .25);
}
.ff-pill:hover { background: rgba(255, 255, 255, .28); }
.ff-hero-cat { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
/* 打字机光标 */
.ff-banner-sub.typing::after {
  content: "▌"; margin-left: 2px; color: #fff;
  animation: ff-blink 1s steps(1) infinite;
}
@keyframes ff-blink { 50% { opacity: 0; } }

/* ---------- 导航（Navbar：固定玻璃条，max-width 同 page-width） ---------- */
.ff-navbar {
  position: fixed; top: .75rem; left: 50%; transform: translateX(-50%);
  z-index: 50;
  width: calc(100% - 1.5rem); max-width: calc(100rem - 1.5rem);
  display: flex; align-items: center; gap: 1rem;
  padding: .45rem .9rem;
  border-radius: 1rem;
  background: color-mix(in oklab, var(--card-bg) 55%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, .18);
  border: 1px solid var(--line-divider);
}
html.dark .ff-navbar { box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, .06); }
.ff-nav-brand { display: flex; align-items: center; gap: .5rem; min-width: 0; padding: .3rem .5rem; border-radius: .6rem; }
.ff-nav-brand:hover { background: var(--btn-plain-bg-hover); }
.ff-logo-avatar {
  width: 1.7rem; height: 1.7rem; border-radius: 50%;
  object-fit: cover; flex-shrink: 0; background: var(--btn-regular-bg);
}
.ff-nav-title { font-weight: 700; font-size: 1rem; color: var(--deep-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ff-nav-menu { display: flex; gap: .15rem; margin-left: auto; }
.ff-nav-item { padding: .3rem .5rem; border-radius: .6rem; }
.ff-nav-item:hover { background: var(--btn-plain-bg-hover); }
.ff-nav-vt {
  display: inline-block; writing-mode: vertical-lr; letter-spacing: .28em;
  font-size: .82rem; line-height: 1; color: var(--content-meta); height: 3.2em;
}
.ff-nav-item:hover .ff-nav-vt { color: var(--primary); }
.ff-dark-toggle {
  border: none; background: none; cursor: pointer; font-size: 1rem;
  padding: .35rem .6rem; border-radius: .6rem; line-height: 1;
}
.ff-dark-toggle:hover { background: var(--btn-plain-bg-hover); }
.ff-icon-dark { display: none; }
html.dark .ff-icon-light { display: none; }
html.dark .ff-icon-dark { display: inline; }

/* ---------- 内容面板（content-panel：top = 横幅高 - 3.5rem） ---------- */
.ff-main {
  position: relative; z-index: 1;
  width: 100%; max-width: 100rem; margin-left: auto; margin-right: auto;
  margin-top: calc(var(--ff-banner-h) - 3.5rem);
  padding-bottom: 2.5rem;
}
body.ff-post .ff-main { --ff-banner-h: 45vh; }
@media (max-width: 1023px) {
  body.ff-post .ff-main { margin-top: 5.5rem; }
}

.ff-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; padding: 0 .5rem; }
/* 移动端：侧栏（资料卡/分类卡）隐藏，仅 PC 端显示 */
@media (max-width: 1023px) {
  .ff-col-side { display: none; }
}
@media (min-width: 1024px) {
  .ff-grid { grid-template-columns: 17.5rem minmax(0, 1fr); padding: 0 1rem; }
  .ff-col-side { max-width: 17.5rem; }
  .ff-side-sticky { position: sticky; top: 5.5rem; display: flex; flex-direction: column; gap: 1rem; }
}
.ff-content { min-width: 0; }

/* ---------- 卡片基座（card-base） ---------- */
.ff-card {
  background: var(--card-bg); border-radius: var(--radius-large);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: box-shadow .15s ease, transform .15s ease;
}

/* ---------- 资料卡（Profile.astro：p-3，头像卡内 rounded-xl，名字下主色小条） ---------- */
.ff-profile { padding: .75rem; }
.ff-avatar-wrap { display: block; border-radius: .75rem; overflow: hidden; margin-bottom: .75rem; max-width: 12rem; margin-inline: auto; }
@media (min-width: 1024px) { .ff-avatar-wrap { max-width: none; } }
.ff-avatar { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.ff-profile-name { font-weight: 700; font-size: 1.25rem; text-align: center; margin-bottom: .25rem; color: var(--text-90); }
.ff-profile-bar { height: .25rem; width: 1.25rem; background: var(--primary); margin: 0 auto .5rem; border-radius: 999px; }
.ff-profile-desc { text-align: center; color: var(--content-meta); font-size: .9rem; margin-bottom: .6rem; line-height: 1.7; }
.ff-profile-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-bottom: .25rem; }
.ff-btn-regular {
  display: inline-flex; align-items: center; justify-content: center;
  height: 2.5rem; padding: 0 .75rem; border-radius: .5rem; font-weight: 700; font-size: .88rem;
  background: var(--btn-regular-bg); color: var(--btn-content);
}
.ff-btn-regular:hover { background: var(--btn-regular-bg-hover); }
.ff-btn-regular:active { background: var(--btn-regular-bg-active); transform: scale(.95); }

/* ---------- Widget ---------- */
.ff-widget { padding: 1.1rem 1.2rem; }
.ff-widget-title {
  position: relative; font-weight: 700; color: var(--text-90);
  padding-left: .8rem; margin-bottom: .6rem; font-size: 1rem;
}
.ff-widget-title::before {
  content: ""; position: absolute; left: 0; top: .18em; bottom: .18em;
  width: 4px; border-radius: 2px; background: var(--primary);
}
.ff-widget-empty { color: var(--content-meta); font-size: .88rem; margin: 0; }
.ff-cat-list, .ff-stat-list { list-style: none; margin: 0; padding: 0; }
.ff-cat-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: .45rem .7rem; border-radius: .65rem; font-size: .92rem; color: var(--content-meta);
}
.ff-cat-item:hover { background: var(--btn-plain-bg-hover); color: var(--primary); }
.ff-cat-count {
  font-size: .75rem; background: var(--btn-regular-bg); color: var(--btn-content);
  border-radius: 999px; padding: 0 .55rem; line-height: 1.5;
}
.ff-stat-list li { padding: .4rem .2rem; font-size: .92rem; border-bottom: 1px dashed var(--line-divider); }
.ff-stat-list li:last-child { border-bottom: none; }
.ff-stat-link { color: var(--content-meta); }
.ff-stat-link:hover { color: var(--primary); }

/* ---------- 文章卡片（PostCard.astro） ---------- */
.ff-post-list { display: flex; flex-direction: column; gap: 1rem; }
.ff-postcard { position: relative; }
/* 移动端：flex-col-reverse，封面在顶部全宽 */
.ff-postcard { display: flex; flex-direction: column-reverse; }
.ff-postcard-content { padding: 1rem; width: 100%; }
.ff-postcard-title {
  display: block; width: 100%; font-weight: 700; margin-bottom: .5rem;
  font-size: 1.125rem; line-height: 1.75rem; color: var(--text-90);
}
.ff-postcard-title:hover { color: var(--primary); }
.ff-postcard-title:active { color: var(--title-active); }
.ff-postcard-meta { display: flex; align-items: center; gap: 1rem; font-size: .85rem; color: var(--content-meta); flex-wrap: wrap; margin-bottom: 1rem; }
.ff-meta-item { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.ff-ico { width: 1em; height: 1em; }
.ff-postcard-desc {
  margin: 0; color: var(--text-75); line-height: 1.7;
  display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere; word-break: break-word; min-width: 0;
}
@media (min-width: 768px) {
  /* 桌面：封面 absolute top/right/bottom-4 宽 30% 圆角 xl；内容留出空间 */
  .ff-postcard-content {
    width: calc(100% - 30% - 1.5rem);
    padding: 1.75rem .5rem 1.75rem 2.25rem;
    min-height: 11rem;
  }
  .ff-postcard-title { font-size: 1.875rem; line-height: 1.3; }
  /* 绿竖线：w-1 h-5 @ top-35px left-18px */
  .ff-postcard-title::before {
    content: ""; position: absolute; top: 2.2rem; left: 1.125rem;
    width: .25rem; height: 1.25rem; border-radius: .375rem; background: var(--primary);
  }
  .ff-postcard-desc { padding-right: 1rem; }
  .ff-postcard-image {
    position: absolute; top: 1rem; right: 1rem; bottom: 1rem; width: 30%;
    border-radius: .75rem; overflow: hidden; display: block;
  }
  .ff-postcard-image img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .3s ease;
  }
  .ff-postcard-image::after {
    content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, 0);
    transition: background .15s ease;
  }
  .ff-postcard-image::before {
    content: "›"; position: absolute; z-index: 2; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 3rem; line-height: 1;
    opacity: 0; transform: scale(.5); transition: all .15s ease;
  }
  .ff-postcard-image:hover::after { background: rgba(0, 0, 0, .3); }
  .ff-postcard-image:hover::before { opacity: 1; transform: scale(1); }
  .ff-postcard-image:hover img { transform: scale(1.1); }
}
@media (max-width: 767px) {
  .ff-postcard-image { margin: .5rem .5rem 0; border-radius: .75rem; overflow: hidden; aspect-ratio: 2 / 1; display: block; }
  .ff-postcard-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
}
.ff-empty { padding: 2.2rem; text-align: center; color: var(--content-meta); }

/* ---------- 分类栏 / 分页（平台组件主题化） ---------- */
.nb-cats { padding: 0 0 1.2rem; }
.nb-cat-active { color: var(--btn-content) !important; background: var(--btn-regular-bg); box-shadow: none; font-weight: 600; }
.nb-pager { padding: 1.8rem 0 1rem; }
.nb-pager-link { border-color: var(--line-divider); background: var(--card-bg); }
.nb-pager-link:hover { background: var(--btn-plain-bg-hover); opacity: 1; color: var(--primary); }
.nb-pager-info { color: var(--content-meta); }

/* ---------- 文章页 ---------- */
.ff-article { padding: 1.8rem clamp(1.2rem, 4vw, 2.4rem) 2.2rem; }
.ff-article-head { display: none; }
@media (max-width: 1023px) {
  .ff-article-head { display: block; margin-bottom: 1.2rem; }
  .ff-article-head h1 {
    font-size: 1.45rem; line-height: 1.4; margin: 0 0 .4rem; color: var(--text-90);
  }
  .ff-article-meta { font-size: .85rem; color: var(--content-meta); }
}
.ff-draft {
  background: var(--btn-regular-bg); color: var(--btn-content);
  border-radius: .6rem; padding: .5rem 1rem; font-size: .88rem; margin-bottom: 1.2rem; text-align: center;
}
.ff-around { display: flex; gap: 1rem; margin-top: 1rem; }
.ff-around-card { flex: 1; min-width: 0; padding: .9rem 1.2rem; display: flex; flex-direction: column; gap: .25rem; }
.ff-around-card:hover { color: var(--primary); }
.ff-around-right { text-align: right; }
.ff-around-label { font-size: .78rem; color: var(--content-meta); }
.ff-around-title { font-weight: 600; color: var(--text-90); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ff-around-card:hover .ff-around-title { color: var(--primary); }

/* ---------- 正文块（nb-*） ---------- */
.post-body { font-size: 1rem; }
.post-body h2, .nb-h2 { font-size: 1.45rem; margin: 1.8rem 0 .8rem; scroll-margin-top: 5.5rem; }
.post-body h3, .nb-h3 { font-size: 1.2rem; margin: 1.5rem 0 .7rem; scroll-margin-top: 5.5rem; }
.post-body h4, .nb-h4 { font-size: 1.05rem; margin: 1.2rem 0 .6rem; scroll-margin-top: 5.5rem; }
.nb-p { margin: .9rem 0; line-height: 1.85; }
.nb-p code, .post-body li code, .post-body h2 code, .post-body h3 code {
  background: var(--inline-code-bg); color: var(--inline-code-color);
  border-radius: .4rem; padding: .12em .45em; font-size: .88em;
  font-family: ui-monospace, "SF Mono", Consolas, Menlo, monospace;
}
.nb-quote {
  margin: 1.1rem 0; padding: .2rem 1.1rem; color: var(--text-75);
  border-left: 4px solid var(--primary); background: var(--btn-regular-bg);
  border-radius: .55rem;
}
.nb-code {
  background: var(--codeblock-bg) !important; color: #e6edf3;
  border-radius: .75rem; padding: 1rem 1.2rem; margin: 1.2rem 0;
  overflow-x: auto; font-size: .88rem; line-height: 1.65;
}
.nb-code code { background: none; color: inherit; padding: 0; font-family: ui-monospace, "SF Mono", Consolas, Menlo, monospace; }
.nb-code code[data-lang]::before {
  content: attr(data-lang); display: block; color: rgba(255,255,255,.55);
  font-size: .75rem; margin-bottom: .5rem; text-transform: uppercase; letter-spacing: .08em;
}
.nb-list { padding-left: 1.5em; margin: .9rem 0; }
.nb-list li { margin: .3rem 0; }
.nb-image { margin: 1.4rem 0; text-align: center; }
.nb-image img { max-width: 100%; border-radius: .75rem; }
.nb-image figcaption { color: var(--content-meta); font-size: .82rem; margin-top: .5rem; }
.nb-link {
  display: flex; flex-direction: column; gap: .15rem; margin: 1.1rem 0;
  padding: .8rem 1.1rem; border: 1px solid var(--line-divider); border-radius: .75rem;
}
.nb-link:hover { border-color: var(--primary); }
.nb-link-title { color: var(--primary); font-weight: 500; }
.nb-link-url { color: var(--content-meta); font-size: .82rem; }

/* ---------- 评论 ---------- */
.nb-comments { margin-top: 1.8rem; border-top: 1px solid var(--line-divider); padding-top: 1.4rem; }
.nb-comment-form textarea { background: var(--btn-regular-bg); border: none; color: var(--text-main); border-radius: .7rem; }
.nb-comment-btn { background: var(--primary); border-radius: .7rem; }
.nb-comment-del { color: var(--primary); }

/* ---------- 页脚 ---------- */
.ff-footer {
  text-align: center; padding: 1.6rem 1rem 2.2rem; color: var(--content-meta); font-size: .88rem;
  display: flex; justify-content: center; gap: .5rem; flex-wrap: wrap;
}
.ff-footer-link { color: var(--primary); }
.ff-footer-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 移动端 ---------- */
@media (max-width: 767px) {
  .ff-navbar { top: .5rem; width: calc(100% - 1rem); padding: .4rem .7rem; gap: .5rem; }
  /* 移动端菜单改横排（竖排是桌面端设计） */
  .ff-nav-vt {
    writing-mode: horizontal-tb; height: auto; letter-spacing: normal;
    font-size: .88rem;
  }
  .ff-nav-item { padding: .35rem .6rem; }
  .ff-hero-pills .ff-pill { padding: .38rem .9rem; font-size: .85rem; }
  .ff-main { padding-bottom: 2rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
