/*!
 * sp.css — sky-blog 主题移植层（SolarPress）
 * 仅追加原版样式表未覆盖的少量规则，不修改任何原版 CSS。
 */

/* Alpine 初始化前隐藏，防止未编译表达式闪烁 */
[x-cloak] {
  display: none !important;
}

/* ---------- 评论（partials/comments.html） ---------- */
.sp-comment img {
  max-width: 100%;
  height: auto;
}

.sp-comment p {
  margin: 0;
}

.sp-reply-tip.hidden {
  display: none;
}

/* 表单消息颜色（DaisyUI 成功/错误色变量） */
.sp-msg-ok {
  color: var(--color-success, oklch(60% 0.15 145));
}

.sp-msg-error {
  color: var(--color-error, oklch(60% 0.22 25));
}

/* ---------- Minimal 列表序号（CSS counter 生成 01/02…） ---------- */
.sp-minimal-list {
  counter-reset: sp-post;
}

.sp-minimal-list .sp-minimal-item {
  counter-increment: sp-post;
}

.sp-minimal-index::before {
  content: counter(sp-post, decimal-leading-zero);
}

/* ---------- 文章卡片封面完整显示（v2.2.44，方案对齐 solitude 定稿） ----------
 * media（左 4:3 缩略图）/ modern（顶部 16:9 大图）/ magazine（全图叠字）
 * 三种卡片的封面 img 已在模板中由 object-cover 改为 object-contain 完整展示；
 * 图片比例与槽位不一致时，::before 以同一张图（--sp-cover 内联注入，
 * 已按封面回退三态取值）cover 放大 + 模糊虚化铺底，不露白边也不裁图。
 * 注意：.sp-cover 不可加 position:relative —— magazine 的容器是
 * absolute inset-0，改为 relative 会高度塌缩；media/modern 容器为静态块，
 * ::before 自动以各自 figure.relative（与容器几何重合）为包含块。
 */
.sp-cover {
  overflow: hidden;
}

.sp-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--sp-cover, none);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(18px) brightness(0.78) saturate(1.08);
  transform: scale(1.2);
  pointer-events: none;
}

.sp-cover .sp-cover-img {
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   公告条 / 公告弹窗（SolarPress 公告组件，颜色取 DaisyUI v5 变量自动适配暗色）
   ========================================================================== */
.sp-ann-bar {
  width: 100%;
  padding: 12px 16px 2px;
  background: transparent;
  font-size: 13.5px;
  color: var(--color-base-content);
}
@media (min-width: 640px) { .sp-ann-bar { padding-left: 24px; padding-right: 24px; } }
@media (min-width: 1024px) { .sp-ann-bar { padding-left: 32px; padding-right: 32px; } }
.sp-ann-bar-inner {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 18px;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-base-100);
  border: 1px solid color-mix(in oklab, var(--color-base-content) 12%, transparent);
  border-radius: var(--radius-box, 1rem);
  box-shadow: 0 2px 12px color-mix(in oklab, var(--color-base-content) 12%, transparent);
}
.sp-ann-ico {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-primary-content, #fff);
  font-size: 12px;
}
.sp-ann-viewport { flex: 1 1 auto; min-width: 0; height: 24px; overflow: hidden; }
.sp-ann-track { will-change: transform; }
.sp-ann-item {
  display: block; height: 24px; line-height: 24px;
  color: var(--color-base-content);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .2s;
}
.sp-ann-item:hover { color: var(--color-primary); }
.sp-ann-close {
  flex: 0 0 auto;
  width: 24px; height: 24px;
  border: none; border-radius: 50%;
  background: transparent;
  color: color-mix(in oklab, var(--color-base-content) 60%, transparent);
  font-size: 13px; line-height: 1;
  cursor: pointer;
  transition: color .2s, background-color .2s;
}
.sp-ann-close:hover {
  color: var(--color-primary);
  background: color-mix(in oklab, var(--color-primary) 14%, transparent);
}

.sp-ann-modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.sp-ann-modal[hidden] { display: none; }
.sp-ann-mask {
  position: absolute; inset: 0;
  background: rgba(15, 17, 21, .55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: spAnnFade .3s ease both;
}
.sp-ann-dialog {
  position: relative; z-index: 1;
  width: 100%; max-width: 560px; max-height: 85vh; overflow: auto;
  background: var(--color-base-100);
  color: var(--color-base-content);
  border: 1px solid var(--color-base-300, var(--color-base-200));
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .25);
  padding: 22px 24px 26px;
  animation: spAnnPop .35s cubic-bezier(.22,1,.36,1) both;
}
.sp-ann-modal-close {
  position: absolute; top: 8px; right: 10px;
  width: 30px; height: 30px;
  border: none; border-radius: 50%;
  background: transparent;
  color: color-mix(in oklab, var(--color-base-content) 60%, transparent);
  font-size: 18px; line-height: 1;
  cursor: pointer; z-index: 2;
  transition: background-color .2s, color .2s;
}
.sp-ann-modal-close:hover {
  background: var(--color-base-200);
  color: var(--color-base-content);
}
.sp-ann-modal-body { font-size: 14.5px; line-height: 1.8; }
.sp-ann-pop-img { display: block; max-width: 100%; margin: 0 auto; border-radius: 12px; }
.sp-ann-pop-html > :first-child { margin-top: 0; }
.sp-ann-pop-html > :last-child { margin-bottom: 0; }
.sp-ann-pop-html img { max-width: 100%; height: auto; border-radius: 12px; }
.sp-ann-pop-html video { max-width: 100%; border-radius: 12px; }
.sp-ann-pop-html audio { width: 100%; }
.sp-ann-pop-html iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 12px; }
.sp-ann-cd {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: color-mix(in oklab, var(--color-base-content) 14%, transparent);
  overflow: hidden;
  border-bottom-left-radius: 16px; border-bottom-right-radius: 16px;
}
.sp-ann-cd i {
  display: block; height: 100%; width: 100%;
  background: var(--color-primary);
}
.sp-ann-fab {
  position: fixed; right: 22px; bottom: 24px; z-index: 90;
  width: 46px; height: 46px;
  border: none; border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-primary-content, #fff);
  font-size: 19px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .25);
  transition: transform .2s, box-shadow .2s;
}
.sp-ann-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(0, 0, 0, .32); }
.sp-ann-fab[hidden] { display: none; }
@keyframes spAnnFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes spAnnPop {
  from { transform: translateY(16px) scale(.96); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@media (max-width: 640px) {
  .sp-ann-bar-inner { min-height: 34px; font-size: 12.5px; gap: 8px; }
  .sp-ann-viewport { height: 22px; }
  .sp-ann-item { height: 22px; line-height: 22px; }
  .sp-ann-dialog { padding: 18px 16px 22px; border-radius: 12px; }
  .sp-ann-fab { right: 14px; bottom: 16px; width: 42px; height: 42px; }
}

/* ==========================================================================
   文章代码块：语法高亮（GitHub 明色，随 data-color-scheme 切暗色）
   + 语言栏/复制 + 超长代码折叠（前 6 行 + 末 4 行，中间省略条，点击展开）
   ========================================================================== */
#article-content .sp-code-block {
  margin: 1.4em 0;
  border: 1px solid #d0d7de;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
  font-size: 13.5px;
  line-height: 1.7;
}
#article-content .sp-code-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 14px;
  background: #f6f8fa;
  border-bottom: 1px solid #d0d7de;
  font-size: 12px;
  line-height: 1.4;
}
#article-content .sp-code-lang {
  font-weight: 700;
  letter-spacing: .06em;
  color: #57606a;
  font-size: 11.5px;
}
#article-content .sp-code-meta {
  color: #8c959f;
}
#article-content .sp-code-actions {
  margin-left: auto;
  display: inline-flex;
  gap: 6px;
}
#article-content .sp-code-bar-btn {
  border: 1px solid #d0d7de;
  background: #ffffff;
  color: #57606a;
  border-radius: 6px;
  padding: 2px 10px;
  font-size: 12px;
  line-height: 1.6;
  cursor: pointer;
  transition: color .15s, background-color .15s, border-color .15s;
}
#article-content .sp-code-bar-btn:hover {
  color: #0969da;
  border-color: #0969da;
  background: #f6f8fa;
}
#article-content .sp-code-bar-btn.is-done {
  color: #1a7f37;
  border-color: #1a7f37;
}
#article-content .sp-code-block pre {
  margin: 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
  border: 0;
  font-size: inherit;
  line-height: inherit;
  overflow-x: auto;
}
#article-content .sp-code-block code.hljs,
#article-content .sp-code-block pre code {
  display: block;
  padding: 14px 16px;
  background: #ffffff;
  color: #24292e;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", "Courier New", "Microsoft YaHei", monospace;
  font-size: 13.5px;
  line-height: 1.7;
  white-space: pre;
  border-radius: 0;
  font-weight: 400;
}
#article-content .sp-code-line {
  display: block;
  min-height: 1.7em;
}
#article-content .sp-code-block.is-collapsed .sp-code-line:not(.is-head):not(.is-tail) {
  display: none;
}
#article-content .sp-code-fold {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 7px 12px;
  border: 0;
  border-top: 1px dashed #d0d7de;
  border-bottom: 1px dashed #d0d7de;
  background: #f6f8fa;
  color: #0969da;
  font-size: 12.5px;
  line-height: 1.5;
  cursor: pointer;
  text-align: center;
  transition: background-color .15s;
}
#article-content .sp-code-fold:hover { background: #eef3f9; }
#article-content .sp-code-fold-dots {
  flex: 0 0 auto;
  width: 18px;
  height: 1px;
  background: #afb8c1;
}
#article-content .sp-code-fold-text { white-space: nowrap; }
#article-content .sp-code-block:not(.is-collapsed) .sp-code-fold { display: none; }

/* 隐藏原版 post.js 注入到 pre 内的复制按钮（功能已由语言栏统一承载） */
#article-content .sp-code-block pre > button { display: none !important; }

/* ---- 语法高亮 token 配色（GitHub Light，作用域收窄到代码块） ---- */
#article-content .sp-code-block .hljs-doctag,
#article-content .sp-code-block .hljs-keyword,
#article-content .sp-code-block .hljs-meta .hljs-keyword,
#article-content .sp-code-block .hljs-template-tag,
#article-content .sp-code-block .hljs-template-variable,
#article-content .sp-code-block .hljs-type,
#article-content .sp-code-block .hljs-variable.language_ { color: #d73a49; }
#article-content .sp-code-block .hljs-title,
#article-content .sp-code-block .hljs-title.class_,
#article-content .sp-code-block .hljs-title.class_.inherited__,
#article-content .sp-code-block .hljs-title.function_ { color: #6f42c1; }
#article-content .sp-code-block .hljs-attr,
#article-content .sp-code-block .hljs-attribute,
#article-content .sp-code-block .hljs-literal,
#article-content .sp-code-block .hljs-meta,
#article-content .sp-code-block .hljs-number,
#article-content .sp-code-block .hljs-operator,
#article-content .sp-code-block .hljs-selector-attr,
#article-content .sp-code-block .hljs-selector-class,
#article-content .sp-code-block .hljs-selector-id,
#article-content .sp-code-block .hljs-variable { color: #005cc5; }
#article-content .sp-code-block .hljs-meta .hljs-string,
#article-content .sp-code-block .hljs-regexp,
#article-content .sp-code-block .hljs-string { color: #032f62; }
#article-content .sp-code-block .hljs-built_in,
#article-content .sp-code-block .hljs-symbol { color: #e36209; }
#article-content .sp-code-block .hljs-code,
#article-content .sp-code-block .hljs-comment,
#article-content .sp-code-block .hljs-formula { color: #6a737d; }
#article-content .sp-code-block .hljs-name,
#article-content .sp-code-block .hljs-quote,
#article-content .sp-code-block .hljs-selector-pseudo,
#article-content .sp-code-block .hljs-selector-tag { color: #22863a; }
#article-content .sp-code-block .hljs-subst { color: #24292e; }
#article-content .sp-code-block .hljs-section { color: #005cc5; font-weight: 700; }
#article-content .sp-code-block .hljs-bullet { color: #735c0f; }
#article-content .sp-code-block .hljs-emphasis { font-style: italic; }
#article-content .sp-code-block .hljs-strong { font-weight: 700; }
#article-content .sp-code-block .hljs-addition { color: #22863a; background-color: #f0fff4; }
#article-content .sp-code-block .hljs-deletion { color: #b31d28; background-color: #ffeef0; }

/* ---- 深色模式（GitHub Dark，跟随主题三态切换 data-color-scheme） ---- */
html[data-color-scheme="dark"] #article-content .sp-code-block {
  border-color: #30363d;
  background: #0d1117;
}
html[data-color-scheme="dark"] #article-content .sp-code-bar {
  background: #161b22;
  border-bottom-color: #30363d;
}
html[data-color-scheme="dark"] #article-content .sp-code-lang { color: #c9d1d9; }
html[data-color-scheme="dark"] #article-content .sp-code-meta { color: #8b949e; }
html[data-color-scheme="dark"] #article-content .sp-code-bar-btn {
  border-color: #30363d;
  background: #21262d;
  color: #c9d1d9;
}
html[data-color-scheme="dark"] #article-content .sp-code-bar-btn:hover {
  color: #58a6ff;
  border-color: #58a6ff;
  background: #21262d;
}
html[data-color-scheme="dark"] #article-content .sp-code-bar-btn.is-done {
  color: #3fb950;
  border-color: #3fb950;
}
html[data-color-scheme="dark"] #article-content .sp-code-block code.hljs,
html[data-color-scheme="dark"] #article-content .sp-code-block pre code {
  background: #0d1117;
  color: #c9d1d9;
}
html[data-color-scheme="dark"] #article-content .sp-code-fold {
  border-top-color: #30363d;
  border-bottom-color: #30363d;
  background: #161b22;
  color: #58a6ff;
}
html[data-color-scheme="dark"] #article-content .sp-code-fold:hover { background: #1c2330; }
html[data-color-scheme="dark"] #article-content .sp-code-fold-dots { background: #484f58; }

html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-doctag,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-keyword,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-meta .hljs-keyword,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-template-tag,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-template-variable,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-type,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-variable.language_ { color: #ff7b72; }
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-title,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-title.class_,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-title.class_.inherited__,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-title.function_ { color: #d2a8ff; }
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-attr,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-attribute,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-literal,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-meta,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-number,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-operator,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-selector-attr,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-selector-class,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-selector-id,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-variable { color: #79c0ff; }
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-meta .hljs-string,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-regexp,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-string { color: #a5d6ff; }
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-built_in,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-symbol { color: #ffa657; }
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-code,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-comment,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-formula { color: #8b949e; }
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-name,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-quote,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-selector-pseudo,
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-selector-tag { color: #7ee787; }
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-subst { color: #c9d1d9; }
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-section { color: #1f6feb; font-weight: 700; }
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-bullet { color: #f2cc60; }
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-addition { color: #aff5b4; background-color: #033a16; }
html[data-color-scheme="dark"] #article-content .sp-code-block .hljs-deletion { color: #ffdcd7; background-color: #67060c; }

/* ---- 移动端 ---- */
@media (max-width: 640px) {
  #article-content .sp-code-block { font-size: 12.5px; border-radius: 10px; }
  #article-content .sp-code-block code.hljs,
  #article-content .sp-code-block pre code { padding: 10px 12px; font-size: 12.5px; }
  #article-content .sp-code-bar { padding: 5px 8px 5px 12px; gap: 8px; }
  #article-content .sp-code-bar-btn { padding: 2px 8px; }
  #article-content .sp-code-meta { display: none; }
  #article-content .sp-code-fold { padding: 6px 10px; font-size: 12px; }
  #article-content .sp-code-fold-dots { width: 12px; }
}
