/* ====================================================================
   云界论坛 · 基础元素样式
   reset + 原生元素排版。变量来自 tokens.css。
   ==================================================================== */

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

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

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    /* 显式清除旧 style.css 硬编码的橙色光晕渐变 */
    background-image: none;
    background-attachment: initial;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--transition), color var(--transition);
}

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

a:hover {
    color: var(--brand-hover);
}

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

button {
    font-family: inherit;
    cursor: pointer;
}

input,
textarea,
select,
button {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
}

p {
    margin: 0 0 var(--space-4);
}

p:last-child {
    margin-bottom: 0;
}

ul, ol {
    margin: 0 0 var(--space-4);
    padding-left: var(--space-6);
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: var(--space-6) 0;
}

code, pre, kbd, samp {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

code {
    background: var(--surface-2);
    color: var(--text-2);
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
}

pre {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-4);
    overflow: auto;
    line-height: 1.5;
}

pre code {
    background: none;
    border: 0;
    padding: 0;
}

blockquote {
    margin: 0 0 var(--space-4);
    padding: var(--space-2) var(--space-4);
    border-left: 3px solid var(--brand);
    background: var(--brand-soft);
    color: var(--text-2);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

th, td {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 600;
    color: var(--text-2);
    background: var(--surface-2);
}

/* 选中文字配色 */
::selection {
    background: var(--brand-glow);
    color: var(--text);
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: var(--radius-full);
    border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-4);
}

/* 焦点可见性（无障碍）*/
:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}

/* 图片/媒体懒加载占位 */
img[loading="lazy"] {
    background: var(--surface-2);
}
