/*
 * 照片背景模式下的「毛玻璃」表面
 *
 * 只在「照片轮换」模式生效：站点启用了背景轮换，且访客没有选择「简洁模式」。
 * 做法是重写一组表面色变量（卡片 / 面板 / 弹窗共用），再给主要容器加背景模糊，
 * 让照片从内容下方透出来，同时靠提高边线对比度、加深次要文字来保证可读性。
 *
 * 约束：只改观感，不动任何结构、交互与功能；简洁模式（html[data-ui-mode="plain"]）
 * 和后台（body.admin-body）完全不受影响。
 */

/* ── 浅色：半透明白 + 更清晰的边线 ─────────────────────────────────── */
html:not([data-ui-mode="plain"]) body.jx-has-site-bg {
    --bg-elevated: rgba(255, 255, 255, 0.62);
    --surface-primary: rgba(255, 255, 255, 0.66);
    --surface-secondary: rgba(255, 255, 255, 0.44);
    --surface-tertiary: rgba(255, 255, 255, 0.34);

    --nav-bg: rgba(255, 255, 255, 0.56);
    --footer-bg: rgba(255, 255, 255, 0.5);

    --border: rgba(15, 23, 42, 0.16);
    --border-light: rgba(15, 23, 42, 0.12);
    --separator: rgba(15, 23, 42, 0.14);

    /* 次要文字在照片底纹上容易发灰，这里略加深，保证对比度 */
    --text-secondary: #63615c;
    --text-muted: #6e6c67;

    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.1);
    --shadow-lg: 0 18px 44px rgba(15, 23, 42, 0.16);

    --jx-glass-hover: rgba(255, 255, 255, 0.76);
    --jx-glass-line: rgba(255, 255, 255, 0.4);
}

/* ── 深色：半透明深灰 + 提亮的边线 ─────────────────────────────────── */
html[data-theme="dark"]:not([data-ui-mode="plain"]) body.jx-has-site-bg {
    --bg-elevated: rgba(28, 28, 30, 0.58);
    --surface-primary: rgba(30, 30, 32, 0.64);
    --surface-secondary: rgba(44, 44, 46, 0.46);
    --surface-tertiary: rgba(54, 54, 56, 0.4);

    --nav-bg: rgba(22, 22, 24, 0.56);
    --footer-bg: rgba(22, 22, 24, 0.5);

    --border: rgba(255, 255, 255, 0.18);
    --border-light: rgba(255, 255, 255, 0.14);
    --separator: rgba(255, 255, 255, 0.16);

    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.45);

    --jx-glass-hover: rgba(44, 44, 46, 0.7);
    --jx-glass-line: rgba(255, 255, 255, 0.14);
}

/* ── 大块面板 / 弹窗：模糊更强，照片不会干扰阅读 ───────────────────── */
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-nav,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-sheet,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-panel,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-page-head,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-footer,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-auth__card,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-status-item,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-status-empty,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-status-pill,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-ui-style,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-ann-dialog,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-share-qr__dialog,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-ui-mode-modal__dialog,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-input,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-aircraft-autocomplete {
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    backdrop-filter: blur(16px) saturate(140%);
}

/* ── 卡片类：模糊略轻，兼顾图库页多卡片滚动性能 ───────────────────── */
/* 注意：.jx-photo-card 已从名单中移除。它的底色是实色 --bg-elevated，
   模糊层被完全盖住、视觉上零收益，却在跟随指针缩放时要求每帧重新采样背景，
   图库页数百张卡片同时缩放就是掉帧的主因。其它卡片保持原样。 */
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-card,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-cat-card,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-home-cat,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-list-card--with-cover,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-photo-detail__author,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-photo-detail__spec,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-photo-detail__exif,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-photo-detail__share,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-staff-card,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-profile-stat,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-multi-card {
    -webkit-backdrop-filter: blur(12px) saturate(135%);
    backdrop-filter: blur(12px) saturate(135%);
}

/* 页头 / 页脚原本用的是不透明的 --bg，这里显式换成玻璃表面（两套主题都覆盖） */
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-page-head,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-footer {
    background: var(--bg-elevated);
}

/* 玻璃底上补一圈很淡的高光，让卡片与照片有分离感 */
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-card,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-panel,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-sheet,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-auth__card,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-status-item,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-ann-dialog,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-ui-mode-modal__dialog {
    box-shadow: inset 0 1px 0 var(--jx-glass-line);
}

/* 卡片悬浮：比默认底色再实一点，避免越悬停越透 */
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-card:hover {
    background: var(--jx-glass-hover);
}

/*
 * 公告弹窗内部原本是「头 / 内容 / 脚」三段各自填色，玻璃化后会层层叠加变成
 * 不透明色块。这里把内层填色交给外层玻璃，只保留分隔线。
 */
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-ann-dialog .jx-ann-header,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-ann-dialog .jx-ann-body,
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-ann-dialog .jx-ann-footer {
    background: transparent;
}

/* 顶部导航滚动后略微加实，长列表下滑时标题更清楚（仍保留透明感） */
html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-nav.is-scrolled {
    background: var(--jx-glass-hover);
}

/* ── 不支持 backdrop-filter 时退回高不透明度，优先保证文字可读 ─────── */
@supports not ((backdrop-filter: blur(4px)) or (-webkit-backdrop-filter: blur(4px))) {
    html:not([data-ui-mode="plain"]) body.jx-has-site-bg {
        --bg-elevated: rgba(255, 255, 255, 0.9);
        --surface-primary: rgba(255, 255, 255, 0.92);
        --surface-secondary: rgba(247, 246, 243, 0.9);
        --surface-tertiary: rgba(238, 234, 228, 0.9);
        --nav-bg: rgba(255, 255, 255, 0.92);
        --footer-bg: rgba(247, 246, 243, 0.92);
    }

    html[data-theme="dark"]:not([data-ui-mode="plain"]) body.jx-has-site-bg {
        --bg-elevated: rgba(28, 28, 30, 0.92);
        --surface-primary: rgba(30, 30, 32, 0.94);
        --surface-secondary: rgba(44, 44, 46, 0.9);
        --surface-tertiary: rgba(54, 54, 56, 0.9);
        --nav-bg: rgba(22, 22, 24, 0.94);
        --footer-bg: rgba(22, 22, 24, 0.92);
    }
}

/* 打印时照片与玻璃效果一并去掉 */
@media print {
    html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-nav,
    html:not([data-ui-mode="plain"]) body.jx-has-site-bg .jx-footer {
        background: #ffffff;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}
