/* ============================================================
   思念宝 · 基础层
   Reset、全局排版、通用工具类、动画
   ============================================================ */

/* ---------- Reset ---------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-height) + 16px);
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-md);
    line-height: var(--leading-body);
    color: var(--ink);
    background: var(--paper);
    overflow-x: hidden;
}

img,
picture,
svg,
canvas {
    display: block;
    max-width: 100%;
}

img {
    height: auto;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

ul,
ol {
    list-style: none;
}

/* ---------- 标题排版 ---------- */
/* h1 / h2 走衬线，作为杂志风的展示级字体；h3 以下走无衬线保证小字号可读性 */
h1,
h2 {
    font-family: var(--font-serif);
    font-weight: 600;
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-display);
    color: var(--ink);
}

h3,
h4,
h5,
h6 {
    font-family: var(--font-sans);
    font-weight: 600;
    line-height: var(--leading-snug);
    color: var(--ink);
}

h1 {
    font-size: var(--text-4xl);
}

h2 {
    font-size: var(--text-2xl);
}

h3 {
    font-size: var(--text-lg);
}

strong {
    font-weight: 600;
    color: var(--ink);
}

/* ---------- 选中与焦点 ---------- */
::selection {
    background: var(--accent-tint);
    color: var(--ink);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--rule-strong);
    border: 3px solid var(--paper);
    border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--ink-3);
}

/* ---------- 工具类 ---------- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* 字距放大的小型标签，用于区块引题 */
.eyebrow {
    display: block;
    margin-bottom: var(--space-4);
    font-family: var(--font-sans);
    font-size: var(--text-2xs);
    font-weight: 600;
    letter-spacing: var(--tracking-eyebrow);
    text-transform: uppercase;
    color: var(--accent);
}

.measure {
    max-width: var(--measure);
}

/* ---------- 动画 ---------- */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* 入场动画：位移幅度收小，只做轻微上浮，避免页面显得"动效驱动" */
.animate-in {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.animate-in.visible {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .animate-in {
        opacity: 1;
        transform: none;
        transition: none;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- 性能：视口外区块延迟渲染 ---------- */
/* 锚点区块除外，避免 hash 定位偏移 */
.square-content,
.square-intro,
.square-faq,
.detail-content {
    content-visibility: auto;
    contain-intrinsic-size: auto 600px;
}
