/*
 * 站点基础样式。
 * 工具类由 public/static/index/js/tailwind.3.4.17.js（Tailwind Play CDN）在浏览器里按页面实际用到的类生成，
 * 这里只放它不生成的东西：CSS 变量、字体栈、标题字重、滚动进入动效、图片随滚动的动效。
 */
:root {
    /* 色板：一个暖灰中性阶（Tailwind stone）+ 品牌粉做唯一强调色 */
    --brand-primary: #FF6699;   /* 填充用（白色文字压在上面） */
    --brand-main: #C92A63;      /* 文字/图标/描边用，白底 5.26:1 */
    --brand-dark: #9D1D4D;
    --bg-light: #fafaf9;
    --bg-white: #ffffff;
    --text-primary: #1c1917;
    --text-secondary: #57534e;
    --text-muted: #78716c;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --font-sans: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", "Source Han Sans SC", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-light);
    line-break: strict;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    text-wrap: balance;
}

/* 标题不加载 webfont，用正文的系统字体栈，只分两档字重：h1 和品牌字 700，h2/h3 600
   （Windows 的微软雅黑只有常规 / 粗体两档，600 取到的是真粗体，不会比 h1 更轻） */
.font-hero {
    font-weight: 700;
}

.font-display {
    font-weight: 600;
}

/* 每页顶部的品牌底色：一团品牌粉从顶栏后面漫下来，右上一抹 B站 蓝呼应，720px 内淡出到页面底色。
   挂在 body 上，所以从固定顶栏后面开始、没有硬边；z-index:-1 在 body 自己的层叠上下文里垫在所有内容下面 */
.hero-bg {
    position: relative;
    isolation: isolate;
}

.hero-bg::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 720px;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(56% 62% at 50% 0%, rgba(255, 102, 153, 0.26), transparent 70%),
        radial-gradient(30% 42% at 88% 0%, rgba(0, 174, 236, 0.14), transparent 70%);
}

p, li, dt, dd {
    text-wrap: pretty;
}

/* 键盘焦点：全站统一一圈品牌色描边 */
:focus-visible {
    outline: 2px solid var(--brand-main);
    outline-offset: 2px;
}

/* 贴在浅灰底上的白底截图：一圈内描边，免得白边糊进底色 */
.img-frame {
    outline: 1px solid rgba(28, 25, 23, 0.1);
    outline-offset: -1px;
}

/* 时间戳、版本号、计数 */
.tabular,
.font-mono {
    font-variant-numeric: tabular-nums;
}

summary {
    list-style: none;
}
summary::-webkit-details-marker {
    display: none;
}

::selection {
    background: rgba(255, 102, 153, 0.22);
}

[v-cloak] {
    display: none;
}

/* 滚动进入动效（reveal.js）：带 data-reveal 的块滚进视口时淡入上移。起始态 reveal-pending、播放态 reveal-active 都由脚本加上，播完即移除，
   所以脚本没跑或系统设了「减少动效」时内容照常显示，也不会盖住块自己的 hover 过渡。
   起始态只藏不挪：位移放进动画里，锚点跳转（教程页目录）按块的真实位置落点 */
.reveal-pending {
    opacity: 0;
}

.reveal-active {
    animation: reveal-in 0.7s var(--ease-out) both;
}

@keyframes reveal-in {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@media print {
    .reveal-pending {
        opacity: 1;
    }
    [data-fx], .hero-in {
        transform: none;
        animation: none;
    }
}

/* 首屏大图进场：页面打开后从下方浮上来（外层容器动，不占用图片自己的滚动动效）；
   只回填开头（延迟那 0.15 秒先藏着），播完动画即失效，不在图上留一个恒等的 transform */
.hero-in {
    animation: hero-in 0.9s var(--ease-out) 0.15s backwards;
}

@keyframes hero-in {
    from {
        opacity: 0;
        transform: translateY(32px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* 图片随滚动的动效（motion.js）：脚本只往图上写变量（--tilt / --fx-y），变形写在这里；
   没跑脚本或系统设了「减少动效」时变量不存在，图就是原样。fx-on 由脚本加上，只为开合成层让滚动跟手 */
[data-fx="tilt"] {
    transform: perspective(1600px) rotateX(var(--tilt, 0deg));
}

[data-fx="parallax"],
[data-fx="pan"] {
    transform: translate3d(0, var(--fx-y, 0px), 0);
}

.fx-on {
    will-change: transform;
}

/* 会员中心左栏在手机上是一行横向滚动的胶囊（会员 / 账户 / 消息分组在桌面才显示）；
   内缩 4px 再用负外边距顶回去，边缘胶囊的焦点框不会被滚动容器裁掉 */
.nav-scroll {
    overflow-x: auto;
    scrollbar-width: none;
    padding: 4px;
    margin: -4px;
}

.nav-scroll::-webkit-scrollbar {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-delay: 0s !important;
    }
}
