/* =========================================
   1. 全局变量定义 (CSS Variables)
   ========================================= */
:root {
    /* 核心色板 - 樱花粉配天空蓝 */
    --primary-color: #ff9a9e;
    --primary-gradient: linear-gradient(120deg, #ff9a9e 0%, #fecfef 100%);
    --secondary-color: #a18cd1;
    --secondary-gradient: linear-gradient(120deg, #a18cd1 0%, #fbc2eb 100%);
    --accent-color: #4facfe;

    /* 文字颜色 */
    --text-main: #4a4a4a;
    /* 不用纯黑，用深灰显得更柔和 */
    --text-secondary: #888888;
    --text-light: #ffffff;

    /* 背景体系 */
    --bg-body: #f9f9fc;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.7);

    /* 装饰性元素 */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 10px 20px rgba(255, 154, 158, 0.3);
    /* 带有主色调的投影 */

    /* 动画曲线 - 有回弹感的平滑过渡 */
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================
   2. 基础重置与骨架 (Reset & Basics)
   ========================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
    outline: none;
}

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

body {
    margin: 0;
    font-family: 'Nunito', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    /* 选用圆润的西文字体 */
    background-color: var(--bg-body);
    /* 添加一个可爱的背景纹理 */
    background-image:
        radial-gradient(var(--primary-color) 1px, transparent 1px),
        radial-gradient(var(--secondary-color) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: 0 0, 20px 20px;
    color: var(--text-main);
    line-height: 1.8;
    overflow-x: hidden;
}

/* 选中文本的颜色 - 二次元风格细节 */
::selection {
    background: var(--primary-color);
    color: #fff;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: #ffc3c6;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* =========================================
   3. 排版与标题 (Typography)
   ========================================= */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: #333;
    font-weight: 700;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    line-height: 1.3;
    letter-spacing: 0.5px;
    position: relative;
}

h1 {
    font-size: 2.5rem;
    color: #ff9a9e;
    display: inline-block;
}

@supports (background-clip: text) or (-webkit-background-clip: text) {
    h1 {
        background: var(--primary-gradient);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        color: transparent;
    }
}

h2 {
    font-size: 2rem;
    padding-left: 12px;
    border-left: 5px solid var(--primary-color);
}

h3 {
    font-size: 1.75rem;
}

h3::after {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: var(--secondary-color);
    border-radius: 2px;
    margin-top: 8px;
    transition: width 0.3s var(--ease-bounce);
}

h3:hover::after {
    width: 80px;
    /* 标题下划线伸缩动画 */
}

p {
    margin-bottom: 1.2rem;
    text-align: justify;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    position: relative;
    font-weight: 600;
    transition: color 0.3s ease;
}

/* 链接下划线动画 */
a::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--primary-color);
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform 0.3s var(--ease-smooth);
}

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

a:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

/* =========================================
   4. 内容容器 (Layout Containers)
   ========================================= */
main,
article {
    max-width: 900px;
    margin: 40px auto;
    padding: 40px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    /* 毛玻璃特效 */
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

/* =========================================
   5. 引用与代码块 (Quotes & Code)
   ========================================= */
blockquote {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    background: #fff0f5;
    /* 极淡的粉色背景 */
    border-left: none;
    border-radius: var(--radius-md);
    position: relative;
    color: #666;
    font-style: italic;
    box-shadow: inset 4px 0 0 var(--primary-color);
}

blockquote::before {
    content: '"';
    font-size: 3rem;
    color: var(--primary-color);
    opacity: 0.3;
    position: absolute;
    top: -10px;
    left: 10px;
}

pre {
    background: #282c34;
    padding: 3rem 1.5rem 1.5rem 1.5rem;
    /* 顶部留空给Mac红绿灯 */
    border-radius: var(--radius-md);
    overflow-x: auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* 模拟 Mac 窗口红绿灯效果 */
pre::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 15px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff5f56;
    box-shadow: 20px 0 0 #ffbd2e, 40px 0 0 #27c93f;
}

code {
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
}

p code {
    background: #fff5f5;
    color: #ff5050;
    padding: 2px 6px;
    border-radius: 4px;
    margin: 0 2px;
}

pre code {
    color: #abb2bf;
    background: transparent;
    padding: 0;
}

/* =========================================
   6. 列表 (Lists)
   ========================================= */
ul,
ol {
    padding-left: 20px;
    margin-bottom: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
    position: relative;
}

/* 自定义列表图标 - 用可爱的小圆点 */
ul li::marker {
    color: var(--primary-color);
    font-size: 1.2em;
}

/* =========================================
   7. 媒体元素 (Media)
   ========================================= */
img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    display: block;
    margin: 2rem auto;
    box-shadow: var(--shadow-sm);
    transition: transform 0.4s var(--ease-bounce), box-shadow 0.4s var(--ease-bounce);
}

img:hover {
    transform: scale(1.02) translateY(-5px);
    box-shadow: var(--shadow-hover);
}

figure {
    margin: 0;
    text-align: center;
}

figcaption {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* =========================================
   8. 表格 (Tables)
   ========================================= */
table {
    width: 100%;
    border-collapse: separate;
    /* 为了圆角 */
    border-spacing: 0;
    margin: 2rem 0;
    overflow: hidden;
    border-radius: var(--radius-md);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.02);
}

th,
td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

tr:last-child td {
    border-bottom: none;
}

tr:nth-child(even) {
    background-color: #fcfcfc;
}

tr:hover td {
    background-color: #fff0f3;
    /* hover时变粉 */
    transition: background-color 0.2s ease;
}

/* =========================================
   9. 表单元素 (Forms & Buttons)
   ========================================= */
input,
textarea,
select {
    width: 100%;
    padding: 12px 15px;
    margin: 8px 0;
    border: 2px solid #eee;
    border-radius: var(--radius-md);
    background: #fff;
    transition: all 0.3s var(--ease-smooth);
    font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 4px rgba(161, 140, 209, 0.2);
}

button,
.btn {
    display: inline-block;
    padding: 12px 28px;
    border: none;
    border-radius: 50px;
    /* 胶囊形状 */
    background: var(--primary-gradient);
    color: white;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 154, 158, 0.4);
    transition: transform 0.3s var(--ease-bounce), box-shadow 0.3s ease;
    text-align: center;
}

button:hover,
.btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 154, 158, 0.6);
}

button:active {
    transform: scale(0.95);
}

/* =========================================
   10. 分割线与杂项 (Misc)
   ========================================= */
hr {
    border: 0;
    height: 1px;
    background-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(255, 154, 158, 0.75), rgba(0, 0, 0, 0));
    margin: 3rem 0;
}

/* 简单的卡片浮动动画类 */
.float-card {
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}