/* ==========================================================================
   Lumina · base.css
   设计变量 / 重置 / 字体 / 基础排版 / 深色模式
   ========================================================================== */

:root {
    /* 色彩系统 */
    --bg: #f7f7fb;
    --bg-soft: #f2f3f8;
    --surface: #ffffff;
    --surface-2: #f4f5f9;
    --surface-3: #f1f3f8;
    --text: #1d2129;
    --text-2: #5f6673;
    --text-3: #8b93a1;
    --text-4: #a9b0bd;
    --border: #eef0f5;
    --border-strong: #e2e5ec;
    --primary: #2586fe;
    --primary-dark: #1476ef;
    --primary-soft: #eaf3ff;
    --red: #ff4d4f;
    --green: #22c55e;
    --orange: #f5a623;
    --purple: #8b5cf6;
    --teal: #10b981;
    --pink: #ec4899;
    --indigo: #6366f1;

    /* 尺寸系统 */
    --container: 1224px;
    --sidebar: 332px;
    --gap: 32px;
    --header-h: 64px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;

    /* 阴影 */
    --shadow-card: 0 2px 12px rgba(29, 41, 59, 0.04);
    --shadow-card-hover: 0 10px 30px rgba(29, 41, 59, 0.08);
    --shadow-float: 0 10px 24px rgba(37, 134, 254, 0.32);

    /* 字体 */
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SFMono-Regular", "SF Mono", "JetBrains Mono", Consolas, "Liberation Mono", Menlo, monospace;

    --header-bg: rgba(247, 248, 252, 0.88);
}

[data-theme="dark"] {
    --bg: #0e1116;
    --bg-soft: #141922;
    --surface: #161b23;
    --surface-2: #1c222c;
    --surface-3: #202733;
    --text: #e9edf3;
    --text-2: #b4bcc9;
    --text-3: #8d97a8;
    --text-4: #6f7988;
    --border: #242b37;
    --border-strong: #2c3542;
    --primary: #4b9bff;
    --primary-dark: #6cb0ff;
    --primary-soft: #16283f;
    --shadow-card: 0 2px 14px rgba(0, 0, 0, 0.25);
    --shadow-card-hover: 0 12px 32px rgba(0, 0, 0, 0.4);
    --shadow-float: 0 10px 24px rgba(0, 0, 0, 0.4);
    --header-bg: rgba(14, 17, 22, 0.82);
}

/* ------------------------------ Reset ------------------------------ */

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 16px);
}

body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
ul,
ol,
li,
figure,
figcaption,
dl,
dd,
blockquote,
pre,
code {
    margin: 0;
    padding: 0;
}

body {
    min-width: 320px;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 暗黑模式切换：对所有颜色/边框/阴影属性启用平滑过渡（仅当 html 携带 data-theme 时） */
html[data-theme] *,
html[data-theme] *::before,
html[data-theme] *::after {
    transition-property:
        background-color, color,
        border-color, border-top-color, border-right-color,
        border-bottom-color, border-left-color,
        fill, stroke, box-shadow, text-decoration-color;
    transition-duration: 0.28s;
    transition-timing-function: ease;
}

img,
video,
svg {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}

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

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

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

button {
    cursor: pointer;
    background: none;
    border: 0;
}

ul,
ol {
    list-style: none;
}

::selection {
    background: rgba(37, 134, 254, 0.18);
    color: var(--text);
}

/* ------------------------------ 图标 ------------------------------ */

.icon {
    width: 16px;
    height: 16px;
    flex: none;
    vertical-align: -0.14em;
}

/* --------------------------- 可访问性工具 --------------------------- */

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

.skip-link {
    position: fixed;
    top: -48px;
    left: 16px;
    z-index: 999;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 12px;
    color: #fff;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ------------------------------ 滚动条 ------------------------------ */

* {
    scrollbar-width: thin;
    scrollbar-color: #c9ced8 transparent;
}

[data-theme="dark"] * {
    scrollbar-color: #3a4352 transparent;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    background: #c9ced8;
    border-radius: 8px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #3a4352;
}

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

/* --------------------------- 动效降级 --------------------------- */

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

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