/* ==================== 全局重置 ==================== */
/* 清除所有元素默认的外边距、内边距，并统一盒模型为 border-box */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==================== 主题色变量 ==================== */
/* 统一定义主按钮与标语共用的绿色，保证两者颜色严格对应 */
:root {
    --primary-green: #4a7c59; /* 与“开始对话”按钮渐变的起始绿色一致 */
}

/* ==================== 页面基础样式 ==================== */
/* 设置全站字体为楷体，背景为米黄色，高度随视口自适应且允许纵向滚动 */
body {
    font-family: 'STKaiti', 'KaiTi', '楷体', serif; /* 字体栈：华文楷体 → 楷体 → 楷体 → 衬线体 */
    background: #f5f0e8; /* 米黄纸色背景，营造古朴氛围 */
    min-height: 100vh; /* 兼容旧浏览器的视口高度 */
    min-height: 100dvh; /* 移动端使用动态视口高度，自动避开浏览器地址栏 */
    overflow-x: hidden; /* 只隐藏横向溢出，避免横向滚动条 */
    overflow-y: auto; /* 内容超出屏幕高度时允许滚动，防止按钮被裁切到屏幕外 */
    position: relative; /* 为子元素绝对定位提供参考 */
}

/* ==================== 背景装饰 ==================== */
/* 背景噪点纹理：使用内联 SVG 生成灰度噪声，极低透明度叠加在背景上 */
.bg-noise {
    position: fixed; /* 固定在视口，不随滚动移动 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.05; /* 透明度 5%，仅保留微弱质感 */
    pointer-events: none; /* 不拦截鼠标事件，不影响页面交互 */
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' /%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
}

/* 背景装饰线条层：承载 SVG 装饰线条，铺满视口并置于最底层 */
.bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0; /* 层级最低，位于内容之后 */
}

/* ==================== 主容器 ==================== */
/* 页面主体布局容器：纵向弹性布局，高度跟随视口且内容超高时从顶部安全排布 */
.main-container {
    position: relative;
    z-index: 1; /* 高于背景装饰层 */
    min-height: 100vh; /* 兼容旧浏览器 */
    min-height: 100dvh; /* 与 body 一致，使用动态视口高度 */
    display: flex;
    flex-direction: column; /* 子元素纵向排列 */
    align-items: center; /* 水平居中 */
    justify-content: center; /* 默认垂直居中 */
    justify-content: safe center; /* 内容超过视口高度时自动改为顶部对齐，避免上下被裁切 */
    gap: 32px; /* 各区块之间固定间距 */
    padding: 40px 20px; /* 兜底内边距 */
    padding: calc(40px + env(safe-area-inset-top)) 20px calc(40px + env(safe-area-inset-bottom)); /* 兼容刘海屏安全区 */
}

/* ==================== 灯盏（Logo）区域 ==================== */
/* 灯盏图片容器：相对定位，并添加上下浮动动画 */
.lamp-container {
    position: relative;
    animation: float 6s ease-in-out infinite; /* 引用 float 关键帧，循环播放 */
}

/* 灯盏 Logo 图片：块级显示，固定基准宽度并限制最大宽度适配移动端 */
.lamp-logo {
    display: block;
    width: 280px;
    height: auto; /* 高度自适应保持图片比例 */
    max-width: 70vw; /* 最大不超过视口宽度的 70% */
}

/* 浮动动画关键帧：让灯盏在原地上下缓慢起伏 10px */
@keyframes float {
    0%, 100% { transform: translateY(0px); } /* 起始和结束回到原位 */
    50% { transform: translateY(-10px); } /* 中途上移 10px */
}

/* ==================== 标题区域 ==================== */
/* 标题区容器：纵向排列主标题、副标题与星星装饰 */
.title-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* 主标题“心灯观象”：大字号、宽字距、深灰色并带柔和阴影 */
.main-title {
    font-size: 48px;
    font-weight: normal; /* 取消加粗，更显清雅 */
    letter-spacing: 0.25em; /* 字间距，增强标题呼吸感 */
    color: #3a3a3a;
    opacity: 0.8;
    text-shadow: rgba(0, 0, 0, 0.1) 2px 2px 4px; /* 轻微投影增加层次 */
}

/* 副标题容器：横向排列左右两条分隔线与中间文字 */
.subtitle {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 副标题两侧的分隔线：渐变色从透明到棕红再到透明，形成淡出效果 */
.divider-line {
    width: 64px;
    height: 1px;
    background: linear-gradient(to right, transparent, #c1440e, transparent);
    opacity: 0.5;
}

/* 副标题文字：小字号、宽字距、棕色且半透明 */
.subtitle-text {
    font-size: 14px;
    letter-spacing: 0.3em;
    color: #8b4513;
    opacity: 0.6;
}

/* ==================== 网站定位标语 ==================== */
/* 主标题下方的绿色标语：用宽字距与主题绿色突出“中年人的避难所与加油站” */
.tagline {
    margin-top: 16px;
    font-size: 16px;
    letter-spacing: 0.2em;
    color: var(--primary-green); /* 直接复用主按钮的绿色变量，确保颜色一致 */
    text-align: center;
}

/* ==================== 操作按钮区域 ==================== */
/* 按钮容器：横向排列两个按钮 */
.action-buttons {
    display: flex;
    gap: 16px;
    margin-top: 24px;
}

/* 按钮通用样式：统一内边距、字体、圆角、手型光标及过渡效果 */
.btn {
    padding: 14px 32px;
    font-size: 16px;
    font-family: 'STKaiti', 'KaiTi', '楷体', serif; /* 与页面字体保持一致 */
    letter-spacing: 0.2em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease; /* 悬停时所有属性平滑过渡 */
    text-decoration: none; /* 去除链接下划线 */
    display: inline-block; /* 让 a 标签也能表现得像按钮 */
}

/* 主要按钮（开始对话）：绿色渐变背景、白色文字与投影 */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-green) 0%, #5a8c69 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(74, 124, 89, 0.3);
}

/* 主要按钮悬停：上移 2px 并加深投影，产生“浮起”反馈 */
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(74, 124, 89, 0.4);
}

/* 次要按钮（了解更多）：半透明棕色背景、棕色文字与描边 */
.btn-secondary {
    background: rgba(139, 69, 19, 0.1);
    color: #8b4513;
    border: 1px solid rgba(139, 69, 19, 0.3);
}

/* 次要按钮悬停：背景加深并上移 2px */
.btn-secondary:hover {
    background: rgba(139, 69, 19, 0.2);
    transform: translateY(-2px);
}

/* ==================== 角落装饰 ==================== */
/* 角落装饰通用样式：固定在视口角落，低透明度且不拦截交互 */
.corner-decoration {
    position: fixed;
    opacity: 0.1;
    pointer-events: none;
}

/* 右上角装饰定位：距顶部和右侧各 80px */
.corner-top-right {
    top: 80px;
    right: 80px;
}

/* 左下角装饰定位：距底部和左侧各 80px */
.corner-bottom-left {
    bottom: 80px;
    left: 80px;
}

/* ==================== 响应式设计（移动端适配） ==================== */
/* 当视口宽度不超过 768px 时，缩小字号并将按钮改为纵向堆叠 */
@media (max-width: 768px) {
    .main-title {
        font-size: 36px; /* 主标题缩小 */
    }

    .subtitle-text {
        font-size: 12px; /* 副标题文字缩小 */
    }

    .divider-line {
        width: 48px; /* 分隔线缩短 */
    }

    .action-buttons {
        flex-direction: column; /* 按钮由横向改为纵向排列 */
        width: 90%;
        max-width: 300px;
    }

    .btn {
        width: 100%; /* 按钮撑满容器宽度 */
        text-align: center;
    }

    /* 移动端隐藏四角装饰，避免拥挤 */
    .corner-top-right,
    .corner-bottom-left {
        display: none;
    }
}

/* ==================== 矮屏幕适配 ==================== */
/* 当视口高度不足时压缩各区块尺寸，确保两个按钮完整显示在屏幕内 */
@media (max-height: 700px) {
    .main-container {
        justify-content: flex-start; /* 旧浏览器兜底：从顶部排布，防止按钮被挤出屏幕 */
        gap: 20px; /* 缩小区块间距 */
        padding-top: max(20px, env(safe-area-inset-top)); /* 矮屏也保留刘海屏安全区 */
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }

    .lamp-logo {
        width: 200px; /* 缩小灯盏，降低纵向占用 */
        max-width: 50vw;
    }

    .title-section {
        gap: 8px; /* 收紧标题区内部间距 */
    }

    .main-title {
        font-size: 32px; /* 矮屏上主标题进一步缩小 */
    }

    .tagline {
        margin-top: 8px;
        font-size: 14px;
    }

    .action-buttons {
        margin-top: 8px;
    }

    .btn {
        padding: 10px 24px; /* 减小按钮高度 */
        font-size: 15px;
    }
}

/* ==================== 入场动画 ==================== */
/* 淡入上移动画关键帧：元素从透明+下方 20px 处淡入到位 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 主容器所有直接子元素统一应用淡入上移动画 */
.main-container > * {
    animation: fadeInUp 0.8s ease-out;
}

/* 依次延迟各子元素的动画，形成逐个入场的层叠效果 */
.main-container > *:nth-child(1) { animation-delay: 0.1s; } /* 灯盏最先出现 */
.main-container > *:nth-child(2) { animation-delay: 0.2s; } /* 标题区次之 */
.main-container > *:nth-child(3) { animation-delay: 0.3s; } /* 按钮区随后 */
.main-container > *:nth-child(4) { animation-delay: 0.4s; } /* 第四个元素最后 */
