/* ============================================================
   康弘主题页 · 基础样式（蓝白学术 VI）
   ============================================================ */

:root {
    --brand: #2F6FBF;
    --brand-strong: #1D4E8C;
    --brand-rgb: 47, 111, 191;
    --brand-soft: rgba(47, 111, 191, 0.07);
    --brand-soft-2: rgba(47, 111, 191, 0.13);
    --gold: #C29A5D;
    --gold-strong: #A87A3F;
    --gold-soft: #F6EFE3;
    --teal: #318596;
    --ink: #172A3D;
    --ink-2: #465A6D;
    --ink-3: #7E91A4;
    --line: #E2EFF9;
    --line-blue: #C9E3F5;
    --bg: #F4FAFE;
    --card: #FFFFFF;
    --shell: 520px;
    --radius-xl: 10px;
    --radius-lg: 5px;
    --radius-md: 3px;
    --shadow-card: 0 4px 14px rgba(23, 78, 126, 0.05);
    --shadow-soft: 0 10px 28px rgba(23, 78, 126, 0.08);
    --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

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

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
    border: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

input,
textarea,
select {
    font: inherit;
    color: inherit;
}

h1, h2, h3, h4, p {
    margin: 0;
}

::selection {
    background: rgba(var(--brand-rgb), 0.16);
    color: var(--ink);
}

/* 桌面背景：蓝白学术氛围 */
body.theme-body,
body.article-body {
    background: #EFF7FD;
}

@media (min-width: 640px) {
    body.theme-body,
    body.article-body {
        background:
            radial-gradient(1000px 500px at 6% -8%, rgba(86, 158, 214, 0.18), transparent 62%),
            radial-gradient(900px 520px at 98% 4%, rgba(49, 133, 150, 0.12), transparent 60%),
            radial-gradient(800px 500px at 50% 112%, rgba(194, 154, 93, 0.12), transparent 62%),
            #EFF7FD;
        background-attachment: fixed;
    }
}

/* 手机容器 */
.page-shell {
    position: relative;
    width: 100%;
    max-width: var(--shell);
    min-height: 100vh;
    margin: 0 auto;
    background: var(--bg);
    box-shadow: 0 0 80px rgba(18, 54, 92, 0.12);
    overflow-x: clip;
}

@supports not (overflow: clip) {
    .page-shell {
        overflow-x: hidden;
    }
}

/* 无障碍跳转链接 */
.skip-link {
    position: fixed;
    top: 8px;
    left: 50%;
    z-index: 999;
    padding: 8px 16px;
    border-radius: 999px;
    background: #153A5D;
    color: #fff;
    font-size: 12px;
    transform: translate(-50%, -160%);
    transition: transform 0.2s ease;
}

.skip-link:focus {
    transform: translate(-50%, 0);
}

:focus-visible {
    outline: 2px solid rgba(var(--brand-rgb), 0.55);
    outline-offset: 2px;
}

/* 轻提示 */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(32px + env(safe-area-inset-bottom));
    z-index: 80;
    max-width: 80vw;
    padding: 10px 18px;
    border-radius: 4px;
    background: rgba(17, 48, 79, 0.94);
    color: #fff;
    font-size: 12px;
    letter-spacing: 0.2px;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 12px);
    transition: opacity 0.24s ease, transform 0.24s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* 回到顶部 */
.to-top {
    position: fixed;
    right: max(16px, calc((100vw - var(--shell)) / 2 + 14px));
    bottom: calc(24px + env(safe-area-inset-bottom));
    z-index: 30;
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border: 1px solid var(--line-blue);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 6px 18px rgba(18, 54, 92, 0.14);
    color: var(--brand);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.22s ease, transform 0.22s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.to-top.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: none;
}

.to-top svg {
    width: 18px;
    height: 18px;
}

/* 动效偏好 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
