/* 貓貓谷 全站原廠場景背景 v1（2026-11-08）
 * 由 scene-bg.js 在 <html> 設定 data-meow-scene 與 --scene-img / --scene-blur，並在 <body> 最前面插入 .meow-scene。
 * 回退：header 拿掉這支 CSS 與 scene-bg.js 兩行即可。
 */

/* 有場景的頁面：根元素底色接手，body 背景改透明，場景圖才看得到。 */
html[data-meow-scene] {
    background: #0b1421;
}

html[data-meow-scene][data-meow-theme="light"] {
    background: #f3f7fb;
}

/* 覆蓋 style.css、color-theme.css 與首頁 live-bridge.css 的 !important 背景。
 * 首頁最高原規則為 html[data-meow-theme] body.meow-home-v2.has-site-scroll-bg.page-home。
 * 只在已選定場景的頁面提高權重；原有樣式檔與無場景頁面保持不變。 */
html[data-meow-scene] body,
html[data-meow-scene][data-meow-theme] body.has-site-scroll-bg.page-home,
html[data-meow-scene][data-meow-theme] body.has-site-scroll-bg.page-inner,
html[data-meow-scene][data-meow-theme] body.meow-home-v2.has-site-scroll-bg.page-home,
html[data-meow-scene][data-meow-theme] body.meow-home-v2.has-site-scroll-bg.page-inner {
    background: transparent !important;
    background-image: none !important;
}

/* 舊城堡是獨立的固定全畫面元素，不是 body 的背景圖。 */
html[data-meow-scene] body > .site-scroll-bg {
    display: none !important;
}

/* 這兩個 app 根容器原有整頁底色；只清掉外層，保留內部主視覺、工具列與卡片。 */
html[data-meow-scene] #meowCodeApp.mcode-app,
html[data-meow-scene] #familiarApp.fam-app {
    background: transparent;
}

/* 搭配大賽列表原為固定淺底：只補深色場景上的外部文字對比。
 * 不改 --oc-*，白底作品卡、預覽圖、按鈕與導覽沿用原有配色。 */
html[data-meow-scene="moon-castle"][data-meow-theme="dark"] #outfit-contest-app[data-view="list"] > .oc-hero > .oc-hero-copy > h1,
html[data-meow-scene="moon-castle"][data-meow-theme="dark"] #outfit-contest-app[data-view="list"] > .oc-how > div > div > strong,
html[data-meow-scene="moon-castle"][data-meow-theme="dark"] #outfit-contest-app[data-view="list"] > #contest-months.oc-section-head > h2 {
    color: #f0edf8;
}

html[data-meow-scene="moon-castle"][data-meow-theme="dark"] #outfit-contest-app[data-view="list"] > .oc-hero > .oc-hero-copy > p:not(.oc-eyebrow),
html[data-meow-scene="moon-castle"][data-meow-theme="dark"] #outfit-contest-app[data-view="list"] > .oc-how > div > div > p {
    color: #bbb7ca;
}

html[data-meow-scene="moon-castle"][data-meow-theme="dark"] #outfit-contest-app[data-view="list"] > .oc-hero > .oc-hero-copy > .oc-eyebrow {
    color: #c7b7ff;
}

.meow-scene {
    --k: #0b1421;
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    z-index: -1;
    height: 600px;
    overflow: hidden;
    pointer-events: none;
}

html[data-meow-theme="light"] .meow-scene {
    --k: #f3f7fb;
}

/* 清晰層 + 虛化層：右邊清楚、左邊（標題所在處）漸漸變模糊 */
.meow-scene i,
.meow-scene s {
    position: absolute;
    inset: 0;
    background: var(--scene-img) var(--scene-pos, right 30%) / cover no-repeat;
}

.meow-scene s {
    background-image: var(--scene-blur);
    -webkit-mask: linear-gradient(90deg, #000 0%, #000 30%, transparent 62%);
    mask: linear-gradient(90deg, #000 0%, #000 30%, transparent 62%);
}

/* 深色主題：壓暗成夜景 */
html[data-meow-theme="dark"] .meow-scene i,
html[data-meow-theme="dark"] .meow-scene s {
    filter: brightness(0.7) saturate(1.05);
}

/* 拍賣場等獨立頁面沒有全站主題屬性：只讓場景依系統模式調整，保留原面板。 */
@media (prefers-color-scheme: light) {
    html[data-meow-scene]:not([data-meow-theme]) {
        background: #f3f7fb;
    }

    html[data-meow-scene]:not([data-meow-theme]) .meow-scene {
        --k: #f3f7fb;
    }
}

@media (prefers-color-scheme: dark) {
    html[data-meow-scene]:not([data-meow-theme]) .meow-scene i,
    html[data-meow-scene]:not([data-meow-theme]) .meow-scene s {
        filter: brightness(0.7) saturate(1.05);
    }
}

/* 左側文字保護 */
.meow-scene b {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        color-mix(in srgb, var(--k) 78%, transparent) 0%,
        color-mix(in srgb, var(--k) 55%, transparent) 32%,
        transparent 62%);
}

/* 往下淡出到底色 */
.meow-scene u {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        transparent 0%,
        transparent 30%,
        color-mix(in srgb, var(--k) 55%, transparent) 55%,
        var(--k) 92%);
}

/* 手機：高度縮短、畫面置中、整片都做文字保護 */
@media (max-width: 760px) {
    .meow-scene {
        height: 420px;
    }

    .meow-scene i,
    .meow-scene s {
        background-position: var(--scene-pos-m, 60% 30%);
    }

    .meow-scene s {
        -webkit-mask: none;
        mask: none;
        opacity: 0.55;
    }

    .meow-scene b {
        background: color-mix(in srgb, var(--k) 45%, transparent);
    }
}

@media print {
    .meow-scene {
        display: none;
    }
}

/* 用戶中心：外層區塊原有整頁淺底（dashboard-refresh.css），在有場景的頁面改為透明；卡片保留原樣。 */
html[data-meow-scene] .dashboard-section.dashboard-refresh {
    background: transparent;
}
