/* ============================================================
   base.css — 全局重置、body、滚动条、布局基础
   梦初雪 (Yume Hatsuyuki) 角色档案卷轴
   ============================================================ */

/* ── 全局重置 ─────────────────────────────────────────────── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    scroll-padding-top: 20px;
}

/* 平滑滚动增强效果 */
:target {
    animation: targetHighlight 2s ease;
}

@keyframes targetHighlight {
    0%   { background-color: rgba(184, 134, 11, 0.1); }
    100% { background-color: transparent; }
}

/* ── body 羊皮纸背景 ─────────────────────────────────────── */
body {
    font-family: var(--font-body);
    line-height: 1.6;
    color: var(--ink-iron);
    background-color: var(--parchment-dark);
    min-height: 100vh;
    padding: max(1rem, 2vw);
    position: relative;
    overflow-x: hidden;

    /* 复杂的羊皮纸背景纹理 */
    background-image:
        linear-gradient(to bottom,
            var(--parchment-old) 0%,
            var(--parchment-stained) 30%,
            var(--parchment-dark) 70%,
            var(--parchment-burnt) 100%),
        url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.15'/%3E%3C/svg%3E"),
        radial-gradient(circle at 10% 20%, rgba(92, 64, 51, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(184, 134, 11, 0.05) 0%, transparent 35%),
        radial-gradient(circle at 30% 70%, rgba(139, 0, 0, 0.04) 0%, transparent 30%);

    background-attachment: fixed;
    background-size: cover;

    box-shadow:
        inset 0 0 60px rgba(42, 32, 18, 0.1),
        inset 0 0 100px rgba(42, 32, 18, 0.05);
}

/* ── 自定义滚动条 — 魔法卷轴风格 ────────────────────────── */
html::-webkit-scrollbar { width: 14px; }

html::-webkit-scrollbar-track {
    background: linear-gradient(135deg,
        var(--parchment-dark) 0%,
        var(--parchment-burnt) 100%);
    border-left: 2px solid var(--ink-iron);
    box-shadow: inset 0 0 10px rgba(42, 32, 18, 0.3);
}

html::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg,
        var(--ink-iron) 0%,
        var(--ink-sepia) 50%,
        var(--ink-iron) 100%);
    border: 2px solid var(--parchment-old);
    border-radius: 8px;
    box-shadow:
        inset 0 0 5px rgba(184, 134, 11, 0.3),
        0 0 10px rgba(42, 32, 18, 0.4);
}

html::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg,
        var(--ink-sepia) 0%,
        var(--ink-gold) 50%,
        var(--ink-sepia) 100%);
    box-shadow:
        inset 0 0 8px rgba(184, 134, 11, 0.5),
        0 0 15px rgba(184, 134, 11, 0.3);
}

html::-webkit-scrollbar-thumb:active {
    background: linear-gradient(135deg,
        var(--ink-gold) 0%,
        var(--ink-blood) 50%,
        var(--ink-gold) 100%);
}

html::-webkit-scrollbar-corner  { background: var(--parchment-dark); }

html::-webkit-scrollbar-button {
    background: var(--parchment-burnt);
    border: 2px solid var(--ink-iron);
    display: block;
    height: 14px;
    box-shadow: inset 0 0 5px rgba(42, 32, 18, 0.3);
}

html::-webkit-scrollbar-button:hover { background: var(--parchment-old); }

html::-webkit-scrollbar-button:single-button:vertical:decrement {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233A2C1C' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 15l-6-6-6 6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

html::-webkit-scrollbar-button:single-button:vertical:increment {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233A2C1C' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

/* Firefox 支持 */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--ink-iron) var(--parchment-dark);
}

/* ── 加载状态 ─────────────────────────────────────────────── */
.grimoire-loading {
    text-align: center;
    padding: 3rem;
    color: var(--ink-gold);
    font-style: italic;
    font-size: 1.2rem;
}

.grimoire-loading::after {
    content: "";
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(184, 134, 11, 0.3);
    border-top: 3px solid var(--ink-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
